JAL-2805 removed unused Aptx instance creation code
[jalview.git] / src / jalview / ext / archaeopteryx / AptxInit.java
index ba34213..9b89cea 100644 (file)
@@ -1,10 +1,8 @@
 package jalview.ext.archaeopteryx;
 
-import jalview.analysis.TreeBuilder;
 import jalview.ext.forester.io.UtilityMethods;
 import jalview.ext.treeviewer.LoadedTreeAssociationI;
 import jalview.ext.treeviewer.LoadedTreeSequenceAssociation;
-import jalview.ext.treeviewer.TreeBuilderI;
 import jalview.ext.treeviewer.TreeFrameI;
 import jalview.ext.treeviewer.TreeI;
 import jalview.ext.treeviewer.TreeViewerUtils;
@@ -74,20 +72,41 @@ public final class AptxInit
   private final static NHXParser.TAXONOMY_EXTRACTION TAXONOMY_EXTRACTION = APTX_CONFIG
           .getTaxonomyExtraction();
 
-  public static TreeFrameI createInstanceFromCalculation(
-          final TreeBuilder calculatedTree)
+
+  public static TreeFrameI createInstanceFromNhx(String treeTitle,
+          String nhxString, AlignmentViewport viewport)
+          throws IOException
   {
-    TreeBuilderI aptxTreeBuilder = new AptxTreeBuilder(
-            calculatedTree);
+    if (Desktop.instance != null)
+    {
+      Desktop.instance.startLoading(treeTitle);
+    }
 
-    TreeI aptxTree = aptxTreeBuilder.buildTree();
+    Phylogeny aptxPhylogeny = Phylogeny
+            .createInstanceFromNhxString(nhxString);
+    aptxPhylogeny.setName(treeTitle);
+
+    TreeFrameI aptxFrame = createAptxFrame(aptxPhylogeny, viewport,
+            treeTitle);
+
+    if (Desktop.instance != null)
+    {
+      Desktop.instance.stopLoading();
+    }
+
+    return aptxFrame;
 
-    TreeFrameI aptxApp = createAptxFrame(aptxTree,
-            calculatedTree.getAvport(), null);
-            
-    return aptxApp;
   }
 
+  /**
+   * Refactored from Archaeopteryx.main
+   * 
+   * @param filePath
+   * @param viewport
+   * @return
+   * @throws IOException
+   * @throws FileNotFoundException
+   */
   public static TreeFrameI[] createInstancesFromFile(File treeFile,
           AlignmentViewport viewport)
           throws FileNotFoundException, IOException
@@ -155,15 +174,7 @@ public final class AptxInit
     return aptxFrames;
   }
 
-  /**
-   * Refactored from Archaeopteryx.main
-   * 
-   * @param filePath
-   * @param viewport
-   * @return
-   * @throws IOException
-   * @throws FileNotFoundException
-   */
+
   public static TreeFrameI[] createInstancesFromFile(
           String filePath,
           AlignmentViewport viewport)
@@ -174,7 +185,6 @@ public final class AptxInit
 
     }
 
-
   public static TreeFrameI[] createInstancesFromUrl(URL treeUrl,
           AlignmentViewport viewport)
           throws FileNotFoundException, IOException, RuntimeException
@@ -466,12 +476,9 @@ public final class AptxInit
         {
           // Not important if this fails, do nothing.
         }
-        // _main_frame.getContentPane().repaint();
       }
     }
 
-    System.gc();
-
 
     if (Desktop.instance != null)
     {