From: jprocter Date: Sun, 3 Jul 2011 12:39:54 +0000 (+0100) Subject: extracted jalviewlite API calls as separate interface (JAL-859) X-Git-Tag: Release_2_7~161 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=0c0991e85ba4c0536b366abe020eaf84ca6e29a4;p=jalview.git extracted jalviewlite API calls as separate interface (JAL-859) --- diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index a4bebef..f044411 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -36,6 +36,7 @@ import jalview.io.FileParse; import jalview.io.IdentifyFile; import jalview.io.JnetAnnotationMaker; import jalview.javascript.JSFunctionExec; +import jalview.javascript.JalviewLiteJsApi; import jalview.javascript.JsCallBack; import jalview.structure.SelectionListener; import jalview.structure.StructureSelectionManager; @@ -64,53 +65,38 @@ import netscape.javascript.JSObject; * @author $author$ * @version $Revision: 1.92 $ */ -public class JalviewLite extends Applet implements StructureSelectionManagerProvider +public class JalviewLite extends Applet implements StructureSelectionManagerProvider, JalviewLiteJsApi { // ///////////////////////////////////////// // The following public methods maybe called // externally, eg via javascript in HTML page - /** - * @return String list of selected sequence IDs, each terminated by the - * 'boolean not' character (""+0x00AC) or (¬) + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences() */ public String getSelectedSequences() { return getSelectedSequencesFrom(getDefaultTargetFrame()); } - /** - * @param sep - * separator string or null for default - * @return String list of selected sequence IDs, each terminated by given - * separator string + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String) */ public String getSelectedSequences(String sep) { return getSelectedSequencesFrom(getDefaultTargetFrame(), sep); } - /** - * @param alf - * alignframe containing selection - * @return String list of selected sequence IDs, each terminated by current - * default separator sequence - * + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui.AlignFrame) */ public String getSelectedSequencesFrom(AlignFrame alf) { return getSelectedSequencesFrom(alf, separator); // ""+0x00AC); } - /** - * get list of selected sequence IDs separated by given separator - * - * @param alf - * window containing selection - * @param sep - * separator string to use - default is 'boolean not' - * @return String list of selected sequence IDs, each terminated by the given - * separator + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui.AlignFrame, java.lang.String) */ public String getSelectedSequencesFrom(AlignFrame alf, String sep) { @@ -134,15 +120,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return result.toString(); } - /** - * - * @param sequenceId - * id of sequence to highlight - * @param position - * integer position [ tobe implemented or range ] on sequence - * @param alignedPosition - * true/false/empty string - indicate if position is an alignment - * column or unaligned sequence position + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String, java.lang.String, java.lang.String) */ public void highlight(String sequenceId, String position, String alignedPosition) @@ -151,15 +130,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv alignedPosition); } - /** - * - * @param sequenceId - * id of sequence to highlight - * @param position - * integer position [ tobe implemented or range ] on sequence - * @param alignedPosition - * false, blank or something else - indicate if position is an - * alignment column or unaligned sequence position + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String) */ public void highlightIn(AlignFrame alf, String sequenceId, String position, String alignedPosition) @@ -196,55 +168,32 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } } - /** - * select regions of the currrent alignment frame - * - * @param sequenceIds - * String separated list of sequence ids or empty string - * @param columns - * String separated list { column range or column, ..} or empty - * string + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, java.lang.String) */ public void select(String sequenceIds, String columns) { selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator); } - /** - * select regions of the currrent alignment frame - * - * @param toselect - * String separated list { column range, seq1...seqn sequence ids } - * @param sep - * separator between toselect fields + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, java.lang.String, java.lang.String) */ public void select(String sequenceIds, String columns, String sep) { selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep); } - /** - * select regions of the given alignment frame - * - * @param alf - * @param toselect - * String separated list { column range, seq1...seqn sequence ids } - * @param sep - * separator between toselect fields + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String) */ public void selectIn(AlignFrame alf, String sequenceIds, String columns) { selectIn(alf, sequenceIds, columns, separator); } - /** - * select regions of the given alignment frame - * - * @param alf - * @param toselect - * String separated list { column range, seq1...seqn sequence ids } - * @param sep - * separator between toselect fields + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String) */ public void selectIn(AlignFrame alf, String sequenceIds, String columns, String sep) @@ -455,18 +404,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } } - /** - * get sequences selected in current alignFrame and return their alignment in - * format 'format' either with or without suffix - * - * @param alf - * - where selection is - * @param format - * - format of alignment file - * @param suffix - * - "true" to append /start-end string to each sequence ID - * @return selected sequences as flat file or empty string if there was no - * current selection + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang.String, java.lang.String) */ public String getSelectedSequencesAsAlignment(String format, String suffix) { @@ -474,18 +413,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv format, suffix); } - /** - * get sequences selected in alf and return their alignment in format 'format' - * either with or without suffix - * - * @param alf - * - where selection is - * @param format - * - format of alignment file - * @param suffix - * - "true" to append /start-end string to each sequence ID - * @return selected sequences as flat file or empty string if there was no - * current selection + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String) */ public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, String suffix) @@ -508,16 +437,25 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return ""; } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder() + */ public String getAlignmentOrder() { return getAlignmentOrderFrom(getDefaultTargetFrame()); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame) + */ public String getAlignmentOrderFrom(AlignFrame alf) { return getAlignmentOrderFrom(alf, separator); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame, java.lang.String) + */ public String getAlignmentOrderFrom(AlignFrame alf, String sep) { AlignmentI alorder = alf.getAlignViewport().getAlignment(); @@ -529,16 +467,25 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return arrayToSeparatorList(order); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, java.lang.String) + */ public String orderBy(String order, String undoName) { return orderBy(order, undoName, separator); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, java.lang.String, java.lang.String) + */ public String orderBy(String order, String undoName, String sep) { return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String) + */ public String orderAlignmentBy(AlignFrame alf, String order, String undoName, String sep) { @@ -588,21 +535,33 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return alf.sortBy(aorder, undoName) ? "true" : ""; } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String) + */ public String getAlignment(String format) { return getAlignmentFrom(getDefaultTargetFrame(), format, "true"); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, java.lang.String) + */ public String getAlignmentFrom(AlignFrame alf, String format) { return getAlignmentFrom(alf, format, "true"); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String, java.lang.String) + */ public String getAlignment(String format, String suffix) { return getAlignmentFrom(getDefaultTargetFrame(), format, suffix); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String) + */ public String getAlignmentFrom(AlignFrame alf, String format, String suffix) { @@ -620,11 +579,17 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String) + */ public void loadAnnotation(String annotation) { loadAnnotationFrom(getDefaultTargetFrame(), annotation); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame, java.lang.String) + */ public void loadAnnotationFrom(AlignFrame alf, String annotation) { if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport() @@ -639,53 +604,72 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String) + */ public String getFeatures(String format) { return getFeaturesFrom(getDefaultTargetFrame(), format); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame, java.lang.String) + */ public String getFeaturesFrom(AlignFrame alf, String format) { return alf.outputFeatures(false, format); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAnnotation() + */ public String getAnnotation() { return getAnnotationFrom(getDefaultTargetFrame()); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame) + */ public String getAnnotationFrom(AlignFrame alf) { return alf.outputAnnotations(false); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#newView() + */ public AlignFrame newView() { return newViewFrom(getDefaultTargetFrame()); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String) + */ public AlignFrame newView(String name) { return newViewFrom(getDefaultTargetFrame(), name); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame) + */ public AlignFrame newViewFrom(AlignFrame alf) { return alf.newView(null); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame, java.lang.String) + */ public AlignFrame newViewFrom(AlignFrame alf, String name) { return alf.newView(name); } - /** - * - * @param text - * alignment file as a string - * @param title - * window title - * @return null or new alignment frame + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String, java.lang.String) */ public AlignFrame loadAlignment(String text, String title) { @@ -708,6 +692,9 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return null; } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String) + */ public void setMouseoverListener(String listener) { setMouseoverListener(currentAlignFrame, listener); @@ -715,6 +702,9 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv private Vector javascriptListeners = new Vector(); + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame, java.lang.String) + */ public void setMouseoverListener(AlignFrame af, String listener) { if (listener != null) @@ -742,11 +732,17 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String) + */ public void setSelectionListener(String listener) { setSelectionListener(null, listener); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame, java.lang.String) + */ public void setSelectionListener(AlignFrame af, String listener) { if (listener != null) @@ -774,6 +770,9 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String, java.lang.String) + */ public void setStructureListener(String listener, String modelSet) { if (listener != null) @@ -800,14 +799,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv } } - /** - * remove any callback using the given listener function and associated with - * the given alignFrame (or null for all callbacks) - * - * @param af - * (may be null) - * @param listener - * (may be null) + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui.AlignFrame, java.lang.String) */ public void removeJavascriptListener(AlignFrame af, String listener) { @@ -908,13 +901,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv StructureSelectionManager.release(this); } private jalview.javascript.JSFunctionExec jsFunctionExec; - /** - * send a mouseover message to all the alignment windows associated with the - * given residue in the pdbfile - * - * @param pdbResNum - * @param chain - * @param pdbfile + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String, java.lang.String, java.lang.String) */ public void mouseOverStructure(String pdbResNum, String chain, String pdbfile) @@ -935,12 +923,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv + pdbResNum + "'"); } } - /** - * adjust horizontal/vertical scroll to the make the given location the top left hand corner for given current view - * - * @param alf - * @param topRow - * @param leftHandColumn + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String) */ public void scrollViewToIn(AlignFrame alf, String topRow, String leftHandColumn) { @@ -2070,9 +2054,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return "" + separator; } - /** - * @return - * @see jalview.appletgui.AlignFrame#getFeatureGroups() + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getFeatureGroups() */ public String getFeatureGroups() { @@ -2081,11 +2064,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return lst; } - /** - * @param alf - * alignframe to get feature groups on - * @return - * @see jalview.appletgui.AlignFrame#getFeatureGroups() + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame) */ public String getFeatureGroupsOn(AlignFrame alf) { @@ -2093,10 +2073,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return lst; } - /** - * @param visible - * @return - * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean) + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean) */ public String getFeatureGroupsOfState(boolean visible) { @@ -2104,25 +2082,16 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv .getFeatureGroupsOfState(visible)); } - /** - * @param alf - * align frame to get groups of state visible - * @param visible - * @return - * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean) + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui.AlignFrame, boolean) */ public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible) { return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible)); } - /** - * @param groups - * tab separated list of group names - * @param state - * true or false - * @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[], - * boolean) + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui.AlignFrame, java.lang.String, boolean) */ public void setFeatureGroupStateOn(AlignFrame alf, String groups, boolean state) @@ -2132,26 +2101,24 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv alf.setFeatureGroupState(separatorListToArray(groups), st); } + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String, boolean) + */ public void setFeatureGroupState(String groups, boolean state) { setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state); } - /** - * List separator string - * - * @return the separator + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#getSeparator() */ public String getSeparator() { return separator; } - /** - * List separator string - * - * @param separator - * the separator to set. empty string will reset separator to default + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String) */ public void setSeparator(String separator) { @@ -2191,21 +2158,8 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv return false; } - /** - * bind a pdb file to a sequence in the given alignFrame. - * - * @param alFrame - * - null or specific alignFrame. This specifies the dataset that - * will be searched for a seuqence called sequenceId - * @param sequenceId - * - sequenceId within the dataset. - * @param pdbEntryString - * - the short name for the PDB file - * @param pdbFile - * - pdb file - either a URL or a valid PDB file. - * @return true if binding was as success TODO: consider making an exception - * structure for indicating when PDB parsing or sequenceId location - * fails. + /* (non-Javadoc) + * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String) */ public boolean addPdbFile(AlignFrame alFrame, String sequenceId, String pdbEntryString, String pdbFile) @@ -2243,6 +2197,9 @@ public class JalviewLite extends Applet implements StructureSelectionManagerProv for (int i=0;i msgset = jsmessages.get(messageclass); diff --git a/src/jalview/javascript/JalviewLiteJsApi.java b/src/jalview/javascript/JalviewLiteJsApi.java new file mode 100644 index 0000000..02da9d4 --- /dev/null +++ b/src/jalview/javascript/JalviewLiteJsApi.java @@ -0,0 +1,480 @@ +package jalview.javascript; + +import jalview.appletgui.AlignFrame; + +/** + * The following public methods may be called + * externally, eg via javascript in an HTML page. + * + *
TODO: introduce abstract interface for jalview.appletgui.AlignFrame
+ * + * Most function arguments are strings, which contain serialised versions of lists. + * Lists of things are separated by a separator character - either the default or a user supplied one. + * Ranges and positions on an alignment or sequence can be specified as a list, where an item containing a single number is a single position, and an item like 1-2 specifies columns 1 and 2 as a range. + */ + +/** + * @author jimp + * + */ +public interface JalviewLiteJsApi +{ + + /** + * @return String list of selected sequence IDs, each terminated by the + * 'boolean not' character (""+0x00AC) or (¬) + */ + public abstract String getSelectedSequences(); + + /** + * @param sep + * separator string or null for default + * @return String list of selected sequence IDs, each terminated by given + * separator string + */ + public abstract String getSelectedSequences(String sep); + + /** + * @param alf + * alignframe containing selection + * @return String list of selected sequence IDs, each terminated by current + * default separator sequence + * + */ + public abstract String getSelectedSequencesFrom(AlignFrame alf); + + /** + * get list of selected sequence IDs separated by given separator + * + * @param alf + * window containing selection + * @param sep + * separator string to use - default is 'boolean not' + * @return String list of selected sequence IDs, each terminated by the given + * separator + */ + public abstract String getSelectedSequencesFrom(AlignFrame alf, String sep); + + /** + * + * @param sequenceId + * id of sequence to highlight + * @param position + * integer position [ tobe implemented or range ] on sequence + * @param alignedPosition + * true/false/empty string - indicate if position is an alignment + * column or unaligned sequence position + */ + public abstract void highlight(String sequenceId, String position, + String alignedPosition); + + /** + * + * @param sequenceId + * id of sequence to highlight + * @param position + * integer position [ tobe implemented or range ] on sequence + * @param alignedPosition + * false, blank or something else - indicate if position is an + * alignment column or unaligned sequence position + */ + public abstract void highlightIn(AlignFrame alf, String sequenceId, + String position, String alignedPosition); + + /** + * select regions of the currrent alignment frame + * + * @param sequenceIds + * String separated list of sequence ids or empty string + * @param columns + * String separated list { column range or column, ..} or empty + * string + */ + public abstract void select(String sequenceIds, String columns); + + /** + * select regions of the currrent alignment frame + * + * @param toselect + * String separated list { column range, seq1...seqn sequence ids } + * @param sep + * separator between toselect fields + */ + public abstract void select(String sequenceIds, String columns, String sep); + + /** + * select regions of the given alignment frame + * + * @param alf + * @param toselect + * String separated list { column range, seq1...seqn sequence ids } + * @param sep + * separator between toselect fields + */ + public abstract void selectIn(AlignFrame alf, String sequenceIds, + String columns); + + /** + * select regions of the given alignment frame + * + * @param alf + * @param toselect + * String separated list { column range, seq1...seqn sequence ids } + * @param sep + * separator between toselect fields + */ + public abstract void selectIn(AlignFrame alf, String sequenceIds, + String columns, String sep); + + /** + * get sequences selected in current alignFrame and return their alignment in + * format 'format' either with or without suffix + * + * @param alf + * - where selection is + * @param format + * - format of alignment file + * @param suffix + * - "true" to append /start-end string to each sequence ID + * @return selected sequences as flat file or empty string if there was no + * current selection + */ + public abstract String getSelectedSequencesAsAlignment(String format, + String suffix); + + /** + * get sequences selected in alf and return their alignment in format 'format' + * either with or without suffix + * + * @param alf + * - where selection is + * @param format + * - format of alignment file + * @param suffix + * - "true" to append /start-end string to each sequence ID + * @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); + + /** + * 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 + * + * @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 + * + * @param alf + * @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. + */ + public abstract String orderBy(String order, String undoName); + + /** + * re-order the current alignment using the given list of sequence IDs + * separated by sep + * + * @param order + * - sep separated list + * @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. + */ + 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 + * + * @param alf + * @param order + * - sep separated list + * @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. + */ + 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) + * @param format + * @return + */ + public abstract String getAlignment(String format); + + /** + * get alignment displayed in alf as format + * @param alf + * @param format + * @return + */ + public abstract String getAlignmentFrom(AlignFrame alf, String format); + + /** + * get alignment as format with jalview start-end sequence suffix appended + * @param format + * @param suffix + * @return + */ + 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 + * @param alf + * @param format + * @param suffix + * @return + */ + public abstract String getAlignmentFrom(AlignFrame alf, String format, + String suffix); + + /** + * 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); + + /** + * get the sequence features in the given format (Jalview or GFF) + * @param format + * @return + */ + public abstract String getFeatures(String format); + + /** + * get the sequence features in alf in the given format (Jalview or GFF) + * @param alf + * @param format + * @return + */ + public abstract String getFeaturesFrom(AlignFrame alf, String format); + + /** + * 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 + */ + public abstract String getAnnotationFrom(AlignFrame alf); + + /** + * 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 + */ + public abstract AlignFrame newView(String name); + + /** + * create a new view on alf and return the alignFrame instance + * @param alf + * @return + */ + public abstract AlignFrame newViewFrom(AlignFrame alf); + + /** + * create a new view named name on alf + * @param alf + * @param name + * @return + */ + public abstract AlignFrame newViewFrom(AlignFrame alf, String name); + + /** + * + * @param text + * alignment file as a string + * @param title + * window title + * @return null or new alignment frame + */ + public abstract AlignFrame loadAlignment(String text, String title); + + /** + * 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)] + */ + 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 + */ + 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)] + */ + 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 + */ + public abstract void setStructureListener(String listener, String modelSet); + + /** + * remove any callback using the given listener function and associated with + * the given alignFrame (or null for all callbacks) + * + * @param af + * (may be null) + * @param listener + * (may be null) + */ + public abstract void removeJavascriptListener(AlignFrame af, + String listener); + + /** + * send a mouseover message to all the alignment windows associated with the + * given residue in the pdbfile + * + * @param pdbResNum + * @param chain + * @param pdbfile + */ + public abstract void mouseOverStructure(String pdbResNum, String chain, + String pdbfile); + + /** + * bind a pdb file to a sequence in the given alignFrame. + * + * @param alFrame + * - null or specific alignFrame. This specifies the dataset that + * will be searched for a seuqence called sequenceId + * @param sequenceId + * - sequenceId within the dataset. + * @param pdbEntryString + * - the short name for the PDB file + * @param pdbFile + * - pdb file - either a URL or a valid PDB file. + * @return true if binding was as success TODO: consider making an exception + * structure for indicating when PDB parsing or sequenceId location + * fails. + */ + public abstract boolean addPdbFile(AlignFrame alFrame, String sequenceId, + String pdbEntryString, String pdbFile); + + /** + * adjust horizontal/vertical scroll to the make the given location the top left hand corner for given current view + * + * @param alf + * @param topRow + * @param leftHandColumn + */ + public abstract void scrollViewToIn(AlignFrame alf, String topRow, + String leftHandColumn); + + /** + * + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroups() + */ + public abstract String getFeatureGroups(); + + /** + * @param alf + * alignframe to get feature groups on + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroups() + */ + public abstract String getFeatureGroupsOn(AlignFrame alf); + + /** + * @param visible + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean) + */ + public abstract String getFeatureGroupsOfState(boolean visible); + + /** + * @param alf + * align frame to get groups of state visible + * @param visible + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean) + */ + public abstract String getFeatureGroupsOfStateOn(AlignFrame alf, + boolean visible); + + /** + * @param groups + * tab separated list of group names + * @param state + * true or false + * @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[], + * boolean) + */ + public abstract void setFeatureGroupStateOn(AlignFrame alf, + String groups, boolean state); + + public abstract void setFeatureGroupState(String groups, boolean state); + + /** + * List separator string + * + * @return the separator + */ + public abstract String getSeparator(); + + /** + * List separator string + * + * @param separator + * the separator to set. empty string will reset separator to default + */ + public abstract void setSeparator(String separator); + + /** + * 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