From d5baf284bbab436696d3987778b493986c20d1e2 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Tue, 16 Jan 2018 01:41:54 +0000 Subject: [PATCH] JAL-2798 added method to tree for writing to jalview project --- src/jalview/ext/archaeopteryx/Tree.java | 13 ++++++++++++- src/jalview/ext/treeviewer/TreeI.java | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/jalview/ext/archaeopteryx/Tree.java b/src/jalview/ext/archaeopteryx/Tree.java index e5a2016..8c1d0be 100644 --- a/src/jalview/ext/archaeopteryx/Tree.java +++ b/src/jalview/ext/archaeopteryx/Tree.java @@ -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 treeSeqs = new ArrayList<>(); Iterator 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); + + + } + } diff --git a/src/jalview/ext/treeviewer/TreeI.java b/src/jalview/ext/treeviewer/TreeI.java index 335b196..702ff61 100644 --- a/src/jalview/ext/treeviewer/TreeI.java +++ b/src/jalview/ext/treeviewer/TreeI.java @@ -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; + } -- 1.7.10.2