Class RootedSubtree
java.lang.Object
jebl.evolution.trees.AbstractRootedTree
jebl.evolution.trees.RootedSubtree
- All Implemented Interfaces:
Graph, RootedTree, Tree, Attributable
A simple, immutable rooted tree implementation that is a subtree of an existing tree
subtending a specified set of taxa..
- Version:
- $Id: SimpleRootedTree.java 935 2008-07-22 16:52:04Z rambaut $
- Author:
- Andrew Rambaut, Alexei Drummond
-
Nested Class Summary
Nested classes/interfaces inherited from interface Graph
Graph.NoEdgeException, Graph.Utils -
Constructor Summary
ConstructorsConstructorDescriptionRootedSubtree(RootedTree tree, Set<Taxon> includedTaxa) Make a copy of the given rooted tree -
Method Summary
Modifier and TypeMethodDescriptionbooleanDue to current implementation limitations, trees store "branch" information in nodes.getAdjacencies(Node node) Returns a list of nodes connected to this node by an edgegetAttribute(String name) Gets the entire attribute map.getChildren(Node node) Returns the Edge that connects these two nodesdoublegetEdgeLength(Node node1, Node node2) Returns the length of the edge that connects these two nodesgetEdges()Returns a list of edges connected to this nodeThe set of external edges.doubleThe set of internal edges.doublegetNodes()getNodes(int degree) Node[]Returns an array of 2 nodes which are the nodes at either end of the edge.getParentEdge(Node node) The root of the tree has the largest node height of all nodes in the tree.getTaxa()booleanbooleanbooleanisExternal(Node node) booleanbooleanbooleanvoidremoveAttribute(String name) voidrenameTaxa(Taxon from, Taxon to) voidsetAttribute(String name, Object value) Sets an named attribute for this object.voidsetConceptuallyUnrooted(boolean intent) voidvoidMethods inherited from class AbstractRootedTree
getExternalNodeCount, getExternalNodes
-
Constructor Details
-
RootedSubtree
Make a copy of the given rooted tree- Parameters:
tree- a rooted treeincludedTaxa-
-
-
Method Details
-
setHeight
- Parameters:
node- the node whose height is being setheight- the height
-
setLength
- Parameters:
node- the node whose branch length (to its parent) is being setlength- the length
-
getChildren
-
hasHeights
public boolean hasHeights()- Returns:
- Whether this tree has node heights available
-
getHeight
- Parameters:
node- the node whose height is being requested.- Returns:
- the height of the given node. The height will be less than the parent's height and greater than it children's heights.
-
hasLengths
public boolean hasLengths()- Returns:
- Whether this tree has branch lengths available
-
getLength
- Parameters:
node- the node whose branch length (to its parent) is being requested.- Returns:
- the length of the branch to the parent node (0.0 if the node is the root).
-
isHeightsKnown
public boolean isHeightsKnown()- Returns:
- Whether the node heights are known or need to be recalculated from the lengths
-
isLengthsKnown
public boolean isLengthsKnown()- Returns:
- Whether the branch lengths are known or need to be recalculated from the heights
-
getParent
-
getParentEdge
-
getRootNode
The root of the tree has the largest node height of all nodes in the tree.- Returns:
- the root of the tree.
-
getExternalNodes
-
getInternalNodes
-
getTaxa
-
getTaxon
-
isExternal
- Parameters:
node- the node- Returns:
- true if the node is of degree 1.
-
getNode
-
renameTaxa
-
getEdges
-
getAdjacencies
-
getEdge
Returns the Edge that connects these two nodes- Parameters:
node1-node2-- Returns:
- the edge object.
- Throws:
Graph.NoEdgeException- if the nodes are not directly connected by an edge.
-
getEdgeLength
Description copied from interface:GraphReturns the length of the edge that connects these two nodes- Parameters:
node1-node2-- Returns:
- the length of the edge connecting node1 and node2.
- Throws:
Graph.NoEdgeException- if the nodes are not directly connected by an edge.
-
getNodes
-
getNodes
-
getEdges
-
getExternalEdges
-
getInternalEdges
-
getNodes
-
setConceptuallyUnrooted
public void setConceptuallyUnrooted(boolean intent) -
conceptuallyUnrooted
public boolean conceptuallyUnrooted()Description copied from interface:RootedTreeDue to current implementation limitations, trees store "branch" information in nodes. So, internally rooted trees are genetrated when un-rooted would be more natural. This should be removed. If this is a rooted tree then it is rooted. This can really only confuse things. Trees are unrooted, RootedTrees are rooted. This is not an implementation limitation. It may be that a RootedTree has an arbitrary root but it is still rooted. With a rooted tree, it is convenient to store branch information at the node (i.e., for the branch above the node) because there is no "branch" object. Andrew. This function will probably become deprecated once the "development" tree viewer becomes in sync with the main tree viewer branch and some method of handling this concept has been introduced. Until then, this method remains.- Returns:
- true if tree(s) are to be viewed as unrooted
-
isRoot
- Parameters:
node- the node- Returns:
- true if the node is the root of this tree.
-
setAttribute
Description copied from interface:AttributableSets an named attribute for this object.- Parameters:
name- the name of the attribute.value- the new value of the attribute.
-
getAttribute
-
removeAttribute
- Parameters:
name- name of attribute to remove
-
getAttributeNames
-
getAttributeMap
Description copied from interface:AttributableGets the entire attribute map.- Returns:
- an unmodifiable map
-