*/
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
+
"-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"
}
}
- 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)
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);
}
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)
}
}
-}
+
+ 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;