JAL-2805 viewport is passed along to the tree parser
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 14 Nov 2017 17:17:50 +0000 (17:17 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 14 Nov 2017 17:19:10 +0000 (17:19 +0000)
src/jalview/ext/forester/io/ForesterTreeParser.java
src/jalview/gui/AlignFrame.java

index 3096269..4e21b9d 100644 (file)
@@ -4,6 +4,7 @@ import jalview.ext.archaeopteryx.ArchaeopteryxInit;
 import jalview.gui.Desktop;
 import jalview.gui.JvOptionPane;
 import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
 
 import java.io.File;
 import java.io.IOException;
@@ -49,7 +50,7 @@ public class ForesterTreeParser implements ExternalTreeParserI<MainFrame>
   }
 
   @Override
-  public MainFrame loadTree()
+  public MainFrame loadTree(AlignmentViewport viewport)
   {
     String[] AptxArgs = new String[] { "-c",
         "_aptx_jalview_configuration_file", filePath };
@@ -62,56 +63,6 @@ public class ForesterTreeParser implements ExternalTreeParserI<MainFrame>
 
 }
 
-/**
- * Mostly refactored from Archaeopteryx.main() and
- * MainFrameApplication.readPhylogeniesFromFile()
- */
-// boolean nhx_or_nexus = false;
-// Configuration config = new Configuration(
-// "_aptx_jalview_configuration_file", false, false, false);
-// try
-// {
-// final PhylogenyParser p = ParserUtils.createParserDependingOnFileType(
-// file, config.isValidatePhyloXmlAgainstSchema());
-//
-// if (p instanceof NHXParser)
-// {
-// nhx_or_nexus = true;
-// final NHXParser nhx = (NHXParser) p;
-// nhx.setReplaceUnderscores(false);
-// nhx.setIgnoreQuotes(false);
-// nhx.setTaxonomyExtraction(config.getTaxonomyExtraction());
-// }
-// else if (p instanceof NexusPhylogeniesParser)
-// {
-// nhx_or_nexus = true;
-// final NexusPhylogeniesParser nex = (NexusPhylogeniesParser) p;
-// nex.setReplaceUnderscores(config.isReplaceUnderscoresInNhParsing());
-// nex.setIgnoreQuotes(false);
-// }
-// else if (p instanceof PhyloXmlParser)
-// {
-//
-// }
-// Phylogeny[] phylogenies = PhylogenyMethods.readPhylogenies(p, file);
-// if (nhx_or_nexus
-// && config.isInternalNumberAreConfidenceForNhParsing())
-// {
-// for (final Phylogeny phy : phylogenies)
-// {
-// PhylogenyMethods.transferInternalNodeNamesToConfidence(phy, "");
-//
-// }
-// }
-// }
-//
-// catch (IOException e)
-// {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
-
 
 
 
index bde5eb6..fa3f489 100644 (file)
@@ -60,8 +60,9 @@ import jalview.datamodel.SeqCigar;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
-import jalview.ext.forester.io.SupportedTreeFileFilter;
+import jalview.ext.forester.io.ExternalTreeParserI;
 import jalview.ext.forester.io.ForesterTreeParser;
+import jalview.ext.forester.io.SupportedTreeFileFilter;
 import jalview.gui.ColourMenuHelper.ColourChangeListener;
 import jalview.gui.ViewSelectionMenu.ViewSetProvider;
 import jalview.io.AlignmentProperties;
@@ -3902,8 +3903,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       NewickFile fin = null;
       try
       {
-        ForesterTreeParser treeParser = new ForesterTreeParser(filePath);
-        treeParser.loadTree();
+        ExternalTreeParserI<?> treeParser = new ForesterTreeParser(
+                filePath);
+        treeParser.loadTree(viewport);