import jalview.ext.treeviewer.TreeI;
import jalview.ext.treeviewer.TreeNodeI;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import org.forester.archaeopteryx.Archaeopteryx;
import org.forester.phylogeny.Phylogeny;
}
@Override
- public SequenceI[] getNodeSequences()
+ public List<SequenceI> getNodeSequences()
{
- SequenceI[] treeSeqs = new SequenceI[tree.getNodeCount()];
+ List<SequenceI> treeSeqs = new ArrayList<>();
Iterator<TreeNodeI> iter = iterateInPreOrder();
int i = 0;
while (iter.hasNext())
SequenceI nodeSeq = iter.next().getSequence();
if (nodeSeq != null)
{
- treeSeqs[i++] = nodeSeq;
+ treeSeqs.add(nodeSeq);
}
}
return treeSeqs;
import java.io.File;
import java.io.IOException;
+import java.util.List;
public class NexusFile extends AlignFile
{
TreeParserI parser = ForesterParser
.createNexusParser(new File(getDataName()));
TreeI[] trees = parser.parse();
- for (TreeI tree : trees) {
- for (SequenceI seq : tree.getNodeSequences()) {
+ List<SequenceI> treeSeqs = trees[0].getNodeSequences();
+ for (SequenceI seq : treeSeqs)
+ {
seqs.add(seq);
}
}
}
-}
+
import java.io.File;
import java.io.IOException;
+import java.util.List;
public class PhyloXmlFile extends AlignFile
{
TreeParserI parser = ForesterParser
.createPhyloXmlParser(new File(getDataName()));
TreeI[] trees = parser.parse();
- for (SequenceI seq : trees[0].getNodeSequences())
+ List<SequenceI> treeSeqs = trees[0].getNodeSequences();
+ for (SequenceI seq : treeSeqs)
{
seqs.add(seq);
}
import jalview.datamodel.SequenceI;
import java.util.Iterator;
+import java.util.List;
public interface TreeI
{
public String[] getAllLeafNames();
- public SequenceI[] getNodeSequences();
+ public List<SequenceI> getNodeSequences();
public void setTreeName(String treeTitle);