X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjavascript%2FJalviewLiteJsApi.java;h=b5811aa52d91adc4a2c2e53fc3ea8278fe59491f;hb=f4766a7bbcfae845fc95923b01fa14ff83d589ff;hp=02da9d403e1e2c6835659a92c2b4555f3b83751c;hpb=0c0991e85ba4c0536b366abe020eaf84ca6e29a4;p=jalview.git diff --git a/src/jalview/javascript/JalviewLiteJsApi.java b/src/jalview/javascript/JalviewLiteJsApi.java index 02da9d4..b5811aa 100644 --- a/src/jalview/javascript/JalviewLiteJsApi.java +++ b/src/jalview/javascript/JalviewLiteJsApi.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.javascript; import jalview.appletgui.AlignFrame; @@ -15,7 +35,7 @@ import jalview.appletgui.AlignFrame; /** * @author jimp - * + * */ public interface JalviewLiteJsApi { @@ -53,7 +73,8 @@ public interface JalviewLiteJsApi * @return String list of selected sequence IDs, each terminated by the given * separator */ - public abstract String getSelectedSequencesFrom(AlignFrame alf, String sep); + public abstract String getSelectedSequencesFrom(AlignFrame alf, + String sep); /** * @@ -100,7 +121,8 @@ public interface JalviewLiteJsApi * @param sep * separator between toselect fields */ - public abstract void select(String sequenceIds, String columns, String sep); + public abstract void select(String sequenceIds, String columns, + String sep); /** * select regions of the given alignment frame @@ -155,35 +177,46 @@ public interface JalviewLiteJsApi * @return selected sequences as flat file or empty string if there was no * current selection */ - public abstract String getSelectedSequencesAsAlignmentFrom( - AlignFrame alf, String format, String suffix); + public abstract String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, + String format, String suffix); /** - * get a separator separated list of sequence IDs reflecting the order of the current alignment + * get a separator separated list of sequence IDs reflecting the order of the + * current alignment + * * @return */ public abstract String getAlignmentOrder(); + /** - * get a separator separated list of sequence IDs reflecting the order of the alignment in alf - * + * get a separator separated list of sequence IDs reflecting the order of the + * alignment in alf + * * @param alf * @return */ public abstract String getAlignmentOrderFrom(AlignFrame alf); /** - * get a sep separated list of sequence IDs reflecting the order of the alignment in alf + * get a sep separated list of sequence IDs reflecting the order of the + * alignment in alf * * @param alf - * @param sep - separator to use + * @param sep + * - separator to use * @return */ public abstract String getAlignmentOrderFrom(AlignFrame alf, String sep); + /** * re-order the current alignment using the given list of sequence IDs - * @param order - sep separated list - * @param undoName - string to use when referring to ordering action in undo buffer - * @return 'true' if alignment was actually reordered. empty string if alignment did not contain sequences. + * + * @param order + * - sep separated list + * @param undoName + * - string to use when referring to ordering action in undo buffer + * @return 'true' if alignment was actually reordered. empty string if + * alignment did not contain sequences. */ public abstract String orderBy(String order, String undoName); @@ -196,13 +229,14 @@ public interface JalviewLiteJsApi * @param undoName * - string to use when referring to ordering action in undo buffer * @param sep - * @return 'true' if alignment was actually reordered. empty string if alignment did not contain sequences. + * @return 'true' if alignment was actually reordered. empty string if + * alignment did not contain sequences. */ public abstract String orderBy(String order, String undoName, String sep); /** - * re-order the given alignment using the given list of sequence IDs - * separated by sep + * re-order the given alignment using the given list of sequence IDs separated + * by sep * * @param alf * @param order @@ -210,13 +244,16 @@ public interface JalviewLiteJsApi * @param undoName * - string to use when referring to ordering action in undo buffer * @param sep - * @return 'true' if alignment was actually reordered. empty string if alignment did not contain sequences. + * @return 'true' if alignment was actually reordered. empty string if + * alignment did not contain sequences. */ public abstract String orderAlignmentBy(AlignFrame alf, String order, String undoName, String sep); /** - * get alignment as format (format names FASTA, BLC, CLUSTAL, MSF, PILEUP, PFAM - see jalview.io.AppletFormatAdapter for full list) + * get alignment as format (format names FASTA, BLC, CLUSTAL, MSF, PILEUP, + * PFAM - see jalview.io.AppletFormatAdapter for full list) + * * @param format * @return */ @@ -224,6 +261,7 @@ public interface JalviewLiteJsApi /** * get alignment displayed in alf as format + * * @param alf * @param format * @return @@ -232,6 +270,7 @@ public interface JalviewLiteJsApi /** * get alignment as format with jalview start-end sequence suffix appended + * * @param format * @param suffix * @return @@ -239,8 +278,9 @@ public interface JalviewLiteJsApi public abstract String getAlignment(String format, String suffix); /** - * get alignment displayed in alf as format - * with or without the jalview start-end sequence suffix appended + * get alignment displayed in alf as format with or without the jalview + * start-end sequence suffix appended + * * @param alf * @param format * @param suffix @@ -251,19 +291,51 @@ public interface JalviewLiteJsApi /** * add the given features or annotation to the current alignment + * * @param annotation */ public abstract void loadAnnotation(String annotation); /** * add the given features or annotation to the given alignment view + * * @param alf * @param annotation */ - public abstract void loadAnnotationFrom(AlignFrame alf, String annotation); + public abstract void loadAnnotationFrom(AlignFrame alf, + String annotation); + + /** + * parse the given string as a jalview feature or GFF annotation file and + * optionally enable feature display on the current alignFrame + * + * @param features + * - gff or features file + * @param autoenabledisplay + * - when true, feature display will be enabled if any features can + * be parsed from the string. + */ + public abstract void loadFeatures(String features, + boolean autoenabledisplay); + + /** + * parse the given string as a jalview feature or GFF annotation file and + * optionally enable feature display on the given alignFrame. + * + * @param alf + * @param features + * - gff or features file + * @param autoenabledisplay + * - when true, feature display will be enabled if any features can + * be parsed from the string. + * @return true if data parsed as features + */ + public abstract boolean loadFeaturesFrom(AlignFrame alf, String features, + boolean autoenabledisplay); /** * get the sequence features in the given format (Jalview or GFF) + * * @param format * @return */ @@ -271,6 +343,7 @@ public interface JalviewLiteJsApi /** * get the sequence features in alf in the given format (Jalview or GFF) + * * @param alf * @param format * @return @@ -279,12 +352,14 @@ public interface JalviewLiteJsApi /** * get current alignment's annotation as an annotation file + * * @return */ public abstract String getAnnotation(); /** * get alignment view alf's annotation as an annotation file + * * @param alf * @return */ @@ -292,12 +367,14 @@ public interface JalviewLiteJsApi /** * create a new view and return the alignFrame instance + * * @return */ public abstract AlignFrame newView(); /** * create a new view named name and return the alignFrame instance + * * @param name * @return */ @@ -305,6 +382,7 @@ public interface JalviewLiteJsApi /** * create a new view on alf and return the alignFrame instance + * * @param alf * @return */ @@ -312,6 +390,7 @@ public interface JalviewLiteJsApi /** * create a new view named name on alf + * * @param alf * @param name * @return @@ -330,32 +409,56 @@ public interface JalviewLiteJsApi /** * register a javascript function to handle any alignment mouseover events - * @param listener name of javascript function (called with arguments [jalview.appletgui.AlignFrame,String(sequence id),String(column in alignment), String(position in sequence)] + * + * @param listener + * name of javascript function (called with arguments + * [jalview.appletgui.AlignFrame,String(sequence id),String(column in + * alignment), String(position in sequence)] */ public abstract void setMouseoverListener(String listener); /** * register a javascript function to handle mouseover events - * @param af (null or specific alignframe for which events are to be listened for) - * @param listener name of javascript function + * + * @param af + * (null or specific alignframe for which events are to be listened + * for) + * @param listener + * name of javascript function */ public abstract void setMouseoverListener(AlignFrame af, String listener); /** - * register a javascript function to handle any alignment selection events. Events are generated when the user completes a selection event, or when the user deselects all selected regions. - * @param listener name of javascript function (called with arguments [jalview.appletgui.AlignFrame, String(sequence set id), String(separator separated list of sequences which were selected), String(separator separated list of column ranges (i.e. single number or hyphenated range) that were selected)] + * register a javascript function to handle any alignment selection events. + * Events are generated when the user completes a selection event, or when the + * user deselects all selected regions. + * + * @param listener + * name of javascript function (called with arguments + * [jalview.appletgui.AlignFrame, String(sequence set id), + * String(separator separated list of sequences which were selected), + * String(separator separated list of column ranges (i.e. single + * number or hyphenated range) that were selected)] */ public abstract void setSelectionListener(String listener); public abstract void setSelectionListener(AlignFrame af, String listener); /** - * register a javascript function to handle events normally routed to a Jmol structure viewer. - * @param listener - javascript function (arguments are variable, see jalview.javascript.MouseOverStructureListener for full details) - * @param modelSet - separator separated list of PDB file URIs that this viewer is handling. - @see jalview.javascript.MouseOverStructureListener + * register a javascript function to handle events normally routed to a Jmol + * structure viewer. + * + * @param listener + * - javascript function (arguments are variable, see + * jalview.javascript.MouseOverStructureListener for full details) + * @param modelSet + * - separator separated list of PDB file URIs that this viewer is + * handling. These files must be in the same order they appear in + * Jmol (e.g. first one is frame 1, second is frame 2, etc). + * @see jalview.javascript.MouseOverStructureListener */ - public abstract void setStructureListener(String listener, String modelSet); + public abstract void setStructureListener(String listener, + String modelSet); /** * remove any callback using the given listener function and associated with @@ -400,7 +503,8 @@ public interface JalviewLiteJsApi String pdbEntryString, String pdbFile); /** - * adjust horizontal/vertical scroll to the make the given location the top left hand corner for given current view + * adjust horizontal/vertical scroll to make the given location the top left + * hand corner for the given view * * @param alf * @param topRow @@ -410,6 +514,24 @@ public interface JalviewLiteJsApi String leftHandColumn); /** + * adjust vertical scroll to make the given row the top one for given view + * + * @param alf + * @param topRow + */ + public abstract void scrollViewToRowIn(AlignFrame alf, String topRow); + + /** + * adjust horizontal scroll to make the given column the left one in the given + * view + * + * @param alf + * @param leftHandColumn + */ + public abstract void scrollViewToColumnIn(AlignFrame alf, + String leftHandColumn); + + /** * * @return * @see jalview.appletgui.AlignFrame#getFeatureGroups() @@ -449,8 +571,8 @@ public interface JalviewLiteJsApi * @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[], * boolean) */ - public abstract void setFeatureGroupStateOn(AlignFrame alf, - String groups, boolean state); + public abstract void setFeatureGroupStateOn(AlignFrame alf, String groups, + boolean state); public abstract void setFeatureGroupState(String groups, boolean state); @@ -471,10 +593,11 @@ public interface JalviewLiteJsApi /** * Retrieve fragments of a large packet of data made available by JalviewLite. + * * @param messageclass * @param viewId * @return next chunk of message */ public abstract String getJsMessage(String messageclass, String viewId); -} \ No newline at end of file +}