public class MutableRootedTree extends java.lang.Object implements RootedTree
Graph.NoEdgeException, Graph.Utils| Constructor and Description |
|---|
MutableRootedTree(RootedTree tree)
Construct a rooted tree from an immutable rooted tree.
|
MutableRootedTree(Tree tree,
Node outGroup)
Construct a rooted tree from unrooted.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
conceptuallyUnrooted()
Due to current implementation limitations, trees store "branch" information in nodes.
|
Node |
createExternalNode(Taxon taxon)
Creates a new external node with the given taxon.
|
jebl.evolution.trees.MutableRootedTree.MutableRootedNode |
createInternalNode(java.util.List<? extends Node> children)
Once a SimpleRootedTree has been created, the node stucture can be created by
calling createExternalNode and createInternalNode.
|
Node |
detachChildren(Node node,
java.util.List<java.lang.Integer> split) |
java.util.List<Node> |
getAdjacencies(Node node)
Returns a list of nodes connected to this node by an edge
|
java.lang.Object |
getAttribute(java.lang.String name) |
java.util.Map<java.lang.String,java.lang.Object> |
getAttributeMap()
Gets the entire attribute map.
|
java.util.Set<java.lang.String> |
getAttributeNames() |
java.util.List<Node> |
getChildren(Node node) |
Edge |
getEdge(Node node1,
Node node2)
Returns the Edge that connects these two nodes
|
double |
getEdgeLength(Node node1,
Node node2)
Returns the length of the edge that connects these two nodes
|
java.util.Set<Edge> |
getEdges() |
java.util.List<Edge> |
getEdges(Node node)
Returns a list of edges connected to this node
|
java.util.Set<Edge> |
getExternalEdges()
The set of external edges.
|
java.util.Set<Node> |
getExternalNodes() |
double |
getHeight(Node node) |
java.util.Set<Edge> |
getInternalEdges()
The set of internal edges.
|
java.util.Set<Node> |
getInternalNodes() |
double |
getLength(Node node) |
Node |
getNode(Taxon taxon) |
java.util.Set<Node> |
getNodes() |
Node[] |
getNodes(Edge edge)
Returns an array of 2 nodes which are the nodes at either end of the edge.
|
java.util.Set<Node> |
getNodes(int degree) |
Node |
getParent(Node node) |
Edge |
getParentEdge(Node node) |
Node |
getRootNode()
The root of the tree has the largest node height of
all nodes in the tree.
|
java.util.Set<Taxon> |
getTaxa() |
Taxon |
getTaxon(Node node) |
boolean |
hasHeights() |
boolean |
hasLengths() |
boolean |
isExternal(Node node) |
boolean |
isRoot(Node node) |
void |
refineNode(Node node,
int[] leftSet) |
void |
removeAttribute(java.lang.String name) |
void |
removeInternalNode(Node node)
Remove internal node.
|
void |
renameTaxa(Taxon from,
Taxon to) |
void |
reRootWithOutgroup(Node outGroup,
java.util.Set<java.lang.String> attributeNames)
Re-root tree using an outgroup.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets an named attribute for this object.
|
void |
setConceptuallyUnrooted(boolean intent) |
void |
setHeight(Node node,
double height) |
void |
setLength(Node node,
double length) |
public MutableRootedTree(Tree tree, Node outGroup)
tree - Unrooted tree to rootoutGroup - Node in tree assumed to be the outgrouppublic MutableRootedTree(RootedTree tree)
tree - Rooted tree to copypublic void removeInternalNode(Node node)
node - to be removedpublic void refineNode(Node node, int[] leftSet)
node - Node to refineleftSet - indices of children in the left new subtree.public void reRootWithOutgroup(Node outGroup, java.util.Set<java.lang.String> attributeNames)
outGroup - attributeNames - Move those attributes (if they exist in node) to their previous parent. The idea is to
preserve "branch" attributes which we now store in the child since only "node" properties are supported.public Node createExternalNode(Taxon taxon)
taxon - the taxon associated with this nodepublic jebl.evolution.trees.MutableRootedTree.MutableRootedNode createInternalNode(java.util.List<? extends Node> children)
children - the child nodes of this nodespublic void setHeight(Node node, double height)
node - the node whose height is being setheight - the heightpublic void setLength(Node node, double length)
node - the node whose branch length (to its parent) is being setlength - the lengthpublic java.util.List<Node> getChildren(Node node)
getChildren in interface RootedTreenode - the node whose children are being requested.public boolean hasHeights()
hasHeights in interface RootedTreepublic double getHeight(Node node)
getHeight in interface RootedTreenode - the node whose height is being requested.public boolean hasLengths()
hasLengths in interface RootedTreepublic double getLength(Node node)
getLength in interface RootedTreenode - the node whose branch length (to its parent) is being requested.public Node getParent(Node node)
getParent in interface RootedTreenode - the node whose parent is requestedpublic Node getRootNode()
getRootNode in interface RootedTreepublic boolean isRoot(Node node)
isRoot in interface RootedTreenode - the nodepublic java.util.Set<Node> getExternalNodes()
getExternalNodes in interface Treepublic java.util.Set<Node> getInternalNodes()
getInternalNodes in interface Treepublic java.util.Set<Taxon> getTaxa()
public boolean isExternal(Node node)
isExternal in interface Treenode - the nodepublic void renameTaxa(Taxon from, Taxon to)
renameTaxa in interface Treepublic java.util.List<Edge> getEdges(Node node)
public Node[] getNodes(Edge edge)
public java.util.List<Node> getAdjacencies(Node node)
GraphgetAdjacencies in interface Graphnode - public Edge getEdge(Node node1, Node node2) throws Graph.NoEdgeException
getEdge in interface Graphnode1 - node2 - Graph.NoEdgeException - if the nodes are not directly connected by an edge.public double getEdgeLength(Node node1, Node node2) throws Graph.NoEdgeException
GraphgetEdgeLength in interface Graphnode1 - node2 - Graph.NoEdgeException - if the nodes are not directly connected by an edge.public java.util.Set<Node> getNodes()
public java.util.Set<Edge> getEdges()
public java.util.Set<Edge> getExternalEdges()
getExternalEdges in interface Treepublic java.util.Set<Edge> getInternalEdges()
getInternalEdges in interface Treepublic java.util.Set<Node> getNodes(int degree)
public void setConceptuallyUnrooted(boolean intent)
public boolean conceptuallyUnrooted()
RootedTreeconceptuallyUnrooted in interface RootedTreepublic void setAttribute(java.lang.String name,
java.lang.Object value)
AttributablesetAttribute in interface Attributablename - the name of the attribute.value - the new value of the attribute.public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface Attributablename - the name of the attribute of interest, or null if the attribute doesn't exist.public void removeAttribute(java.lang.String name)
removeAttribute in interface Attributablename - name of attribute to removepublic java.util.Set<java.lang.String> getAttributeNames()
getAttributeNames in interface Attributablepublic java.util.Map<java.lang.String,java.lang.Object> getAttributeMap()
AttributablegetAttributeMap in interface Attributablehttp://code.google.com/p/jebl2/