|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jebl.evolution.trees.RootedFromUnrooted
public class RootedFromUnrooted
Root an unrooted tree. This class works as a wrapper over any tree to root it. There are two constructors, one which roots the tree at any internal node, the other roots the tree between any two internal nodes. Be aware that rooting between nodes where one of them has less than 3 adjacencies may be problematic when converting back from the Newick format.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface jebl.evolution.graphs.Graph |
---|
Graph.NoEdgeException, Graph.Utils |
Constructor Summary | |
---|---|
RootedFromUnrooted(Tree source,
Node root,
boolean intent)
Root tree source at root. |
|
RootedFromUnrooted(Tree source,
Node left,
Node right,
double fromLeft)
Root source by creating a new internal node whose children are (the adjacent) left and right. |
Method Summary | |
---|---|
boolean |
conceptuallyUnrooted()
Due to current implementation limitations, trees store "branch" information in nodes. |
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 |
removeAttribute(String name)
|
void |
setAttribute(String name,
Object value)
Sets an named attribute for this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RootedFromUnrooted(Tree source, Node root, boolean intent)
source
- root
- public RootedFromUnrooted(Tree source, Node left, Node right, double fromLeft)
source
- left
- right
- fromLeft
- branch from new root to left node.Method Detail |
---|
public List<Node> getChildren(Node node)
getChildren
in interface RootedTree
node
- the node whose children are being requested.
public boolean hasHeights()
hasHeights
in interface RootedTree
public double getHeight(Node node)
getHeight
in interface RootedTree
node
- the node whose height is being requested.
public boolean hasLengths()
hasLengths
in interface RootedTree
public double getLength(Node node)
getLength
in interface RootedTree
node
- the node whose branch length (to its parent) is being requested.
public Node getParent(Node node)
getParent
in interface RootedTree
node
- the node whose parent is requested
public Node getRootNode()
RootedTree
getRootNode
in interface RootedTree
public boolean conceptuallyUnrooted()
RootedTree
conceptuallyUnrooted
in interface RootedTree
public Set<Node> getExternalNodes()
getExternalNodes
in interface Tree
public Set<Node> getInternalNodes()
getInternalNodes
in interface Tree
public Set<Taxon> getTaxa()
getTaxa
in interface Tree
public Taxon getTaxon(Node node)
getTaxon
in interface Tree
node
- the node whose associated taxon is being requested.
public boolean isExternal(Node node)
isExternal
in interface Tree
node
- the node
public Node getNode(Taxon taxon)
getNode
in interface Tree
taxon
- the taxon
public List<Edge> getEdges(Node node)
getEdges
in interface Graph
node
-
public Node[] getNodes(Edge edge)
Graph
getNodes
in interface Graph
public List<Node> getAdjacencies(Node node)
Graph
getAdjacencies
in interface Graph
public double getEdgeLength(Node node1, Node node2) throws Graph.NoEdgeException
Graph
getEdgeLength
in interface Graph
Graph.NoEdgeException
- if the nodes are not directly connected by an edge.public Edge getEdge(Node node1, Node node2) throws Graph.NoEdgeException
Graph
getEdge
in interface Graph
Graph.NoEdgeException
- if the nodes are not directly connected by an edge.public Set<Node> getNodes()
getNodes
in interface Graph
public Set<Edge> getEdges()
getEdges
in interface Graph
public Set<Edge> getExternalEdges()
getExternalEdges
in interface Tree
public Set<Edge> getInternalEdges()
getInternalEdges
in interface Tree
public Set<Node> getNodes(int degree)
getNodes
in interface Graph
degree
- the number of edges connected to a node
public boolean isRoot(Node node)
isRoot
in interface RootedTree
node
- the node
public void setAttribute(String name, Object value)
Attributable
setAttribute
in interface Attributable
name
- the name of the attribute.value
- the new value of the attribute.public Object getAttribute(String name)
getAttribute
in interface Attributable
name
- the name of the attribute of interest.
public void removeAttribute(String name)
removeAttribute
in interface Attributable
name
- name of attribute to removepublic Set<String> getAttributeNames()
getAttributeNames
in interface Attributable
public 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 |