|
PhyloSort | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectphylosort.TreeNodeUtil
public final class TreeNodeUtil
Utility methods for general TreeNode processing.
| Constructor Summary | |
|---|---|
TreeNodeUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
belongs(TreeNode node,
java.util.Set<java.lang.String> taxa)
Checks whether the set of all OTUs is a subset of taxa |
static boolean |
contains(TreeNode node,
java.util.Set<java.lang.String> taxa)
Checks whether each group of taxa is represented at least by one OTU |
static TreeNode |
copy(TreeNode root,
TreeNode exclude)
Returns a copy of a TreeNode |
static TreeNode |
findOutgroup(TreeNode node,
java.util.List<java.util.Set<java.lang.String>> taxa)
Finds a leaf node with a taxon not included within a list of taxa |
static TreeNode |
findOutgroup(TreeNode node,
java.util.Set<java.lang.String> taxa)
Finds a leaf node with a taxon not included within a list of taxa |
static java.util.Collection<TreeNode> |
getAllMonophyleticNodes(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa)
Checks whether a tree has a common branch holding groups of taxa |
static java.util.Collection<TreeNode> |
getAllMonophyleticNodes(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa,
boolean exclusive)
Checks whether a tree has a common branch holding groups of taxa |
static float |
getAverageNumberOfCopies(TreeNode root)
Returns the average number of copies per species |
static TreeNode |
getMonophyleticNode(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa)
Checks whether a tree has a common branch holding groups of taxa |
static TreeNode |
getMonophyleticNode(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa,
boolean exclusive)
Checks whether a tree has a common branch holding groups of taxa |
static java.util.Collection<TreeNode> |
getNodesByTaxa(TreeNode tree,
java.util.Set<java.lang.String> taxa)
Returns all OTU nodes with labels matching the set of taxa |
static java.util.Collection<TreeNode> |
getNodesByTaxa(TreeNode node,
java.util.Set<java.lang.String> taxa,
boolean equal)
Returns all OTU nodes with labels matching the set of taxa |
static java.util.Set<java.lang.String> |
getTaxa(java.io.File file)
Returns a Set of String of all taxa in a file |
static java.util.Set<java.lang.String> |
getTaxa(TreeNode node)
Returns a Set of String of taxa in a TreeNode |
static int |
hasMonophyly(TreeNode node,
java.util.Set<java.lang.String> extended,
java.util.List<java.util.Set<java.lang.String>> sets,
java.util.Set<java.lang.Integer> excluded)
Returns node id if the node is valid, otherwise returns -1 |
static int |
lca(java.lang.Iterable<TreeNode> nodes)
Returns the lowest common ancestor (LCA) for a list of nodes |
static TreeNode |
load(java.io.File file)
Loads a tree from a text file |
static TreeNode |
reroot(TreeNode outgroup)
Reroots a tree based on an outgroup node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TreeNodeUtil()
| Method Detail |
|---|
public static boolean belongs(TreeNode node,
java.util.Set<java.lang.String> taxa)
node - Tree to check it OTUstaxa - Set of taxa to check aganist
public static boolean contains(TreeNode node,
java.util.Set<java.lang.String> taxa)
node - Tree to check it OTUstaxa - Sets of taxa to check
public static TreeNode getMonophyleticNode(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa)
tree - Tree to search in for a common branchtaxa - Groups of taxa (labels) to search for a common branch
public static TreeNode getMonophyleticNode(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa,
boolean exclusive)
tree - Tree to search in for a common branchtaxa - Groups of taxa (labels) to search for a common branchexclusive - Validation type indicator
public static java.util.Collection<TreeNode> getAllMonophyleticNodes(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa)
tree - Tree to search in for a common branchtaxa - Groups of taxa (labels) to search for a common branch
public static java.util.Collection<TreeNode> getAllMonophyleticNodes(TreeNode tree,
java.util.List<java.util.List<java.lang.String>> taxa,
boolean exclusive)
tree - Tree to search in for a common branchtaxa - Groups of taxa (labels) to search for a common branchexclusive - Validation type indicator
public static int hasMonophyly(TreeNode node,
java.util.Set<java.lang.String> extended,
java.util.List<java.util.Set<java.lang.String>> sets,
java.util.Set<java.lang.Integer> excluded)
node - Node to validateextended - Extended list of taxasets - Taxa in groupsexcluded - List of ids of exlcuded nodes (already visited)
public static java.util.Set<java.lang.String> getTaxa(TreeNode node)
Set of String of taxa in a TreeNode
node - TreeNode
Set of String of taxa in a TreeNode
public static java.util.Set<java.lang.String> getTaxa(java.io.File file)
throws java.lang.Exception
Set of String of all taxa in a file
file - Input file
Set of String of all taxa in a file
java.lang.Exception
public static java.util.Collection<TreeNode> getNodesByTaxa(TreeNode tree,
java.util.Set<java.lang.String> taxa)
tree - Tree to search intaxa - Taxa to search for
TreeNode
public static java.util.Collection<TreeNode> getNodesByTaxa(TreeNode node,
java.util.Set<java.lang.String> taxa,
boolean equal)
node - Tree to search intaxa - Taxa to search forequal - Flag to search of equality or non-equality
TreeNode
public static TreeNode load(java.io.File file)
throws java.lang.Exception
file - Tree text file
TreeNode root of the tree (midpoint?)
java.lang.Exceptionpublic static int lca(java.lang.Iterable<TreeNode> nodes)
nodes - The list of tree nodes
int) of the LCATreeNodepublic static TreeNode reroot(TreeNode outgroup)
outgroup - TreeNode outgroup node
TreeNode
public static TreeNode copy(TreeNode root,
TreeNode exclude)
TreeNode
root - TreeNode to start coping fromexclude - TreeNode to exclude while coping
TreeNode copy of the root node
public static TreeNode findOutgroup(TreeNode node,
java.util.List<java.util.Set<java.lang.String>> taxa)
node - TreeNode root of a tree to search for an outgrouptaxa - List of taxa (ingroup)
TreeNode outgroup leaf node or null if no outgroup is
found
public static TreeNode findOutgroup(TreeNode node,
java.util.Set<java.lang.String> taxa)
node - TreeNode root of a tree to search for an outgrouptaxa - List of taxa (ingroup)
TreeNode outgroup leaf node or null if no outgroup is
foundpublic static float getAverageNumberOfCopies(TreeNode root)
root - TreeNode root of a tree
|
PhyloSort | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||