84fec4569df2aad30c78c0ea9171e28f16861235
[jalview.git] / src / jalview / bin / Jalview.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.bin;
22
23 import jalview.api.AlignFrameI;
24 import jalview.api.AlignViewportI;
25 import jalview.api.JalviewApp;
26 import jalview.api.StructureSelectionManagerProvider;
27 import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
28 import jalview.datamodel.ColumnSelection;
29 import jalview.datamodel.HiddenColumns;
30 import jalview.datamodel.PDBEntry;
31 import jalview.datamodel.SequenceGroup;
32 import jalview.datamodel.SequenceI;
33 import jalview.ext.so.SequenceOntology;
34 import jalview.gui.AlignFrame;
35 import jalview.gui.AlignViewport;
36 import jalview.gui.AlignmentPanel;
37 import jalview.gui.Desktop;
38 import jalview.gui.Preferences;
39 import jalview.gui.PromptUserConfig;
40 import jalview.gui.StructureViewer;
41 import jalview.io.AppletFormatAdapter;
42 import jalview.io.BioJsHTMLOutput;
43 import jalview.io.DataSourceType;
44 import jalview.io.FileFormat;
45 import jalview.io.FileFormatException;
46 import jalview.io.FileFormatI;
47 import jalview.io.FileFormats;
48 import jalview.io.FileLoader;
49 import jalview.io.HtmlSvgOutput;
50 import jalview.io.IdentifyFile;
51 import jalview.io.NewickFile;
52 import jalview.io.gff.SequenceOntologyFactory;
53 import jalview.javascript.JSFunctionExec;
54 import jalview.javascript.JalviewLiteJsApi;
55 import jalview.javascript.MouseOverStructureListener;
56 import jalview.renderer.seqfeatures.FeatureRenderer;
57 import jalview.schemes.ColourSchemeI;
58 import jalview.schemes.ColourSchemeProperty;
59 import jalview.structure.SelectionSource;
60 import jalview.structure.VamsasSource;
61 import jalview.util.MessageManager;
62 import jalview.util.Platform;
63 import jalview.ws.jws2.Jws2Discoverer;
64
65 import java.applet.AppletContext;
66 import java.io.BufferedReader;
67 import java.io.File;
68 import java.io.FileOutputStream;
69 import java.io.IOException;
70 import java.io.InputStreamReader;
71 import java.io.OutputStreamWriter;
72 import java.io.PrintWriter;
73 import java.net.MalformedURLException;
74 import java.net.URI;
75 import java.net.URISyntaxException;
76 import java.net.URL;
77 import java.security.AllPermission;
78 import java.security.CodeSource;
79 import java.security.PermissionCollection;
80 import java.security.Permissions;
81 import java.security.Policy;
82 import java.util.HashMap;
83 import java.util.Hashtable;
84 import java.util.Map;
85 import java.util.Vector;
86 import java.util.logging.ConsoleHandler;
87 import java.util.logging.Level;
88 import java.util.logging.Logger;
89
90 import javax.swing.LookAndFeel;
91 import javax.swing.UIManager;
92
93 import groovy.lang.Binding;
94 import groovy.util.GroovyScriptEngine;
95 import netscape.javascript.JSObject;
96
97 /**
98  * Main class for Jalview Application <br>
99  * <br>
100  * start with: java -classpath "$PATH_TO_LIB$/*:$PATH_TO_CLASSES$" \
101  * jalview.bin.Jalview
102  * 
103  * or on Windows: java -classpath "$PATH_TO_LIB$/*;$PATH_TO_CLASSES$" \
104  * jalview.bin.Jalview jalview.bin.Jalview
105  * 
106  * (ensure -classpath arg is quoted to avoid shell expansion of '*' and do not
107  * embellish '*' to e.g. '*.jar')
108  * 
109  * @author $author$
110  * @version $Revision$
111  */
112 public class Jalview implements ApplicationSingletonI, JalviewLiteJsApi
113 {
114
115   public static Jalview getInstance()
116   {
117     return (Jalview) ApplicationSingletonProvider
118             .getInstance(Jalview.class);
119   }
120
121   private Jalview()
122   {
123   }
124
125   static
126   {
127     Platform.getURLCommandArguments();
128   }
129
130   private boolean headless;
131
132   public static boolean isHeadlessMode()
133   {
134     return getInstance().headless;
135   }
136
137   private Desktop desktop;
138
139   private AlignFrame currentAlignFrame;
140
141   public boolean isJavaAppletTag;
142
143   public String appletResourcePath;
144
145   private JalviewAppLoader appLoader;
146
147   protected JSFunctionExec jsFunctionExec;
148
149   public static AlignFrame getCurrentAlignFrame()
150   {
151     return getInstance().currentAlignFrame;
152   }
153
154   public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
155   {
156     getInstance().currentAlignFrame = currentAlignFrame;
157   }
158
159   static
160   {
161     if (!Platform.isJS())
162     /**
163      * Java only
164      * 
165      * @j2sIgnore
166      */
167     {
168       // grab all the rights we can for the JVM
169       Policy.setPolicy(new Policy()
170       {
171         @Override
172         public PermissionCollection getPermissions(CodeSource codesource)
173         {
174           Permissions perms = new Permissions();
175           perms.add(new AllPermission());
176           return (perms);
177         }
178
179         @Override
180         public void refresh()
181         {
182         }
183       });
184     }
185   }
186
187   /**
188    * keep track of feature fetching tasks.
189    * 
190    * @author JimP
191    * 
192    */
193   class FeatureFetcher
194   {
195     /*
196      * TODO: generalise to track all jalview events to orchestrate batch
197      * processing events.
198      */
199
200     private int queued = 0;
201
202     private int running = 0;
203
204     public FeatureFetcher()
205     {
206
207     }
208
209     public void addFetcher(final AlignFrame af,
210             final Vector<String> dasSources)
211     {
212       final long id = System.currentTimeMillis();
213       queued++;
214       final FeatureFetcher us = this;
215       new Thread(new Runnable()
216       {
217
218         @Override
219         public void run()
220         {
221           synchronized (us)
222           {
223             queued--;
224             running++;
225           }
226
227           af.setProgressBar(MessageManager
228                   .getString("status.das_features_being_retrived"), id);
229           af.featureSettings_actionPerformed(null);
230           af.setProgressBar(null, id);
231           synchronized (us)
232           {
233             running--;
234           }
235         }
236       }).start();
237     }
238
239     public synchronized boolean allFinished()
240     {
241       return queued == 0 && running == 0;
242     }
243
244   }
245
246   /**
247    * main class for Jalview application
248    * 
249    * @param args
250    *          open <em>filename</em>
251    */
252   public static void main(String[] args)
253   {
254     // setLogging(); // BH - for event debugging in JavaScript
255     getInstance().doMain(args);
256   }
257
258   private static void logClass(String name)
259   {
260     // BH - for event debugging in JavaScript
261     ConsoleHandler consoleHandler = new ConsoleHandler();
262     consoleHandler.setLevel(Level.ALL);
263     Logger logger = Logger.getLogger(name);
264     logger.setLevel(Level.ALL);
265     logger.addHandler(consoleHandler);
266   }
267
268   @SuppressWarnings("unused")
269   private static void setLogging()
270   {
271
272     /**
273      * @j2sIgnore
274      * 
275      */
276     {
277       System.out.println("not in js");
278     }
279
280     // BH - for event debugging in JavaScript (Java mode only)
281     if (!Platform.isJS())
282     /**
283      * Java only
284      * 
285      * @j2sIgnore
286      */
287     {
288       Logger.getLogger("").setLevel(Level.ALL);
289       logClass("java.awt.EventDispatchThread");
290       logClass("java.awt.EventQueue");
291       logClass("java.awt.Component");
292       logClass("java.awt.focus.Component");
293       logClass("java.awt.focus.DefaultKeyboardFocusManager");
294     }
295
296   }
297
298   /**
299    * @param args
300    */
301   void doMain(String[] args)
302   {
303
304     boolean isJS = Platform.isJS();
305     if (!isJS)
306     {
307       System.setSecurityManager(null);
308     }
309
310     System.out
311             .println("Java version: " + System.getProperty("java.version"));
312     System.out.println(System.getProperty("os.arch") + " "
313             + System.getProperty("os.name") + " "
314             + System.getProperty("os.version"));
315
316     ArgsParser aparser = new ArgsParser(args);
317
318     String usrPropsFile = aparser.getValue(ArgsParser.PROPS);
319     Cache.loadProperties(usrPropsFile);
320     if (isJS)
321     {
322       isJavaAppletTag = aparser.isApplet();
323       if (isJavaAppletTag)
324       {
325         Preferences.setAppletDefaults();
326         Cache.loadProperties(usrPropsFile); // again, because we
327         // might be changing defaults here?
328       }
329       System.out.println(
330               "<Applet> found: " + aparser.getValue("Info.j2sAppletID"));
331       appletResourcePath = aparser.getValue("Info.resourcePath");
332     }
333     else
334     /**
335      * Java only
336      * 
337      * @j2sIgnore
338      */
339     {
340       if (usrPropsFile != null)
341       {
342         System.out.println(
343                 "CMD [-props " + usrPropsFile + "] executed successfully!");
344       }
345
346       if (aparser.contains("help") || aparser.contains("h"))
347       {
348         showUsage();
349         System.exit(0);
350       }
351       if (aparser.contains(ArgsParser.NODISPLAY)
352               || aparser.contains(ArgsParser.NOGUI)
353               || aparser.contains(ArgsParser.HEADLESS)
354               || "true".equals(System.getProperty("java.awt.headless")))
355       {
356         headless = true;
357       }
358
359       // anything else!
360
361       final String jabawsUrl = aparser.getValue(ArgsParser.JABAWS);
362       if (jabawsUrl != null)
363       {
364         try
365         {
366           Jws2Discoverer.getInstance().setPreferredUrl(jabawsUrl);
367           System.out.println(
368                   "CMD [-jabaws " + jabawsUrl + "] executed successfully!");
369         } catch (MalformedURLException e)
370         {
371           System.err.println(
372                   "Invalid jabaws parameter: " + jabawsUrl + " ignored");
373         }
374       }
375
376     }
377     // check for property setting
378     String defs = aparser.getValue(ArgsParser.SETPROP);
379     while (defs != null)
380     {
381       int p = defs.indexOf('=');
382       if (p == -1)
383       {
384         System.err.println("Ignoring invalid setprop argument : " + defs);
385       }
386       else
387       {
388         System.out.println("Executing setprop argument: " + defs);
389         if (isJS)
390         {
391           Cache.setProperty(defs.substring(0, p), defs.substring(p + 1));
392         }
393       }
394       defs = aparser.getValue(ArgsParser.SETPROP);
395     }
396     System.setProperty("http.agent",
397             "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
398     try
399     {
400       Cache.initLogger();
401     } catch (NoClassDefFoundError error)
402     {
403       error.printStackTrace();
404       System.out.println("\nEssential logging libraries not found."
405               + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview");
406       System.exit(0);
407     }
408
409     desktop = null;
410
411     try
412     {
413       UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
414     } catch (Exception ex)
415     {
416       System.err.println("Unexpected Look and Feel Exception");
417       ex.printStackTrace();
418     }
419     if (Platform.isAMacAndNotJS())
420     {
421
422       LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager
423               .getLookAndFeel();
424       System.setProperty("com.apple.mrj.application.apple.menu.about.name",
425               "Jalview");
426       System.setProperty("apple.laf.useScreenMenuBar", "true");
427       if (lookAndFeel != null)
428       {
429         try
430         {
431           UIManager.setLookAndFeel(lookAndFeel);
432         } catch (Throwable e)
433         {
434           System.err.println(
435                   "Failed to set QuaQua look and feel: " + e.toString());
436         }
437       }
438       if (lookAndFeel == null
439               || !(lookAndFeel.getClass().isAssignableFrom(
440                       UIManager.getLookAndFeel().getClass()))
441               || !UIManager.getLookAndFeel().getClass().toString()
442                       .toLowerCase().contains("quaqua"))
443       {
444         try
445         {
446           System.err.println(
447                   "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976");
448           UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
449         } catch (Throwable e)
450         {
451           System.err.println(
452                   "Failed to reset look and feel: " + e.toString());
453         }
454       }
455     }
456
457     /*
458      * configure 'full' SO model if preferences say to, 
459      * else use the default (SO Lite)
460      */
461     if (Cache.getDefault(Preferences.USE_FULL_SO, false))
462     {
463       SequenceOntologyFactory.setSequenceOntology(new SequenceOntology());
464     }
465
466     if (!headless)
467     {
468       desktop = Desktop.getInstance();
469       desktop.setInBatchMode(true); // indicate we are starting up
470       desktop.setVisible(true);
471
472       if (!isJS)
473       /**
474        * Java only
475        * 
476        * @j2sIgnore
477        */
478       {
479         desktop.startServiceDiscovery();
480         if (!aparser.contains(ArgsParser.NOUSAGESTATS))
481         {
482           startUsageStats(desktop);
483         }
484         else
485         {
486           System.err.println("CMD [-nousagestats] executed successfully!");
487         }
488
489         if (!aparser.contains(ArgsParser.NOQUESTIONNAIRE))
490         {
491           String url = aparser.getValue(ArgsParser.QUESTIONNAIRE);
492           if (url != null)
493           {
494             // Start the desktop questionnaire prompter with the specified
495             // questionnaire
496             Cache.log.debug("Starting questionnaire url at " + url);
497             desktop.checkForQuestionnaire(url);
498             System.out.println("CMD questionnaire[-" + url
499                     + "] executed successfully!");
500           }
501           else
502           {
503             if (Cache.getProperty(Preferences.NOQUESTIONNAIRES) == null)
504             {
505               // Start the desktop questionnaire prompter with the specified
506               // questionnaire
507               // String defurl =
508               // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
509               // //
510               String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
511               Cache.log.debug(
512                       "Starting questionnaire with default url: " + defurl);
513               desktop.checkForQuestionnaire(defurl);
514             }
515           }
516         }
517         else
518         {
519           System.err
520                   .println("CMD [-noquestionnaire] executed successfully!");
521         }
522
523         if (!aparser.contains(ArgsParser.NONEWS))
524         {
525           desktop.checkForNews();
526         }
527
528         BioJsHTMLOutput.updateBioJS();
529       }
530     }
531
532     // script to execute after all loading is
533     // completed one way or another
534     // extract groovy argument and execute if necessary
535     String groovyscript = (isJS ? null
536             : aparser.getValue(ArgsParser.GROOVY, true));
537     String file = aparser.getValue(ArgsParser.OPEN, true);
538     // BH this here to allow split frame; not working as of 5/17/2019
539     String file2 = aparser.getValue(ArgsParser.OPEN2, true);
540     String fileFormat = (isJavaAppletTag
541             ? aparser.getAppletValue("format", null)
542             : null);
543
544     FileFormatI format = null;
545     DataSourceType protocol = null;
546
547     if (file == null && desktop == null)
548     {
549       System.out.println("No files to open!");
550       System.exit(1);
551     }
552     boolean haveImport = checkStartVamas(aparser);
553     // Finally, deal with the remaining input data.
554     long progress = -1;
555     if (file == null && isJavaAppletTag)
556     {
557       // Maybe the sequences are added as parameters
558       StringBuffer data = new StringBuffer("PASTE");
559       int i = 1;
560       while ((file = aparser.getAppletValue("sequence" + i, null)) != null)
561       {
562         data.append(file.toString() + "\n");
563         i++;
564       }
565       if (data.length() > 5)
566       {
567         file = data.toString();
568       }
569     }
570
571     if (file != null)
572     {
573       if (!headless)
574       {
575         desktop.setProgressBar(
576                 MessageManager
577                         .getString("status.processing_commandline_args"),
578                 progress = System.currentTimeMillis());
579       }
580
581       if (!isJS)
582       /**
583        * ignore in JavaScript -- can't just check file existence - could load
584        * it?
585        * 
586        * @j2sIgnore
587        */
588       {
589         if (!file.startsWith("http://") && !file.startsWith("https://"))
590         // BH 2019 added https check for Java
591         {
592           if (!(new File(file)).exists())
593           {
594             System.out.println("Can't find " + file);
595             if (headless)
596             {
597               System.exit(1);
598             }
599           }
600         }
601       }
602
603       protocol = AppletFormatAdapter.checkProtocol(file);
604
605       try
606       {
607         format = (isJavaAppletTag && fileFormat != null
608                 ? FileFormats.getInstance().forName(fileFormat)
609                 : null);
610         if (format == null)
611         {
612           format = new IdentifyFile().identify(file, protocol);
613         }
614       } catch (FileFormatException e1)
615       {
616         // TODO ?
617       }
618
619       AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
620               protocol, format);
621       if (af == null)
622       {
623         System.out.println("error");
624       }
625       else
626       {
627         System.out
628                 .println("CMD [-open " + file + "] executed successfully!");
629         if (file2 != null)
630         {
631           protocol = AppletFormatAdapter.checkProtocol(file2);
632           try
633           {
634             format = new IdentifyFile().identify(file2, protocol);
635           } catch (FileFormatException e1)
636           {
637             // TODO ?
638           }
639           AlignFrame af2 = new FileLoader(!headless)
640                   .loadFileWaitTillLoaded(file2, protocol, format);
641           if (af2 == null)
642           {
643             System.out.println("error");
644           }
645           else
646           {
647             AlignViewport.openLinkedAlignmentAs(af,
648                     af.getViewport().getAlignment(),
649                     af2.getViewport().getAlignment(), "",
650                     AlignViewport.SPLIT_FRAME);
651             System.out.println(
652                     "CMD [-open2 " + file2 + "] executed successfully!");
653           }
654         }
655
656         setCurrentAlignFrame(af);
657
658         // TODO: file2 How to implement file2 for the applet spit screen?
659
660         String data = aparser.getValue(ArgsParser.COLOUR, true);
661         if (data != null)
662         {
663           data.replaceAll("%20", " ");
664
665           ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
666                   af.getViewport(), af.getViewport().getAlignment(), data);
667
668           if (cs != null)
669           {
670             System.out.println(
671                     "CMD [-color " + data + "] executed successfully!");
672           }
673           af.changeColour(cs);
674         }
675
676         // Must maintain ability to use the groups flag
677         data = aparser.getValue(ArgsParser.GROUPS, true);
678         if (data != null)
679         {
680           af.parseFeaturesFile(data,
681                   AppletFormatAdapter.checkProtocol(data));
682           // System.out.println("Added " + data);
683           System.out.println(
684                   "CMD groups[-" + data + "]  executed successfully!");
685         }
686         data = aparser.getValue(ArgsParser.FEATURES, true);
687         if (data != null)
688         {
689           af.parseFeaturesFile(data,
690                   AppletFormatAdapter.checkProtocol(data));
691           // System.out.println("Added " + data);
692           System.out.println(
693                   "CMD [-features " + data + "]  executed successfully!");
694         }
695
696         data = aparser.getValue(ArgsParser.ANNOTATIONS, true);
697         if (data != null)
698         {
699           af.loadJalviewDataFile(data, null, null, null);
700           // System.out.println("Added " + data);
701           System.out.println(
702                   "CMD [-annotations " + data + "] executed successfully!");
703         }
704         // set or clear the sortbytree flag.
705         if (aparser.contains(ArgsParser.SORTBYTREE))
706         {
707           af.getViewport().setSortByTree(true);
708           if (af.getViewport().getSortByTree())
709           {
710             System.out.println("CMD [-sortbytree] executed successfully!");
711           }
712         }
713         if (aparser.contains(ArgsParser.NOANNOTATION)
714                 || aparser.contains(ArgsParser.NOANNOTATION2))
715         {
716           af.getViewport().setShowAnnotation(false);
717           if (!af.getViewport().isShowAnnotation())
718           {
719             System.out.println("CMD no-annotation executed successfully!");
720           }
721         }
722         if (aparser.contains(ArgsParser.NOSORTBYTREE))
723         {
724           af.getViewport().setSortByTree(false);
725           if (!af.getViewport().getSortByTree())
726           {
727             System.out
728                     .println("CMD [-nosortbytree] executed successfully!");
729           }
730         }
731         data = aparser.getValue(ArgsParser.TREE, true);
732         if (data != null)
733         {
734           try
735           {
736             System.out.println(
737                     "CMD [-tree " + data + "] executed successfully!");
738             NewickFile nf = new NewickFile(data,
739                     AppletFormatAdapter.checkProtocol(data));
740             af.getViewport()
741                     .setCurrentTree(af.showNewickTree(nf, data).getTree());
742           } catch (IOException ex)
743           {
744             System.err.println("Couldn't add tree " + data);
745             ex.printStackTrace(System.err);
746           }
747         }
748         // TODO - load PDB structure(s) to alignment JAL-629
749         // (associate with identical sequence in alignment, or a specified
750         // sequence)
751         if (isJavaAppletTag)
752         {
753           loadAppletParams(aparser, af);
754         }
755         else if (!isJS)
756         /**
757          * Java only
758          * 
759          * @j2sIgnore
760          */
761         {
762           if (groovyscript != null)
763           {
764             // Execute the groovy script after we've done all the rendering
765             // stuff
766             // and before any images or figures are generated.
767             System.out.println("Executing script " + groovyscript);
768             executeGroovyScript(groovyscript, af);
769             System.out.println("CMD groovy[" + groovyscript
770                     + "] executed successfully!");
771             groovyscript = null;
772           }
773           checkOutputFile(aparser, af, format);
774           while (aparser.getSize() > 0)
775           {
776             System.out.println("Unknown arg: " + aparser.nextValue());
777           }
778         }
779       }
780     }
781     AlignFrame startUpAlframe = null;
782     // We'll only open the default file if the desktop is visible.
783     // And the user
784     // ////////////////////
785
786     if (!isJS && !headless && file == null && !haveImport
787             && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
788     /**
789      * Java only
790      * 
791      * @j2sIgnore
792      */
793     {
794       file = jalview.bin.Cache.getDefault("STARTUP_FILE",
795               jalview.bin.Cache.getDefault("www.jalview.org",
796                       "http://www.jalview.org")
797                       + "/examples/exampleFile_2_7.jar");
798       if (file.equals(
799               "http://www.jalview.org/examples/exampleFile_2_3.jar"))
800       {
801         // hardwire upgrade of the startup file
802         file.replace("_2_3.jar", "_2_7.jar");
803         // and remove the stale setting
804         jalview.bin.Cache.removeProperty("STARTUP_FILE");
805       }
806
807       protocol = DataSourceType.FILE;
808
809       if (file.indexOf("http:") > -1)
810       {
811         protocol = DataSourceType.URL;
812       }
813
814       if (file.endsWith(".jar"))
815       {
816         format = FileFormat.Jalview;
817       }
818       else
819       {
820         try
821         {
822           format = new IdentifyFile().identify(file, protocol);
823         } catch (FileFormatException e)
824         {
825           // TODO what?
826         }
827       }
828
829       startUpAlframe = new FileLoader(!headless)
830               .loadFileWaitTillLoaded(file, protocol, format);
831       // extract groovy arguments before anything else.
832     }
833
834     // Once all other stuff is done, execute any groovy scripts (in order)
835     if (groovyscript != null)
836     {
837       if (Cache.groovyJarsPresent())
838       {
839         System.out.println("Executing script " + groovyscript);
840         executeGroovyScript(groovyscript, startUpAlframe);
841       }
842       else
843       {
844         System.err.println(
845                 "Sorry. Groovy Support is not available, so ignoring the provided groovy script "
846                         + groovyscript);
847       }
848     }
849     // and finally, turn off batch mode indicator - if the desktop still exists
850     if (desktop != null)
851     {
852       if (progress != -1)
853       {
854         desktop.setProgressBar(null, progress);
855       }
856       desktop.setInBatchMode(false);
857     }
858   }
859
860   private boolean checkStartVamas(ArgsParser aparser)
861   {
862     String vamsasImport = aparser.getValue(ArgsParser.VDOC);
863     String vamsasSession = aparser.getValue(ArgsParser.VSESS);
864     if (vamsasImport == null && vamsasSession == null)
865     {
866       return false;
867     }
868     if (desktop == null || headless)
869     {
870       System.out.println(
871               "Headless vamsas sessions not yet supported. Sorry.");
872       System.exit(1);
873     }
874     boolean haveImport = (vamsasImport != null);
875     if (haveImport)
876     {
877       // if we have a file, start a new session and import it.
878       boolean inSession = false;
879       try
880       {
881         DataSourceType viprotocol = AppletFormatAdapter
882                 .checkProtocol(vamsasImport);
883         if (viprotocol == DataSourceType.FILE)
884         {
885           inSession = desktop.vamsasImport(new File(vamsasImport));
886         }
887         else if (viprotocol == DataSourceType.URL)
888         {
889           inSession = desktop.vamsasImport(new URL(vamsasImport));
890         }
891
892       } catch (Exception e)
893       {
894         System.err.println("Exeption when importing " + vamsasImport
895                 + " as a vamsas document.");
896         e.printStackTrace();
897       }
898       if (!inSession)
899       {
900         System.err.println("Failed to import " + vamsasImport
901                 + " as a vamsas document.");
902       }
903       else
904       {
905         System.out.println("Imported Successfully into new session "
906                 + desktop.getVamsasApplication().getCurrentSession());
907       }
908     }
909     if (vamsasSession != null)
910     {
911       if (vamsasImport != null)
912       {
913         // close the newly imported session and import the Jalview specific
914         // remnants into the new session later on.
915         desktop.vamsasStop_actionPerformed(null);
916       }
917       // now join the new session
918       try
919       {
920         if (desktop.joinVamsasSession(vamsasSession))
921         {
922           System.out.println(
923                   "Successfully joined vamsas session " + vamsasSession);
924         }
925         else
926         {
927           System.err.println("WARNING: Failed to join vamsas session "
928                   + vamsasSession);
929         }
930       } catch (Exception e)
931       {
932         System.err.println(
933                 "ERROR: Failed to join vamsas session " + vamsasSession);
934         e.printStackTrace();
935       }
936       if (vamsasImport != null)
937       {
938         // the Jalview specific remnants can now be imported into the new
939         // session at the user's leisure.
940         Cache.log.info(
941                 "Skipping Push for import of data into existing vamsas session."); // TODO:
942         // enable
943         // this
944         // when
945         // debugged
946         // desktop.getVamsasApplication().push_update();
947       }
948     }
949     return haveImport;
950   }
951
952   private void checkOutputFile(ArgsParser aparser, AlignFrame af,
953           FileFormatI format)
954   {
955     String imageName = "unnamed.png";
956     while (aparser.getSize() > 1)
957     {
958       // PNG filename
959       // SVG filename
960       // HTML filename
961       // biojsmsa filename
962       String outputFormat = aparser.nextValue();
963       String file = aparser.nextValue();
964       if (outputFormat.equalsIgnoreCase("png"))
965       {
966         af.createPNG(new File(file));
967         imageName = (new File(file)).getName();
968         System.out.println("Creating PNG image: " + file);
969         continue;
970       }
971       else if (outputFormat.equalsIgnoreCase("svg"))
972       {
973         File imageFile = new File(file);
974         imageName = imageFile.getName();
975         af.createSVG(imageFile);
976         System.out.println("Creating SVG image: " + file);
977         continue;
978       }
979       else if (outputFormat.equalsIgnoreCase("html"))
980       {
981         File imageFile = new File(file);
982         imageName = imageFile.getName();
983         HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
984         htmlSVG.exportHTML(file);
985
986         System.out.println("Creating HTML image: " + file);
987         continue;
988       }
989       else if (outputFormat.equalsIgnoreCase("biojsmsa"))
990       {
991         if (file == null)
992         {
993           System.err.println("The output html file must not be null");
994           return;
995         }
996         try
997         {
998           BioJsHTMLOutput.refreshVersionInfo(
999                   BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
1000         } catch (URISyntaxException e)
1001         {
1002           e.printStackTrace();
1003         }
1004         BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
1005         bjs.exportHTML(file);
1006         System.out.println("Creating BioJS MSA Viwer HTML file: " + file);
1007         continue;
1008       }
1009       else if (outputFormat.equalsIgnoreCase("imgMap"))
1010       {
1011         af.createImageMap(new File(file), imageName);
1012         System.out.println("Creating image map: " + file);
1013         continue;
1014       }
1015       else if (outputFormat.equalsIgnoreCase("eps"))
1016       {
1017         File outputFile = new File(file);
1018         System.out.println(
1019                 "Creating EPS file: " + outputFile.getAbsolutePath());
1020         af.createEPS(outputFile);
1021         continue;
1022       }
1023
1024       af.saveAlignment(file, format);
1025       if (af.isSaveAlignmentSuccessful())
1026       {
1027         System.out.println(
1028                 "Written alignment in " + format + " format to " + file);
1029       }
1030       else
1031       {
1032         System.out.println("Error writing file " + file + " in " + format
1033                 + " format!!");
1034       }
1035
1036     }
1037   }
1038
1039   private static void showUsage()
1040   {
1041     System.out.println(
1042             "Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
1043                     + "-nodisplay\tRun Jalview without User Interface.\n"
1044                     + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
1045                     + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
1046                     + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
1047                     + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
1048                     + "-features FILE\tUse the given file to mark features on the alignment.\n"
1049                     + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
1050                     + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
1051                     + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
1052                     + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
1053                     + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
1054                     + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
1055                     + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
1056                     + "-json FILE\tCreate alignment file FILE in JSON format.\n"
1057                     + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
1058                     + "-png FILE\tCreate PNG image FILE from alignment.\n"
1059                     + "-svg FILE\tCreate SVG image FILE from alignment.\n"
1060                     + "-html FILE\tCreate HTML file from alignment.\n"
1061                     + "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML file from alignment.\n"
1062                     + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
1063                     + "-eps FILE\tCreate EPS file FILE from alignment.\n"
1064                     + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
1065                     + "-noquestionnaire\tTurn off questionnaire check.\n"
1066                     + "-nonews\tTurn off check for Jalview news.\n"
1067                     + "-nousagestats\tTurn off google analytics tracking for this session.\n"
1068                     + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
1069                     // +
1070                     // "-setprop PROPERTY=VALUE\tSet the given Jalview property,
1071                     // after all other properties files have been read\n\t
1072                     // (quote the 'PROPERTY=VALUE' pair to ensure spaces are
1073                     // passed in correctly)"
1074                     + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
1075                     + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
1076                     // +
1077                     // "-vdoc vamsas-document\tImport vamsas document into new
1078                     // session or join existing session with same URN\n"
1079                     // + "-vses vamsas-session\tJoin session with given URN\n"
1080                     + "-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"
1081                     + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
1082   }
1083
1084   private static void startUsageStats(final Desktop desktop)
1085   {
1086     /**
1087      * start a User Config prompt asking if we can log usage statistics.
1088      */
1089     PromptUserConfig prompter = new PromptUserConfig(
1090             Desktop.getDesktopPane(), "USAGESTATS",
1091             "Jalview Usage Statistics",
1092             "Do you want to help make Jalview better by enabling "
1093                     + "the collection of usage statistics with Google Analytics ?"
1094                     + "\n\n(you can enable or disable usage tracking in the preferences)",
1095             new Runnable()
1096             {
1097               @Override
1098               public void run()
1099               {
1100                 Cache.log.debug(
1101                         "Initialising googletracker for usage stats.");
1102                 Cache.initGoogleTracker();
1103                 Cache.log.debug("Tracking enabled.");
1104               }
1105             }, new Runnable()
1106             {
1107               @Override
1108               public void run()
1109               {
1110                 Cache.log.debug("Not enabling Google Tracking.");
1111               }
1112             }, null, true);
1113     desktop.addDialogThread(prompter);
1114   }
1115
1116   /**
1117    * Locate the given string as a file and pass it to the groovy interpreter.
1118    * 
1119    * @param groovyscript
1120    *          the script to execute
1121    * @param jalviewContext
1122    *          the Jalview Desktop object passed in to the groovy binding as the
1123    *          'Jalview' object.
1124    */
1125   private void executeGroovyScript(String groovyscript, AlignFrame af)
1126   {
1127     /**
1128      * for scripts contained in files
1129      */
1130     File tfile = null;
1131     /**
1132      * script's URI
1133      */
1134     URL sfile = null;
1135     if (groovyscript.trim().equals("STDIN"))
1136     {
1137       // read from stdin into a tempfile and execute it
1138       try
1139       {
1140         tfile = File.createTempFile("jalview", "groovy");
1141         PrintWriter outfile = new PrintWriter(
1142                 new OutputStreamWriter(new FileOutputStream(tfile)));
1143         BufferedReader br = new BufferedReader(
1144                 new InputStreamReader(System.in));
1145         String line = null;
1146         while ((line = br.readLine()) != null)
1147         {
1148           outfile.write(line + "\n");
1149         }
1150         br.close();
1151         outfile.flush();
1152         outfile.close();
1153
1154       } catch (Exception ex)
1155       {
1156         System.err.println("Failed to read from STDIN into tempfile "
1157                 + ((tfile == null) ? "(tempfile wasn't created)"
1158                         : tfile.toString()));
1159         ex.printStackTrace();
1160         return;
1161       }
1162       try
1163       {
1164         sfile = tfile.toURI().toURL();
1165       } catch (Exception x)
1166       {
1167         System.err.println(
1168                 "Unexpected Malformed URL Exception for temporary file created from STDIN: "
1169                         + tfile.toURI());
1170         x.printStackTrace();
1171         return;
1172       }
1173     }
1174     else
1175     {
1176       try
1177       {
1178         sfile = new URI(groovyscript).toURL();
1179       } catch (Exception x)
1180       {
1181         tfile = new File(groovyscript);
1182         if (!tfile.exists())
1183         {
1184           System.err.println("File '" + groovyscript + "' does not exist.");
1185           return;
1186         }
1187         if (!tfile.canRead())
1188         {
1189           System.err.println("File '" + groovyscript + "' cannot be read.");
1190           return;
1191         }
1192         if (tfile.length() < 1)
1193         {
1194           System.err.println("File '" + groovyscript + "' is empty.");
1195           return;
1196         }
1197         try
1198         {
1199           sfile = tfile.getAbsoluteFile().toURI().toURL();
1200         } catch (Exception ex)
1201         {
1202           System.err.println("Failed to create a file URL for "
1203                   + tfile.getAbsoluteFile());
1204           return;
1205         }
1206       }
1207     }
1208     try
1209     {
1210       Map<String, Object> vbinding = new HashMap<>();
1211       vbinding.put("Jalview", this);
1212       if (af != null)
1213       {
1214         vbinding.put("currentAlFrame", af);
1215       }
1216       Binding gbinding = new Binding(vbinding);
1217       GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
1218       gse.run(sfile.toString(), gbinding);
1219       if ("STDIN".equals(groovyscript))
1220       {
1221         // delete temp file that we made -
1222         // only if it was successfully executed
1223         tfile.delete();
1224       }
1225     } catch (Exception e)
1226     {
1227       System.err.println("Exception Whilst trying to execute file " + sfile
1228               + " as a groovy script.");
1229       e.printStackTrace(System.err);
1230
1231     }
1232   }
1233
1234   public AlignFrame[] getAlignFrames()
1235   {
1236     return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1237             : Desktop.getAlignFrames();
1238
1239   }
1240
1241   /**
1242    * Quit method delegates to Desktop.quit - unless running in headless mode
1243    * when it just ends the JVM
1244    */
1245   public void quit()
1246   {
1247     if (jsFunctionExec != null)
1248     {
1249       jsFunctionExec.tidyUp();
1250       jsFunctionExec = null;
1251     }
1252
1253     if (desktop != null)
1254     {
1255       desktop.quit();
1256     }
1257     else
1258     {
1259       System.exit(0);
1260     }
1261   }
1262
1263   /**
1264    * Get the SwingJS applet ID and combine that with the frameType
1265    * 
1266    * @param frameType
1267    *          "alignment", "desktop", etc., or null
1268    * @return
1269    */
1270   public static String getAppID(String frameType)
1271   {
1272     String id = Cache.getProperty("Info.j2sAppletID");
1273     if (id == null)
1274     {
1275       id = "jalview";
1276     }
1277     return id + (frameType == null ? "" : "-" + frameType);
1278   }
1279
1280   /**
1281    * Handle all JalviewLite applet parameters
1282    * 
1283    * @param aparser
1284    * @param af
1285    */
1286   private void loadAppletParams(ArgsParser aparser, AlignFrame af)
1287   {
1288     JalviewApp app = new JalviewApp()
1289     {
1290
1291       private boolean alignPDBStructures; // From JalviewLite; not implemented
1292
1293       private Hashtable<String, Hashtable<String, String[]>> jsmessages;
1294
1295       private Hashtable<String, int[]> jshashes;
1296
1297       @Override
1298       public String getParameter(String name)
1299       {
1300         return aparser.getAppletValue(name, null);
1301       }
1302
1303       @Override
1304       public boolean getDefaultParameter(String name, boolean def)
1305       {
1306         String stn;
1307         return ((stn = getParameter(name)) == null ? def
1308                 : "true".equalsIgnoreCase(stn));
1309       }
1310
1311       /**
1312        * Get the applet-like document base even though this is an application.
1313        */
1314       @Override
1315       public URL getDocumentBase()
1316       {
1317         return Platform.getDocumentBase();
1318       }
1319
1320       /**
1321        * Get the applet-like code base even though this is an application.
1322        */
1323       @Override
1324       public URL getCodeBase()
1325       {
1326         return Platform.getCodeBase();
1327       }
1328
1329       @Override
1330       public AlignViewportI getViewport()
1331       {
1332         return af.getViewport();
1333       }
1334
1335       /**
1336        * features
1337        * 
1338        */
1339       @Override
1340       public boolean parseFeaturesFile(String filename,
1341               DataSourceType protocol)
1342       {
1343         return af.parseFeaturesFile(filename, protocol);
1344       }
1345
1346       /**
1347        * scorefile
1348        * 
1349        */
1350       @Override
1351       public boolean loadScoreFile(String sScoreFile) throws IOException
1352       {
1353         af.loadJalviewDataFile(sScoreFile, null, null, null);
1354         return true;
1355       }
1356
1357       /**
1358        * annotations, jpredfile, jnetfile
1359        * 
1360        */
1361       @Override
1362       public void updateForAnnotations()
1363       {
1364         af.updateForAnnotations();
1365       }
1366
1367       @Override
1368       public void loadTree(NewickFile fin, String treeFile)
1369               throws IOException
1370       {
1371         // n/a -- already done by standard Jalview command line processing
1372       }
1373
1374       @Override
1375       public void setAlignPdbStructures(boolean defaultParameter)
1376       {
1377         alignPDBStructures = true;
1378       }
1379
1380       @Override
1381       public void newStructureView(PDBEntry pdb, SequenceI[] seqs,
1382               String[] chains, DataSourceType protocol)
1383       {
1384         StructureViewer.launchStructureViewer(af.alignPanel, pdb, seqs);
1385       }
1386
1387       @Override
1388       public void setFeatureGroupState(String[] groups, boolean state)
1389       {
1390         af.setFeatureGroupState(groups, state);
1391       }
1392
1393       @Override
1394       public void alignedStructureView(PDBEntry[] pdb, SequenceI[][] seqs,
1395               String[][] chains, String[] protocols)
1396       {
1397         System.err.println(
1398                 "Jalview applet interface alignedStructureView not implemented");
1399       }
1400
1401       @Override
1402       public void newFeatureSettings()
1403       {
1404         System.err.println(
1405                 "Jalview applet interface newFeatureSettings not implemented");
1406       }
1407
1408       private Vector<Runnable> jsExecQueue;
1409
1410       @Override
1411       public Vector<Runnable> getJsExecQueue(JSFunctionExec exec)
1412       {
1413         jsFunctionExec = exec;
1414         return (jsExecQueue == null ? (jsExecQueue = new Vector<>())
1415                 : jsExecQueue);
1416       }
1417
1418       @Override
1419       public AppletContext getAppletContext()
1420       {
1421         // TODO Auto-generated method stub
1422         return null;
1423       }
1424
1425       @Override
1426       public boolean isJsfallbackEnabled()
1427       {
1428         // TODO Auto-generated method stub
1429         return false;
1430       }
1431
1432       @Override
1433       public JSObject getJSObject()
1434       {
1435         // TODO Auto-generated method stub
1436         return null;
1437       }
1438
1439       @Override
1440       public StructureSelectionManagerProvider getStructureSelectionManagerProvider()
1441       {
1442         // TODO Auto-generated method stub
1443         return null;
1444       }
1445
1446       @Override
1447       public void updateColoursFromMouseOver(Object source,
1448               MouseOverStructureListener mouseOverStructureListener)
1449       {
1450         // TODO Auto-generated method stub
1451
1452       }
1453
1454       @Override
1455       public Object[] getSelectionForListener(SequenceGroup seqsel,
1456               ColumnSelection colsel, HiddenColumns hidden,
1457               SelectionSource source, Object alignFrame)
1458       {
1459         // TODO Auto-generated method stub
1460         return null;
1461       }
1462
1463       @Override
1464       public String arrayToSeparatorList(String[] array)
1465       {
1466         return appLoader.arrayToSeparatorList(array);
1467       }
1468
1469       @Override
1470       public Hashtable<String, int[]> getJSHashes()
1471       {
1472         return (jshashes == null
1473                 ? (jshashes = new Hashtable<>())
1474                 : jshashes);
1475       }
1476
1477       @Override
1478       public Hashtable<String, Hashtable<String, String[]>> getJSMessages()
1479       {
1480         return (jsmessages == null
1481                 ? (jsmessages = new Hashtable<>())
1482                 : jsmessages);
1483       }
1484
1485       @Override
1486       public Object getFrameForSource(VamsasSource source)
1487       {
1488         if (source != null)
1489         {
1490           AlignFrame af;
1491           if (source instanceof jalview.gui.AlignViewport
1492                   && source == (af = getCurrentAlignFrame()).getViewport())
1493           {
1494             // should be valid if it just generated an event!
1495             return af;
1496           }
1497           // TODO: ensure that if '_af' is specified along with a handler
1498           // function, then only events from that alignFrame are sent to that
1499           // function
1500         }
1501         return null;
1502       }
1503
1504       @Override
1505       public FeatureRenderer getNewFeatureRenderer(AlignViewportI vp)
1506       {
1507         return new jalview.gui.FeatureRenderer((AlignmentPanel) vp);
1508       }
1509
1510     };
1511
1512     appLoader = new JalviewAppLoader(true);
1513     appLoader.load(app);
1514   }
1515
1516   @Override
1517   public String getSelectedSequences()
1518   {
1519     // TODO Auto-generated method stub
1520     return null;
1521   }
1522
1523   @Override
1524   public String getSelectedSequences(String sep)
1525   {
1526     // TODO Auto-generated method stub
1527     return null;
1528   }
1529
1530   @Override
1531   public String getSelectedSequencesFrom(AlignFrameI alf)
1532   {
1533     // TODO Auto-generated method stub
1534     return null;
1535   }
1536
1537   @Override
1538   public String getSelectedSequencesFrom(AlignFrameI alf,
1539           String sep)
1540   {
1541     // TODO Auto-generated method stub
1542     return null;
1543   }
1544
1545   @Override
1546   public void highlight(String sequenceId, String position,
1547           String alignedPosition)
1548   {
1549     // TODO Auto-generated method stub
1550
1551   }
1552
1553   @Override
1554   public void highlightIn(AlignFrameI alf,
1555           String sequenceId, String position, String alignedPosition)
1556   {
1557     // TODO Auto-generated method stub
1558
1559   }
1560
1561   @Override
1562   public void select(String sequenceIds, String columns)
1563   {
1564     // TODO Auto-generated method stub
1565
1566   }
1567
1568   @Override
1569   public void select(String sequenceIds, String columns, String sep)
1570   {
1571     // TODO Auto-generated method stub
1572
1573   }
1574
1575   @Override
1576   public void selectIn(AlignFrameI alf, String sequenceIds,
1577           String columns)
1578   {
1579     // TODO Auto-generated method stub
1580
1581   }
1582
1583   @Override
1584   public void selectIn(AlignFrameI alf, String sequenceIds,
1585           String columns, String sep)
1586   {
1587     // TODO Auto-generated method stub
1588
1589   }
1590
1591   @Override
1592   public String getSelectedSequencesAsAlignment(String format,
1593           String suffix)
1594   {
1595     // TODO Auto-generated method stub
1596     return null;
1597   }
1598
1599   @Override
1600   public String getSelectedSequencesAsAlignmentFrom(
1601           AlignFrameI alf, String format, String suffix)
1602   {
1603     // TODO Auto-generated method stub
1604     return null;
1605   }
1606
1607   @Override
1608   public String getAlignmentOrder()
1609   {
1610     // TODO Auto-generated method stub
1611     return null;
1612   }
1613
1614   @Override
1615   public String getAlignmentOrderFrom(AlignFrameI alf)
1616   {
1617     // TODO Auto-generated method stub
1618     return null;
1619   }
1620
1621   @Override
1622   public String getAlignmentOrderFrom(AlignFrameI alf,
1623           String sep)
1624   {
1625     // TODO Auto-generated method stub
1626     return null;
1627   }
1628
1629   @Override
1630   public String orderBy(String order, String undoName)
1631   {
1632     // TODO Auto-generated method stub
1633     return null;
1634   }
1635
1636   @Override
1637   public String orderBy(String order, String undoName, String sep)
1638   {
1639     // TODO Auto-generated method stub
1640     return null;
1641   }
1642
1643   @Override
1644   public String orderAlignmentBy(AlignFrameI alf,
1645           String order, String undoName, String sep)
1646   {
1647     // TODO Auto-generated method stub
1648     return null;
1649   }
1650
1651   @Override
1652   public String getAlignment(String format)
1653   {
1654     // TODO Auto-generated method stub
1655     return null;
1656   }
1657
1658   @Override
1659   public String getAlignmentFrom(AlignFrameI alf,
1660           String format)
1661   {
1662     // TODO Auto-generated method stub
1663     return null;
1664   }
1665
1666   @Override
1667   public String getAlignment(String format, String suffix)
1668   {
1669     // TODO Auto-generated method stub
1670     return null;
1671   }
1672
1673   @Override
1674   public String getAlignmentFrom(AlignFrameI alf,
1675           String format, String suffix)
1676   {
1677     // TODO Auto-generated method stub
1678     return null;
1679   }
1680
1681   @Override
1682   public void loadAnnotation(String annotation)
1683   {
1684     // TODO Auto-generated method stub
1685
1686   }
1687
1688   @Override
1689   public void loadAnnotationFrom(AlignFrameI alf,
1690           String annotation)
1691   {
1692     // TODO Auto-generated method stub
1693
1694   }
1695
1696   @Override
1697   public void loadFeatures(String features, boolean autoenabledisplay)
1698   {
1699     // TODO Auto-generated method stub
1700
1701   }
1702
1703   @Override
1704   public boolean loadFeaturesFrom(AlignFrameI alf,
1705           String features, boolean autoenabledisplay)
1706   {
1707     // TODO Auto-generated method stub
1708     return false;
1709   }
1710
1711   @Override
1712   public String getFeatures(String format)
1713   {
1714     // TODO Auto-generated method stub
1715     return null;
1716   }
1717
1718   @Override
1719   public String getFeaturesFrom(AlignFrameI alf,
1720           String format)
1721   {
1722     // TODO Auto-generated method stub
1723     return null;
1724   }
1725
1726   @Override
1727   public String getAnnotation()
1728   {
1729     // TODO Auto-generated method stub
1730     return null;
1731   }
1732
1733   @Override
1734   public String getAnnotationFrom(AlignFrameI alf)
1735   {
1736     // TODO Auto-generated method stub
1737     return null;
1738   }
1739
1740   @Override
1741   public AlignFrameI newView()
1742   {
1743     // TODO Auto-generated method stub
1744     return null;
1745   }
1746
1747   @Override
1748   public AlignFrameI newView(String name)
1749   {
1750     // TODO Auto-generated method stub
1751     return null;
1752   }
1753
1754   @Override
1755   public AlignFrameI newViewFrom(AlignFrameI alf)
1756   {
1757     // TODO Auto-generated method stub
1758     return null;
1759   }
1760
1761   @Override
1762   public AlignFrameI newViewFrom(AlignFrameI alf, String name)
1763   {
1764     // TODO Auto-generated method stub
1765     return null;
1766   }
1767
1768   @Override
1769   public AlignFrameI loadAlignment(String text,
1770           String title)
1771   {
1772     // TODO Auto-generated method stub
1773     return null;
1774   }
1775
1776   @Override
1777   public void setMouseoverListener(String listener)
1778   {
1779     // TODO Auto-generated method stub
1780
1781   }
1782
1783   @Override
1784   public void setMouseoverListener(AlignFrameI af,
1785           String listener)
1786   {
1787     // TODO Auto-generated method stub
1788
1789   }
1790
1791   @Override
1792   public void setSelectionListener(String listener)
1793   {
1794     // TODO Auto-generated method stub
1795
1796   }
1797
1798   @Override
1799   public void setSelectionListener(AlignFrameI af,
1800           String listener)
1801   {
1802     // TODO Auto-generated method stub
1803
1804   }
1805
1806   @Override
1807   public void setStructureListener(String listener, String modelSet)
1808   {
1809     // TODO Auto-generated method stub
1810
1811   }
1812
1813   @Override
1814   public void removeJavascriptListener(AlignFrameI af,
1815           String listener)
1816   {
1817     // TODO Auto-generated method stub
1818
1819   }
1820
1821   @Override
1822   public void mouseOverStructure(String pdbResNum, String chain,
1823           String pdbfile)
1824   {
1825     // TODO Auto-generated method stub
1826
1827   }
1828
1829   @Override
1830   public boolean addPdbFile(AlignFrameI alFrame,
1831           String sequenceId, String pdbEntryString, String pdbFile)
1832   {
1833     // TODO Auto-generated method stub
1834     return false;
1835   }
1836
1837   @Override
1838   public void scrollViewToIn(AlignFrameI alf,
1839           String topRow, String leftHandColumn)
1840   {
1841     // TODO Auto-generated method stub
1842
1843   }
1844
1845   @Override
1846   public void scrollViewToRowIn(AlignFrameI alf,
1847           String topRow)
1848   {
1849     // TODO Auto-generated method stub
1850
1851   }
1852
1853   @Override
1854   public void scrollViewToColumnIn(AlignFrameI alf,
1855           String leftHandColumn)
1856   {
1857     // TODO Auto-generated method stub
1858
1859   }
1860
1861   @Override
1862   public String getFeatureGroups()
1863   {
1864     // TODO Auto-generated method stub
1865     return null;
1866   }
1867
1868   @Override
1869   public String getFeatureGroupsOn(AlignFrameI alf)
1870   {
1871     // TODO Auto-generated method stub
1872     return null;
1873   }
1874
1875   @Override
1876   public String getFeatureGroupsOfState(boolean visible)
1877   {
1878     // TODO Auto-generated method stub
1879     return null;
1880   }
1881
1882   @Override
1883   public String getFeatureGroupsOfStateOn(AlignFrameI alf,
1884           boolean visible)
1885   {
1886     // TODO Auto-generated method stub
1887     return null;
1888   }
1889
1890   @Override
1891   public void setFeatureGroupStateOn(AlignFrameI alf,
1892           String groups, boolean state)
1893   {
1894     // TODO Auto-generated method stub
1895
1896   }
1897
1898   @Override
1899   public void setFeatureGroupState(String groups, boolean state)
1900   {
1901     // TODO Auto-generated method stub
1902
1903   }
1904
1905   @Override
1906   public String getSeparator()
1907   {
1908     // TODO Auto-generated method stub
1909     return null;
1910   }
1911
1912   @Override
1913   public void setSeparator(String separator)
1914   {
1915     // TODO Auto-generated method stub
1916
1917   }
1918
1919   @Override
1920   public String getJsMessage(String messageclass, String viewId)
1921   {
1922     // TODO Auto-generated method stub
1923     return null;
1924   }
1925
1926 }