All Packages Class Hierarchy This Package Previous Next Index
Interface mesquite.lib.Tree
- public abstract interface Tree
- extends mesquite.lib.Listable
This interface matches the readable methods of MesquiteTree, and was created so that translator classes could
be written that could access tree structures from other programs. Most calculations are passed trees under the
guise of interface Tree, which allows these calculations to be used on tree structures other than MesquiteTree, and
which ensures they will not modify the tree. Some modules that need to modify tree structures check to see whether the passed
Tree is an instance of AdjustableTree or MesquiteTree. The change to using interfaces (from the previous system
which just passed MesquiteTree under the name Tree) was done August 2000, and the change has not fully settled in yet.
-
BY_NAMES
- writing mode -- puts full taxon name in tree descriptions
-
BY_NUMBERS
- writing mode -- puts number of taxon in tree descriptions
-
BY_TABLE
- writing mode -- puts label from translation table, if available, in tree descriptions
-
anySelected()
-
-
anySelectedInClade(int)
- Returns whether there are any selected nodes in the clade
-
branchingAncestor(int)
- Returns the closest ancestor that has more than one daughter.
-
branchingDescendant(int)
- Returns the closest descendant that has more than one daughter, or is terminal.
-
branchLengthUnassigned(int)
-
-
cloneTree()
-
-
daughterOf(int, int)
- Returns true if branchD is an immediate daughter of branchA
-
daughtersOfNode(int)
- Returns the array of daughters of a node.
-
depthToAncestor(int, int)
- Returns depth of second branch below first; -1 if not ancestral.
-
descendantOf(int, int)
- Returns true iff first branch is a descendant of second branch.
-
dispose()
-
-
firstDaughterOfNode(int)
- Returns the first (left-most) daughter of node.
-
firstDaughterOfNodeUR(int, int)
- Returns the first (left-most) daughter of node in an UNROOTED sense where the node
is treated as descendant from anc.
-
getAssociatedBit(NameReference, int)
-
-
getAssociatedBits(int)
-
-
getAssociatedDouble(NameReference, int)
-
-
getAssociatedDoubles(int)
-
-
getAssociatedLong(NameReference, int)
-
-
getAssociatedLongs(int)
-
-
getAssociatedObject(NameReference, int)
-
-
getAssociatedObjects(int)
-
-
getBranchLength(int)
- Returns the branch length of the node.
-
getBranchLength(int, double)
- Returns the branch length of the node.
-
getFirstSelected(int)
- Gets the first node selected in clade of node node
-
getID()
-
-
getNodeLabel(int)
-
-
getNumberAssociatedBits()
-
-
getNumberAssociatedDoubles()
-
-
getNumberAssociatedLongs()
-
-
getNumberAssociatedObjects()
-
-
getNumNodeSpaces()
- Returns the number of node spaces available in storage arrays within tree object.
-
getNumTaxa()
- Returns the number of terminal taxa in the Taxa to which the tree refers.
-
getRoot()
-
-
getRooted()
-
-
getSelected(int)
-
-
getSubRoot()
-
-
getTaxa()
-
-
getTerminalTaxa(int)
- Returns list of terminal taxa of clade of node.
-
getVersionNumber()
-
-
getWhichAssociatedBits(NameReference)
-
-
getWhichAssociatedDouble(NameReference)
-
-
getWhichAssociatedLong(NameReference)
-
-
getWhichAssociatedObject(NameReference)
-
-
grandmotherOfNode(int)
- Returns the node's mother's mother.
-
hasBranchLengths()
- Returns true if tree has branch lengths.
-
hasNodeLabels()
-
-
hasPolytomies(int)
- Returns whether clade has polytomies.
-
indexedDaughterOfNode(int, int)
- Returns the indexTH daughter of node.
-
isDefined()
-
-
isLocked()
- Returns false if tree is null, has no nodes, or is locked.
-
lastDaughterOfNode(int)
- Returns the right-most daughter of node.
-
lastDaughterOfNodeUR(int, int)
- Returns the first (left-most) daughter of node in an UNROOTED sense where the node
is treated as descendant from anc.
-
leftmostTerminalOfNode(int)
- Returns the left-most terminal that is descendant from node.
-
makeAllRootings(int, TreeVector)
- Puts into TreeVector trees from each rerooting within the clade of the node passed
-
motherOfNode(int)
- Returns the immediate ancestor of node (mother) if node is non-reticulate.
-
mrca(int, int)
- Returns most recent common ancestor of two branches.
-
nextAroundUR(int, int)
- Returns the next (clockwise) to node connected to anc.
-
nextSisterOfNode(int)
- Returns the node's sister immediately to the right.
-
nextSisterOfNodeUR(int, int, int)
- Returns the node's sister immediately to the right in an UNROOTED sense where the node
is treated as descendant from anc, which is descendant from ancAnc.
-
nodeExists(int)
- Returns true if N is a valid node designation in tree.
-
nodeHasLabel(int)
-
-
nodeInTraversal(int)
- Returns indexTH node in tree traversal
-
nodeInTraversal(int, int)
- Returns indexTH node in traversal through clade
-
nodeInTree(int)
- Returns whether node is part of tree.
-
nodeIsFirstDaughter(int)
- Returns true if node is the first (leftmost) daughter of its mother.
-
nodeIsHard(int)
- Returns true if the node has one descendant, two, or is a hard polytomy.
-
nodeIsInternal(int)
- Returns true if node is an internal node.
-
nodeIsPolytomous(int)
- Returns true if the node is polytomous (has more than two daughters).
-
nodeIsSoft(int)
- Returns true if the node is a soft polytomy.
-
nodeIsTerminal(int)
- Returns true if node is a terminal node.
-
nodeOfBranchUR(int, int)
- Returns what node number in Mesquite's standard rooted sense corresponds to the anc-node branch.
-
nodeOfTaxonNumber(int)
- Returns the terminal node corresponding to the given taxon number; 0 if the taxon is not part of the tree.
-
nodesAreSisters(int, int)
- Returns true if branch1 and branch2 are sisters by their mother (i.e., primary parent).
-
numberOfDaughtersOfNode(int)
- Returns the number of daughters of the node.
-
numberOfInternalsInClade(int)
- Returns number of internal nodes in clade.
-
numberOfNodesInClade(int)
- Returns number of total nodes (internal and external) in clade.
-
numberOfParentsOfNode(int)
- Returns the number of parents of node.
-
numberOfTerminalsInClade(int)
- Returns number of terminal taxa in clade.
-
numberSelectedInClade(int)
- Returns the number of nodes selected in the clade
-
parentOfNode(int, int)
- Returns the indexTH parent of node.
-
parentsOfNode(int)
- Returns the array of parents of node.
-
previousSisterOfNode(int)
- Returns the node's sister immediately to the left.
-
rightmostTerminalOfNode(int)
- Returns the right-most terminal that is descendant from node.
-
tallestPathAboveNode(int)
-
-
tallestPathAboveNode(int, double)
-
-
tallestPathAboveNodeUR(int, int)
-
-
tallestPathAboveNodeUR(int, int, double)
- returns total of branchlengths from node up to tallest terminal
-
taxonInTree(int)
- Returns whether taxon is part of tree.
-
taxonNumberOfNode(int)
- Returns the taxon number of the node.
-
whichDaughter(int)
- Returns the index of the node among its sisters (i.e., if it is the first daughter of
its mother, the second , third, etc.
-
whichDaughterDescendantOf(int, int)
- Returns if branchD is descendant of branchA, then which daughter of branchA does it descend from?
Returns 0 if not descendant.
-
writeTree()
-
-
writeTree(int)
-
-
writeTree(int, boolean)
-
-
writeTree(int, boolean, boolean, boolean, boolean, String)
-
BY_NAMES
public static final int BY_NAMES
- writing mode -- puts full taxon name in tree descriptions
BY_NUMBERS
public static final int BY_NUMBERS
- writing mode -- puts number of taxon in tree descriptions
BY_TABLE
public static final int BY_TABLE
- writing mode -- puts label from translation table, if available, in tree descriptions
cloneTree
public abstract mesquite.lib.MesquiteTree cloneTree()
isDefined
public abstract boolean isDefined()
isLocked
public abstract boolean isLocked()
- Returns false if tree is null, has no nodes, or is locked.
getID
public abstract long getID()
getVersionNumber
public abstract long getVersionNumber()
getTaxa
public abstract mesquite.lib.Taxa getTaxa()
getRoot
public abstract int getRoot()
getSubRoot
public abstract int getSubRoot()
getRooted
public abstract boolean getRooted()
getNumTaxa
public abstract int getNumTaxa()
- Returns the number of terminal taxa in the Taxa to which the tree refers. This is not necessarily the
number of terminal taxa in the tree itself (for that, call numberOfTerminalsInClade(root)).
getNumNodeSpaces
public abstract int getNumNodeSpaces()
- Returns the number of node spaces available in storage arrays within tree object.
nodeExists
public abstract boolean nodeExists(int node)
- Returns true if N is a valid node designation in tree.
nodeInTree
public abstract boolean nodeInTree(int sought)
- Returns whether node is part of tree. Differs from nodeExists by doing full recursion (more reliable, slower).
nodeIsInternal
public abstract boolean nodeIsInternal(int node)
- Returns true if node is an internal node.
nodeIsTerminal
public abstract boolean nodeIsTerminal(int node)
- Returns true if node is a terminal node.
taxonInTree
public abstract boolean taxonInTree(int taxonNum)
- Returns whether taxon is part of tree.
taxonNumberOfNode
public abstract int taxonNumberOfNode(int node)
- Returns the taxon number of the node. This is -1 if the node is internal,
the taxon number if terminal.
nodeOfTaxonNumber
public abstract int nodeOfTaxonNumber(int taxonNum)
- Returns the terminal node corresponding to the given taxon number; 0 if the taxon is not part of the tree.
motherOfNode
public abstract int motherOfNode(int node)
- Returns the immediate ancestor of node (mother) if node is non-reticulate.
If node is reticulate, returns the first (primary) parent.
grandmotherOfNode
public abstract int grandmotherOfNode(int node)
- Returns the node's mother's mother.
numberOfParentsOfNode
public abstract int numberOfParentsOfNode(int node)
- Returns the number of parents of node.
parentOfNode
public abstract int parentOfNode(int node,
int index)
- Returns the indexTH parent of node.
parentsOfNode
public abstract int[] parentsOfNode(int node)
- Returns the array of parents of node. If node is not reticulate, the array returned contains
only the mother node.
descendantOf
public abstract boolean descendantOf(int branchD,
int branchA)
- Returns true iff first branch is a descendant of second branch.
depthToAncestor
public abstract int depthToAncestor(int branchD,
int branchA)
- Returns depth of second branch below first; -1 if not ancestral.
firstDaughterOfNode
public abstract int firstDaughterOfNode(int node)
- Returns the first (left-most) daughter of node.
lastDaughterOfNode
public abstract int lastDaughterOfNode(int node)
- Returns the right-most daughter of node.
daughtersOfNode
public abstract int[] daughtersOfNode(int node)
- Returns the array of daughters of a node. Normally it will be best to cycle through the
daughters as shown in the recursion example in the documentation for the Tree class.
daughterOf
public abstract boolean daughterOf(int branchD,
int branchA)
- Returns true if branchD is an immediate daughter of branchA
nodeIsFirstDaughter
public abstract boolean nodeIsFirstDaughter(int node)
- Returns true if node is the first (leftmost) daughter of its mother.
whichDaughter
public abstract int whichDaughter(int node)
- Returns the index of the node among its sisters (i.e., if it is the first daughter of
its mother, the second , third, etc.
indexedDaughterOfNode
public abstract int indexedDaughterOfNode(int node,
int index)
- Returns the indexTH daughter of node.
numberOfDaughtersOfNode
public abstract int numberOfDaughtersOfNode(int node)
- Returns the number of daughters of the node.
whichDaughterDescendantOf
public abstract int whichDaughterDescendantOf(int branchD,
int branchA)
- Returns if branchD is descendant of branchA, then which daughter of branchA does it descend from?
Returns 0 if not descendant.
nextSisterOfNode
public abstract int nextSisterOfNode(int node)
- Returns the node's sister immediately to the right. If the node has no
sister to the right, returns 0 (which is not a valid node designation).
previousSisterOfNode
public abstract int previousSisterOfNode(int node)
- Returns the node's sister immediately to the left. If the node has no
sister to the right, returns 0 (which is not a valid node designation).
nodesAreSisters
public abstract boolean nodesAreSisters(int branch1,
int branch2)
- Returns true if branch1 and branch2 are sisters by their mother (i.e., primary parent).
There is currently no method to return whether two nodes share at least one parent.
hasPolytomies
public abstract boolean hasPolytomies(int node)
- Returns whether clade has polytomies.
nodeIsPolytomous
public abstract boolean nodeIsPolytomous(int node)
- Returns true if the node is polytomous (has more than two daughters).
nodeIsHard
public abstract boolean nodeIsHard(int node)
- Returns true if the node has one descendant, two, or is a hard polytomy.
nodeIsSoft
public abstract boolean nodeIsSoft(int node)
- Returns true if the node is a soft polytomy.
numberOfNodesInClade
public abstract int numberOfNodesInClade(int node)
- Returns number of total nodes (internal and external) in clade.
numberOfTerminalsInClade
public abstract int numberOfTerminalsInClade(int node)
- Returns number of terminal taxa in clade.
numberOfInternalsInClade
public abstract int numberOfInternalsInClade(int node)
- Returns number of internal nodes in clade.
leftmostTerminalOfNode
public abstract int leftmostTerminalOfNode(int node)
- Returns the left-most terminal that is descendant from node.
rightmostTerminalOfNode
public abstract int rightmostTerminalOfNode(int node)
- Returns the right-most terminal that is descendant from node.
getTerminalTaxa
public abstract int[] getTerminalTaxa(int node)
- Returns list of terminal taxa of clade of node.
nodeInTraversal
public abstract int nodeInTraversal(int index)
- Returns indexTH node in tree traversal
nodeInTraversal
public abstract int nodeInTraversal(int index,
int cladeRoot)
- Returns indexTH node in traversal through clade
mrca
public abstract int mrca(int branchA,
int branchB)
- Returns most recent common ancestor of two branches.
branchingAncestor
public abstract int branchingAncestor(int node)
- Returns the closest ancestor that has more than one daughter.
branchingDescendant
public abstract int branchingDescendant(int node)
- Returns the closest descendant that has more than one daughter, or is terminal.
nextAroundUR
public abstract int nextAroundUR(int anc,
int node)
- Returns the next (clockwise) to node connected to anc. This is one of the UR procedures, designed
to allow unrooted style traversal through the tree
firstDaughterOfNodeUR
public abstract int firstDaughterOfNodeUR(int anc,
int node)
- Returns the first (left-most) daughter of node in an UNROOTED sense where the node
is treated as descendant from anc. This is one of the UR procedures, designed
to allow unrooted style traversal through the tree
nextSisterOfNodeUR
public abstract int nextSisterOfNodeUR(int ancAnc,
int anc,
int node)
- Returns the node's sister immediately to the right in an UNROOTED sense where the node
is treated as descendant from anc, which is descendant from ancAnc. If the node has no
sister to the right, returns 0 (which is not a valid node designation). This is one of the UR procedures, designed
to allow unrooted style traversal through the tree
lastDaughterOfNodeUR
public abstract int lastDaughterOfNodeUR(int anc,
int node)
- Returns the first (left-most) daughter of node in an UNROOTED sense where the node
is treated as descendant from anc. This is one of the UR procedures, designed
to allow unrooted style traversal through the tree
nodeOfBranchUR
public abstract int nodeOfBranchUR(int anc,
int node)
- Returns what node number in Mesquite's standard rooted sense corresponds to the anc-node branch.
makeAllRootings
public abstract void makeAllRootings(int cladeRoot,
mesquite.lib.TreeVector trees)
- Puts into TreeVector trees from each rerooting within the clade of the node passed
hasBranchLengths
public abstract boolean hasBranchLengths()
- Returns true if tree has branch lengths.
getBranchLength
public abstract double getBranchLength(int node)
- Returns the branch length of the node.
getBranchLength
public abstract double getBranchLength(int node,
double ifUnassigned)
- Returns the branch length of the node. If the branch length is unassigned, pass back the double passed in
branchLengthUnassigned
public abstract boolean branchLengthUnassigned(int node)
tallestPathAboveNode
public abstract double tallestPathAboveNode(int node)
tallestPathAboveNodeUR
public abstract double tallestPathAboveNodeUR(int anc,
int node)
tallestPathAboveNode
public abstract double tallestPathAboveNode(int node,
double perUnassignedLength)
tallestPathAboveNodeUR
public abstract double tallestPathAboveNodeUR(int anc,
int node,
double perUnassignedLength)
- returns total of branchlengths from node up to tallest terminal
getSelected
public abstract boolean getSelected(int node)
anySelected
public abstract boolean anySelected()
numberSelectedInClade
public abstract int numberSelectedInClade(int node)
- Returns the number of nodes selected in the clade
anySelectedInClade
public abstract boolean anySelectedInClade(int node)
- Returns whether there are any selected nodes in the clade
getFirstSelected
public abstract int getFirstSelected(int node)
- Gets the first node selected in clade of node node
getNumberAssociatedBits
public abstract int getNumberAssociatedBits()
getAssociatedBits
public abstract mesquite.lib.Bits getAssociatedBits(int index)
getWhichAssociatedBits
public abstract mesquite.lib.Bits getWhichAssociatedBits(mesquite.lib.NameReference nRef)
getAssociatedBit
public abstract boolean getAssociatedBit(mesquite.lib.NameReference nRef,
int index)
getNumberAssociatedLongs
public abstract int getNumberAssociatedLongs()
getAssociatedLongs
public abstract mesquite.lib.LongArray getAssociatedLongs(int index)
getWhichAssociatedLong
public abstract mesquite.lib.LongArray getWhichAssociatedLong(mesquite.lib.NameReference nRef)
getAssociatedLong
public abstract long getAssociatedLong(mesquite.lib.NameReference nRef,
int index)
getNumberAssociatedDoubles
public abstract int getNumberAssociatedDoubles()
getWhichAssociatedDouble
public abstract mesquite.lib.DoubleArray getWhichAssociatedDouble(mesquite.lib.NameReference nRef)
getAssociatedDoubles
public abstract mesquite.lib.DoubleArray getAssociatedDoubles(int index)
getAssociatedDouble
public abstract double getAssociatedDouble(mesquite.lib.NameReference nRef,
int index)
getNumberAssociatedObjects
public abstract int getNumberAssociatedObjects()
getAssociatedObjects
public abstract mesquite.lib.ObjectArray getAssociatedObjects(int index)
getWhichAssociatedObject
public abstract mesquite.lib.ObjectArray getWhichAssociatedObject(mesquite.lib.NameReference nRef)
getAssociatedObject
public abstract java.lang.Object getAssociatedObject(mesquite.lib.NameReference nRef,
int index)
writeTree
public abstract java.lang.String writeTree()
writeTree
public abstract java.lang.String writeTree(int byWhat)
writeTree
public abstract java.lang.String writeTree(int byWhat,
boolean associatedUseComments)
writeTree
public abstract java.lang.String writeTree(int byWhat,
boolean associatedUseComments,
boolean includeBranchLengths,
boolean includeNodeLabels,
boolean zeroBased,
java.lang.String delimiter)
hasNodeLabels
public abstract boolean hasNodeLabels()
getNodeLabel
public abstract java.lang.String getNodeLabel(int node)
nodeHasLabel
public abstract boolean nodeHasLabel(int node)
dispose
public abstract void dispose()
All Packages Class Hierarchy This Package Previous Next Index