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.setSecurityManager(null);
186 System.out.println("Java version: "
187 + System.getProperty("java.version"));
188 System.out.println(System.getProperty("os.arch") + " "
189 + System.getProperty("os.name") + " "
190 + System.getProperty("os.version"));
192 ArgsParser aparser = new ArgsParser(args);
193 boolean headless = false;
195 if (aparser.contains("help") || aparser.contains("h"))
200 if (aparser.contains("nodisplay") || aparser.contains("nogui")
201 || aparser.contains("headless"))
203 System.setProperty("java.awt.headless", "true");
206 String usrPropsFile = aparser.getValue("props");
207 Cache.loadProperties(usrPropsFile); // must do this before
208 if (usrPropsFile != null)
210 System.out.println("CMD [-props " + usrPropsFile
211 + "] executed successfully!");
216 final String jabawsUrl = aparser.getValue("jabaws");
217 if (jabawsUrl != null)
221 Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
222 System.out.println("CMD [-jabaws " + jabawsUrl
223 + "] executed successfully!");
224 } catch (MalformedURLException e)
226 System.err.println("Invalid jabaws parameter: " + jabawsUrl
231 String defs = aparser.getValue("setprop");
234 int p = defs.indexOf('=');
237 System.err.println("Ignoring invalid setprop argument : " + defs);
241 System.out.println("Executing setprop argument: " + defs);
242 // DISABLED FOR SECURITY REASONS
243 // TODO: add a property to allow properties to be overriden by cli args
244 // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
246 defs = aparser.getValue("setprop");
248 if (System.getProperty("java.awt.headless") != null
249 && System.getProperty("java.awt.headless").equals("true"))
253 System.setProperty("http.agent",
254 "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
258 } catch (NoClassDefFoundError error)
260 error.printStackTrace();
262 .println("\nEssential logging libraries not found."
263 + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
271 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
272 } catch (Exception ex)
275 if (Platform.isAMac())
277 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
279 System.setProperty("apple.laf.useScreenMenuBar", "true");
282 UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager
284 } catch (Throwable e)
286 System.err.println("Failed to set QuaQua look and feel: "
293 desktop = new Desktop();
294 desktop.setInBatchMode(true); // indicate we are starting up
295 desktop.setVisible(true);
296 desktop.startServiceDiscovery();
297 if (!aparser.contains("nousagestats"))
299 startUsageStats(desktop);
303 System.err.println("CMD [-nousagestats] executed successfully!");
306 if (!aparser.contains("noquestionnaire"))
308 String url = aparser.getValue("questionnaire");
311 // Start the desktop questionnaire prompter with the specified
313 Cache.log.debug("Starting questionnaire url at " + url);
314 desktop.checkForQuestionnaire(url);
315 System.out.println("CMD questionnaire[-" + url
316 + "] executed successfully!");
320 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
322 // Start the desktop questionnaire prompter with the specified
325 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
327 String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
328 Cache.log.debug("Starting questionnaire with default url: "
330 desktop.checkForQuestionnaire(defurl);
336 System.err.println("CMD [-noquestionnaire] executed successfully!");
339 if (!aparser.contains("nonews"))
341 desktop.checkForNews();
344 BioJsHTMLOutput.updateBioJS();
347 String file = null, protocol = null, format = null, data = null;
348 FileLoader fileLoader = new FileLoader(!headless);
349 Vector<String> getFeatures = null; // vector of das source nicknames to
353 String groovyscript = null; // script to execute after all loading is
354 // completed one way or another
355 // extract groovy argument and execute if necessary
356 groovyscript = aparser.getValue("groovy", true);
357 file = aparser.getValue("open", true);
359 if (file == null && desktop == null)
361 System.out.println("No files to open!");
364 String vamsasImport = aparser.getValue("vdoc");
365 String vamsasSession = aparser.getValue("vsess");
366 if (vamsasImport != null || vamsasSession != null)
368 if (desktop == null || headless)
371 .println("Headless vamsas sessions not yet supported. Sorry.");
374 // if we have a file, start a new session and import it.
375 boolean inSession = false;
376 if (vamsasImport != null)
380 String viprotocol = AppletFormatAdapter
381 .checkProtocol(vamsasImport);
382 if (viprotocol == jalview.io.FormatAdapter.FILE)
384 inSession = desktop.vamsasImport(new File(vamsasImport));
386 else if (viprotocol == FormatAdapter.URL)
388 inSession = desktop.vamsasImport(new URL(vamsasImport));
391 } catch (Exception e)
393 System.err.println("Exeption when importing " + vamsasImport
394 + " as a vamsas document.");
399 System.err.println("Failed to import " + vamsasImport
400 + " as a vamsas document.");
404 System.out.println("Imported Successfully into new session "
405 + desktop.getVamsasApplication().getCurrentSession());
408 if (vamsasSession != null)
410 if (vamsasImport != null)
412 // close the newly imported session and import the Jalview specific
413 // remnants into the new session later on.
414 desktop.vamsasStop_actionPerformed(null);
416 // now join the new session
419 if (desktop.joinVamsasSession(vamsasSession))
421 System.out.println("Successfully joined vamsas session "
426 System.err.println("WARNING: Failed to join vamsas session "
429 } catch (Exception e)
431 System.err.println("ERROR: Failed to join vamsas session "
435 if (vamsasImport != null)
437 // the Jalview specific remnants can now be imported into the new
438 // session at the user's leisure.
440 .info("Skipping Push for import of data into existing vamsas session."); // TODO:
445 // desktop.getVamsasApplication().push_update();
450 // Finally, deal with the remaining input data.
455 desktop.setProgressBar(MessageManager
456 .getString("status.processing_commandline_args"),
457 progress = System.currentTimeMillis());
459 System.out.println("CMD [-open " + file + "] executed successfully!");
461 if (!file.startsWith("http://"))
463 if (!(new File(file)).exists())
465 System.out.println("Can't find " + file);
473 protocol = AppletFormatAdapter.checkProtocol(file);
475 format = new IdentifyFile().identify(file, protocol);
477 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
481 System.out.println("error");
485 setCurrentAlignFrame(af);
486 data = aparser.getValue("colour", true);
489 data.replaceAll("%20", " ");
491 ColourSchemeI cs = ColourSchemeProperty.getColour(af
492 .getViewport().getAlignment(), data);
496 UserColourScheme ucs = new UserColourScheme("white");
497 ucs.parseAppletParameter(data);
502 System.out.println("CMD [-color " + data
503 + "] executed successfully!");
508 // Must maintain ability to use the groups flag
509 data = aparser.getValue("groups", true);
512 af.parseFeaturesFile(data,
513 AppletFormatAdapter.checkProtocol(data));
514 // System.out.println("Added " + data);
515 System.out.println("CMD groups[-" + data
516 + "] executed successfully!");
518 data = aparser.getValue("features", true);
521 af.parseFeaturesFile(data,
522 AppletFormatAdapter.checkProtocol(data));
523 // System.out.println("Added " + data);
524 System.out.println("CMD [-features " + data
525 + "] executed successfully!");
528 data = aparser.getValue("annotations", true);
531 af.loadJalviewDataFile(data, null, null, null);
532 // System.out.println("Added " + data);
533 System.out.println("CMD [-annotations " + data
534 + "] executed successfully!");
536 // set or clear the sortbytree flag.
537 if (aparser.contains("sortbytree"))
539 af.getViewport().setSortByTree(true);
540 if (af.getViewport().getSortByTree())
542 System.out.println("CMD [-sortbytree] executed successfully!");
545 if (aparser.contains("no-annotation"))
547 af.getViewport().setShowAnnotation(false);
548 if (!af.getViewport().isShowAnnotation())
550 System.out.println("CMD no-annotation executed successfully!");
553 if (aparser.contains("nosortbytree"))
555 af.getViewport().setSortByTree(false);
556 if (!af.getViewport().getSortByTree())
559 .println("CMD [-nosortbytree] executed successfully!");
562 data = aparser.getValue("tree", true);
565 jalview.io.NewickFile fin = null;
568 System.out.println("CMD [-tree " + data
569 + "] executed successfully!");
570 fin = new NewickFile(data,
571 AppletFormatAdapter.checkProtocol(data));
574 af.getViewport().setCurrentTree(
575 af.ShowNewickTree(fin, data).getTree());
577 } catch (IOException ex)
579 System.err.println("Couldn't add tree " + data);
580 ex.printStackTrace(System.err);
583 // TODO - load PDB structure(s) to alignment JAL-629
584 // (associate with identical sequence in alignment, or a specified
587 getFeatures = checkDasArguments(aparser);
588 if (af != null && getFeatures != null)
590 FeatureFetcher ff = startFeatureFetching(getFeatures);
593 while (!ff.allFinished() || af.operationInProgress())
595 // wait around until fetching is finished.
599 } catch (Exception e)
605 getFeatures = null; // have retrieved features - forget them now.
607 if (groovyscript != null)
609 // Execute the groovy script after we've done all the rendering stuff
610 // and before any images or figures are generated.
611 System.out.println("Executing script " + groovyscript);
612 executeGroovyScript(groovyscript, af);
613 System.out.println("CMD groovy[" + groovyscript
614 + "] executed successfully!");
617 String imageName = "unnamed.png";
618 while (aparser.getSize() > 1)
620 format = aparser.nextValue();
621 file = aparser.nextValue();
623 if (format.equalsIgnoreCase("png"))
625 af.createPNG(new File(file));
626 imageName = (new File(file)).getName();
627 System.out.println("Creating PNG image: " + file);
630 else if (format.equalsIgnoreCase("svg"))
632 File imageFile = new File(file);
633 imageName = imageFile.getName();
634 af.createSVG(imageFile);
635 System.out.println("Creating SVG image: " + file);
638 else if (format.equalsIgnoreCase("html"))
640 File imageFile = new File(file);
641 imageName = imageFile.getName();
642 new HtmlSvgOutput(new File(file), af.alignPanel);
643 System.out.println("Creating HTML image: " + file);
646 else if (format.equalsIgnoreCase("imgMap"))
648 af.createImageMap(new File(file), imageName);
649 System.out.println("Creating image map: " + file);
652 else if (format.equalsIgnoreCase("eps"))
654 File outputFile = new File(file);
655 System.out.println("Creating EPS file: "
656 + outputFile.getAbsolutePath());
657 af.createEPS(outputFile);
661 if (af.saveAlignment(file, format))
663 System.out.println("Written alignment in " + format
664 + " format to " + file);
668 System.out.println("Error writing file " + file + " in "
669 + format + " format!!");
674 while (aparser.getSize() > 0)
676 System.out.println("Unknown arg: " + aparser.nextValue());
680 AlignFrame startUpAlframe = null;
681 // We'll only open the default file if the desktop is visible.
683 // ////////////////////
685 if (!headless && file == null && vamsasImport == null
686 && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
688 file = jalview.bin.Cache.getDefault(
690 jalview.bin.Cache.getDefault("www.jalview.org",
691 "http://www.jalview.org")
692 + "/examples/exampleFile_2_7.jar");
693 if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar"))
695 // hardwire upgrade of the startup file
696 file.replace("_2_3.jar", "_2_7.jar");
697 // and remove the stale setting
698 jalview.bin.Cache.removeProperty("STARTUP_FILE");
703 if (file.indexOf("http:") > -1)
708 if (file.endsWith(".jar"))
714 format = new IdentifyFile().identify(file, protocol);
717 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
719 getFeatures = checkDasArguments(aparser);
720 // extract groovy arguments before anything else.
722 // If the user has specified features to be retrieved,
723 // or a groovy script to be executed, do them if they
724 // haven't been done already
725 // fetch features for the default alignment
726 if (getFeatures != null)
728 if (startUpAlframe != null)
730 startFeatureFetching(getFeatures);
733 // Once all other stuff is done, execute any groovy scripts (in order)
734 if (groovyscript != null)
736 if (Cache.groovyJarsPresent())
738 System.out.println("Executing script " + groovyscript);
739 executeGroovyScript(groovyscript, startUpAlframe);
744 .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
748 // and finally, turn off batch mode indicator - if the desktop still exists
753 desktop.setProgressBar(null, progress);
755 desktop.setInBatchMode(false);
759 private static void showUsage()
762 .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
763 + "-nodisplay\tRun Jalview without User Interface.\n"
764 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
765 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
766 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
767 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
768 + "-features FILE\tUse the given file to mark features on the alignment.\n"
769 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
770 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
771 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
772 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
773 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
774 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
775 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
776 + "-json FILE\tCreate alignment file FILE in JSON format.\n"
777 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
778 + "-png FILE\tCreate PNG image FILE from alignment.\n"
779 + "-svg FILE\tCreate SVG image FILE from alignment.\n"
780 + "-html FILE\tCreate HTML file from alignment.\n"
781 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
782 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
783 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
784 + "-noquestionnaire\tTurn off questionnaire check.\n"
785 + "-nonews\tTurn off check for Jalview news.\n"
786 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
787 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
789 // "-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)"
790 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
791 + "-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"
792 + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
793 + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
794 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
796 // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
797 // + "-vses vamsas-session\tJoin session with given URN\n"
798 + "-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"
799 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
802 private static void startUsageStats(final Desktop desktop)
805 * start a User Config prompt asking if we can log usage statistics.
807 PromptUserConfig prompter = new PromptUserConfig(
810 "Jalview Usage Statistics",
811 "Do you want to help make Jalview better by enabling "
812 + "the collection of usage statistics with Google Analytics ?"
813 + "\n\n(you can enable or disable usage tracking in the preferences)",
820 .debug("Initialising googletracker for usage stats.");
821 Cache.initGoogleTracker();
822 Cache.log.debug("Tracking enabled.");
829 Cache.log.debug("Not enabling Google Tracking.");
832 desktop.addDialogThread(prompter);
836 * Locate the given string as a file and pass it to the groovy interpreter.
838 * @param groovyscript
839 * the script to execute
840 * @param jalviewContext
841 * the Jalview Desktop object passed in to the groovy binding as the
844 private void executeGroovyScript(String groovyscript, AlignFrame af)
847 * for scripts contained in files
854 if (groovyscript.trim().equals("STDIN"))
856 // read from stdin into a tempfile and execute it
859 tfile = File.createTempFile("jalview", "groovy");
860 PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
861 new FileOutputStream(tfile)));
862 BufferedReader br = new BufferedReader(new InputStreamReader(
865 while ((line = br.readLine()) != null)
867 outfile.write(line + "\n");
873 } catch (Exception ex)
875 System.err.println("Failed to read from STDIN into tempfile "
876 + ((tfile == null) ? "(tempfile wasn't created)" : tfile
878 ex.printStackTrace();
883 sfile = tfile.toURI().toURL();
884 } catch (Exception x)
887 .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
897 sfile = new URI(groovyscript).toURL();
898 } catch (Exception x)
900 tfile = new File(groovyscript);
903 System.err.println("File '" + groovyscript + "' does not exist.");
906 if (!tfile.canRead())
908 System.err.println("File '" + groovyscript + "' cannot be read.");
911 if (tfile.length() < 1)
913 System.err.println("File '" + groovyscript + "' is empty.");
918 sfile = tfile.getAbsoluteFile().toURI().toURL();
919 } catch (Exception ex)
921 System.err.println("Failed to create a file URL for "
922 + tfile.getAbsoluteFile());
929 Map<String, Object> vbinding = new HashMap<String, Object>();
930 vbinding.put("Jalview", this);
933 vbinding.put("currentAlFrame", af);
935 Binding gbinding = new Binding(vbinding);
936 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
937 gse.run(sfile.toString(), gbinding);
938 if ("STDIN".equals(groovyscript))
940 // delete temp file that we made -
941 // only if it was successfully executed
944 } catch (Exception e)
946 System.err.println("Exception Whilst trying to execute file " + sfile
947 + " as a groovy script.");
948 e.printStackTrace(System.err);
954 * Check commandline for any das server definitions or any fetchfrom switches
956 * @return vector of DAS source nicknames to retrieve from
958 private static Vector<String> checkDasArguments(ArgsParser aparser)
960 Vector<String> source = null;
962 String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
963 while ((data = aparser.getValue("dasserver", true)) != null)
965 String nickname = null;
967 int pos = data.indexOf('=');
968 // determine capabilities
971 nickname = data.substring(0, pos);
973 url = data.substring(pos + 1);
975 && (url.startsWith("http:") || url
976 .startsWith("sequence:http:")))
978 if (nickname == null)
982 if (locsources == null)
990 locsources = locsources + nickname + "|" + url;
992 .println("NOTE! dasserver parameter not yet really supported (got args of "
993 + nickname + "|" + url);
996 source = new Vector<String>();
998 source.addElement(nickname);
1000 System.out.println("CMD [-dasserver " + data
1001 + "] executed successfully!");
1002 } // loop until no more server entries are found.
1003 if (locsources != null && locsources.indexOf('|') > -1)
1005 Cache.log.debug("Setting local source list in properties file to:\n"
1007 Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources);
1009 while ((data = aparser.getValue("fetchfrom", true)) != null)
1011 System.out.println("adding source '" + data + "'");
1014 source = new Vector<String>();
1016 source.addElement(data);
1022 * start a feature fetcher for every alignment frame
1026 private FeatureFetcher startFeatureFetching(
1027 final Vector<String> dasSources)
1029 FeatureFetcher ff = new FeatureFetcher();
1030 AlignFrame afs[] = Desktop.getAlignFrames();
1031 if (afs == null || afs.length == 0)
1035 for (int i = 0; i < afs.length; i++)
1037 ff.addFetcher(afs[i], dasSources);
1042 public static boolean isHeadlessMode()
1044 String isheadless = System.getProperty("java.awt.headless");
1045 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1052 public AlignFrame[] getAlignFrames()
1054 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1055 : Desktop.getAlignFrames();
1060 * Quit method delegates to Desktop.quit - unless running in headless mode
1061 * when it just ends the JVM
1065 if (desktop != null)
1075 public static AlignFrame getCurrentAlignFrame()
1077 return Jalview.currentAlignFrame;
1080 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1082 Jalview.currentAlignFrame = currentAlignFrame;