X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fbin%2FJalview.java;h=65628fb73ff82c501cad6f75e72fb4766619e16d;hb=83f6c6309e9705037a0853a26da74821c9d4fd12;hp=3c6fc39060e8d2e983f094e4cbc75516349b8bf8;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 3c6fc39..65628fb 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -18,11 +18,13 @@ */ package jalview.bin; +import java.io.IOException; import java.util.*; import javax.swing.*; import jalview.gui.*; +import jalview.io.AppletFormatAdapter; /** * Main class for Jalview Application @@ -60,6 +62,8 @@ public class Jalview + "-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" @@ -173,22 +177,10 @@ public class Jalview } } - protocol = "File"; - - if (file.indexOf("http:") > -1 || file.indexOf("file:") > -1) - { - protocol = "URL"; - } - - if (file.endsWith(".jar")) - { - format = "Jalview"; - } - else - { - format = new jalview.io.IdentifyFile().Identify(file, protocol); - } - + protocol = checkProtocol(file); + + format = new jalview.io.IdentifyFile().Identify(file, protocol); + AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol, format); if (af == null) @@ -222,13 +214,13 @@ public class Jalview data = aparser.getValue("groups"); if (data != null) { - af.parseFeaturesFile(data, protocol); + af.parseFeaturesFile(data, checkProtocol(data)); System.out.println("Added " + data); } data = aparser.getValue("features"); if (data != null) { - af.parseFeaturesFile(data, protocol); + af.parseFeaturesFile(data, checkProtocol(data)); System.out.println("Added " + data); } @@ -238,6 +230,24 @@ public class Jalview af.loadJalviewDataFile(data); System.out.println("Added " + data); } + data = aparser.getValue("tree"); + if (data != null) + { + jalview.io.NewickFile fin = null; + try { + fin = new jalview.io.NewickFile(data, checkProtocol(data)); + if (fin!=null) + { + af.getViewport().setCurrentTree(af.ShowNewickTree(fin, data).getTree()); + System.out.println("Added tree " + data); + } + } + catch (IOException ex) + { + System.err.println("Couldn't add tree "+data); + ex.printStackTrace(System.err); + } + } String imageName = "unnamed.png"; while (aparser.getSize() > 1) @@ -295,7 +305,7 @@ public class Jalview { file = jalview.bin.Cache.getDefault("STARTUP_FILE", - "http://www.jalview.org/examples/exampleFile.jar"); + "http://www.jalview.org/examples/exampleFile_2_3.jar"); protocol = "File"; @@ -317,8 +327,19 @@ public class Jalview } } -} + + private static String checkProtocol(String file) + { + String protocol = jalview.io.FormatAdapter.FILE; + + if (file.indexOf("http:") > -1 || file.indexOf("file:") > -1) + { + protocol = jalview.io.FormatAdapter.URL; + } + return protocol; + } +} class ArgsParser { Vector vargs = null;