Package pal.tree
Class RootedTreeUtils
- java.lang.Object
-
- pal.tree.RootedTreeUtils
-
public class RootedTreeUtils extends java.lang.ObjectThis class contains utility methods. These include:
1. gathering information about subtrees from a set of trees
2. comparing subtrees and clades.
All these methods assume rooted trees!- Version:
- $Id: RootedTreeUtils.java,v 1.3 2003/06/11 05:26:46 matt Exp $
- Author:
- Alexei Drummond
-
-
Constructor Summary
Constructors Constructor Description RootedTreeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcladeCount(Node subtree, java.util.Vector trees)static voidcollectProportions(Tree tree, java.util.Vector trees)static intcollectTaxa(Node root, java.util.Hashtable table)Collects all of the names of the taxa in the tree into a hashtable.static booleancontainsClade(Node root, Node clade)static booleancontainsNovelTaxa(Node root, java.util.Hashtable taxa)static booleancontainsSubtree(Node root, Node node)static booleanequal(Node node1, Node node2)static NodegetClade(Node root, Node clade)static doublegetMeanCladeHeight(Node clade, java.util.Vector trees)static doublegetMeanSubtreeHeight(Node subtree, java.util.Vector trees)static NodegetSubtree(Node root, Node node)static booleansameTaxa(Node node1, Node node2)static intsubtreeCount(Node subtree, java.util.Vector trees)
-
-
-
Method Detail
-
containsSubtree
public static boolean containsSubtree(Node root, Node node)
- Parameters:
root- the root of the tree in which search for a subtreenode- the subtree to search for.- Returns:
- true if the first node contains a subtree identical to the second node or is identical to the second node.
-
containsClade
public static boolean containsClade(Node root, Node clade)
- Parameters:
root- the root of the tree in which search for a subtreetaxa- the hashtable of taxa.- Returns:
- true if the given tree contains a clade holding all the taxa in the given subtree.
-
getSubtree
public static Node getSubtree(Node root, Node node)
- Returns:
- a subtree within the first node with the same labelled topology as the second node or null if it doesn't exist.
-
getClade
public static Node getClade(Node root, Node clade)
- Returns:
- a subtree within the first node with the same labels as the second node or null if it doesn't exist.
-
equal
public static boolean equal(Node node1, Node node2)
- Returns:
- true if the trees have the same tip-labelled structure. Child order is not important.
-
sameTaxa
public static boolean sameTaxa(Node node1, Node node2)
- Returns:
- true if the trees have the same tip labels. topology unimportant.
-
collectTaxa
public static int collectTaxa(Node root, java.util.Hashtable table)
Collects all of the names of the taxa in the tree into a hashtable.- Parameters:
root- the root node of the tree.taxa- a hashtable to hold the taxa names, may already hold some taxa names.- Returns:
- the number of new taxa added to the hashtable from this tree.
-
containsNovelTaxa
public static boolean containsNovelTaxa(Node root, java.util.Hashtable taxa)
- Parameters:
root- the root node of the tree.taxa- a hashtable holding taxa names.- Returns:
- true if the given tree contains taxa not already in the given hashtable.
-
subtreeCount
public static int subtreeCount(Node subtree, java.util.Vector trees)
- Parameters:
subtree- the subtree being searched for.trees- a vector of trees to search for the subtree in.- Returns:
- the number of times the subtree was found in the given list of trees. If a subtree occurs more than once in a tree (for some bizarre reason) it is counted only once.
-
getMeanSubtreeHeight
public static double getMeanSubtreeHeight(Node subtree, java.util.Vector trees)
- Parameters:
subtree- the subtree being searched for.trees- a vector of trees to search for the subtree in.- Returns:
- the mean height of the given subtree in the given list of trees. If a subtree occurs more than once in a tree (for some bizarre reason) results are undefined.
-
getMeanCladeHeight
public static double getMeanCladeHeight(Node clade, java.util.Vector trees)
- Parameters:
clade- a node containing the clade being searched for.trees- a vector of trees to search for the clade in.- Returns:
- the mean height of the given clade in the given list of trees. If a clade occurs more than once in a tree (for some bizarre reason) results are undefined.
-
cladeCount
public static int cladeCount(Node subtree, java.util.Vector trees)
- Parameters:
subtree- a subtree containing the taxaset being searched for.trees- a vector of trees to search for the clade in.- Returns:
- the number of times the clade was found in the given list of trees. If a clade occurs more than once in a tree (for some bizarre reason) it is counted only once.
-
collectProportions
public static void collectProportions(Tree tree, java.util.Vector trees)
-
-