Package pal.tree

Class RootedTreeUtils

java.lang.Object
pal.tree.RootedTreeUtils

public class RootedTreeUtils extends Object
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!
Version:
$Id: RootedTreeUtils.java,v 1.3 2003/06/11 05:26:46 matt Exp $
Author:
Alexei Drummond
  • Constructor Details

    • RootedTreeUtils

      public RootedTreeUtils()
  • Method Details

    • containsSubtree

      public static boolean containsSubtree(Node root, Node node)
      Parameters:
      root - the root of the tree in which search for a subtree
      node - 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 subtree
      taxa - 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, 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, 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, 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, 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, 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, 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, Vector trees)