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/>.
20 import jalview.api.SequenceStructureBinding;
21 import jalview.appletgui.AlignFrame;
22 import jalview.appletgui.EmbmenuFrame;
23 import jalview.appletgui.FeatureSettings;
24 import jalview.datamodel.Alignment;
25 import jalview.datamodel.PDBEntry;
26 import jalview.datamodel.Sequence;
27 import jalview.datamodel.SequenceI;
28 import jalview.io.AnnotationFile;
29 import jalview.io.AppletFormatAdapter;
30 import jalview.io.FileParse;
31 import jalview.io.IdentifyFile;
32 import jalview.io.JnetAnnotationMaker;
34 import java.applet.Applet;
35 import java.awt.Button;
36 import java.awt.Color;
38 import java.awt.Frame;
39 import java.awt.Graphics;
40 import java.awt.event.ActionEvent;
41 import java.awt.event.WindowAdapter;
42 import java.awt.event.WindowEvent;
43 import java.io.BufferedReader;
44 import java.io.InputStreamReader;
45 import java.lang.reflect.Method;
46 import java.util.Enumeration;
47 import java.util.StringTokenizer;
48 import java.util.Vector;
51 * Jalview Applet. Runs in Java 1.18 runtime
56 public class JalviewLite extends Applet
59 // /////////////////////////////////////////
60 // The following public methods maybe called
61 // externally, eg via javascript in HTML page
63 * @return String list of selected sequence IDs, each terminated by "¬"
66 public String getSelectedSequences()
68 return getSelectedSequencesFrom(getDefaultTargetFrame());
73 * separator string or null for default
74 * @return String list of selected sequence IDs, each terminated by sep or
77 public String getSelectedSequences(String sep)
79 return getSelectedSequencesFrom(getDefaultTargetFrame(), sep);
84 * alignframe containing selection
85 * @return String list of selected sequence IDs, each terminated by "¬"
88 public String getSelectedSequencesFrom(AlignFrame alf)
90 return getSelectedSequencesFrom(alf, "¬");
94 * get list of selected sequence IDs separated by given separator
97 * window containing selection
99 * separator string to use - default is "¬"
100 * @return String list of selected sequence IDs, each terminated by the given
103 public String getSelectedSequencesFrom(AlignFrame alf, String sep)
105 StringBuffer result = new StringBuffer("");
106 if (sep == null || sep.length() == 0)
110 if (alf.viewport.getSelectionGroup() != null)
112 SequenceI[] seqs = alf.viewport.getSelectionGroup()
113 .getSequencesInOrder(alf.viewport.getAlignment());
115 for (int i = 0; i < seqs.length; i++)
117 result.append(seqs[i].getName());
122 return result.toString();
126 * get sequences selected in current alignFrame and return their alignment in
127 * format 'format' either with or without suffix
130 * - where selection is
132 * - format of alignment file
134 * - "true" to append /start-end string to each sequence ID
135 * @return selected sequences as flat file or empty string if there was no
138 public String getSelectedSequencesAsAlignment(String format, String suffix)
140 return getSelectedSequencesAsAlignmentFrom(currentAlignFrame, format,
145 * get sequences selected in alf and return their alignment in format 'format'
146 * either with or without suffix
149 * - where selection is
151 * - format of alignment file
153 * - "true" to append /start-end string to each sequence ID
154 * @return selected sequences as flat file or empty string if there was no
157 public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,
158 String format, String suffix)
162 boolean seqlimits = suffix.equalsIgnoreCase("true");
163 if (alf.viewport.getSelectionGroup() != null)
165 String reply = new AppletFormatAdapter().formatSequences(format,
166 new Alignment(alf.viewport.getSelectionAsNewSequence()),
170 } catch (Exception ex)
172 ex.printStackTrace();
173 return "Error retrieving alignment in " + format + " format. ";
178 public String getAlignment(String format)
180 return getAlignmentFrom(getDefaultTargetFrame(), format, "true");
183 public String getAlignmentFrom(AlignFrame alf, String format)
185 return getAlignmentFrom(alf, format, "true");
188 public String getAlignment(String format, String suffix)
190 return getAlignmentFrom(getDefaultTargetFrame(), format, suffix);
193 public String getAlignmentFrom(AlignFrame alf, String format,
198 boolean seqlimits = suffix.equalsIgnoreCase("true");
200 String reply = new AppletFormatAdapter().formatSequences(format,
201 alf.viewport.getAlignment(), seqlimits);
203 } catch (Exception ex)
205 ex.printStackTrace();
206 return "Error retrieving alignment in " + format + " format. ";
210 public void loadAnnotation(String annotation)
212 loadAnnotationFrom(getDefaultTargetFrame(), annotation);
215 public void loadAnnotationFrom(AlignFrame alf, String annotation)
217 if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport()
218 .getAlignment(), annotation, AppletFormatAdapter.PASTE))
220 alf.alignPanel.fontChanged();
221 alf.alignPanel.setScrollValues(0, 0);
225 alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE);
229 public String getFeatures(String format)
231 return getFeaturesFrom(getDefaultTargetFrame(), format);
234 public String getFeaturesFrom(AlignFrame alf, String format)
236 return alf.outputFeatures(false, format);
239 public String getAnnotation()
241 return getAnnotationFrom(getDefaultTargetFrame());
244 public String getAnnotationFrom(AlignFrame alf)
246 return alf.outputAnnotations(false);
249 public AlignFrame newView()
251 return newViewFrom(getDefaultTargetFrame());
254 public AlignFrame newView(String name)
256 return newViewFrom(getDefaultTargetFrame(), name);
259 public AlignFrame newViewFrom(AlignFrame alf)
261 return alf.newView(null);
264 public AlignFrame newViewFrom(AlignFrame alf, String name)
266 return alf.newView(name);
272 * alignment file as a string
275 * @return null or new alignment frame
277 public AlignFrame loadAlignment(String text, String title)
281 String format = new IdentifyFile().Identify(text,
282 AppletFormatAdapter.PASTE);
285 al = new AppletFormatAdapter().readFile(text,
286 AppletFormatAdapter.PASTE, format);
287 if (al.getHeight() > 0)
289 return new AlignFrame(al, this, title, false);
291 } catch (java.io.IOException ex)
293 ex.printStackTrace();
298 // //////////////////////////////////////////////
299 // //////////////////////////////////////////////
301 public static int lastFrameX = 200;
303 public static int lastFrameY = 200;
305 boolean fileFound = true;
307 String file = "No file";
309 Button launcher = new Button("Start Jalview");
312 * The currentAlignFrame is static, it will change if and when the user
313 * selects a new window. Note that it will *never* point back to the embedded
314 * AlignFrame if the applet is started as embedded on the page and then
315 * afterwards a new view is created.
317 public static AlignFrame currentAlignFrame = null;
320 * This is the first frame to be displayed, and does not change. API calls
321 * will default to this instance if currentAlignFrame is null.
323 AlignFrame initialAlignFrame = null;
325 boolean embedded = false;
327 private boolean checkForJmol = true;
329 private boolean checkedForJmol = false; // ensure we don't check for jmol
331 // every time the app is re-inited
333 public boolean jmolAvailable = false;
335 public static boolean debug = false;
337 static String builddate = null, version = null;
339 private static void initBuildDetails()
341 if (builddate == null)
343 builddate = "unknown";
345 java.net.URL url = JalviewLite.class
346 .getResource("/.build_properties");
351 BufferedReader reader = new BufferedReader(new InputStreamReader(
354 while ((line = reader.readLine()) != null)
356 if (line.indexOf("VERSION") > -1)
358 version = line.substring(line.indexOf("=") + 1);
360 if (line.indexOf("BUILD_DATE") > -1)
362 builddate = line.substring(line.indexOf("=") + 1);
365 } catch (Exception ex)
367 ex.printStackTrace();
373 public static String getBuildDate()
379 public static String getVersion()
386 * init method for Jalview Applet
392 * turn on extra applet debugging
394 String dbg = getParameter("debug");
397 debug = dbg.toLowerCase().equals("true");
402 System.err.println("JalviewLite Version " + getVersion());
403 System.err.println("Build Date : " + getBuildDate());
407 * if true disable the check for jmol
409 String chkforJmol = getParameter("nojmol");
410 if (chkforJmol != null)
412 checkForJmol = !chkforJmol.equals("true");
415 * get the separator parameter if present
417 String sep = getParameter("separator");
420 if (sep.length() > 0)
425 System.err.println("Separator set to '" + separator + "'");
431 "Invalid separator parameter - must be non-zero length");
437 String param = getParameter("RGB");
443 r = Integer.parseInt(param.substring(0, 2), 16);
444 g = Integer.parseInt(param.substring(2, 4), 16);
445 b = Integer.parseInt(param.substring(4, 6), 16);
446 } catch (Exception ex)
454 param = getParameter("label");
457 launcher.setLabel(param);
460 this.setBackground(new Color(r, g, b));
462 file = getParameter("file");
466 // Maybe the sequences are added as parameters
467 StringBuffer data = new StringBuffer("PASTE");
469 while ((file = getParameter("sequence" + i)) != null)
471 data.append(file.toString() + "\n");
474 if (data.length() > 5)
476 file = data.toString();
480 final JalviewLite applet = this;
481 if (getParameter("embedded") != null
482 && getParameter("embedded").equalsIgnoreCase("true"))
484 // Launch as embedded applet in page
486 LoadingThread loader = new LoadingThread(file, applet);
489 else if (file != null)
491 if (getParameter("showbutton") == null
492 || !getParameter("showbutton").equalsIgnoreCase("false"))
494 // Add the JalviewLite 'Button' to the page
496 launcher.addActionListener(new java.awt.event.ActionListener()
498 public void actionPerformed(ActionEvent e)
500 LoadingThread loader = new LoadingThread(file, applet);
507 // Open jalviewLite immediately.
508 LoadingThread loader = new LoadingThread(file, applet);
514 // jalview initialisation with no alignment. loadAlignment() method can
515 // still be called to open new alignments.
522 * Initialises and displays a new java.awt.Frame
525 * java.awt.Frame to be displayed
531 * height of new frame
533 public static void addFrame(final Frame frame, String title, int width,
536 frame.setLocation(lastFrameX, lastFrameY);
539 frame.setSize(width, height);
540 frame.setTitle(title);
541 frame.addWindowListener(new WindowAdapter()
543 public void windowClosing(WindowEvent e)
545 if (frame instanceof AlignFrame)
547 ((AlignFrame) frame).closeMenuItem_actionPerformed();
549 if (currentAlignFrame == frame)
551 currentAlignFrame = null;
555 if (frame instanceof EmbmenuFrame)
557 ((EmbmenuFrame) frame).destroyMenus();
559 frame.setMenuBar(null);
563 public void windowActivated(WindowEvent e)
565 if (frame instanceof AlignFrame)
567 currentAlignFrame = (AlignFrame) frame;
570 System.err.println("Activated window " + frame);
574 super.windowActivated(e);
577 * Probably not necessary to do this - see TODO above. (non-Javadoc)
580 * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent
583 * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame ==
584 * frame) { currentAlignFrame = null; if (debug) {
585 * System.err.println("Deactivated window "+frame); } }
586 * super.windowDeactivated(e); }
589 frame.setVisible(true);
593 * This paints the background surrounding the "Launch Jalview button" <br>
595 * If file given in parameter not found, displays error message
600 public void paint(Graphics g)
604 g.setColor(new Color(200, 200, 200));
605 g.setColor(Color.cyan);
606 g.fillRect(0, 0, getSize().width, getSize().height);
607 g.setColor(Color.red);
608 g.drawString("Jalview can't open file", 5, 15);
609 g.drawString("\"" + file + "\"", 5, 30);
613 g.setColor(Color.black);
614 g.setFont(new Font("Arial", Font.BOLD, 24));
615 g.drawString("Jalview Applet", 50, this.getSize().height / 2 - 30);
616 g.drawString("Loading Data...", 50, this.getSize().height / 2);
620 class LoadJmolThread extends Thread
622 private boolean running = false;
626 if (running || checkedForJmol)
635 if (!System.getProperty("java.version").startsWith("1.1"))
637 Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter");
638 jmolAvailable = true;
643 .println("Jmol not available - Using MCview for structures");
645 } catch (java.lang.ClassNotFoundException ex)
651 jmolAvailable = false;
655 .println("Skipping Jmol check. Will use MCView (probably)");
658 checkedForJmol = true;
662 public boolean notFinished()
664 return running || !checkedForJmol;
668 class LoadingThread extends Thread
671 * State variable: File source
676 * State variable: protocol for access to file source
681 * State variable: format of file source
689 private void dbgMsg(String msg)
693 System.err.println(msg);
698 * update the protocol state variable for accessing the datasource located
702 * @return possibly updated datasource string
704 public String setProtocolState(String file)
706 if (file.startsWith("PASTE"))
708 file = file.substring(5);
709 protocol = AppletFormatAdapter.PASTE;
711 else if (inArchive(file))
713 protocol = AppletFormatAdapter.CLASSLOADER;
717 file = addProtocol(file);
718 protocol = AppletFormatAdapter.URL;
720 dbgMsg("Protocol identified as '" + protocol + "'");
724 public LoadingThread(String _file, JalviewLite _applet)
732 LoadJmolThread jmolchecker = new LoadJmolThread();
734 while (jmolchecker.notFinished())
736 // wait around until the Jmol check is complete.
740 } catch (Exception e)
748 private void startLoading()
750 AlignFrame newAlignFrame;
751 dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile");
752 file = setProtocolState(_file);
754 format = new jalview.io.IdentifyFile().Identify(file, protocol);
755 dbgMsg("File identified as '" + format + "'");
756 dbgMsg("Loading started.");
760 al = new AppletFormatAdapter().readFile(file, protocol, format);
761 } catch (java.io.IOException ex)
763 dbgMsg("File load exception.");
764 ex.printStackTrace();
769 FileParse fp = new FileParse(file, protocol);
771 dbgMsg(">>>Dumping contents of '" + file + "' " + "("
773 while ((ln = fp.nextLine()) != null)
777 dbgMsg(">>>Dump finished.");
778 } catch (Exception e)
781 .println("Exception when trying to dump the content of the file parameter.");
786 if ((al != null) && (al.getHeight() > 0))
788 dbgMsg("Successfully loaded file.");
789 newAlignFrame = new AlignFrame(al, applet, file, embedded);
790 if (initialAlignFrame == null)
792 initialAlignFrame = newAlignFrame;
795 currentAlignFrame = newAlignFrame;
797 if (protocol == jalview.io.AppletFormatAdapter.PASTE)
799 newAlignFrame.setTitle("Sequences from " + getDocumentBase());
802 newAlignFrame.statusBar.setText("Successfully loaded file " + file);
804 String treeFile = applet.getParameter("tree");
805 if (treeFile == null)
807 treeFile = applet.getParameter("treeFile");
810 if (treeFile != null)
814 treeFile = setProtocolState(treeFile);
816 * if (inArchive(treeFile)) { protocol =
817 * AppletFormatAdapter.CLASSLOADER; } else { protocol =
818 * AppletFormatAdapter.URL; treeFile = addProtocol(treeFile); }
820 jalview.io.NewickFile fin = new jalview.io.NewickFile(treeFile,
825 if (fin.getTree() != null)
827 newAlignFrame.loadTree(fin, treeFile);
828 dbgMsg("Successfuly imported tree.");
832 dbgMsg("Tree parameter did not resolve to a valid tree.");
834 } catch (Exception ex)
836 ex.printStackTrace();
840 String param = getParameter("features");
843 param = setProtocolState(param);
845 newAlignFrame.parseFeaturesFile(param, protocol);
848 param = getParameter("showFeatureSettings");
849 if (param != null && param.equalsIgnoreCase("true"))
851 newAlignFrame.viewport.showSequenceFeatures(true);
852 new FeatureSettings(newAlignFrame.alignPanel);
855 param = getParameter("annotations");
858 param = setProtocolState(param);
860 if (new AnnotationFile().readAnnotationFile(
861 newAlignFrame.viewport.getAlignment(), param, protocol))
863 newAlignFrame.alignPanel.fontChanged();
864 newAlignFrame.alignPanel.setScrollValues(0, 0);
869 .println("Annotations were not added from annotation file '"
875 param = getParameter("jnetfile");
880 param = setProtocolState(param);
881 jalview.io.JPredFile predictions = new jalview.io.JPredFile(
883 JnetAnnotationMaker.add_annotation(predictions,
884 newAlignFrame.viewport.getAlignment(), 0, false); // false==do
892 newAlignFrame.alignPanel.fontChanged();
893 newAlignFrame.alignPanel.setScrollValues(0, 0);
894 } catch (Exception ex)
896 ex.printStackTrace();
901 * <param name="PDBfile" value="1gaq.txt PDB|1GAQ|1GAQ|A PDB|1GAQ|1GAQ|B
904 * <param name="PDBfile2" value="1gaq.txt A=SEQA B=SEQB C=SEQB">
906 * <param name="PDBfile3" value="1q0o Q45135_9MICO">
909 int pdbFileCount = 0;
912 if (pdbFileCount > 0)
913 param = getParameter("PDBFILE" + pdbFileCount);
915 param = getParameter("PDBFILE");
919 PDBEntry pdb = new PDBEntry();
922 SequenceI[] seqs = null;
923 String[] chains = null;
925 StringTokenizer st = new StringTokenizer(param, " ");
927 if (st.countTokens() < 2)
929 String sequence = applet.getParameter("PDBSEQ");
930 if (sequence != null)
931 seqs = new SequenceI[]
932 { (Sequence) newAlignFrame.getAlignViewport()
933 .getAlignment().findName(sequence) };
938 param = st.nextToken();
939 Vector tmp = new Vector();
940 Vector tmp2 = new Vector();
942 while (st.hasMoreTokens())
944 seqstring = st.nextToken();
945 StringTokenizer st2 = new StringTokenizer(seqstring, "=");
946 if (st2.countTokens() > 1)
949 tmp2.addElement(st2.nextToken());
950 seqstring = st2.nextToken();
952 tmp.addElement((Sequence) newAlignFrame.getAlignViewport()
953 .getAlignment().findName(seqstring));
956 seqs = new SequenceI[tmp.size()];
958 if (tmp2.size() == tmp.size())
960 chains = new String[tmp2.size()];
961 tmp2.copyInto(chains);
964 param = setProtocolState(param);
966 if (// !jmolAvailable
968 protocol == AppletFormatAdapter.CLASSLOADER)
970 // TODO: verify this Re:
971 // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
972 // This exception preserves the current behaviour where, even if
973 // the local pdb file was identified in the class loader
974 protocol = AppletFormatAdapter.URL; // this is probably NOT
976 param = addProtocol(param); //
983 for (int i = 0; i < seqs.length; i++)
987 ((Sequence) seqs[i]).addPDBId(pdb);
991 if (JalviewLite.debug)
993 // this may not really be a problem but we give a warning
996 .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "
1002 newAlignFrame.newStructureView(applet, pdb, seqs, chains,
1009 } while (pdbFileCount < 10);
1011 // ///////////////////////////
1012 // modify display of features
1014 // hide specific groups
1015 param = getParameter("hidefeaturegroups");
1018 applet.setFeatureGroupStateOn(newAlignFrame, param, false);
1020 // show specific groups
1021 param = getParameter("showfeaturegroups");
1024 applet.setFeatureGroupStateOn(newAlignFrame, param, true);
1036 * Discovers whether the given file is in the Applet Archive
1042 boolean inArchive(String file)
1044 // This might throw a security exception in certain browsers
1045 // Netscape Communicator for instance.
1048 boolean rtn = (getClass().getResourceAsStream("/" + file) != null);
1051 System.err.println("Resource '" + file + "' was "
1052 + (rtn ? "" : "not") + " located by classloader.");
1055 } catch (Exception ex)
1057 System.out.println("Exception checking resources: " + file + " "
1063 String addProtocol(String file)
1065 if (file.indexOf("://") == -1)
1067 file = getCodeBase() + file;
1070 System.err.println("Prepended codebase for resource: '" + file
1080 * @return the default alignFrame acted on by the public applet methods. May
1081 * return null with an error message on System.err indicating the
1084 protected AlignFrame getDefaultTargetFrame()
1086 if (currentAlignFrame != null)
1088 return currentAlignFrame;
1090 if (initialAlignFrame != null)
1092 return initialAlignFrame;
1095 .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use.");
1100 * separator used for separatorList
1102 protected String separator = "|"; // this is a safe(ish) separator - tabs
1104 // don't work for firefox
1107 * parse the string into a list
1110 * @return elements separated by separator
1112 public String[] separatorListToArray(String list)
1114 int seplen = separator.length();
1115 if (list == null || list.equals(""))
1117 java.util.Vector jv = new Vector();
1119 while ((pos = list.indexOf(separator, cp)) > cp)
1121 jv.addElement(list.substring(cp, pos));
1124 if (cp < list.length())
1126 jv.addElement(list.substring(cp));
1130 String[] v = new String[jv.size()];
1131 for (int i = 0; i < v.length; i++)
1133 v[i] = (String) jv.elementAt(i);
1135 jv.removeAllElements();
1138 System.err.println("Array from '" + separator
1139 + "' separated List:\n" + v.length);
1140 for (int i = 0; i < v.length; i++)
1142 System.err.println("item " + i + " '" + v[i] + "'");
1149 System.err.println("Empty Array from '" + separator
1150 + "' separated List");
1156 * concatenate the list with separator
1159 * @return concatenated string
1161 public String arrayToSeparatorList(String[] list)
1163 StringBuffer v = new StringBuffer();
1166 for (int i = 0, iSize = list.length - 1; i < iSize; i++)
1168 if (list[i] != null)
1172 v.append(separator);
1174 if (list[list.length - 1] != null)
1176 v.append(list[list.length - 1]);
1180 System.err.println("Returning '" + separator
1181 + "' separated List:\n");
1182 System.err.println(v);
1184 return v.toString();
1188 System.err.println("Returning empty '" + separator
1189 + "' separated List\n");
1196 * @see jalview.appletgui.AlignFrame#getFeatureGroups()
1198 public String getFeatureGroups()
1200 String lst = arrayToSeparatorList(getDefaultTargetFrame()
1201 .getFeatureGroups());
1207 * alignframe to get feature groups on
1209 * @see jalview.appletgui.AlignFrame#getFeatureGroups()
1211 public String getFeatureGroupsOn(AlignFrame alf)
1213 String lst = arrayToSeparatorList(alf.getFeatureGroups());
1220 * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean)
1222 public String getFeatureGroupsOfState(boolean visible)
1224 return arrayToSeparatorList(getDefaultTargetFrame()
1225 .getFeatureGroupsOfState(visible));
1230 * align frame to get groups of state visible
1233 * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean)
1235 public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
1237 return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));
1242 * tab separated list of group names
1245 * @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[],
1248 public void setFeatureGroupStateOn(AlignFrame alf, String groups,
1251 boolean st = state;// !(state==null || state.equals("") ||
1252 // state.toLowerCase().equals("false"));
1253 alf.setFeatureGroupState(separatorListToArray(groups), st);
1256 public void setFeatureGroupState(String groups, boolean state)
1258 setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state);
1262 * List separator string
1264 * @return the separator
1266 public String getSeparator()
1272 * List separator string
1275 * the separator to set
1277 public void setSeparator(String separator)
1279 this.separator = separator;
1283 * get boolean value of applet parameter 'name' and return default if
1284 * parameter is not set
1289 * the value to return otherwise
1290 * @return true or false
1292 public boolean getDefaultParameter(String name, boolean def)
1295 if ((stn = getParameter(name)) == null)
1299 if (stn.toLowerCase().equals("true"))
1307 * bind a pdb file to a sequence in the given alignFrame.
1310 * - null or specific alignFrame. This specifies the dataset that
1311 * will be searched for a seuqence called sequenceId
1313 * - sequenceId within the dataset.
1314 * @param pdbEntryString
1315 * - the short name for the PDB file
1317 * - pdb file - either a URL or a valid PDB file.
1318 * @return true if binding was as success TODO: consider making an exception
1319 * structure for indicating when PDB parsing or seqeunceId location
1322 public boolean addPdbFile(AlignFrame alFrame, String sequenceId,
1323 String pdbEntryString, String pdbFile)
1325 return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile);
1330 * bind structures in a viewer to any matching sequences in an alignFrame (use
1331 * sequenceIds to limit scope of search to specific sequences)
1335 * @param sequenceIds
1336 * @return TODO: consider making an exception structure for indicating when
1338 public SequenceStructureBinding addStructureViewInstance(
1339 AlignFrame alFrame, Object viewer, String sequenceIds)
1342 if (sequenceIds != null && sequenceIds.length() > 0)
1344 return alFrame.addStructureViewInstance(viewer,
1345 separatorListToArray(sequenceIds));
1349 return alFrame.addStructureViewInstance(viewer, null);