5 import jalview.datamodel.SequenceI;
6 import jalview.gui.AlignFrame;
9 * JAL-3369 JalviewJS API BH 2019.07.17
14 public interface JalviewJSApi
18 * bind a pdb file to a sequence in the given AlignFrame.
21 * - sequenceId within the dataset or null
23 * - the four-character PDB ID
25 * - pdb file - either a URL or a valid PDB file or null.
27 * - null or specific AlignFrame. This specifies the dataset that
28 * will be searched for a seuqence called sequenceId
30 * @return true if binding was success
32 public boolean addPdbFile(String sequenceId, String pdbId, String pdbFile,
36 * Get alignment as format with or without the jalview start-end sequence
47 public String getAlignment(String format, boolean addSuffix,
51 * Get an array of sequence IDs reflecting the order of the alignment in the
52 * specified alignment frame
56 * @return array of sequence IDs
58 public String[] getAlignmentOrder(AlignFrame alf);
61 * Get alignment view alf's annotation as an annotation file
67 public String getAnnotation(AlignFrame alf);
70 * Get the URL for the location where the code is found; typically ending in
73 * @return web page URL
75 public URL getCodeBase();
77 AlignFrame getCurrentAlignFrame();
80 * Get the URL for the hosting web page.
82 * @return web page URL
84 public URL getDocumentBase();
87 * Get the array of feature groups for an alignment frame.
90 * AlignFrame to get feature groups for (default current)
93 public String[] getFeatureGroups(AlignFrame alf);
96 * Get the array of feature groups for an alignment frame with a specific
102 * align frame (default current)
106 public String[] getFeatureGroupsOfState(boolean visible, AlignFrame alf);
109 * Get the sequence features in the alignment frame in the given format
110 * (Jalview or GFF). Two additional options can be added to the format, each
111 * starting with a semicolon:
113 * ;includeNonpositional (default) or ;positionalOnly
118 * case-insensitive "Jalview" or "GFF" (default "GFF")
121 * @return formatted sequence features
123 public String getFeatures(String format, AlignFrame alf);
126 * Get an applet parameter as a string.
129 * @return value or null
131 public String getParameter(String name);
134 * Get an applet parameter object value.
137 * @return value or null
139 public Object getParameterAsObject(String name);
143 * AlignFrame containing selection
144 * @return String list of selected sequence IDs, each terminated by current
145 * default separator sequence
148 public SequenceI[] getSelectedSequences(AlignFrame alf);
150 // BH incompatibility here -- JalviewLite created an AlignFrame; Jalview
151 // creates an AlignmentPanel
153 // * create a new view and return the AlignFrame instance
158 // public AlignFrame newView();
161 // * create a new view named name and return the AlignFrame instance
167 // public AlignFrame newView(String name);
170 // * create a new view on alf and return the AlignFrame instance
175 // public AlignFrame newViewFrom(AlignFrame alf);
178 // * create a new view named name on alf
184 // public AlignFrame newViewFrom(AlignFrame alf, String name);
188 * get sequences selected in alf and return their alignment in format 'format'
189 * either with or without suffix
192 * - format of alignment file
194 * - where selection is
196 * - true to append /start-end string to each sequence ID
198 * @return selected sequences as flat file or empty string if there was no
201 public String getSelectedSequencesAsAlignment(String format,
202 boolean addSuffix, AlignFrame alf);
207 * id of sequence to highlight
209 * integer position [ tobe implemented or range ] on sequence
210 * @param alignedPosition
211 * false, blank or something else - indicate if position is an
212 * alignment column or unaligned sequence position
214 * alignment frame (default current)
216 public void highlight(String sequenceId, String position,
217 String alignedPosition, AlignFrame alf);
222 * alignment data as a string
226 * desired width or 0 for default width
228 * desired height or 0 for default height
229 * @return null or new alignment frame
232 public AlignFrame loadAlignment(String data, String title, int width,
236 * add the given features or annotation to the given alignment view
240 * alignment frame (default current)
242 public void loadAnnotation(String annotation, AlignFrame alf);
245 * Parse the given string as a jalview feature or GFF annotation file and
246 * optionally enable feature display on the given AlignFrame.
249 * - gff or features file
250 * @param autoenabledisplay
251 * - when true, feature display will be enabled if any features can
252 * be parsed from the string.
254 * alignment frame (default current)
256 * @return true if data parsed as features
258 public boolean loadFeatures(String features, boolean autoenabledisplay,
266 * alignment frame (default current)
270 public boolean loadScoreFile(String sScoreFile, AlignFrame alf);
273 * public static method for JalviewJS API to open a PCAPanel without
274 * necessarily using a dialog.
280 * @return the PCAPanel, or the string "label.you_need_at_least_n_sequences"
281 * if number of sequences selected is inappropriate
283 public Object openPcaPanel(String modelName, AlignFrame alf);
286 * Open a new Tree panel on the desktop statically. Params are standard (not
287 * set by Groovy). No dialog is opened.
292 * align frame (default current)
294 * @return null, or the string "label.you_need_at_least_n_sequences" if number
295 * of sequences selected is inappropriate
297 public Object openTreePanel(String treeType, String modelName,
301 * re-order the given alignment using the given array of sequence IDs
304 * array of sequence IDs
306 * - string to use when referring to ordering action in undo buffer
308 * alignment frame (default current)
310 * @return 'true' if alignment was actually reordered. empty string if
311 * alignment did not contain sequences.
313 public boolean orderAlignment(String[] ids, String undoName,
317 * process commandline arguments after the JavaScript application has started
322 public Object parseArguments(String[] args);
324 boolean parseFeaturesFile(String filename, AlignFrame alf);
329 * remove any callback using the given listener function and associated with
330 * the given AlignFrame (or null for all callbacks);
335 * alignment frame (default current)
337 public void removeSelectionListener(String listener, AlignFrame af);
340 * adjust horizontal/vertical scroll to make the given location the top left
341 * hand corner for the given view
344 * -1 for current top row
345 * @param leftHandColumn
346 * -1 for current left-hand column
348 * alignment frame (default current)
350 public void scrollViewTo(int topRow, int leftHandColumn, AlignFrame alf);
352 * select regions of the given alignment frame
355 * alignment frame (default current)
357 * String separated list { column range, seq1...seqn sequence ids }
359 * separator between toselect fields
361 public void select(String[] sequenceIds, String[] columns,
365 * Set the state (visible or not) of the selected feature groups.
372 public void setFeatureGroupState(String[] groups, boolean state,
376 * Register a JavaScript function to handle alignment selection events. Events
377 * are generated when the user completes a selection event, or when the user
378 * deselects all selected regions. The method is called back with the
379 * following arguments:
381 * the appletID (such as "Jalview1")
383 * the source alignment frame
385 * the SelectionSource object (for example, an AlignViewport)
387 * the sequence set ID
389 * an array of sequence IDs
391 * an array of columns (single number or hyphenated range)
394 * name of JavaScript function to be called
397 * alignment frame (default ALL)
399 public void setSelectionListener(String listener, AlignFrame alf);
401 public void showOverview();
408 * align frame (default current)
410 public void showStructure(String pdbID, String fileType, AlignFrame alf);