Package jebl.evolution.trees

# Class RootedTreeUtils

java.lang.Object
jebl.evolution.trees.RootedTreeUtils

public class RootedTreeUtils extends Object
Static utility functions for rooted trees.

Version:
  $Id: RootedTreeUtils.java 889 2008-02-27 01:13:21Z matt_kearse $
Author:
  Andrew Rambaut, Alexei Drummond

## Method Summary

Modifier and Type
Method
Description
`static boolean`
`equal(RootedTree tree1, RootedTree tree2)`
Compares 2 trees and returns true if they have the same topology.
`static double`
`getAverageTipDistance(RootedTree tree, Node node)`
returns the average distance from the given node to all the tips below it
`static Node`
`getCommonAncestorNode(RootedTree tree, Set<Node> tipNodes)`
Gets the most recent common ancestor (MRCA) node of a set of tip nodes.
`static Set<Node>`
`getDescendantTips(RootedTree tree, Node node)`
Gets a set of tip nodes descended from the given node.
`static double`
`getMaxTipHeight(RootedTree tree, Node node)`
`static double`
`getMinTipHeight(RootedTree tree, Node node)`
`static final int`
`getTipCount(RootedTree tree, Node node)`
Return the number of leaves under this node.
`static Set<Node>`
`getTipsForTaxa(RootedTree tree, Collection<Taxon> taxa)`
Gets a set of external nodes that correspond to the given taxa.
`static boolean`
`isBinary(RootedTree tree)`
`static boolean`
`isMonophyletic(RootedTree tree, Set<Node> tipNodes)`
Performs the a monophyly test on a set of tip nodes.
`static boolean`
`isUltrametric(RootedTree tree, double tolerance)`
`static String`
`uniqueNewick(RootedTree tree, Node node)`
Recursive function for constructing a newick tree representation in the given buffer.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getTipCount

public static final int getTipCount(RootedTree tree, Node node)
Return the number of leaves under this node.

Parameters:
  `tree` -
  `node` -
Returns:
  the number of leaves under this node.

### getMinTipHeight

public static double getMinTipHeight(RootedTree tree, Node node)

### getMaxTipHeight

public static double getMaxTipHeight(RootedTree tree, Node node)

### getAverageTipDistance

public static double getAverageTipDistance(RootedTree tree, Node node)
returns the average distance from the given node to all the tips below it

Parameters:
  `tree` -
  `node` -
Returns:

### isUltrametric

public static boolean isUltrametric(RootedTree tree, double tolerance)

Returns:
  true only if all tips have height 0.0

### isBinary

public static boolean isBinary(RootedTree tree)

Returns:
  true only if internal nodes have 2 children

### getTipsForTaxa

public static Set<Node> getTipsForTaxa(RootedTree tree, Collection<Taxon> taxa) throws MissingTaxonException
Gets a set of external nodes that correspond to the given taxa.

Throws:
  `MissingTaxonException`

### getDescendantTips

public static Set<Node> getDescendantTips(RootedTree tree, Node node)
Gets a set of tip nodes descended from the given node.

### getCommonAncestorNode

public static Node getCommonAncestorNode(RootedTree tree, Set<Node> tipNodes)
Gets the most recent common ancestor (MRCA) node of a set of tip nodes.

Parameters:
  `tree` - the Tree
  `tipNodes` - a set of tip nodes
Returns:
  the Node of the MRCA

### isMonophyletic

public static boolean isMonophyletic(RootedTree tree, Set<Node> tipNodes)
Performs the a monophyly test on a set of tip nodes. The nodes are monophyletic if there is a node in the tree which subtends all the tips in the set (and only those tips).

Parameters:
  `tree` - a tree object to perform test on
  `tipNodes` - a set containing the tip node.
Returns:
  boolean is monophyletic?

### uniqueNewick

public static String uniqueNewick(RootedTree tree, Node node)
Recursive function for constructing a newick tree representation in the given buffer.

### equal

public static boolean equal(RootedTree tree1, RootedTree tree2)
Compares 2 trees and returns true if they have the same topology.