X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=954bb34bd63bc94e4eedfc845a59a073c7a0500a;hb=bdff041b485dae497cfa699bb536e3e79105527b;hp=76ae3ff68853611646efd564066bf2ed30476103;hpb=8c7fd90d480e2671e0fa251ada3c89fa1d18862a;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 76ae3ff..954bb34 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -23,19 +23,23 @@ package jalview.bin; import groovy.lang.Binding; import groovy.util.GroovyScriptEngine; +import jalview.ext.so.SequenceOntology; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.PromptUserConfig; import jalview.io.AppletFormatAdapter; import jalview.io.BioJsHTMLOutput; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; +import jalview.io.FileFormatException; +import jalview.io.FileFormatI; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import jalview.io.HtmlSvgOutput; import jalview.io.IdentifyFile; import jalview.io.NewickFile; +import jalview.io.gff.SequenceOntologyFactory; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; -import jalview.schemes.UserColourScheme; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; @@ -49,6 +53,7 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.MalformedURLException; import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.security.AllPermission; import java.security.CodeSource; @@ -288,6 +293,15 @@ public class Jalview } } + /* + * configure 'full' SO model if preferences say to, + * else use the default (SO Lite) + */ + if (Cache.getDefault("USE_FULL_SO", false)) + { + SequenceOntologyFactory.setInstance(new SequenceOntology()); + } + if (!headless) { desktop = new Desktop(); @@ -328,7 +342,6 @@ public class Jalview Cache.log.debug("Starting questionnaire with default url: " + defurl); desktop.checkForQuestionnaire(defurl); - } } } @@ -336,15 +349,18 @@ public class Jalview { System.err.println("CMD [-noquestionnaire] executed successfully!"); } - desktop.checkForNews(); - } - if (!isHeadlessMode()) - { + if (!aparser.contains("nonews")) + { + desktop.checkForNews(); + } + BioJsHTMLOutput.updateBioJS(); } - String file = null, protocol = null, format = null, data = null; + String file = null, data = null; + FileFormatI format = null; + DataSourceType protocol = null; FileLoader fileLoader = new FileLoader(!headless); Vector getFeatures = null; // vector of das source nicknames to // fetch @@ -377,13 +393,13 @@ public class Jalview { try { - String viprotocol = AppletFormatAdapter + DataSourceType viprotocol = AppletFormatAdapter .checkProtocol(vamsasImport); - if (viprotocol == jalview.io.FormatAdapter.FILE) + if (viprotocol == DataSourceType.FILE) { inSession = desktop.vamsasImport(new File(vamsasImport)); } - else if (viprotocol == FormatAdapter.URL) + else if (viprotocol == DataSourceType.URL) { inSession = desktop.vamsasImport(new URL(vamsasImport)); } @@ -472,7 +488,13 @@ public class Jalview protocol = AppletFormatAdapter.checkProtocol(file); - format = new IdentifyFile().identify(file, protocol); + try + { + format = new IdentifyFile().identify(file, protocol); + } catch (FileFormatException e1) + { + // TODO ? + } AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol, format); @@ -488,16 +510,10 @@ public class Jalview { data.replaceAll("%20", " "); - ColourSchemeI cs = ColourSchemeProperty.getColour(af + ColourSchemeI cs = ColourSchemeProperty.getColourScheme(af .getViewport().getAlignment(), data); - if (cs == null) - { - UserColourScheme ucs = new UserColourScheme("white"); - ucs.parseAppletParameter(data); - cs = ucs; - } - else + if (cs != null) { System.out.println("CMD [-color " + data + "] executed successfully!"); @@ -562,18 +578,14 @@ public class Jalview data = aparser.getValue("tree", true); if (data != null) { - jalview.io.NewickFile fin = null; try { System.out.println("CMD [-tree " + data + "] executed successfully!"); - fin = new NewickFile(data, + NewickFile nf = new NewickFile(data, AppletFormatAdapter.checkProtocol(data)); - if (fin != null) - { - af.getViewport().setCurrentTree( - af.ShowNewickTree(fin, data).getTree()); - } + af.getViewport().setCurrentTree( + af.showNewickTree(nf, data).getTree()); } catch (IOException ex) { System.err.println("Couldn't add tree " + data); @@ -617,17 +629,17 @@ public class Jalview String imageName = "unnamed.png"; while (aparser.getSize() > 1) { - format = aparser.nextValue(); + String outputFormat = aparser.nextValue(); file = aparser.nextValue(); - if (format.equalsIgnoreCase("png")) + if (outputFormat.equalsIgnoreCase("png")) { af.createPNG(new File(file)); imageName = (new File(file)).getName(); System.out.println("Creating PNG image: " + file); continue; } - else if (format.equalsIgnoreCase("svg")) + else if (outputFormat.equalsIgnoreCase("svg")) { File imageFile = new File(file); imageName = imageFile.getName(); @@ -635,21 +647,44 @@ public class Jalview System.out.println("Creating SVG image: " + file); continue; } - else if (format.equalsIgnoreCase("html")) + else if (outputFormat.equalsIgnoreCase("html")) { File imageFile = new File(file); imageName = imageFile.getName(); - new HtmlSvgOutput(new File(file), af.alignPanel); + HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel); + htmlSVG.exportHTML(file); + System.out.println("Creating HTML image: " + file); continue; } - else if (format.equalsIgnoreCase("imgMap")) + else if (outputFormat.equalsIgnoreCase("biojsmsa")) + { + if (file == null) + { + System.err.println("The output html file must not be null"); + return; + } + try + { + BioJsHTMLOutput + .refreshVersionInfo(BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY); + } catch (URISyntaxException e) + { + e.printStackTrace(); + } + BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel); + bjs.exportHTML(file); + System.out.println("Creating BioJS MSA Viwer HTML file: " + + file); + continue; + } + else if (outputFormat.equalsIgnoreCase("imgMap")) { af.createImageMap(new File(file), imageName); System.out.println("Creating image map: " + file); continue; } - else if (format.equalsIgnoreCase("eps")) + else if (outputFormat.equalsIgnoreCase("eps")) { File outputFile = new File(file); System.out.println("Creating EPS file: " @@ -698,20 +733,26 @@ public class Jalview jalview.bin.Cache.removeProperty("STARTUP_FILE"); } - protocol = "File"; + protocol = DataSourceType.FILE; if (file.indexOf("http:") > -1) { - protocol = "URL"; + protocol = DataSourceType.URL; } if (file.endsWith(".jar")) { - format = "Jalview"; + format = FileFormat.Jalview; } else { - format = new IdentifyFile().identify(file, protocol); + try + { + format = new IdentifyFile().identify(file, protocol); + } catch (FileFormatException e) + { + // TODO what? + } } startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol, @@ -778,10 +819,12 @@ public class Jalview + "-png FILE\tCreate PNG image FILE from alignment.\n" + "-svg FILE\tCreate SVG image FILE from alignment.\n" + "-html FILE\tCreate HTML file from alignment.\n" + + "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML 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" + + "-nonews\tTurn off check for Jalview news.\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" // +