2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import groovy.lang.Binding;
24 import groovy.util.GroovyScriptEngine;
26 import jalview.gui.AlignFrame;
27 import jalview.gui.Desktop;
28 import jalview.gui.PromptUserConfig;
29 import jalview.io.AppletFormatAdapter;
30 import jalview.io.BioJsHTMLOutput;
31 import jalview.io.FileLoader;
32 import jalview.io.FormatAdapter;
33 import jalview.io.HtmlSvgOutput;
34 import jalview.io.IdentifyFile;
35 import jalview.io.NewickFile;
36 import jalview.schemes.ColourSchemeI;
37 import jalview.schemes.ColourSchemeProperty;
38 import jalview.schemes.UserColourScheme;
39 import jalview.util.MessageManager;
40 import jalview.util.Platform;
41 import jalview.ws.jws2.Jws2Discoverer;
43 import java.io.BufferedReader;
45 import java.io.FileOutputStream;
46 import java.io.IOException;
47 import java.io.InputStreamReader;
48 import java.io.OutputStreamWriter;
49 import java.io.PrintWriter;
50 import java.net.MalformedURLException;
53 import java.security.AllPermission;
54 import java.security.CodeSource;
55 import java.security.PermissionCollection;
56 import java.security.Permissions;
57 import java.security.Policy;
58 import java.util.HashMap;
60 import java.util.Vector;
62 import javax.swing.UIManager;
65 * Main class for Jalview Application <br>
67 * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview
75 * singleton instance of this class
77 private static Jalview instance;
79 private Desktop desktop;
81 public static AlignFrame currentAlignFrame;
85 // grab all the rights we can the JVM
86 Policy.setPolicy(new Policy()
89 public PermissionCollection getPermissions(CodeSource codesource)
91 Permissions perms = new Permissions();
92 perms.add(new AllPermission());
104 * keep track of feature fetching tasks.
112 * TODO: generalise to track all jalview events to orchestrate batch
116 private int queued = 0;
118 private int running = 0;
120 public FeatureFetcher()
125 public void addFetcher(final AlignFrame af,
126 final Vector<String> dasSources)
128 final long id = System.currentTimeMillis();
130 final FeatureFetcher us = this;
131 new Thread(new Runnable()
143 af.setProgressBar(MessageManager
144 .getString("status.das_features_being_retrived"), id);
145 af.featureSettings_actionPerformed(null);
146 af.featureSettings.fetchDasFeatures(dasSources, true);
147 af.setProgressBar(null, id);
156 public synchronized boolean allFinished()
158 return queued == 0 && running == 0;
163 public static Jalview getInstance()
169 * main class for Jalview application
172 * open <em>filename</em>
174 public static void main(String[] args)
176 instance = new Jalview();
177 instance.doMain(args);
183 void doMain(String[] args)
185 System.out.println("Java version: "
186 + System.getProperty("java.version"));
187 System.out.println(System.getProperty("os.arch") + " "
188 + System.getProperty("os.name") + " "
189 + System.getProperty("os.version"));
191 ArgsParser aparser = new ArgsParser(args);
192 boolean headless = false;
194 if (aparser.contains("help") || aparser.contains("h"))
199 if (aparser.contains("nodisplay") || aparser.contains("nogui")
200 || aparser.contains("headless"))
202 System.setProperty("java.awt.headless", "true");
205 String usrPropsFile = aparser.getValue("props");
206 Cache.loadProperties(usrPropsFile); // must do this before
207 if (usrPropsFile != null)
209 System.out.println("CMD [-props " + usrPropsFile
210 + "] executed successfully!");
215 final String jabawsUrl = aparser.getValue("jabaws");
216 if (jabawsUrl != null)
220 Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
221 System.out.println("CMD [-jabaws " + jabawsUrl
222 + "] executed successfully!");
223 } catch (MalformedURLException e)
225 System.err.println("Invalid jabaws parameter: " + jabawsUrl
230 String defs = aparser.getValue("setprop");
233 int p = defs.indexOf('=');
236 System.err.println("Ignoring invalid setprop argument : " + defs);
240 System.out.println("Executing setprop argument: " + defs);
241 // DISABLED FOR SECURITY REASONS
242 // TODO: add a property to allow properties to be overriden by cli args
243 // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
245 defs = aparser.getValue("setprop");
247 if (System.getProperty("java.awt.headless") != null
248 && System.getProperty("java.awt.headless").equals("true"))
252 System.setProperty("http.agent",
253 "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
257 } catch (NoClassDefFoundError error)
259 error.printStackTrace();
261 .println("\nEssential logging libraries not found."
262 + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
270 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
271 } catch (Exception ex)
274 if (Platform.isAMac())
276 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
278 System.setProperty("apple.laf.useScreenMenuBar", "true");
281 UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager
283 } catch (Throwable e)
285 System.err.println("Failed to set QuaQua look and feel: "
292 desktop = new Desktop();
293 desktop.setInBatchMode(true); // indicate we are starting up
294 desktop.setVisible(true);
295 desktop.startServiceDiscovery();
296 if (!aparser.contains("nousagestats"))
298 startUsageStats(desktop);
302 System.err.println("CMD [-nousagestats] executed successfully!");
305 if (!aparser.contains("noquestionnaire"))
307 String url = aparser.getValue("questionnaire");
310 // Start the desktop questionnaire prompter with the specified
312 Cache.log.debug("Starting questionnaire url at " + url);
313 desktop.checkForQuestionnaire(url);
314 System.out.println("CMD questionnaire[-" + url
315 + "] executed successfully!");
319 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
321 // Start the desktop questionnaire prompter with the specified
324 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
326 String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
327 Cache.log.debug("Starting questionnaire with default url: "
329 desktop.checkForQuestionnaire(defurl);
336 System.err.println("CMD [-noquestionnaire] executed successfully!");
338 desktop.checkForNews();
341 if (!isHeadlessMode())
343 BioJsHTMLOutput.updateBioJS();
346 String file = null, protocol = null, format = null, data = null;
347 FileLoader fileLoader = new FileLoader(!headless);
348 Vector<String> getFeatures = null; // vector of das source nicknames to
352 String groovyscript = null; // script to execute after all loading is
353 // completed one way or another
354 // extract groovy argument and execute if necessary
355 groovyscript = aparser.getValue("groovy", true);
356 file = aparser.getValue("open", true);
358 if (file == null && desktop == null)
360 System.out.println("No files to open!");
363 String vamsasImport = aparser.getValue("vdoc");
364 String vamsasSession = aparser.getValue("vsess");
365 if (vamsasImport != null || vamsasSession != null)
367 if (desktop == null || headless)
370 .println("Headless vamsas sessions not yet supported. Sorry.");
373 // if we have a file, start a new session and import it.
374 boolean inSession = false;
375 if (vamsasImport != null)
379 String viprotocol = AppletFormatAdapter
380 .checkProtocol(vamsasImport);
381 if (viprotocol == jalview.io.FormatAdapter.FILE)
383 inSession = desktop.vamsasImport(new File(vamsasImport));
385 else if (viprotocol == FormatAdapter.URL)
387 inSession = desktop.vamsasImport(new URL(vamsasImport));
390 } catch (Exception e)
392 System.err.println("Exeption when importing " + vamsasImport
393 + " as a vamsas document.");
398 System.err.println("Failed to import " + vamsasImport
399 + " as a vamsas document.");
403 System.out.println("Imported Successfully into new session "
404 + desktop.getVamsasApplication().getCurrentSession());
407 if (vamsasSession != null)
409 if (vamsasImport != null)
411 // close the newly imported session and import the Jalview specific
412 // remnants into the new session later on.
413 desktop.vamsasStop_actionPerformed(null);
415 // now join the new session
418 if (desktop.joinVamsasSession(vamsasSession))
420 System.out.println("Successfully joined vamsas session "
425 System.err.println("WARNING: Failed to join vamsas session "
428 } catch (Exception e)
430 System.err.println("ERROR: Failed to join vamsas session "
434 if (vamsasImport != null)
436 // the Jalview specific remnants can now be imported into the new
437 // session at the user's leisure.
439 .info("Skipping Push for import of data into existing vamsas session."); // TODO:
444 // desktop.getVamsasApplication().push_update();
449 // Finally, deal with the remaining input data.
454 desktop.setProgressBar(MessageManager
455 .getString("status.processing_commandline_args"),
456 progress = System.currentTimeMillis());
458 System.out.println("CMD [-open " + file + "] executed successfully!");
460 if (!file.startsWith("http://"))
462 if (!(new File(file)).exists())
464 System.out.println("Can't find " + file);
472 protocol = AppletFormatAdapter.checkProtocol(file);
474 format = new IdentifyFile().identify(file, protocol);
476 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
480 System.out.println("error");
484 setCurrentAlignFrame(af);
485 data = aparser.getValue("colour", true);
488 data.replaceAll("%20", " ");
490 ColourSchemeI cs = ColourSchemeProperty.getColour(af
491 .getViewport().getAlignment(), data);
495 UserColourScheme ucs = new UserColourScheme("white");
496 ucs.parseAppletParameter(data);
501 System.out.println("CMD [-color " + data
502 + "] executed successfully!");
507 // Must maintain ability to use the groups flag
508 data = aparser.getValue("groups", true);
511 af.parseFeaturesFile(data,
512 AppletFormatAdapter.checkProtocol(data));
513 // System.out.println("Added " + data);
514 System.out.println("CMD groups[-" + data
515 + "] executed successfully!");
517 data = aparser.getValue("features", true);
520 af.parseFeaturesFile(data,
521 AppletFormatAdapter.checkProtocol(data));
522 // System.out.println("Added " + data);
523 System.out.println("CMD [-features " + data
524 + "] executed successfully!");
527 data = aparser.getValue("annotations", true);
530 af.loadJalviewDataFile(data, null, null, null);
531 // System.out.println("Added " + data);
532 System.out.println("CMD [-annotations " + data
533 + "] executed successfully!");
535 // set or clear the sortbytree flag.
536 if (aparser.contains("sortbytree"))
538 af.getViewport().setSortByTree(true);
539 if (af.getViewport().getSortByTree())
541 System.out.println("CMD [-sortbytree] executed successfully!");
544 if (aparser.contains("no-annotation"))
546 af.getViewport().setShowAnnotation(false);
547 if (!af.getViewport().isShowAnnotation())
549 System.out.println("CMD no-annotation executed successfully!");
552 if (aparser.contains("nosortbytree"))
554 af.getViewport().setSortByTree(false);
555 if (!af.getViewport().getSortByTree())
558 .println("CMD [-nosortbytree] executed successfully!");
561 data = aparser.getValue("tree", true);
564 jalview.io.NewickFile fin = null;
567 System.out.println("CMD [-tree " + data
568 + "] executed successfully!");
569 fin = new NewickFile(data,
570 AppletFormatAdapter.checkProtocol(data));
573 af.getViewport().setCurrentTree(
574 af.ShowNewickTree(fin, data).getTree());
576 } catch (IOException ex)
578 System.err.println("Couldn't add tree " + data);
579 ex.printStackTrace(System.err);
582 // TODO - load PDB structure(s) to alignment JAL-629
583 // (associate with identical sequence in alignment, or a specified
586 getFeatures = checkDasArguments(aparser);
587 if (af != null && getFeatures != null)
589 FeatureFetcher ff = startFeatureFetching(getFeatures);
592 while (!ff.allFinished() || af.operationInProgress())
594 // wait around until fetching is finished.
598 } catch (Exception e)
604 getFeatures = null; // have retrieved features - forget them now.
606 if (groovyscript != null)
608 // Execute the groovy script after we've done all the rendering stuff
609 // and before any images or figures are generated.
610 System.out.println("Executing script " + groovyscript);
611 executeGroovyScript(groovyscript, af);
612 System.out.println("CMD groovy[" + groovyscript
613 + "] executed successfully!");
616 String imageName = "unnamed.png";
617 while (aparser.getSize() > 1)
619 format = aparser.nextValue();
620 file = aparser.nextValue();
622 if (format.equalsIgnoreCase("png"))
624 af.createPNG(new File(file));
625 imageName = (new File(file)).getName();
626 System.out.println("Creating PNG image: " + file);
629 else if (format.equalsIgnoreCase("svg"))
631 File imageFile = new File(file);
632 imageName = imageFile.getName();
633 af.createSVG(imageFile);
634 System.out.println("Creating SVG image: " + file);
637 else if (format.equalsIgnoreCase("html"))
639 File imageFile = new File(file);
640 imageName = imageFile.getName();
641 new HtmlSvgOutput(new File(file), af.alignPanel);
642 System.out.println("Creating HTML image: " + file);
645 else if (format.equalsIgnoreCase("imgMap"))
647 af.createImageMap(new File(file), imageName);
648 System.out.println("Creating image map: " + file);
651 else if (format.equalsIgnoreCase("eps"))
653 File outputFile = new File(file);
654 System.out.println("Creating EPS file: "
655 + outputFile.getAbsolutePath());
656 af.createEPS(outputFile);
660 if (af.saveAlignment(file, format))
662 System.out.println("Written alignment in " + format
663 + " format to " + file);
667 System.out.println("Error writing file " + file + " in "
668 + format + " format!!");
673 while (aparser.getSize() > 0)
675 System.out.println("Unknown arg: " + aparser.nextValue());
679 AlignFrame startUpAlframe = null;
680 // We'll only open the default file if the desktop is visible.
682 // ////////////////////
684 if (!headless && file == null && vamsasImport == null
685 && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
687 file = jalview.bin.Cache.getDefault(
689 jalview.bin.Cache.getDefault("www.jalview.org",
690 "http://www.jalview.org")
691 + "/examples/exampleFile_2_7.jar");
692 if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar"))
694 // hardwire upgrade of the startup file
695 file.replace("_2_3.jar", "_2_7.jar");
696 // and remove the stale setting
697 jalview.bin.Cache.removeProperty("STARTUP_FILE");
702 if (file.indexOf("http:") > -1)
707 if (file.endsWith(".jar"))
713 format = new IdentifyFile().identify(file, protocol);
716 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
718 getFeatures = checkDasArguments(aparser);
719 // extract groovy arguments before anything else.
721 // If the user has specified features to be retrieved,
722 // or a groovy script to be executed, do them if they
723 // haven't been done already
724 // fetch features for the default alignment
725 if (getFeatures != null)
727 if (startUpAlframe != null)
729 startFeatureFetching(getFeatures);
732 // Once all other stuff is done, execute any groovy scripts (in order)
733 if (groovyscript != null)
735 if (Cache.groovyJarsPresent())
737 System.out.println("Executing script " + groovyscript);
738 executeGroovyScript(groovyscript, startUpAlframe);
743 .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
747 // and finally, turn off batch mode indicator - if the desktop still exists
752 desktop.setProgressBar(null, progress);
754 desktop.setInBatchMode(false);
758 private static void showUsage()
761 .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
762 + "-nodisplay\tRun Jalview without User Interface.\n"
763 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
764 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
765 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
766 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
767 + "-features FILE\tUse the given file to mark features on the alignment.\n"
768 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
769 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
770 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
771 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
772 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
773 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
774 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
775 + "-json FILE\tCreate alignment file FILE in JSON format.\n"
776 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
777 + "-png FILE\tCreate PNG image FILE from alignment.\n"
778 + "-svg FILE\tCreate SVG image FILE from alignment.\n"
779 + "-html FILE\tCreate HTML file from alignment.\n"
780 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
781 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
782 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
783 + "-noquestionnaire\tTurn off questionnaire check.\n"
784 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
785 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
787 // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
788 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
789 + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
790 + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
791 + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
792 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
794 // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
795 // + "-vses vamsas-session\tJoin session with given URN\n"
796 + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
797 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
800 private static void startUsageStats(final Desktop desktop)
803 * start a User Config prompt asking if we can log usage statistics.
805 PromptUserConfig prompter = new PromptUserConfig(
808 "Jalview Usage Statistics",
809 "Do you want to help make Jalview better by enabling "
810 + "the collection of usage statistics with Google Analytics ?"
811 + "\n\n(you can enable or disable usage tracking in the preferences)",
818 .debug("Initialising googletracker for usage stats.");
819 Cache.initGoogleTracker();
820 Cache.log.debug("Tracking enabled.");
827 Cache.log.debug("Not enabling Google Tracking.");
830 desktop.addDialogThread(prompter);
834 * Locate the given string as a file and pass it to the groovy interpreter.
836 * @param groovyscript
837 * the script to execute
838 * @param jalviewContext
839 * the Jalview Desktop object passed in to the groovy binding as the
842 private void executeGroovyScript(String groovyscript, AlignFrame af)
845 * for scripts contained in files
852 if (groovyscript.trim().equals("STDIN"))
854 // read from stdin into a tempfile and execute it
857 tfile = File.createTempFile("jalview", "groovy");
858 PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
859 new FileOutputStream(tfile)));
860 BufferedReader br = new BufferedReader(new InputStreamReader(
863 while ((line = br.readLine()) != null)
865 outfile.write(line + "\n");
871 } catch (Exception ex)
873 System.err.println("Failed to read from STDIN into tempfile "
874 + ((tfile == null) ? "(tempfile wasn't created)" : tfile
876 ex.printStackTrace();
881 sfile = tfile.toURI().toURL();
882 } catch (Exception x)
885 .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
895 sfile = new URI(groovyscript).toURL();
896 } catch (Exception x)
898 tfile = new File(groovyscript);
901 System.err.println("File '" + groovyscript + "' does not exist.");
904 if (!tfile.canRead())
906 System.err.println("File '" + groovyscript + "' cannot be read.");
909 if (tfile.length() < 1)
911 System.err.println("File '" + groovyscript + "' is empty.");
916 sfile = tfile.getAbsoluteFile().toURI().toURL();
917 } catch (Exception ex)
919 System.err.println("Failed to create a file URL for "
920 + tfile.getAbsoluteFile());
927 Map<String, Object> vbinding = new HashMap<String, Object>();
928 vbinding.put("Jalview", this);
931 vbinding.put("currentAlFrame", af);
933 Binding gbinding = new Binding(vbinding);
934 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
935 gse.run(sfile.toString(), gbinding);
936 if ("STDIN".equals(groovyscript))
938 // delete temp file that we made -
939 // only if it was successfully executed
942 } catch (Exception e)
944 System.err.println("Exception Whilst trying to execute file " + sfile
945 + " as a groovy script.");
946 e.printStackTrace(System.err);
952 * Check commandline for any das server definitions or any fetchfrom switches
954 * @return vector of DAS source nicknames to retrieve from
956 private static Vector<String> checkDasArguments(ArgsParser aparser)
958 Vector<String> source = null;
960 String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
961 while ((data = aparser.getValue("dasserver", true)) != null)
963 String nickname = null;
965 int pos = data.indexOf('=');
966 // determine capabilities
969 nickname = data.substring(0, pos);
971 url = data.substring(pos + 1);
973 && (url.startsWith("http:") || url
974 .startsWith("sequence:http:")))
976 if (nickname == null)
980 if (locsources == null)
988 locsources = locsources + nickname + "|" + url;
990 .println("NOTE! dasserver parameter not yet really supported (got args of "
991 + nickname + "|" + url);
994 source = new Vector<String>();
996 source.addElement(nickname);
998 System.out.println("CMD [-dasserver " + data
999 + "] executed successfully!");
1000 } // loop until no more server entries are found.
1001 if (locsources != null && locsources.indexOf('|') > -1)
1003 Cache.log.debug("Setting local source list in properties file to:\n"
1005 Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources);
1007 while ((data = aparser.getValue("fetchfrom", true)) != null)
1009 System.out.println("adding source '" + data + "'");
1012 source = new Vector<String>();
1014 source.addElement(data);
1020 * start a feature fetcher for every alignment frame
1024 private FeatureFetcher startFeatureFetching(
1025 final Vector<String> dasSources)
1027 FeatureFetcher ff = new FeatureFetcher();
1028 AlignFrame afs[] = Desktop.getAlignFrames();
1029 if (afs == null || afs.length == 0)
1033 for (int i = 0; i < afs.length; i++)
1035 ff.addFetcher(afs[i], dasSources);
1040 public static boolean isHeadlessMode()
1042 String isheadless = System.getProperty("java.awt.headless");
1043 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1050 public AlignFrame[] getAlignFrames()
1052 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1053 : Desktop.getAlignFrames();
1058 * Quit method delegates to Desktop.quit - unless running in headless mode
1059 * when it just ends the JVM
1063 if (desktop != null)
1073 public static AlignFrame getCurrentAlignFrame()
1075 return Jalview.currentAlignFrame;
1078 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1080 Jalview.currentAlignFrame = currentAlignFrame;