|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjebl.evolution.trees.MutableRootedTree
public class MutableRootedTree
A simple rooted tree providing some ability to manipulate the tree. - Root an unrooted tree using an outgroup. - Remove internal node: all children of node are adopted by it's parent. - Split/Refine node by creating two new children and distributing the children to new nodes. - Re-root a rooted tree given an outgroup.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface jebl.evolution.graphs.Graph |
|---|
Graph.NoEdgeException, Graph.Utils |
| Field Summary | |
|---|---|
protected Set<Node> |
internalNodes
|
protected jebl.evolution.trees.MutableRootedTree.MutableRootedNode |
rootNode
|
| Constructor Summary | |
|---|---|
MutableRootedTree(Tree tree,
Node outGroup)
Construct a rooted tree from unrooted. |
|
| Method Summary | |
|---|---|
protected void |
calculateBranchLengths()
Calculate branch lengths from the current node heights. |
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(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,
List<Integer> split)
|
List<Node> |
getAdjacencies(Node node)
Returns a list of nodes connected to this node by an edge |
Object |
getAttribute(String name)
|
Map<String,Object> |
getAttributeMap()
Gets the entire attribute map. |
Set<String> |
getAttributeNames()
|
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 |
Set<Edge> |
getEdges()
|
List<Edge> |
getEdges(Node node)
Returns a list of edges connected to this node |
Set<Edge> |
getExternalEdges()
The set of external edges. |
Set<Node> |
getExternalNodes()
|
double |
getHeight(Node node)
|
Set<Edge> |
getInternalEdges()
The set of internal edges. |
Set<Node> |
getInternalNodes()
|
double |
getLength(Node node)
|
Node |
getNode(Taxon taxon)
|
Set<Node> |
getNodes()
|
Node[] |
getNodes(Edge edge)
Returns an array of 2 nodes which are the nodes at either end of the edge. |
Set<Node> |
getNodes(int degree)
|
Node |
getParent(Node node)
|
Node |
getRootNode()
The root of the tree has the largest node height of all nodes in the tree. |
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(String name)
|
void |
removeInternalNode(Node node)
Remove internal node. |
void |
reRootWithOutgroup(Node outGroup,
Set<String> attributeNames)
Re-root tree using an outgroup. |
void |
setAttribute(String name,
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected jebl.evolution.trees.MutableRootedTree.MutableRootedNode rootNode
protected final Set<Node> internalNodes
| Constructor Detail |
|---|
public MutableRootedTree(Tree tree,
Node outGroup)
tree - Unrooted tree to tooroutGroup - Node in tree assumed to be the outgroup| Method Detail |
|---|
public void removeInternalNode(Node node)
node - to be removed
public void refineNode(Node node,
int[] leftSet)
node - Node to refineleftSet - indices of children in the left new subtree.
public void reRootWithOutgroup(Node outGroup,
Set<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 detachChildren(Node node,
List<Integer> split)
public Node createExternalNode(Taxon taxon)
taxon - the taxon associated with this node
public jebl.evolution.trees.MutableRootedTree.MutableRootedNode createInternalNode(List<? extends Node> children)
children - the child nodes of this nodes
public void setHeight(Node node,
double height)
node - the node whose height is being setheight - the height
public void setLength(Node node,
double length)
node - the node whose branch length (to its parent) is being setlength - the lengthpublic 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 requested
public Node getRootNode()
getRootNode in interface RootedTreepublic boolean isRoot(Node node)
isRoot in interface RootedTreenode - the node
public Set<Node> getExternalNodes()
getExternalNodes in interface Treepublic Set<Node> getInternalNodes()
getInternalNodes in interface Treepublic Set<Taxon> getTaxa()
getTaxa in interface Treepublic Taxon getTaxon(Node node)
getTaxon in interface Treenode - the node whose associated taxon is being requested.
public boolean isExternal(Node node)
isExternal in interface Treenode - the node
public Node getNode(Taxon taxon)
getNode in interface Treetaxon - the taxon
public List<Edge> getEdges(Node node)
getEdges in interface Graphnode -
public Node[] getNodes(Edge edge)
getNodes in interface Graphedge -
public List<Node> getAdjacencies(Node node)
Graph
getAdjacencies 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
Graph
getEdgeLength in interface Graphnode1 - node2 -
Graph.NoEdgeException - if the nodes are not directly connected by an edge.public Set<Node> getNodes()
getNodes in interface Graphpublic Set<Edge> getEdges()
getEdges in interface Graphpublic Set<Edge> getExternalEdges()
getExternalEdges in interface Treepublic Set<Edge> getInternalEdges()
getInternalEdges in interface Treepublic Set<Node> getNodes(int degree)
getNodes in interface Graphdegree - the number of edges connected to a node
protected void calculateBranchLengths()
public void setConceptuallyUnrooted(boolean intent)
public boolean conceptuallyUnrooted()
RootedTree
conceptuallyUnrooted in interface RootedTree
public void setAttribute(String name,
Object value)
Attributable
setAttribute in interface Attributablename - the name of the attribute.value - the new value of the attribute.public Object getAttribute(String name)
getAttribute in interface Attributablename - the name of the attribute of interest.
public void removeAttribute(String name)
removeAttribute in interface Attributablename - name of attribute to removepublic Set<String> getAttributeNames()
getAttributeNames in interface Attributablepublic Map<String,Object> getAttributeMap()
Attributable
getAttributeMap in interface Attributable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||