added the jnetfile parameter to specify a JNet concise file to be
[jalview.git] / src / jalview / bin / Jalview.java
index 910c947..bdfe3ae 100755 (executable)
@@ -57,11 +57,8 @@ public class Jalview
         System.out.println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"\r
                            +"-nodisplay\tRun Jalview without User Interface.\n"\r
                            +"-props FILE\tUse the given Jalview properties file instead of users default.\n"\r
-                           +"-groups FILE\tUse the given file to mark groups on the alignment. \nGroups file is in the following tab delimited format\n"\r
-                           +"TEXT<tab>SEQUENCE_ID<tab>SEQUENCE_INDEX<tab>START_RESIDUE<tab>END_RESIDUE<tab>COLOUR\n"\r
-                           +"SequenceID is used in preference to SequenceIndex if both are provided.\n"\r
-                           +"Enter ID_NOT_SPECIFIED for SEQUENCE_ID or -1 for SEQUENCE_INDEX if unknown.\n"\r
-                           +"COLOUR can be hexadecimal RGB or 'red', 'blue' etc.\n\n"\r
+                           +"-annotations FILE\tAdd precalculated annotations to the alignment.\n"\r
+                           +"-features FILE\tUse the given file to mark features on the alignment.\n"\r
                            +"-fasta FILE\tCreate alignment file FILE in Fasta format.\n"\r
                            +"-clustal FILE\tCreate alignment file FILE in Clustal format.\n"\r
                            +"-pfam FILE\tCreate alignment file FILE in PFAM format.\n"\r
@@ -72,14 +69,17 @@ public class Jalview
                            +"-jalview FILE\tCreate alignment file FILE in Jalview format.\n"\r
                            +"-png FILE\tCreate PNG image FILE from alignment.\n"\r
                            +"-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"\r
-                           +"-eps FILE\tCreate EPS file FILE from alignment.");\r
+                           +"-eps FILE\tCreate EPS file FILE from alignment."\r
+            +"\n\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");\r
         System.exit(0);\r
           }\r
 \r
+          Cache.loadProperties(aparser.getValue("props")); // must do this before anything else!\r
 \r
           if (aparser.contains("nodisplay"))\r
+          {\r
             System.setProperty("java.awt.headless", "true");\r
-\r
+          }\r
           if (System.getProperty("java.awt.headless") != null\r
               && System.getProperty("java.awt.headless").equals("true"))\r
           {\r
@@ -99,8 +99,6 @@ public class Jalview
             System.exit(0);\r
           }\r
 \r
-        Cache.loadProperties(aparser.getValue("props"));\r
-\r
         Desktop desktop = null;\r
         if( !headless )\r
         {\r
@@ -126,7 +124,7 @@ public class Jalview
         }\r
 \r
 \r
-         String file = null, protocol = null, format = null, groups=null;\r
+         String file = null, protocol = null, format = null, data=null;\r
          jalview.io.FileLoader fileLoader = new jalview.io.FileLoader();\r
 \r
           file = aparser.getValue("open");\r
@@ -145,7 +143,8 @@ public class Jalview
               if (! (new java.io.File(file)).exists())\r
               {\r
                 System.out.println("Can't find " + file);\r
-                System.exit(1);\r
+                if(headless)\r
+                  System.exit(1);\r
               }\r
             }\r
 \r
@@ -159,18 +158,34 @@ public class Jalview
             if (file.endsWith(".jar"))\r
               format = "Jalview";\r
             else\r
-              format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+              format = new jalview.io.IdentifyFile().Identify(file, protocol);\r
 \r
             System.out.println("Opening: " + format + " file " + file);\r
 \r
             AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol, format);\r
 \r
-            groups = aparser.getValue("groups");\r
-            if (groups != null)\r
+            // Must maintain ability to use the groups flag\r
+            data = aparser.getValue("groups");\r
+            if (data != null)\r
+            {\r
+              af.parseGroupsFile(data);\r
+              System.out.println("Added "+data);\r
+            }\r
+            data = aparser.getValue("features");\r
+            if (data != null)\r
+            {\r
+              af.parseGroupsFile(data);\r
+              System.out.println("Added "+data);\r
+            }\r
+\r
+            data = aparser.getValue("annotations");\r
+            if (data != null)\r
             {\r
-              af.parseGroupsFile(groups);\r
+              af.loadJalviewDataFile(data);\r
+              System.out.println("Added "+data);\r
             }\r
 \r
+\r
             String imageName = "unnamed.png";\r
             while (aparser.getSize() > 1)\r
             {\r
@@ -215,12 +230,14 @@ public class Jalview
         // We'll only open the default file if the desktop is visible.\r
         //////////////////////\r
           if (\r
-              !headless &&\r
-              jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))\r
+              !headless\r
+          && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)\r
+                    )\r
           {\r
 \r
             file = jalview.bin.Cache.getDefault("STARTUP_FILE",\r
                                                 "http://www.jalview.org/examples/exampleFile.jar");\r
+\r
             protocol = "File";\r
 \r
             if (file.indexOf("http:") > -1)\r
@@ -230,18 +247,14 @@ public class Jalview
 \r
             if (file.endsWith(".jar"))\r
             {\r
-              Jalview2XML.LoadJalviewAlign(file);\r
+              new Jalview2XML().LoadJalviewAlign(file);\r
             }\r
             else\r
             {\r
-              format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-              desktop.LoadFile(file, protocol, format);\r
+              format = new jalview.io.IdentifyFile().Identify(file, protocol);\r
+              new jalview.io.FileLoader().LoadFile(file, protocol, format);\r
             }\r
           }\r
-\r
-\r
-          if (desktop==null)\r
-            System.exit(0);\r
     }\r
 }\r
 \r