2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
23 import java.awt.event.*;
24 import java.io.BufferedReader;
25 import java.io.InputStreamReader;
28 import jalview.api.SequenceStructureBinding;
29 import jalview.appletgui.*;
30 import jalview.datamodel.*;
34 * Jalview Applet. Runs in Java 1.18 runtime
39 public class JalviewLite extends Applet
42 // /////////////////////////////////////////
43 // The following public methods maybe called
44 // externally, eg via javascript in HTML page
46 * @return String list of selected sequence IDs, each terminated by "¬"
49 public String getSelectedSequences()
51 return getSelectedSequencesFrom(getDefaultTargetFrame());
56 * separator string or null for default
57 * @return String list of selected sequence IDs, each terminated by sep or
60 public String getSelectedSequences(String sep)
62 return getSelectedSequencesFrom(getDefaultTargetFrame(), sep);
67 * alignframe containing selection
68 * @return String list of selected sequence IDs, each terminated by "¬"
71 public String getSelectedSequencesFrom(AlignFrame alf)
73 return getSelectedSequencesFrom(alf, "¬");
77 * get list of selected sequence IDs separated by given separator
80 * window containing selection
82 * separator string to use - default is "¬"
83 * @return String list of selected sequence IDs, each terminated by the given
86 public String getSelectedSequencesFrom(AlignFrame alf, String sep)
88 StringBuffer result = new StringBuffer("");
89 if (sep == null || sep.length() == 0)
93 if (alf.viewport.getSelectionGroup() != null)
95 SequenceI[] seqs = alf.viewport.getSelectionGroup()
96 .getSequencesInOrder(alf.viewport.getAlignment());
98 for (int i = 0; i < seqs.length; i++)
100 result.append(seqs[i].getName());
105 return result.toString();
109 * get sequences selected in current alignFrame and return their alignment in
110 * format 'format' either with or without suffix
113 * - where selection is
115 * - format of alignment file
117 * - "true" to append /start-end string to each sequence ID
118 * @return selected sequences as flat file or empty string if there was no
121 public String getSelectedSequencesAsAlignment(String format, String suffix)
123 return getSelectedSequencesAsAlignmentFrom(currentAlignFrame, format,
128 * get sequences selected in alf and return their alignment in format 'format'
129 * either with or without suffix
132 * - where selection is
134 * - format of alignment file
136 * - "true" to append /start-end string to each sequence ID
137 * @return selected sequences as flat file or empty string if there was no
140 public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,
141 String format, String suffix)
145 boolean seqlimits = suffix.equalsIgnoreCase("true");
146 if (alf.viewport.getSelectionGroup() != null)
148 String reply = new AppletFormatAdapter().formatSequences(format,
149 new Alignment(alf.viewport.getSelectionAsNewSequence()),
153 } catch (Exception ex)
155 ex.printStackTrace();
156 return "Error retrieving alignment in " + format + " format. ";
161 public String getAlignment(String format)
163 return getAlignmentFrom(getDefaultTargetFrame(), format, "true");
166 public String getAlignmentFrom(AlignFrame alf, String format)
168 return getAlignmentFrom(alf, format, "true");
171 public String getAlignment(String format, String suffix)
173 return getAlignmentFrom(getDefaultTargetFrame(), format, suffix);
176 public String getAlignmentFrom(AlignFrame alf, String format,
181 boolean seqlimits = suffix.equalsIgnoreCase("true");
183 String reply = new AppletFormatAdapter().formatSequences(format,
184 alf.viewport.getAlignment(), seqlimits);
186 } catch (Exception ex)
188 ex.printStackTrace();
189 return "Error retrieving alignment in " + format + " format. ";
193 public void loadAnnotation(String annotation)
195 loadAnnotationFrom(getDefaultTargetFrame(), annotation);
198 public void loadAnnotationFrom(AlignFrame alf, String annotation)
200 if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport()
201 .getAlignment(), annotation, AppletFormatAdapter.PASTE))
203 alf.alignPanel.fontChanged();
204 alf.alignPanel.setScrollValues(0, 0);
208 alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE);
212 public String getFeatures(String format)
214 return getFeaturesFrom(getDefaultTargetFrame(), format);
217 public String getFeaturesFrom(AlignFrame alf, String format)
219 return alf.outputFeatures(false, format);
222 public String getAnnotation()
224 return getAnnotationFrom(getDefaultTargetFrame());
227 public String getAnnotationFrom(AlignFrame alf)
229 return alf.outputAnnotations(false);
232 public AlignFrame newView()
234 return newViewFrom(getDefaultTargetFrame());
237 public AlignFrame newView(String name)
239 return newViewFrom(getDefaultTargetFrame(), name);
242 public AlignFrame newViewFrom(AlignFrame alf)
244 return alf.newView(null);
247 public AlignFrame newViewFrom(AlignFrame alf, String name)
249 return alf.newView(name);
255 * alignment file as a string
258 * @return null or new alignment frame
260 public AlignFrame loadAlignment(String text, String title)
264 String format = new IdentifyFile().Identify(text,
265 AppletFormatAdapter.PASTE);
268 al = new AppletFormatAdapter().readFile(text,
269 AppletFormatAdapter.PASTE, format);
270 if (al.getHeight() > 0)
272 return new AlignFrame(al, this, title, false);
274 } catch (java.io.IOException ex)
276 ex.printStackTrace();
281 // //////////////////////////////////////////////
282 // //////////////////////////////////////////////
284 static int lastFrameX = 200;
286 static int lastFrameY = 200;
288 boolean fileFound = true;
290 String file = "No file";
292 Button launcher = new Button("Start Jalview");
295 * The currentAlignFrame is static, it will change if and when the user
296 * selects a new window. Note that it will *never* point back to the embedded
297 * AlignFrame if the applet is started as embedded on the page and then
298 * afterwards a new view is created.
300 public static AlignFrame currentAlignFrame = null;
303 * This is the first frame to be displayed, and does not change. API calls
304 * will default to this instance if currentAlignFrame is null.
306 AlignFrame initialAlignFrame = null;
308 boolean embedded = false;
310 private boolean checkForJmol = true;
312 private boolean checkedForJmol = false; // ensure we don't check for jmol
314 // every time the app is re-inited
316 public boolean jmolAvailable = false;
318 public static boolean debug = false;
320 static String builddate = null, version = null;
322 private static void initBuildDetails()
324 if (builddate == null)
326 builddate = "unknown";
328 java.net.URL url = JalviewLite.class
329 .getResource("/.build_properties");
334 BufferedReader reader = new BufferedReader(new InputStreamReader(
337 while ((line = reader.readLine()) != null)
339 if (line.indexOf("VERSION") > -1)
341 version = line.substring(line.indexOf("=") + 1);
343 if (line.indexOf("BUILD_DATE") > -1)
345 builddate = line.substring(line.indexOf("=") + 1);
348 } catch (Exception ex)
350 ex.printStackTrace();
356 public static String getBuildDate()
362 public static String getVersion()
369 * init method for Jalview Applet
375 * turn on extra applet debugging
377 String dbg = getParameter("debug");
380 debug = dbg.toLowerCase().equals("true");
385 System.err.println("JalviewLite Version " + getVersion());
386 System.err.println("Build Date : " + getBuildDate());
390 * if true disable the check for jmol
392 String chkforJmol = getParameter("nojmol");
393 if (chkforJmol != null)
395 checkForJmol = !chkforJmol.equals("true");
398 * get the separator parameter if present
400 String sep = getParameter("separator");
403 if (sep.length() > 0)
408 System.err.println("Separator set to '" + separator + "'");
414 "Invalid separator parameter - must be non-zero length");
420 String param = getParameter("RGB");
426 r = Integer.parseInt(param.substring(0, 2), 16);
427 g = Integer.parseInt(param.substring(2, 4), 16);
428 b = Integer.parseInt(param.substring(4, 6), 16);
429 } catch (Exception ex)
437 param = getParameter("label");
440 launcher.setLabel(param);
443 this.setBackground(new Color(r, g, b));
445 file = getParameter("file");
449 // Maybe the sequences are added as parameters
450 StringBuffer data = new StringBuffer("PASTE");
452 while ((file = getParameter("sequence" + i)) != null)
454 data.append(file.toString() + "\n");
457 if (data.length() > 5)
459 file = data.toString();
463 final JalviewLite applet = this;
464 if (getParameter("embedded") != null
465 && getParameter("embedded").equalsIgnoreCase("true"))
467 // Launch as embedded applet in page
469 LoadingThread loader = new LoadingThread(file, applet);
472 else if (file != null)
474 if (getParameter("showbutton") == null
475 || !getParameter("showbutton").equalsIgnoreCase("false"))
477 // Add the JalviewLite 'Button' to the page
479 launcher.addActionListener(new java.awt.event.ActionListener()
481 public void actionPerformed(ActionEvent e)
483 LoadingThread loader = new LoadingThread(file, applet);
490 // Open jalviewLite immediately.
491 LoadingThread loader = new LoadingThread(file, applet);
497 // jalview initialisation with no alignment. loadAlignment() method can
498 // still be called to open new alignments.
505 * Initialises and displays a new java.awt.Frame
508 * java.awt.Frame to be displayed
514 * height of new frame
516 public static void addFrame(final Frame frame, String title, int width,
519 frame.setLocation(lastFrameX, lastFrameY);
522 frame.setSize(width, height);
523 frame.setTitle(title);
524 frame.addWindowListener(new WindowAdapter()
526 public void windowClosing(WindowEvent e)
528 if (frame instanceof AlignFrame)
530 ((AlignFrame) frame).closeMenuItem_actionPerformed();
532 if (currentAlignFrame == frame)
534 currentAlignFrame = null;
538 if (frame instanceof EmbmenuFrame)
540 ((EmbmenuFrame) frame).destroyMenus();
542 frame.setMenuBar(null);
546 public void windowActivated(WindowEvent e)
548 if (frame instanceof AlignFrame)
550 currentAlignFrame = (AlignFrame) frame;
553 System.err.println("Activated window " + frame);
557 super.windowActivated(e);
560 * Probably not necessary to do this - see TODO above. (non-Javadoc)
563 * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent
566 * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame ==
567 * frame) { currentAlignFrame = null; if (debug) {
568 * System.err.println("Deactivated window "+frame); } }
569 * super.windowDeactivated(e); }
572 frame.setVisible(true);
576 * This paints the background surrounding the "Launch Jalview button" <br>
578 * If file given in parameter not found, displays error message
583 public void paint(Graphics g)
587 g.setColor(new Color(200, 200, 200));
588 g.setColor(Color.cyan);
589 g.fillRect(0, 0, getSize().width, getSize().height);
590 g.setColor(Color.red);
591 g.drawString("Jalview can't open file", 5, 15);
592 g.drawString("\"" + file + "\"", 5, 30);
596 g.setColor(Color.black);
597 g.setFont(new Font("Arial", Font.BOLD, 24));
598 g.drawString("Jalview Applet", 50, this.getSize().height / 2 - 30);
599 g.drawString("Loading Data...", 50, this.getSize().height / 2);
603 class LoadJmolThread extends Thread
605 private boolean running = false;
609 if (running || checkedForJmol)
618 if (!System.getProperty("java.version").startsWith("1.1"))
620 Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter");
621 jmolAvailable = true;
626 .println("Jmol not available - Using MCview for structures");
628 } catch (java.lang.ClassNotFoundException ex)
634 jmolAvailable = false;
638 .println("Skipping Jmol check. Will use MCView (probably)");
641 checkedForJmol = true;
645 public boolean notFinished()
647 return running || !checkedForJmol;
651 class LoadingThread extends Thread
654 * State variable: File source
659 * State variable: protocol for access to file source
664 * State variable: format of file source
672 private void dbgMsg(String msg)
676 System.err.println(msg);
681 * update the protocol state variable for accessing the datasource located
685 * @return possibly updated datasource string
687 public String setProtocolState(String file)
689 if (file.startsWith("PASTE"))
691 file = file.substring(5);
692 protocol = AppletFormatAdapter.PASTE;
694 else if (inArchive(file))
696 protocol = AppletFormatAdapter.CLASSLOADER;
700 file = addProtocol(file);
701 protocol = AppletFormatAdapter.URL;
703 dbgMsg("Protocol identified as '" + protocol + "'");
707 public LoadingThread(String _file, JalviewLite _applet)
715 LoadJmolThread jmolchecker = new LoadJmolThread();
717 while (jmolchecker.notFinished())
719 // wait around until the Jmol check is complete.
723 } catch (Exception e)
731 private void startLoading()
733 AlignFrame newAlignFrame;
734 dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile");
735 file = setProtocolState(_file);
737 format = new jalview.io.IdentifyFile().Identify(file, protocol);
738 dbgMsg("File identified as '" + format + "'");
739 dbgMsg("Loading started.");
743 al = new AppletFormatAdapter().readFile(file, protocol, format);
744 } catch (java.io.IOException ex)
746 dbgMsg("File load exception.");
747 ex.printStackTrace();
752 FileParse fp = new FileParse(file, protocol);
754 dbgMsg(">>>Dumping contents of '" + file + "' " + "("
756 while ((ln = fp.nextLine()) != null)
760 dbgMsg(">>>Dump finished.");
761 } catch (Exception e)
764 .println("Exception when trying to dump the content of the file parameter.");
769 if ((al != null) && (al.getHeight() > 0))
771 dbgMsg("Successfully loaded file.");
772 newAlignFrame = new AlignFrame(al, applet, file, embedded);
773 if (initialAlignFrame == null)
775 initialAlignFrame = newAlignFrame;
778 currentAlignFrame = newAlignFrame;
780 if (protocol == jalview.io.AppletFormatAdapter.PASTE)
782 newAlignFrame.setTitle("Sequences from " + getDocumentBase());
785 newAlignFrame.statusBar.setText("Successfully loaded file " + file);
787 String treeFile = applet.getParameter("tree");
788 if (treeFile == null)
790 treeFile = applet.getParameter("treeFile");
793 if (treeFile != null)
797 treeFile = setProtocolState(treeFile);
799 * if (inArchive(treeFile)) { protocol =
800 * AppletFormatAdapter.CLASSLOADER; } else { protocol =
801 * AppletFormatAdapter.URL; treeFile = addProtocol(treeFile); }
803 jalview.io.NewickFile fin = new jalview.io.NewickFile(treeFile,
808 if (fin.getTree() != null)
810 newAlignFrame.loadTree(fin, treeFile);
811 dbgMsg("Successfuly imported tree.");
815 dbgMsg("Tree parameter did not resolve to a valid tree.");
817 } catch (Exception ex)
819 ex.printStackTrace();
823 String param = getParameter("features");
826 param = setProtocolState(param);
828 newAlignFrame.parseFeaturesFile(param, protocol);
831 param = getParameter("showFeatureSettings");
832 if (param != null && param.equalsIgnoreCase("true"))
834 newAlignFrame.viewport.showSequenceFeatures(true);
835 new FeatureSettings(newAlignFrame.alignPanel);
838 param = getParameter("annotations");
841 param = setProtocolState(param);
843 if (new AnnotationFile().readAnnotationFile(
844 newAlignFrame.viewport.getAlignment(), param, protocol))
846 newAlignFrame.alignPanel.fontChanged();
847 newAlignFrame.alignPanel.setScrollValues(0, 0);
852 .println("Annotations were not added from annotation file '"
858 param = getParameter("jnetfile");
863 param = setProtocolState(param);
864 jalview.io.JPredFile predictions = new jalview.io.JPredFile(
866 JnetAnnotationMaker.add_annotation(predictions,
867 newAlignFrame.viewport.getAlignment(), 0, false); // false==do
875 newAlignFrame.alignPanel.fontChanged();
876 newAlignFrame.alignPanel.setScrollValues(0, 0);
877 } catch (Exception ex)
879 ex.printStackTrace();
884 * <param name="PDBfile" value="1gaq.txt PDB|1GAQ|1GAQ|A PDB|1GAQ|1GAQ|B
887 * <param name="PDBfile2" value="1gaq.txt A=SEQA B=SEQB C=SEQB">
889 * <param name="PDBfile3" value="1q0o Q45135_9MICO">
892 int pdbFileCount = 0;
895 if (pdbFileCount > 0)
896 param = getParameter("PDBFILE" + pdbFileCount);
898 param = getParameter("PDBFILE");
902 PDBEntry pdb = new PDBEntry();
905 SequenceI[] seqs = null;
906 String[] chains = null;
908 StringTokenizer st = new StringTokenizer(param, " ");
910 if (st.countTokens() < 2)
912 String sequence = applet.getParameter("PDBSEQ");
913 if (sequence != null)
914 seqs = new SequenceI[]
915 { (Sequence) newAlignFrame.getAlignViewport()
916 .getAlignment().findName(sequence) };
921 param = st.nextToken();
922 Vector tmp = new Vector();
923 Vector tmp2 = new Vector();
925 while (st.hasMoreTokens())
927 seqstring = st.nextToken();
928 StringTokenizer st2 = new StringTokenizer(seqstring, "=");
929 if (st2.countTokens() > 1)
932 tmp2.addElement(st2.nextToken());
933 seqstring = st2.nextToken();
935 tmp.addElement((Sequence) newAlignFrame.getAlignViewport()
936 .getAlignment().findName(seqstring));
939 seqs = new SequenceI[tmp.size()];
941 if (tmp2.size() == tmp.size())
943 chains = new String[tmp2.size()];
944 tmp2.copyInto(chains);
947 param = setProtocolState(param);
949 if (// !jmolAvailable
951 protocol == AppletFormatAdapter.CLASSLOADER)
953 // TODO: verify this Re:
954 // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
955 // This exception preserves the current behaviour where, even if
956 // the local pdb file was identified in the class loader
957 protocol = AppletFormatAdapter.URL; // this is probably NOT
959 param = addProtocol(param); //
966 for (int i = 0; i < seqs.length; i++)
970 ((Sequence) seqs[i]).addPDBId(pdb);
974 if (JalviewLite.debug)
976 // this may not really be a problem but we give a warning
979 .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "
987 new jalview.appletgui.AppletJmol(pdb, seqs, chains,
988 newAlignFrame.alignPanel, protocol);
993 new MCview.AppletPDBViewer(pdb, seqs, chains,
994 newAlignFrame.alignPanel, protocol);
999 } while (pdbFileCount < 10);
1001 // ///////////////////////////
1002 // modify display of features
1004 // hide specific groups
1005 param = getParameter("hidefeaturegroups");
1008 applet.setFeatureGroupStateOn(newAlignFrame, param, false);
1010 // show specific groups
1011 param = getParameter("showfeaturegroups");
1014 applet.setFeatureGroupStateOn(newAlignFrame, param, true);
1026 * Discovers whether the given file is in the Applet Archive
1032 boolean inArchive(String file)
1034 // This might throw a security exception in certain browsers
1035 // Netscape Communicator for instance.
1038 boolean rtn = (getClass().getResourceAsStream("/" + file) != null);
1041 System.err.println("Resource '" + file + "' was "
1042 + (rtn ? "" : "not") + " located by classloader.");
1045 } catch (Exception ex)
1047 System.out.println("Exception checking resources: " + file + " "
1053 String addProtocol(String file)
1055 if (file.indexOf("://") == -1)
1057 file = getCodeBase() + file;
1060 System.err.println("Prepended codebase for resource: '" + file
1070 * @return the default alignFrame acted on by the public applet methods. May
1071 * return null with an error message on System.err indicating the
1074 protected AlignFrame getDefaultTargetFrame()
1076 if (currentAlignFrame != null)
1078 return currentAlignFrame;
1080 if (initialAlignFrame != null)
1082 return initialAlignFrame;
1085 .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use.");
1090 * separator used for separatorList
1092 protected String separator = "|"; // this is a safe(ish) separator - tabs
1094 // don't work for firefox
1097 * parse the string into a list
1100 * @return elements separated by separator
1102 public String[] separatorListToArray(String list)
1104 int seplen = separator.length();
1105 if (list == null || list.equals(""))
1107 java.util.Vector jv = new Vector();
1109 while ((pos = list.indexOf(separator, cp)) > cp)
1111 jv.addElement(list.substring(cp, pos));
1114 if (cp < list.length())
1116 jv.addElement(list.substring(cp));
1120 String[] v = new String[jv.size()];
1121 for (int i = 0; i < v.length; i++)
1123 v[i] = (String) jv.elementAt(i);
1125 jv.removeAllElements();
1128 System.err.println("Array from '" + separator
1129 + "' separated List:\n" + v.length);
1130 for (int i = 0; i < v.length; i++)
1132 System.err.println("item " + i + " '" + v[i] + "'");
1139 System.err.println("Empty Array from '" + separator
1140 + "' separated List");
1146 * concatenate the list with separator
1149 * @return concatenated string
1151 public String arrayToSeparatorList(String[] list)
1153 StringBuffer v = new StringBuffer();
1156 for (int i = 0, iSize = list.length - 1; i < iSize; i++)
1158 if (list[i] != null)
1162 v.append(separator);
1164 if (list[list.length - 1] != null)
1166 v.append(list[list.length - 1]);
1170 System.err.println("Returning '" + separator
1171 + "' separated List:\n");
1172 System.err.println(v);
1174 return v.toString();
1178 System.err.println("Returning empty '" + separator
1179 + "' separated List\n");
1186 * @see jalview.appletgui.AlignFrame#getFeatureGroups()
1188 public String getFeatureGroups()
1190 String lst = arrayToSeparatorList(getDefaultTargetFrame()
1191 .getFeatureGroups());
1197 * alignframe to get feature groups on
1199 * @see jalview.appletgui.AlignFrame#getFeatureGroups()
1201 public String getFeatureGroupsOn(AlignFrame alf)
1203 String lst = arrayToSeparatorList(alf.getFeatureGroups());
1210 * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean)
1212 public String getFeatureGroupsOfState(boolean visible)
1214 return arrayToSeparatorList(getDefaultTargetFrame()
1215 .getFeatureGroupsOfState(visible));
1220 * align frame to get groups of state visible
1223 * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean)
1225 public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
1227 return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));
1232 * tab separated list of group names
1235 * @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[],
1238 public void setFeatureGroupStateOn(AlignFrame alf, String groups,
1241 boolean st = state;// !(state==null || state.equals("") ||
1242 // state.toLowerCase().equals("false"));
1243 alf.setFeatureGroupState(separatorListToArray(groups), st);
1246 public void setFeatureGroupState(String groups, boolean state)
1248 setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state);
1252 * List separator string
1254 * @return the separator
1256 public String getSeparator()
1262 * List separator string
1265 * the separator to set
1267 public void setSeparator(String separator)
1269 this.separator = separator;
1273 * get boolean value of applet parameter 'name' and return default if
1274 * parameter is not set
1279 * the value to return otherwise
1280 * @return true or false
1282 public boolean getDefaultParameter(String name, boolean def)
1285 if ((stn = getParameter(name)) == null)
1289 if (stn.toLowerCase().equals("true"))
1296 * bind a pdb file to a sequence in the given alignFrame.
1297 * @param alFrame - null or specific alignFrame. This specifies the dataset that will be searched for a seuqence called sequenceId
1298 * @param sequenceId - sequenceId within the dataset.
1299 * @param pdbEntryString - the short name for the PDB file
1300 * @param pdbFile - pdb file - either a URL or a valid PDB file.
1301 * @return true if binding was as success
1302 * TODO: consider making an exception structure for indicating when PDB parsing or seqeunceId location fails.
1304 public boolean addPdbFile(AlignFrame alFrame, String sequenceId, String pdbEntryString, String pdbFile)
1306 System.err.println("addPdbFile not yet implemented.");
1310 * bind the viewer instance to the pdbFile associated with sequences in the given alFrame.
1312 * @param pdbFile - pdbFile URI as given via applet's parameters or by addPdb
1314 * @return binding for viewer
1315 * TODO: consider making an exception structure for indicating when binding fails
1317 public SequenceStructureBinding addJmolInstance(AlignFrame alFrame, String pdbFile, org.jmol.api.JmolViewer viewer)
1319 System.err.println("addJmolInstance not yet implemented.");
1325 * bind structures in a viewer to any matching sequences in an alignFrame (use seuqenceIds to limit scope of search to specific sequences)
1328 * @param sequenceIds
1331 public SequenceStructureBinding addJmolInstance(AlignFrame alFrame, org.jmol.api.JmolViewer viewer, String sequenceIds)
1335 if (sequenceIds!=null && sequenceIds.length()>0)
1337 return alFrame.addJmolInstance(viewer, separatorListToArray(sequenceIds));
1339 return alFrame.addJmolInstance(viewer, null);