All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class mesquite.lib.MesquiteTree

java.lang.Object
   |
   +----mesquite.lib.Listened
           |
           +----mesquite.lib.Associable
                   |
                   +----mesquite.lib.MesquiteTree

public class MesquiteTree
extends mesquite.lib.Associable
implements mesquite.lib.AdjustableTree, mesquite.lib.Listable, mesquite.lib.Renamable, mesquite.lib.Commandable, mesquite.lib.MesquiteListener, mesquite.lib.CompatibilityChecker, mesquite.lib.Identifiable
The basic Tree class of Mesquite. Nodes are represented by integers (Object representation of nodes is too memory-costly). Node relationships use the first daughter/next sister system to accommodate polytomies easily. Thus a recursive method can take the following form and be called initially by recurse(tree, tree.getRoot()); :
void recurse (Tree tree, int N) {
for (int d = tree.firstDaughterOfNode(N); tree.nodeExists(d); d = tree.nextSisterOfNode(d))
recurse(tree, d);
}
Daughters, sisters and parents of a node can be found using public methods.

Information can be stored at the nodes of the tree in the following ways. The first two storage sites are directly embedded within the Tree. Modules cannot store their own private information directly in the Tree, but they can use the other storage methods.

Support for special sorts of trees:


Variable Index

 o checkIntegrity
If true then after branch moves, etc., tree integrity is checked.
 o polytomyDefaultHard
True if default behavior for polytomies is as hard polytomy
 o totalCreated
A counter of the total number of Trees created (for debugging/memory leaks)
 o totalDisposed
A counter of the total number of Trees disposed (for debugging/memory leaks)

Constructor Index

 o MesquiteTree(Taxa)
The constructor, passed the Taxa on which the tree is based
 o MesquiteTree(Taxa, int, int, long)
The constructor, passed the Taxa on which the tree is based.

Method Index

 o accumulateTerminals(int, int[], MesquiteInteger)
Places into the passed array (which must have been sized correctly in advance) the taxon numbers in the clade
 o allLengthsAssigned()
Returns true if tree has all nodes with branch lengths assigned.
 o anyAttachedSensitive(Class)
Returns whether there are any sensitive attachments of the given class or a subclass
 o anySelectedInClade(int)
Returns whether there are any selected nodes in the clade
 o attachToSensitives(Object)
Attach the object to the sensitive attachments
 o branchingAncestor(int)
Returns the closest ancestor that has more than one daughter.
 o branchingDescendant(int)
Returns the closest descendant that has more than one daughter, or is terminal.
 o branchLengthUnassigned(int)
Returns whether branch length of node is unassigned.
 o changed(Object, Object, int, int[])
For MesquiteListener interface.
 o cloneTree()
Returns a clone of the tree.
 o collapseAllBranches(int, boolean)
Collapses all internal branches within clade above node, to yield bush.
 o collapseBranch(int, boolean)
Collapses branch to yield polytomy.
 o daughterOf(int, int)
Returns true if branchD is an immediate daughter of branchA
 o daughtersOfNode(int)
Returns the array of daughters of a node.
 o deleteClade(int, boolean)
Excise node and clade above it from tree, zeroing information at each node in clade.
 o depthToAncestor(int, int)
Returns depth of second branch below first; -1 if not ancestral.
 o descendantOf(int, int)
Returns true iff first branch is a descendant of second branch.
 o dispose()
Disconnects listeners
 o disposing(Object)
For MesquiteListener interface.
 o doCommand(String, String, CommandRecord, CommandChecker)
For Commandable interface; currently responds to set branch length messages and tree description writing
 o equalsCoreArrays(MesquiteTree)
Returns true if passed tree has same core array storage (same root, mothers, firstDaughter, nextSister, taxonNumber).
 o firstDaughterOfNode(int)
Returns the first (left-most) daughter of node.
 o firstDaughterOfNodeUR(int, int)
Returns the first (left-most) daughter of node in an UNROOTED sense where the node is treated as descendant from anc.
 o getAttachedSensitive(Class, int)
Returns the indexTH sensitive attachment of the given class or a subclass
 o getBranchLength(int)
Returns the branch length of the node.
 o getBranchLength(int, double)
Returns the branch length of the node.
 o getBranchLengthsVersion()
Returns branch lengths version number of tree.
 o getFirstSelected(int)
Gets the first node selected in clade of node node
 o getID()
Returns the unique id number of this tree
 o getListAttachedSensitives()
Lists attached sensitives
 o getName()
Returns the name of the tree, or "Untitled" if no name has been set.
 o getNodeLabel(int)
Gets the node label of the node
 o getNumNodeSpaces()
Returns the number of node spaces available in storage arrays within tree object.
 o getNumTaxa()
Returns the number of terminal taxa in the Taxa to which the tree refers.
 o getRoot()
Returns the root of the tree (i.e., the most recent common ancestor of the terminal taxa in the tree.
 o getRooted()
Returns whether tree is rooted.
 o getSubRoot()
Returns the subRoot of the tree (the mother of the most recent common ancestral node of the tree).
 o getTaxa()
Returns the Taxa to which the tree refers.
 o getTerminalTaxa(int)
Returns list of terminal taxa of clade of node.
 o getTopologyVersion()
Returns topology version number of tree.
 o getTreeReference(TreeReference)
 o getTreeVector()
Gets the tree vector to which the tree belongs.
 o graftClade(int, int, boolean)
Attach node fromN (and any clade to attached to it) along node toN.
 o graftTaxon(int, int, boolean)
Attach terminal taxon to tree along given branch.
 o grandmotherOfNode(int)
Returns the node's mother's mother.
 o hasBranchLengths()
Returns true if tree has branch lengths.
 o hasNodeLabels()
Returns whether the tree has node labels
 o hasPolytomies(int)
Returns whether clade has polytomies.
 o inBounds(int)
Overriding method of Associable.
 o indexedDaughterOfNode(int, int)
Returns the indexTH daughter of node (zero based).
 o insertNode(int, boolean)
Inserts a new node on the branch represented by "node", and returns the number of the inserted node
 o interchangeBranches(int, int, boolean)
Interchanges two branches of tree.
 o isCompatible(Object, MesquiteProject, EmployerEmployee)
returns true if object is set of taxa on which tree is based.
 o isDefined()
 o isLocked()
Returns whether tree is locked.
 o lastDaughterOfNode(int)
Returns the right-most daughter of node.
 o lastDaughterOfNodeUR(int, int)
Returns the first (left-most) daughter of node in an UNROOTED sense where the node is treated as descendant from anc.
 o leftmostTerminalOfNode(int)
Returns the left-most terminal that is descendant from node.
 o makeAllRootings(int, TreeVector)
makes trees for all rootings of clade above node given, and places them into TreeVector
 o motherOfNode(int)
Returns the immediate ancestor of node (mother) if node is non-reticulate.
 o moveBranch(int, int, boolean)
Move branch so as to excise branchFrom from its current position, and attach it to branch beneath node branchTo.
 o mrca(int, int)
Returns most recent common ancestor of two branches.
 o nextAroundUR(int, int)
Returns the next (clockwise) to node connected to anc.
 o nextSisterOfNode(int)
Returns the node's sister immediately to the right.
 o 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.
 o nodeExists(int)
Returns true if N is a valid node designation in tree.
 o nodeHasLabel(int)
Returns whether the node has a label
 o nodeInTraversal(int)
Returns indexTH node in tree traversal
 o nodeInTraversal(int, int)
Returns indexTH node in traversal through clade
 o nodeInTree(int)
Returns whether node is part of tree.
 o nodeIsFirstDaughter(int)
Returns true if node is the first (leftmost) daughter of its mother.
 o nodeIsHard(int)
Returns true if the node has one descendant, two, or is a hard polytomy.
 o nodeIsInternal(int)
Returns true if node is an internal node.
 o nodeIsPolytomous(int)
Returns true if the node is polytomous (has more than two daughters).
 o nodeIsSoft(int)
Returns true if the node is a soft polytomy.
 o nodeIsTerminal(int)
Returns true if node is a terminal node.
 o nodeOfBranchUR(int, int)
Returns what node number in Mesquite's standard rooted sense corresponds to the anc-node branch.
 o nodeOfLabel(String)
Finds the node with the given label
 o nodeOfLabel(String, boolean)
Finds the node with the given label
 o nodeOfTaxonNumber(int)
Returns the terminal node corresponding to the given taxon number; 0 if the taxon is not part of the tree.
 o nodesAreSisters(int, int)
Returns true if branch1 and branch2 are sisters by their mother (i.e., primary parent).
 o numberAttachedSensitive(Class)
Returns the number of sensitive attachments of the given class or a subclass
 o numberOfDaughtersOfNode(int)
Returns the number of daughters of the node.
 o numberOfDichotomousTrees(int)
returns the number of dichotomous trees with the passed number of terminal taxa.
 o numberOfInternalsInClade(int)
Returns number of internal nodes in clade.
 o numberOfNodesInClade(int)
Returns number of total nodes (internal and external) in clade.
 o numberOfParentsOfNode(int)
Returns the number of parents of node.
 o numberOfTerminalsInClade(int)
Returns number of terminal taxa in clade.
 o numberSelectedInClade(int)
Returns the number of nodes selected in the clade
 o OK(Tree)
Returns false if tree is null, has no nodes, or is locked.
 o okToDispose(Object, int)
For MesquiteListener interface.
 o parentOfNode(int, int)
Returns the indexTH parent of node.
 o parentsOfNode(int)
Returns the array of parents of node.
 o previousSisterOfNode(int)
Returns the node's sister immediately to the left.
 o readTree(String)
Reads the tree description string and sets the tree object to store the tree described.
 o removeAllSensitives()
Remove all objects from the sensitive attachments
 o removeFromSensitives(Object)
Remove the object from the sensitive attachments
 o reroot(int, int, boolean)
reroot the clade below node atNode.
 o rightmostTerminalOfNode(int)
Returns the right-most terminal that is descendant from node.
 o sameTreeVersions(TreeReference, boolean, boolean)
 o scaleAllBranchLengths(double, boolean)
Sets the branch length of node.
 o setAllBranchLengths(double, boolean)
Sets the branch length of node.
 o setAsDefined(boolean)
 o setBranchLength(int, double, boolean)
Sets the branch length of node.
 o setBranchLength(int, int, boolean)
Sets the branch length of node (stored as a double internally).
 o setLocked()
Locks the tree (Currently, not used properly!!!!).
 o setName(String)
Sets the name of the tree.
 o setNameLock(boolean)
Sets whether name is locked
 o setNodeLabel(String, int)
Sets the node label to the passed string (doesn't copy string; just uses reference)
 o setParentOfNode(int, int, boolean)
Sets par to be an additional parent of node.
 o setRooted(boolean, boolean)
Sets whether tree is rooted.
 o setTaxonNumber(int, int, boolean)
Sets the taxon number for the node.
 o setToClone(MesquiteTree)
Sets this tree to be a clone of that passed.
 o setToDefaultBush(int, boolean)
Sets the tree to be a default bush.
 o setToDefaultLadder(int, boolean)
Sets the tree to be a default ladder.
 o setToFirstInSequence()
Returns the first tree in the sequence of all possible trees (polytomies are set to first resolution)
 o setToNextInSequence()
Returns the next tree in the sequence of all possible trees (polytomies are set to first resolution)
 o setTreeVector(TreeVector)
Sets the tree vector to which the tree belongs.
 o shortestPathAboveNode(int, double)
returns total of branchlengths from node up to shortest terminal, with unassigned lengths given value "perUnassignedLength"
 o snipClade(int, boolean)
Excise node and clade above it from tree but leave the clade intact, in case it is to be attached elsewhere.
 o splitTerminal(int, int, boolean)
Branches a terminal node off taxon number taxonNum, and assigns it taxon newNumber
 o sproutDaughter(int, boolean)
Sprouts a new daughter from node and returns it.
 o standardize(int, boolean)
Puts clade in standard arrangement, such that smaller clades to left, and if sister clades have same number of terminals, then with one with lowest numbered terminal to left.
 o standardNumNodeSpaces(int)
Returns the base numNodeSpaces used for a tree of numTaxa taxa; a convenient starting point for modules that need to allocate space for storage for nodes but which don't yet have a tree in hand.
 o standardNumNodeSpaces(Taxa)
Returns the base numNodeSpaces used for a tree for the passed taxa; a convenient starting point for modules that need to allocate space for storage for nodes but which don't yet have a tree in hand.
 o tallestPathAboveNode(int)
returns total of branchlengths from node up to tallest terminal
 o tallestPathAboveNode(int, double)
returns total of branchlengths from node up to tallest terminal, with unassigned lengths given value "perUnassignedLength"
 o tallestPathAboveNodeUR(int, int)
returns total of branchlengths from node up to tallest terminal
 o tallestPathAboveNodeUR(int, int, double)
returns total of branchlengths from node up to tallest terminal
 o taxonInTree(int)
Returns whether taxon is part of tree.
 o taxonNumberOfNode(int)
Returns the taxon number of the node.
 o toExternal(int)
Translates internal numbering system to external (currently, 0 based to 1 based)
 o toInternal(int)
Translates external numbering system to internal (currently, 1 based to 0 based)
 o toString()
Outputs as string; currently returns name if the tree exists, otherwise calls super.toString()
 o upToDateWithTaxa()
 o whichDaughter(int)
Returns the index of the node among its sisters (i.e., if it is daughter number 0 of its mother, 1, 2, etc.
 o whichDaughterDescendantOf(int, int)
Returns if branchD is descendant of branchA, then which daughter of branchA does it descend from? Returns 0 if not descendant.
 o writeTree()
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon numbers to refer to the taxa.
 o writeTree(int)
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon names or numbers to refer to the taxa, depending on the boolean parameter byNames.
 o writeTree(int, boolean)
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon names or numbers to refer to the taxa, depending on the boolean parameter byNames.
 o writeTree(int, boolean, boolean, boolean, boolean, String)
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon names or numbers to refer to the taxa, depending on the boolean parameter byNames.
 o writeTreeWithNodeNumbers()
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon numbers to refer to the taxa.

Variables

 o polytomyDefaultHard
 public static boolean polytomyDefaultHard
True if default behavior for polytomies is as hard polytomy

 o totalCreated
 public static long totalCreated
A counter of the total number of Trees created (for debugging/memory leaks)

 o totalDisposed
 public static long totalDisposed
A counter of the total number of Trees disposed (for debugging/memory leaks)

 o checkIntegrity
 public static boolean checkIntegrity
If true then after branch moves, etc., tree integrity is checked.

Constructors

 o MesquiteTree
 public MesquiteTree(mesquite.lib.Taxa taxa)
The constructor, passed the Taxa on which the tree is based

 o MesquiteTree
 public MesquiteTree(mesquite.lib.Taxa taxa,
                     int numTaxa,
                     int numNodeSpaces,
                     long taxaVersion)
The constructor, passed the Taxa on which the tree is based. This initializer is used only for cloning, as it prepares for an exact copy of the tree even if it's currently out of date

Methods

 o cloneTree
 public mesquite.lib.MesquiteTree cloneTree()
Returns a clone of the tree.

 o setToClone
 public void setToClone(mesquite.lib.MesquiteTree tree)
Sets this tree to be a clone of that passed.

 o upToDateWithTaxa
 public boolean upToDateWithTaxa()
 o equalsCoreArrays
 public boolean equalsCoreArrays(mesquite.lib.MesquiteTree tree)
Returns true if passed tree has same core array storage (same root, mothers, firstDaughter, nextSister, taxonNumber).

 o standardNumNodeSpaces
 public static int standardNumNodeSpaces(int numTaxa)
Returns the base numNodeSpaces used for a tree of numTaxa taxa; a convenient starting point for modules that need to allocate space for storage for nodes but which don't yet have a tree in hand.

 o standardNumNodeSpaces
 public static int standardNumNodeSpaces(mesquite.lib.Taxa taxa)
Returns the base numNodeSpaces used for a tree for the passed taxa; a convenient starting point for modules that need to allocate space for storage for nodes but which don't yet have a tree in hand.

 o getID
 public long getID()
Returns the unique id number of this tree

 o getName
 public java.lang.String getName()
Returns the name of the tree, or "Untitled" if no name has been set.

 o setName
 public void setName(java.lang.String name)
Sets the name of the tree.

 o setNameLock
 public void setNameLock(boolean lock)
Sets whether name is locked

 o getTopologyVersion
 public long getTopologyVersion()
Returns topology version number of tree. Version number should be incremented with each change in topology.

 o getBranchLengthsVersion
 public long getBranchLengthsVersion()
Returns branch lengths version number of tree. Version number should be incremented with each change in branch lengths.

 o sameTreeVersions
 public boolean sameTreeVersions(mesquite.lib.TreeReference tr,
                                 boolean checkBranchLengths,
                                 boolean exact)
 o getTreeReference
 public mesquite.lib.TreeReference getTreeReference(mesquite.lib.TreeReference tr)
 o getTaxa
 public mesquite.lib.Taxa getTaxa()
Returns the Taxa to which the tree refers.

 o isCompatible
 public boolean isCompatible(java.lang.Object obj,
                             mesquite.lib.MesquiteProject project,
                             mesquite.lib.EmployerEmployee prospectiveEmployer)
returns true if object is set of taxa on which tree is based. For CompatibilityChecker interface

 o isDefined
 public boolean isDefined()
 o setAsDefined
 public void setAsDefined(boolean defined)
 o OK
 public static boolean OK(mesquite.lib.Tree tree)
Returns false if tree is null, has no nodes, or is locked.

 o setTreeVector
 public void setTreeVector(mesquite.lib.TreeVector treeVector)
Sets the tree vector to which the tree belongs.

 o getTreeVector
 public mesquite.lib.TreeVector getTreeVector()
Gets the tree vector to which the tree belongs.

 o dispose
 public void dispose()
Disconnects listeners

Overrides:
dispose in class mesquite.lib.Associable
 o doCommand
 public java.lang.Object doCommand(java.lang.String commandName,
                                   java.lang.String arguments,
                                   mesquite.lib.CommandRecord commandRec,
                                   mesquite.lib.CommandChecker checker)
For Commandable interface; currently responds to set branch length messages and tree description writing

Overrides:
doCommand in class mesquite.lib.Associable
 o getRoot
 public int getRoot()
Returns the root of the tree (i.e., the most recent common ancestor of the terminal taxa in the tree.

 o getSubRoot
 public int getSubRoot()
Returns the subRoot of the tree (the mother of the most recent common ancestral node of the tree). The subroot exists so that some traversals (including for drawing the root branch) don't choke when they come to the root and look for an ancestor.

 o setRooted
 public void setRooted(boolean rooted,
                       boolean notify)
Sets whether tree is rooted.

 o getRooted
 public boolean getRooted()
Returns whether tree is rooted.

 o getNumTaxa
 public 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)).

 o getNumNodeSpaces
 public int getNumNodeSpaces()
Returns the number of node spaces available in storage arrays within tree object.

 o nodeExists
 public boolean nodeExists(int node)
Returns true if N is a valid node designation in tree.

 o inBounds
 protected boolean inBounds(int node)
Overriding method of Associable.

Overrides:
inBounds in class mesquite.lib.Associable
 o nodeIsInternal
 public boolean nodeIsInternal(int node)
Returns true if node is an internal node.

 o nodeIsTerminal
 public boolean nodeIsTerminal(int node)
Returns true if node is a terminal node.

 o taxonNumberOfNode
 public int taxonNumberOfNode(int node)
Returns the taxon number of the node. This is -1 if the node is internal, the taxon number if terminal.

 o nodeOfTaxonNumber
 public int nodeOfTaxonNumber(int taxonNum)
Returns the terminal node corresponding to the given taxon number; 0 if the taxon is not part of the tree.

 o setTaxonNumber
 public void setTaxonNumber(int node,
                            int num,
                            boolean notify)
Sets the taxon number for the node. If the node is internal, the number should be set to -1. Otherwise it should be set to the taxon corresponding to the node. NOTE: this should be used with caution, since it doesn't check for tree integrity. Intended primarily for internal use (with MesquiteTree).

 o motherOfNode
 public 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.

 o grandmotherOfNode
 public int grandmotherOfNode(int node)
Returns the node's mother's mother.

 o numberOfParentsOfNode
 public int numberOfParentsOfNode(int node)
Returns the number of parents of node.

 o parentOfNode
 public int parentOfNode(int node,
                         int index)
Returns the indexTH parent of node.

 o parentsOfNode
 public int[] parentsOfNode(int node)
Returns the array of parents of node. If node is not reticulate, the array returned contains only the mother node.

 o setParentOfNode
 public void setParentOfNode(int node,
                             int par,
                             boolean notify)
Sets par to be an additional parent of node. Used to make reticulations. Currently there is no way to subtract parents, nor to rearrange trees that contain reticulations.

 o descendantOf
 public boolean descendantOf(int branchD,
                             int branchA)
Returns true iff first branch is a descendant of second branch.

 o depthToAncestor
 public int depthToAncestor(int branchD,
                            int branchA)
Returns depth of second branch below first; -1 if not ancestral.

 o firstDaughterOfNode
 public int firstDaughterOfNode(int node)
Returns the first (left-most) daughter of node.

 o lastDaughterOfNode
 public int lastDaughterOfNode(int node)
Returns the right-most daughter of node.

 o daughtersOfNode
 public 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.

 o daughterOf
 public boolean daughterOf(int branchD,
                           int branchA)
Returns true if branchD is an immediate daughter of branchA

 o nodeIsFirstDaughter
 public boolean nodeIsFirstDaughter(int node)
Returns true if node is the first (leftmost) daughter of its mother.

 o whichDaughter
 public int whichDaughter(int node)
Returns the index of the node among its sisters (i.e., if it is daughter number 0 of its mother, 1, 2, etc. (zero based).

 o indexedDaughterOfNode
 public int indexedDaughterOfNode(int node,
                                  int index)
Returns the indexTH daughter of node (zero based).

 o numberOfDaughtersOfNode
 public int numberOfDaughtersOfNode(int node)
Returns the number of daughters of the node.

 o whichDaughterDescendantOf
 public 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.

 o nextSisterOfNode
 public 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).

 o previousSisterOfNode
 public 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).

 o nodesAreSisters
 public 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.

 o hasPolytomies
 public boolean hasPolytomies(int node)
Returns whether clade has polytomies.

 o nodeIsPolytomous
 public boolean nodeIsPolytomous(int node)
Returns true if the node is polytomous (has more than two daughters).

 o nodeIsHard
 public boolean nodeIsHard(int node)
Returns true if the node has one descendant, two, or is a hard polytomy.

 o nodeIsSoft
 public boolean nodeIsSoft(int node)
Returns true if the node is a soft polytomy.

 o numberOfNodesInClade
 public int numberOfNodesInClade(int node)
Returns number of total nodes (internal and external) in clade.

 o numberOfTerminalsInClade
 public int numberOfTerminalsInClade(int node)
Returns number of terminal taxa in clade.

 o numberOfInternalsInClade
 public int numberOfInternalsInClade(int node)
Returns number of internal nodes in clade.

 o leftmostTerminalOfNode
 public int leftmostTerminalOfNode(int node)
Returns the left-most terminal that is descendant from node.

 o rightmostTerminalOfNode
 public int rightmostTerminalOfNode(int node)
Returns the right-most terminal that is descendant from node.

 o getTerminalTaxa
 public int[] getTerminalTaxa(int node)
Returns list of terminal taxa of clade of node.

 o nodeInTree
 public boolean nodeInTree(int sought)
Returns whether node is part of tree. Differs from nodeExists by doing full recursion (more reliable, slower).

 o taxonInTree
 public boolean taxonInTree(int taxonNum)
Returns whether taxon is part of tree.

 o nodeInTraversal
 public int nodeInTraversal(int index)
Returns indexTH node in tree traversal

 o nodeInTraversal
 public int nodeInTraversal(int index,
                            int cladeRoot)
Returns indexTH node in traversal through clade

 o mrca
 public int mrca(int branchA,
                 int branchB)
Returns most recent common ancestor of two branches.

 o branchingAncestor
 public int branchingAncestor(int node)
Returns the closest ancestor that has more than one daughter.

 o branchingDescendant
 public int branchingDescendant(int node)
Returns the closest descendant that has more than one daughter, or is terminal.

 o nextAroundUR
 public 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

 o firstDaughterOfNodeUR
 public 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

 o nextSisterOfNodeUR
 public 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

 o lastDaughterOfNodeUR
 public 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

 o nodeOfBranchUR
 public int nodeOfBranchUR(int anc,
                           int node)
Returns what node number in Mesquite's standard rooted sense corresponds to the anc-node branch.

 o hasBranchLengths
 public boolean hasBranchLengths()
Returns true if tree has branch lengths.

 o allLengthsAssigned
 public boolean allLengthsAssigned()
Returns true if tree has all nodes with branch lengths assigned.

 o getBranchLength
 public double getBranchLength(int node)
Returns the branch length of the node.

 o getBranchLength
 public 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

 o setAllBranchLengths
 public void setAllBranchLengths(double length,
                                 boolean notify)
Sets the branch length of node.

 o scaleAllBranchLengths
 public void scaleAllBranchLengths(double factor,
                                   boolean notify)
Sets the branch length of node.

 o setBranchLength
 public void setBranchLength(int node,
                             int length,
                             boolean notify)
Sets the branch length of node (stored as a double internally).

 o setBranchLength
 public void setBranchLength(int node,
                             double length,
                             boolean notify)
Sets the branch length of node.

 o branchLengthUnassigned
 public boolean branchLengthUnassigned(int node)
Returns whether branch length of node is unassigned.

 o tallestPathAboveNode
 public double tallestPathAboveNode(int node)
returns total of branchlengths from node up to tallest terminal

 o tallestPathAboveNodeUR
 public double tallestPathAboveNodeUR(int anc,
                                      int node)
returns total of branchlengths from node up to tallest terminal

 o tallestPathAboveNodeUR
 public double tallestPathAboveNodeUR(int anc,
                                      int node,
                                      double perUnassignedLength)
returns total of branchlengths from node up to tallest terminal

 o tallestPathAboveNode
 public double tallestPathAboveNode(int node,
                                    double perUnassignedLength)
returns total of branchlengths from node up to tallest terminal, with unassigned lengths given value "perUnassignedLength"

 o shortestPathAboveNode
 public double shortestPathAboveNode(int node,
                                     double perUnassignedLength)
returns total of branchlengths from node up to shortest terminal, with unassigned lengths given value "perUnassignedLength"

 o readTree
 public void readTree(java.lang.String TreeDescription)
Reads the tree description string and sets the tree object to store the tree described.

 o setToDefaultBush
 public void setToDefaultBush(int numTaxa,
                              boolean notify)
Sets the tree to be a default bush.

 o setToDefaultLadder
 public void setToDefaultLadder(int numTaxa,
                                boolean notify)
Sets the tree to be a default ladder.

 o writeTree
 public java.lang.String writeTree(int byWhat,
                                   boolean associatedUseComments,
                                   boolean includeBranchLengths,
                                   boolean includeNodeLabels,
                                   boolean zeroBased,
                                   java.lang.String delimiter)
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon names or numbers to refer to the taxa, depending on the boolean parameter byNames.

 o toString
 public java.lang.String toString()
Outputs as string; currently returns name if the tree exists, otherwise calls super.toString()

Overrides:
toString in class java.lang.Object
 o writeTreeWithNodeNumbers
 public java.lang.String writeTreeWithNodeNumbers()
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon numbers to refer to the taxa.

 o writeTree
 public java.lang.String writeTree()
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon numbers to refer to the taxa.

 o writeTree
 public java.lang.String writeTree(int byWhat)
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon names or numbers to refer to the taxa, depending on the boolean parameter byNames.

 o writeTree
 public java.lang.String writeTree(int byWhat,
                                   boolean associatedUseComments)
Returns a string describing the tree in standard parenthesis notation (Newick standard), using taxon names or numbers to refer to the taxa, depending on the boolean parameter byNames.

 o splitTerminal
 public synchronized void splitTerminal(int taxonNum,
                                        int newNumber,
                                        boolean notify)
Branches a terminal node off taxon number taxonNum, and assigns it taxon newNumber

 o sproutDaughter
 public synchronized int sproutDaughter(int node,
                                        boolean notify)
Sprouts a new daughter from node and returns it.

 o standardize
 public synchronized boolean standardize(int node,
                                         boolean notify)
Puts clade in standard arrangement, such that smaller clades to left, and if sister clades have same number of terminals, then with one with lowest numbered terminal to left. NOTE: in future will pass two booleans to control sort order

 o interchangeBranches
 public synchronized boolean interchangeBranches(int node,
                                                 int otherNode,
                                                 boolean notify)
Interchanges two branches of tree.

 o collapseBranch
 public synchronized boolean collapseBranch(int node,
                                            boolean notify)
Collapses branch to yield polytomy.

 o collapseAllBranches
 public synchronized boolean collapseAllBranches(int node,
                                                 boolean notify)
Collapses all internal branches within clade above node, to yield bush.

 o deleteClade
 public synchronized boolean deleteClade(int node,
                                         boolean notify)
Excise node and clade above it from tree, zeroing information at each node in clade.

 o snipClade
 public synchronized boolean snipClade(int node,
                                       boolean notify)
Excise node and clade above it from tree but leave the clade intact, in case it is to be attached elsewhere.

 o graftTaxon
 public synchronized boolean graftTaxon(int taxon,
                                        int toN,
                                        boolean notify)
Attach terminal taxon to tree along given branch.

 o graftClade
 public synchronized int graftClade(int fromN,
                                    int toN,
                                    boolean notify)
Attach node fromN (and any clade to attached to it) along node toN. Returns the new node created to attach fromN

 o moveBranch
 public synchronized boolean moveBranch(int branchFrom,
                                        int branchTo,
                                        boolean notify)
Move branch so as to excise branchFrom from its current position, and attach it to branch beneath node branchTo. If successful, rename as given (to ensure renamed before notified).

 o insertNode
 public synchronized int insertNode(int node,
                                    boolean notify)
Inserts a new node on the branch represented by "node", and returns the number of the inserted node

 o reroot
 public synchronized boolean reroot(int atNode,
                                    int cladeRoot,
                                    boolean notify)
reroot the clade below node atNode.

 o makeAllRootings
 public void makeAllRootings(int cladeRoot,
                             mesquite.lib.TreeVector trees)
makes trees for all rootings of clade above node given, and places them into TreeVector

 o accumulateTerminals
 public void accumulateTerminals(int node,
                                 int terminals[],
                                 mesquite.lib.MesquiteInteger next)
Places into the passed array (which must have been sized correctly in advance) the taxon numbers in the clade

 o setToFirstInSequence
 public void setToFirstInSequence()
Returns the first tree in the sequence of all possible trees (polytomies are set to first resolution)

 o setToNextInSequence
 public boolean setToNextInSequence()
Returns the next tree in the sequence of all possible trees (polytomies are set to first resolution)

 o hasNodeLabels
 public boolean hasNodeLabels()
Returns whether the tree has node labels

 o setNodeLabel
 public void setNodeLabel(java.lang.String s,
                          int node)
Sets the node label to the passed string (doesn't copy string; just uses reference)

 o getNodeLabel
 public java.lang.String getNodeLabel(int node)
Gets the node label of the node

 o nodeHasLabel
 public boolean nodeHasLabel(int node)
Returns whether the node has a label

 o nodeOfLabel
 public int nodeOfLabel(java.lang.String s)
Finds the node with the given label

 o nodeOfLabel
 public int nodeOfLabel(java.lang.String s,
                        boolean caseSensitive)
Finds the node with the given label

 o isLocked
 public boolean isLocked()
Returns whether tree is locked.

 o setLocked
 public void setLocked()
Locks the tree (Currently, not used properly!!!!).

 o anySelectedInClade
 public boolean anySelectedInClade(int node)
Returns whether there are any selected nodes in the clade

 o numberSelectedInClade
 public int numberSelectedInClade(int node)
Returns the number of nodes selected in the clade

 o getFirstSelected
 public int getFirstSelected(int node)
Gets the first node selected in clade of node node

 o attachToSensitives
 public void attachToSensitives(java.lang.Object obj)
Attach the object to the sensitive attachments

 o removeFromSensitives
 public void removeFromSensitives(java.lang.Object obj)
Remove the object from the sensitive attachments

 o removeAllSensitives
 public void removeAllSensitives()
Remove all objects from the sensitive attachments

 o anyAttachedSensitive
 public boolean anyAttachedSensitive(java.lang.Class c)
Returns whether there are any sensitive attachments of the given class or a subclass

 o numberAttachedSensitive
 public int numberAttachedSensitive(java.lang.Class c)
Returns the number of sensitive attachments of the given class or a subclass

 o getAttachedSensitive
 public java.lang.Object getAttachedSensitive(java.lang.Class c,
                                              int index)
Returns the indexTH sensitive attachment of the given class or a subclass

 o getListAttachedSensitives
 public java.lang.String getListAttachedSensitives()
Lists attached sensitives

 o changed
 public void changed(java.lang.Object caller,
                     java.lang.Object obj,
                     int code,
                     int parameters[])
For MesquiteListener interface. Passes which object changed, along with optional integer (e.g. for character)

 o disposing
 public void disposing(java.lang.Object obj)
For MesquiteListener interface. Passes which object was disposed

 o okToDispose
 public boolean okToDispose(java.lang.Object obj,
                            int queryUser)
For MesquiteListener interface. Asks whether it's ok to delete the object as far as the listener is concerned (e.g., is it in use?)

 o toExternal
 public static int toExternal(int i)
Translates internal numbering system to external (currently, 0 based to 1 based)

 o toInternal
 public static int toInternal(int i)
Translates external numbering system to internal (currently, 1 based to 0 based)

 o numberOfDichotomousTrees
 public static java.math.BigInteger numberOfDichotomousTrees(int numTaxa)
returns the number of dichotomous trees with the passed number of terminal taxa. At 12 this is greater than the maximum int.


All Packages  Class Hierarchy  This Package  Previous  Next  Index