Package pal.tree
Class RootedTreeUtils
java.lang.Object
pal.tree.RootedTreeUtils
This 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!
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic int
cladeCount
(Node subtree, Vector trees) static void
collectProportions
(Tree tree, Vector trees) static int
collectTaxa
(Node root, Hashtable table) Collects all of the names of the taxa in the tree into a hashtable.static boolean
containsClade
(Node root, Node clade) static boolean
containsNovelTaxa
(Node root, Hashtable taxa) static boolean
containsSubtree
(Node root, Node node) static boolean
static Node
static double
getMeanCladeHeight
(Node clade, Vector trees) static double
getMeanSubtreeHeight
(Node subtree, Vector trees) static Node
getSubtree
(Node root, Node node) static boolean
static int
subtreeCount
(Node subtree, Vector trees)
-
Constructor Details
-
RootedTreeUtils
public RootedTreeUtils()
-
-
Method Details
-
containsSubtree
- 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
- 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
- Returns:
- a subtree within the first node with the same labelled topology as the second node or null if it doesn't exist.
-
getClade
- Returns:
- a subtree within the first node with the same labels as the second node or null if it doesn't exist.
-
equal
- Returns:
- true if the trees have the same tip-labelled structure. Child order is not important.
-
sameTaxa
- Returns:
- true if the trees have the same tip labels. topology unimportant.
-
collectTaxa
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
- 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
- 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
- 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
- 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
- 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
-