Package pal.tree
Class TreeTool
- java.lang.Object
-
- pal.tree.TreeTool
-
public final class TreeTool extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description TreeTool()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Tree
createNeighbourJoiningTree(double[][] dm, java.lang.String[] otuNames)
Neighbour-joining tree construction based on a distance matrixstatic Tree
createNeighbourJoiningTree(DistanceMatrix dm)
Neighbour-joining tree construction based on a distance matrixstatic Tree
createUPGMA(DistanceMatrix dm)
UPGMA tree construction based on a distance matrixstatic Tree
createUPGMATree(double[][] dm, java.lang.String[] otuNames)
UPGMA tree construction based on a distance matrixstatic Tree
getMidPointRooted(Tree t)
Root a tree around it's midpoint.static Tree
getRooted(Tree t, java.lang.String[] outgroupMembers)
Root a tree by an outgroup.static Tree
getUnrooted(Tree t)
Unroot a tree (makes the base of the tree a trification).static Tree
readTree(java.io.Reader r)
Read a tree from an input source.
-
-
-
Method Detail
-
readTree
public static final Tree readTree(java.io.Reader r) throws java.io.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:
java.io.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, java.lang.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 matchotuNames
- 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, java.lang.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 matchotuNames
- 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, java.lang.String[] outgroupMembers)
Root a tree by an outgroup. Total Branch lengths are conserved- Parameters:
t
- The unrooted (or rooted) treeoutgroupMembers
- 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
-
-