JAL-2798 added method to tree for writing to jalview project
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 16 Jan 2018 01:41:54 +0000 (01:41 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 16 Jan 2018 01:41:54 +0000 (01:41 +0000)
src/jalview/ext/archaeopteryx/Tree.java
src/jalview/ext/treeviewer/TreeI.java

index e5a2016..8c1d0be 100644 (file)
@@ -5,11 +5,14 @@ import jalview.ext.treeviewer.TreeFrameI;
 import jalview.ext.treeviewer.TreeI;
 import jalview.ext.treeviewer.TreeNodeI;
 
+import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
 import org.forester.archaeopteryx.Archaeopteryx;
+import org.forester.io.writers.PhylogenyWriter;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyMethods;
 import org.forester.phylogeny.PhylogenyNode;
@@ -159,7 +162,6 @@ public class Tree implements TreeI
   {
     List<SequenceI> treeSeqs = new ArrayList<>();
     Iterator<TreeNodeI> iter = iterateInPreOrder();
-    int i = 0;
     while (iter.hasNext())
     {
 
@@ -185,4 +187,13 @@ public class Tree implements TreeI
     return treeNodes;
   }
 
+  @Override
+  public void writeToXml(File outputFile) throws IOException
+  {
+    PhylogenyWriter treeWriter = new PhylogenyWriter();
+    treeWriter.toPhyloXML(tree, 0, outputFile);
+
+
+  }
+
 }
index 335b196..702ff61 100644 (file)
@@ -2,6 +2,8 @@ package jalview.ext.treeviewer;
 
 import jalview.datamodel.SequenceI;
 
+import java.io.File;
+import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
 
@@ -41,4 +43,6 @@ public interface TreeI
 
   TreeFrameI createTreeViewerFromTree(String instanceTitle);
 
+  public void writeToXml(File outputFile) throws IOException;
+
 }