|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pal.tree.TreeUtils
various utility functions on trees.
Constructor Summary | |
TreeUtils()
|
Method Summary | |
static void |
computeAllDistances(Tree tree,
int a,
double[] dist,
double[] idist,
boolean countEdges,
double epsilon)
|
static double |
computeDistance(Tree tree,
int a,
int b)
compute distance between two external nodes |
static Alignment |
extractAlignment(Tree tree)
Extracts an alignment from a tree. |
static Alignment |
extractAlignment(Tree tree,
boolean leaveSeqsInTree)
Extracts an alignment from a tree. |
static TimeOrderCharacterData |
extractTimeOrderCharacterData(Tree tree,
int units)
Extracts a time order character data from a tree. |
static Tree |
generationsToMutations(Tree generationTree,
MutationRateModel muModel)
Takes a tree (in generation units) and returns a scaled version of it (in mutation units). |
static Tree |
generationsToMutations(Tree generationTree,
MutationRateModel muModel,
double generationTime)
Takes a tree (in generation units) and returns a scaled version of it (in mutation units). |
static Tree |
getBootstrapSupportByCladeTree(java.lang.String attributeName,
Tree baseTree,
Tree[] alternativeTrees)
Generates a tree which is identical to baseTree but has attributes (defined by attributeName) at all internal nodes excluding the root node signifying (as a value between 0 and 100) the bootstrap support by clade (that is the proportion of replicates that produce the sub clade under that node) |
static void |
getEveryRoot(Tree tree,
java.util.Vector roots)
Makes a copy of this tree for every possible rooting and fills a vector with all possible rootings of the given tree. |
static IdGroup |
getLeafIdGroup(Tree tree)
get list of the identifiers of the external nodes |
static Node |
getNodeByName(Node root,
java.lang.String name)
|
static Node |
getNodeByName(Tree tree,
java.lang.String name)
|
static Node |
getRandomNode(Tree tree)
Returns a uniformly distributed random node from the tree, including both internal and external nodes. |
static double |
getRobinsonFouldsDistance(SplitSystem s1,
Tree t2)
computes Robinson-Foulds (1981) distance between two trees |
static double |
getRobinsonFouldsDistance(Tree t1,
Tree t2)
computes Robinson-Foulds (1981) distance between two trees |
static double |
getRobinsonFouldsRescaledDistance(SplitSystem s1,
Tree t2)
computes Robinson-Foulds (1981) distance between two trees rescaled to a number between 0 and 1 |
static double |
getRobinsonFouldsRescaledDistance(Tree t1,
Tree t2)
computes Robinson-Foulds (1981) distance between two trees rescaled to a number between 0 and 1 |
static Tree |
getUnrootedTree(Tree t)
Creates an unrooted copy of a tree. |
static void |
labelInternalNodes(Tree tree)
Labels the internal nodes of the tree using numbers starting from 0. |
static int[] |
mapExternalIdentifiers(IdGroup idGroup,
Tree tree)
map external identifiers in the tree to a set of given identifiers (which can be larger than the set of external identifiers but must contain all of them) NOTE: for efficiency it is assumed that the node lists of the tree are correctly maintained. |
static Tree |
mutationsToGenerations(Tree mutationTree,
MutationRateModel muModel)
Takes a tree (in mutation units) and returns a scaled version of it (in generation units). |
static void |
printNH(Tree tree,
java.io.PrintWriter out)
print a this tree in New Hampshire format (including distances and internal labels) |
static void |
printNH(Tree tree,
java.io.PrintWriter out,
boolean printLengths,
boolean printInternalLabels)
print this tree in New Hampshire format |
static void |
renameNodes(Tree tree,
java.util.Hashtable table)
Given a translation table where the keys are the current identifier names and the values are the new identifier names, this method replaces the current identifiers in the tree with new identifiers. |
static void |
report(Tree tree,
java.io.PrintWriter out)
|
static void |
reroot(Tree tree,
Node node)
|
static void |
rotateByLeafCount(Tree tree)
Rotates branches by leaf count. |
static Tree |
scale(Tree oldTree,
double rate,
int newUnits)
Takes a tree and returns a scaled version of it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TreeUtils()
Method Detail |
public static double getRobinsonFouldsDistance(Tree t1, Tree t2)
t1
- tree 1t2
- tree 2
Definition: Assuming that t1 is the reference tree, let fn be the
false negatives, i.e. the number of edges in t1 missing in t2,
and fp the number of false positives, i.e. the number of edges
in t2 missing in t1. The RF distance is then (fn + fp)/2public static double getRobinsonFouldsDistance(SplitSystem s1, Tree t2)
s1
- tree 1 (as represented by a SplitSystem)t2
- tree 2public static double getRobinsonFouldsRescaledDistance(Tree t1, Tree t2)
t1
- tree 1t2
- tree 2public static double getRobinsonFouldsRescaledDistance(SplitSystem s1, Tree t2)
s1
- tree 1 (as represented by a SplitSystem)t2
- tree 2public static Node getRandomNode(Tree tree)
public static final Tree getUnrootedTree(Tree t)
public static final Node getNodeByName(Tree tree, java.lang.String name)
tree
- The Tree supposidly containing such a named nodename
- The name of the node to find.public static final Node getNodeByName(Node root, java.lang.String name)
root
- The root node of a treename
- The name of the node to find.public static Tree mutationsToGenerations(Tree mutationTree, MutationRateModel muModel)
mutationRateModel
- the mutation rate model used for scaling
and the desired units are expected substitutions then this scale
factor should be equal to the mutation rate.newUnits
- the new units of the tree.public static Tree generationsToMutations(Tree generationTree, MutationRateModel muModel)
mutationRateModel
- the mutation rate model.
The mutation rate must be in units of mutations per site per generation.public static Tree generationsToMutations(Tree generationTree, MutationRateModel muModel, double generationTime)
mutationRateModel
- the mutation rate model in calendar units.generationTime
- the length of a generation in calendar units.
If the mutation rate is in mutations per site per year, then the
generation time will be in generations per year.public static Tree scale(Tree oldTree, double rate, int newUnits)
rate
- scale factor. If the original tree is in generations
and the desired units are expected substitutions then this scale
factor should be equal to the mutation rate.newUnits
- the new units of the tree.public static void renameNodes(Tree tree, java.util.Hashtable table)
public static void rotateByLeafCount(Tree tree)
public static final IdGroup getLeafIdGroup(Tree tree)
public static final int[] mapExternalIdentifiers(IdGroup idGroup, Tree tree) throws java.lang.IllegalArgumentException
idGroup
- an ordered group of identifierspublic static void getEveryRoot(Tree tree, java.util.Vector roots)
public static final void labelInternalNodes(Tree tree)
public static TimeOrderCharacterData extractTimeOrderCharacterData(Tree tree, int units)
public static Alignment extractAlignment(Tree tree, boolean leaveSeqsInTree)
public static Alignment extractAlignment(Tree tree)
public static void printNH(Tree tree, java.io.PrintWriter out)
out
- output streampublic static void printNH(Tree tree, java.io.PrintWriter out, boolean printLengths, boolean printInternalLabels)
out
- output streamprintLengths
- boolean variable determining whether
branch lengths should be included in outputprintInternalLabels
- boolean variable determining whether
internal labels should be included in outputpublic static void reroot(Tree tree, Node node)
public static void computeAllDistances(Tree tree, int a, double[] dist, double[] idist, boolean countEdges, double epsilon)
public static final double computeDistance(Tree tree, int a, int b)
tree
- treea
- external node 1b
- external node 2public static void report(Tree tree, java.io.PrintWriter out)
public static final Tree getBootstrapSupportByCladeTree(java.lang.String attributeName, Tree baseTree, Tree[] alternativeTrees)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |