package jalview.ext.treeviewer; import jalview.datamodel.SequenceI; import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.List; /** * Interface for implementing a phylogenetic tree. * * @author kjvanderheide * */ public interface TreeI { /** * Uses this tree as the basis for a new tree frame. * * @param instanceTitle * name of the new tree frame. * @return */ TreeFrameI createTreeViewerFromTree(String instanceTitle); public String[] getAllLeafNames(); public TreeNodeI[] getAllNodes(); /** * Gets the node that has the maximum branch length from the root (or top * level node if tree is unrooted). * * @return */ public TreeNodeI getFurthestNode(); /** * Returns the longest total branch length from the root to a leaf node. * * @param adjustForCollapsedSubtrees * true if nodes part of a collapsed (hidden) subtree should be * considered. * @return */ public double getMaximumLength(boolean adjustForCollapsedSubtrees); public List getNodeSequences(); public TreeNodeI getNodeWithName(String name); public TreeNodeI getRoot(); public String getTreeName(); /** * Check if the tree actually contains any nodes. * * @return true if tree has no nodes (or is deleted), false otherwise. */ public boolean isEmpty(); public Iterator iterateInLevelOrder(); public Iterator iterateInPostOrder(); public Iterator iterateInPreOrder(); /** * This should write the tree to the richest file format available for * compatibility reasons as this is the method used when Jalview saves a tree * to its project. * * @param outputFile * File that tree should be written to * @throws IOException */ public void outputAsFile(File outputFile) throws IOException; public void setRerootable(boolean b); public void setRoot(TreeNodeI rootNode); public void setRooted(boolean b); public void setTreeName(String treeTitle); }