Package pal.tree

Class TreeTool

java.lang.Object
pal.tree.TreeTool

public final class TreeTool extends Object
  • Constructor Details

    • TreeTool

      public TreeTool()
  • Method Details

    • readTree

      public static final Tree readTree(Reader r) throws IOException
      Read a tree from an input source. Currently only understands the Newick format
      Parameters:
      r - A reader object (is not closed)
      Returns:
      A tree
      Throws:
      IOException - if there was a problem
    • createNeighbourJoiningTree

      public static final Tree createNeighbourJoiningTree(DistanceMatrix dm)
      Neighbour-joining tree construction based on a distance matrix
      Parameters:
      dm - The related DistanceMatrix object
      Returns:
      A tree formed by the neighbour-joining process using the input distance matrix
    • createUPGMA

      public static final Tree createUPGMA(DistanceMatrix dm)
      UPGMA tree construction based on a distance matrix
      Parameters:
      dm - The related DistanceMatrix object
      Returns:
      A tree formed by the UPGMA process using the input distance matrix
    • createNeighbourJoiningTree

      public static final Tree createNeighbourJoiningTree(double[][] dm, String[] otuNames)
      Neighbour-joining tree construction based on a distance matrix
      Parameters:
      dm - A matrix of doubles that forms the distance matrix. It is assumed this matrix is perfectly square and the diagonals match
      otuNames - The list of operational taxonimic units that match the column/rows of the distance matrix.
      Returns:
      A tree formed by the neighbour-joining process using the input distance matrix
    • createUPGMATree

      public static final Tree createUPGMATree(double[][] dm, String[] otuNames)
      UPGMA tree construction based on a distance matrix
      Parameters:
      dm - A matrix of doubles that forms the distance matrix. It is assumed this matrix is perfectly square and the diagonals match
      otuNames - The list of operational taxonimic units that match the column/rows of the distance matrix.
      Returns:
      A tree formed by the neighbour-joining process using the input distance matrix
    • getUnrooted

      public static final Tree getUnrooted(Tree t)
      Unroot a tree (makes the base of the tree a trification). Total Branch lengths are conserved
      Parameters:
      t - The rooted (or unrooted) tree
      Returns:
      An unrooted tree
    • getMidPointRooted

      public static final Tree getMidPointRooted(Tree t)
      Root a tree around it's midpoint. Total Branch lengths are conserved
      Parameters:
      t - The unrooted (or rooted) tree
      Returns:
      A rooted tree
    • getRooted

      public static final Tree getRooted(Tree t, String[] outgroupMembers)
      Root a tree by an outgroup. Total Branch lengths are conserved
      Parameters:
      t - The unrooted (or rooted) tree
      outgroupMembers - The names of the outgroup members (must be at least one). If there are more than one outgroup than the clade that contains all members is used as the outgroup. In some case poorly choosen outgroup members can result in multiple ways of rooting. If for some reason this is what is wanted see the TreeManipulator class for more powerful options.
      Returns:
      A rooted tree