Package pal.tree
Class SimpleTree
java.lang.Object
pal.tree.SimpleTree
- All Implemented Interfaces:
Serializable,IdGroup,Report,Units,UnitsProvider,Tree
- Direct Known Subclasses:
ClusterTree,NeighborJoiningTree,ReadTree,UPGMATree
data structure for a binary/non-binary rooted/unrooted trees
- Version:
- $Id: SimpleTree.java,v 1.23 2002/12/05 04:27:28 matt Exp $
- Author:
- Alexei Drummond, Korbinian Strimmer
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface pal.misc.IdGroup
IdGroup.UtilsNested classes/interfaces inherited from interface pal.tree.Tree
Tree.TreeBase -
Field Summary
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS -
Constructor Summary
ConstructorsConstructorDescriptionconstructor tree consisting solely of root nodeSimpleTree(Node r) constructor taking a root nodeSimpleTree(Tree tree) clone constructorSimpleTree(Tree tree, boolean keepIdentifiers) clone constructorSimpleTree(Tree tree, LabelMapping lm) clone constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidcount and list external and internal nodes and compute heights of each nodefindNode(int num) return node with number num (as displayed in ASCII tree)getAttribute(Node node, String name) getCopy()final NodegetExternalNode(int i) Returns the ith external node.final intReturns the number of external nodes.intReturns the number of identifiers in this groupgetIdentifier(int i) Returns the ith identifier.final NodegetInternalNode(int i) Returns the ith internal node.final intReturns the number of internal nodes.final NodegetRoot()Returns the root node of this tree.final intgetUnits()Return the units that this tree is expressed in.voidreport(PrintWriter out) print human readable report (e.g., on parameters and associated model)voidreroot(int num) make node with number num to root nodevoidmake provided node the root nodevoidsetAttribute(Node node, String name, Object value) Sets an named attribute for a given node.voidsetIdentifier(int i, Identifier id) Sets the ith identifier.final voidSet a new node as root node.final voidsetUnits(int units) Sets the units that this tree is expressed in.toString()intreturns the index of the identifier with the given name.
-
Constructor Details
-
SimpleTree
public SimpleTree()constructor tree consisting solely of root node -
SimpleTree
constructor taking a root node -
SimpleTree
clone constructor -
SimpleTree
clone constructor -
SimpleTree
clone constructor- Parameters:
lm- - a label mapping use for translating the original label names into something else
-
-
Method Details
-
getUnits
public final int getUnits()Return the units that this tree is expressed in.- Specified by:
getUnitsin interfaceTree- Specified by:
getUnitsin interfaceUnitsProvider- Returns:
- the units relating to this object.
-
setUnits
public final void setUnits(int units) Sets the units that this tree is expressed in. -
getExternalNodeCount
public final int getExternalNodeCount()Returns the number of external nodes.- Specified by:
getExternalNodeCountin interfaceTree- Returns:
- a count of the number of external nodes (tips) in this tree.
-
getExternalNode
Returns the ith external node.- Specified by:
getExternalNodein interfaceTree- Returns:
- the ith external node in the tree.
-
getInternalNodeCount
public final int getInternalNodeCount()Returns the number of internal nodes.- Specified by:
getInternalNodeCountin interfaceTree- Returns:
- a count of the number of internal nodes (and hence clades) in this tree.
-
getInternalNode
Returns the ith internal node.- Specified by:
getInternalNodein interfaceTree- Returns:
- the ith internal node in the tree.
-
getRoot
Returns the root node of this tree. -
setRoot
Set a new node as root node. -
createNodeList
public void createNodeList()count and list external and internal nodes and compute heights of each node- Specified by:
createNodeListin interfaceTree
-
toString
-
findNode
return node with number num (as displayed in ASCII tree)- Parameters:
num- number of node- Returns:
- node
-
setAttribute
Sets an named attribute for a given node.- Specified by:
setAttributein interfaceTree- Parameters:
node- the node whose attribute is being set.name- the name of the attribute.value- the new value of the attribute.
-
getIdCount
public int getIdCount()Description copied from interface:IdGroupReturns the number of identifiers in this group- Specified by:
getIdCountin interfaceIdGroup
-
getIdentifier
Description copied from interface:IdGroupReturns the ith identifier.- Specified by:
getIdentifierin interfaceIdGroup
-
setIdentifier
Description copied from interface:IdGroupSets the ith identifier.- Specified by:
setIdentifierin interfaceIdGroup
-
whichIdNumber
Description copied from interface:IdGroupreturns the index of the identifier with the given name.- Specified by:
whichIdNumberin interfaceIdGroup
-
getAttribute
- Specified by:
getAttributein interfaceTree- Parameters:
node- the node being interrogated.name- the name of the attribute of interest.- Returns:
- an object representing the named attributed for the numbered node.
-
reroot
public void reroot(int num) make node with number num to root node- Parameters:
num- number of node
-
reroot
make provided node the root node- Parameters:
node- the node to make the root.
-
report
Description copied from interface:Reportprint human readable report (e.g., on parameters and associated model) -
getCopy
-