public final class Utils
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static void |
assertAllTreesHaveTheSameTaxa(java.util.List<? extends Tree> trees) |
Checks whether all of the trees passed in have the same taxa sets (ignoring
order of taxa), and throws an IllegalArgumentException if this is not the case.
|
static java.lang.String |
asText(Tree tree) |
|
static java.lang.String[] |
asText(Tree tree,
int widthGuide) |
|
static RootedTree |
copyTree(RootedTree treeToCopy) |
This method creates an unattached copy of the given rooted tree such that changes to the copied tree do not affect the original tree.
|
static java.util.Comparator<Node> |
createNodeDensityComparator(RootedTree tree) |
|
static java.util.Comparator<Node> |
createNodeDensityMinNodeHeightComparator(RootedTree tree) |
|
static java.lang.String |
DEBUGsubTreeRep(RootedTree tree,
Node node) |
|
static int |
getExternalNodeCount(RootedTree tree,
Node node) |
Return the number of external nodes under this node.
|
static double |
getMinNodeHeight(RootedTree tree,
Node node) |
|
static java.util.List<Node> |
getNodes(RootedTree tree,
Node node) |
All nodes in subtree - parents before children (pre - order).
|
static double |
getPathLength(Tree tree,
Node node1,
Node node2) |
|
static boolean |
isBinary(RootedTree rootedTree) |
|
static boolean |
isUltrametric(RootedTree rootedTree) |
|
static Node |
leftNb(RootedTree tree,
Node node) |
Left Neighbour of a tip (taxon).
|
static int |
maxLevels(RootedTree tree) |
|
static Node |
rightNb(RootedTree tree,
Node tipNode) |
Right Neighbour of a tip (taxon).
|
static RootedTree |
rootTheTree(Tree tree) |
Return a rooted tree from any tree.
|
static RootedTree |
rootTreeAtCenter(Tree tree) |
Root any tree by locating the "center" of tree and adding a new root node at that point
|
static double |
safeNodeHeight(RootedTree tree,
Node node) |
|
static java.lang.String |
toNewick(RootedTree tree) |
|
static java.lang.String |
toUniqueNewick(RootedTree tree) |
Constructs a unique newick representation of a tree
|
static java.lang.String |
toUniqueNewickByAttribute(RootedTree tree,
java.lang.String attribute) |
Constructs a unique newick representation of a tree print only an attribute
|
public static java.lang.String toNewick(RootedTree tree)
tree
- public static java.lang.String toUniqueNewick(RootedTree tree)
tree
- public static java.lang.String toUniqueNewickByAttribute(RootedTree tree, java.lang.String attribute)
tree
- public static double safeNodeHeight(RootedTree tree, Node node)
public static int maxLevels(RootedTree tree)
public static java.lang.String asText(Tree tree)
public static java.lang.String[] asText(Tree tree, int widthGuide)
public static RootedTree rootTheTree(Tree tree)
tree
- to rootpublic static RootedTree rootTreeAtCenter(Tree tree)
tree
- to rootpublic static double getPathLength(Tree tree, Node node1, Node node2)
tree
- the treenode1
- node2
- public static boolean isBinary(RootedTree rootedTree)
rootedTree
- the rooted treepublic static boolean isUltrametric(RootedTree rootedTree)
rootedTree
- the rooted treepublic static int getExternalNodeCount(RootedTree tree, Node node)
tree
- node
- public static java.util.List<Node> getNodes(RootedTree tree, Node node)
tree
- node
- public static Node rightNb(RootedTree tree, Node tipNode)
tree
- tipNode
- public static Node leftNb(RootedTree tree, Node node)
tree
- node
- public static double getMinNodeHeight(RootedTree tree, Node node)
tree
- node
- public static java.util.Comparator<Node> createNodeDensityComparator(RootedTree tree)
public static java.util.Comparator<Node> createNodeDensityMinNodeHeightComparator(RootedTree tree)
public static void assertAllTreesHaveTheSameTaxa(java.util.List<? extends Tree> trees) throws java.lang.IllegalArgumentException
trees
- Zero or more treesjava.lang.IllegalArgumentException
- if not all of the trees have the same taxajava.lang.NullPointerException
- if trees is nullpublic static java.lang.String DEBUGsubTreeRep(RootedTree tree, Node node)
public static RootedTree copyTree(RootedTree treeToCopy)
treeToCopy
- the tree to copyhttp://code.google.com/p/jebl2/