+ static
+ {
+ // grab all the rights we can the JVM
+ Policy.setPolicy(new Policy()
+ {
+ public PermissionCollection getPermissions(CodeSource codesource)
+ {
+ Permissions perms = new Permissions();
+ perms.add(new AllPermission());
+ return (perms);
+ }
+
+ public void refresh()
+ {
+ }
+ });
+ }
+
+ /**
+ * Put protein=true for get a protein example
+ */
+ private static boolean protein = false;
+
+ /**
+ * main class for Jalview application
+ *
+ * @param args
+ * open <em>filename</em>
+ */
+ public static void main(String[] args)
+ {
+ System.out.println("Java version: "
+ + System.getProperty("java.version"));
+ System.out.println(System.getProperty("os.arch") + " "
+ + System.getProperty("os.name") + " "
+ + System.getProperty("os.version"));
+ if (new Platform().isAMac())
+ {
+ System.setProperty("com.apple.mrj.application.apple.menu.about.name",
+ "Jalview");
+ System.setProperty("apple.laf.useScreenMenuBar", "true");
+ }
+
+ ArgsParser aparser = new ArgsParser(args);
+ boolean headless = false;
+
+ if (aparser.contains("help") || aparser.contains("h"))
+ {
+ System.out
+ .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
+ + "-nodisplay\tRun Jalview without User Interface.\n"
+ + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
+ + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
+ + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
+ + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
+ + "-features FILE\tUse the given file to mark features on the alignment.\n"
+ + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
+ + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
+ + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
+ + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
+ + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
+ + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
+ + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
+ + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
+ + "-png FILE\tCreate PNG image FILE from alignment.\n"
+ + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
+ + "-eps FILE\tCreate EPS file FILE from alignment.\n"
+ + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
+ + "-noquestionnaire\tTurn off questionnaire check.\n"
+ + "-nousagestats\tTurn off google analytics tracking for this session.\n"
+ + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
+ // +
+ // "-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)"
+ + "-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"
+ + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
+ + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
+ + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
+ // +
+ // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
+ // + "-vses vamsas-session\tJoin session with given URN\n"
+ + "-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"
+ + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
+ System.exit(0);
+ }
+ if (aparser.contains("nodisplay") || aparser.contains("nogui")
+ || aparser.contains("headless"))
+ {
+ System.setProperty("java.awt.headless", "true");
+ headless = true;
+ }
+ Cache.loadProperties(aparser.getValue("props")); // must do this before
+ // anything else!
+ String defs = aparser.getValue("setprop");
+ while (defs != null)
+ {
+ int p = defs.indexOf('=');
+ if (p == -1)
+ {
+ System.err.println("Ignoring invalid setprop argument : " + defs);
+ }
+ else
+ {
+ System.out.println("Executing setprop argument: " + defs);
+ // DISABLED FOR SECURITY REASONS
+ // TODO: add a property to allow properties to be overriden by cli args
+ // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
+ }
+ defs = aparser.getValue("setprop");
+ }
+ if (System.getProperty("java.awt.headless") != null
+ && System.getProperty("java.awt.headless").equals("true"))
+ {
+ headless = true;
+ }
+ System.setProperty("http.agent",
+ "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
+ try
+ {
+ Cache.initLogger();
+ } catch (java.lang.NoClassDefFoundError error)
+ {
+ error.printStackTrace();
+ System.out
+ .println("\nEssential logging libraries not found."
+ + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
+ System.exit(0);
+ }
+
+ Desktop desktop = null;
+
+ try
+ {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception ex)
+ {
+ }
+
+ if (!headless)
+ {
+ desktop = new Desktop();
+ desktop.setInBatchMode(true); // indicate we are starting up
+ desktop.setVisible(true);
+ desktop.startServiceDiscovery();
+ if (!aparser.contains("nousagestats"))
+ {
+ startUsageStats(desktop);
+ }
+ if (!aparser.contains("noquestionnaire"))
+ {
+ String url = aparser.getValue("questionnaire");
+ if (url != null)
+ {
+ // Start the desktop questionnaire prompter with the specified
+ // questionnaire
+ Cache.log.debug("Starting questionnaire url at " + url);
+ desktop.checkForQuestionnaire(url);
+ }
+ else
+ {
+ if (Cache.getProperty("NOQUESTIONNAIRES") == null)
+ {
+ // Start the desktop questionnaire prompter with the specified
+ // questionnaire
+ // String defurl =
+ // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
+ // //
+ String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
+ Cache.log.debug("Starting questionnaire with default url: "
+ + defurl);
+ desktop.checkForQuestionnaire(defurl);