forester v1.3

forester.tree
Class Node

java.lang.Object
  |
  +--forester.tree.Node
All Implemented Interfaces:
java.io.Serializable

public class Node
extends java.lang.Object
implements java.io.Serializable

Version:
1.252 -- last modified: 10/11/00
Author:
Christian M. Zmasek
See Also:
Serialized Form

Field Summary
static int BOOTSTRAP_DEFAULT
          Value of -99 is used as default value.
static double DISTANCE_DEFAULT
          Value of -99.0 is used as default value.
static double DISTANCE_NULL
          Value of -100 is used to indicate that the branch does not exist.
static int TAXO_ID_DEFAULT
          Value of -99 is used as default value.
 
Constructor Summary
Node()
          Default constructor for Node.
Node(java.lang.String s)
          Constructor for Node.
 
Method Summary
 boolean collapse()
          Returns whether this Node should be drawn as collapsed.
static boolean compareArraysOfNodes(Node[] nodes1, Node[] nodes2)
          Returns true if Node arrays nodes1 and nodes2 are equal, false otherwise.
static boolean compareSeqNamesInArraysOfNodes(Node[] nodes1, Node[] nodes2)
          Returns true if Node arrays nodes1 and nodes2 are equal, false otherwise.
 Node[] copyAllExtChildren()
          Returns a array containing copies all external children of this Node.
 Node copyNodeData()
          Returns a new Node which has its data copied from this Node.
 void deleteData()
          Deletes data of this Node.
 boolean equals(Node node)
          Compares this Node with Node node.
 java.util.Vector getAllChildren()
          Returns a Vector containing references to all (both internal and external) children of this Node.
 java.util.Vector getAllExternalChildren()
          Returns a Vector containing references to all external children of this Node.
 double getBlOfSeqOnParentBranch()
          Returns the resulting (ML) branch length of a Node placed on the parent branch of this Node (double).
 int getBootstrap()
          Returns the bootstrap value (int) of this Node.
 Node getChild1()
          Returns a refernce to the first child Node of this Node.
 Node getChild2()
          Returns a refernce to the second child Node of this Node.
 double getDistanceToParent()
          Returns the length of the branch leading to the parent of this Node (double).
 java.lang.String getECnumber()
          Returns the EC number associated with this Node (as String).
 int getID()
          Returns the ID (int) of this Node.
 int getIndicator()
          Returns the indicator value of this Node (int).
 Node getLink()
          Returns a refernce to the linked Node of this Node.
 double getLnLonParentBranch()
          Returns the log likelihood value associated with the branch leading to the parent of this Node (double).
 Node getNextExtNode()
          Returns a refernce to the next external Node of this Node.
static int getNodeCount()
          Returns the total number of all Nodes created so far.
 java.lang.String getOrigSeqName()
          Returns the original (unchanged) name of the sequence associated with this Node (String).
 Node getParent()
          Returns a refernce to the parent Node of this Node.
 Node getPrevExtNode()
          Returns a refernce to the previous external Node of this Node.
 java.lang.String getSeqName()
          Returns the name of the sequence associated with this Node (String).
 java.lang.String getSpecies()
          Returns the name of the species associated with this Node (String).
 int getSumExtNodes()
          Returns the total number of external Nodes originating from this Node (int).
 int getTaxonomyID()
          Returns the NCBI Taxonomy ID (int) of this Node.
 java.util.Vector getVector()
          Returns a refernce to the Vector associated with this Node.
 int getXcoord()
          Used for drawing of Trees.
 int getYcoord()
          Used for drawing of Trees.
static void increaseNodeCount()
          Increases the total number of all Nodes created so far by one.
 boolean isChild1()
          Returns true if this Node is the first child of its parent Node.
 boolean isDuplication()
          Returns true if this Node represents a duplication event, false otherwise.
 boolean isDuplicationOrSpecAssigned()
          Returns whether a duplication or speciation event has been assigned for this Node.
 boolean isExternal()
          Checks whether this Node is external (tip).
 boolean isLnLonParentBranchAssigned()
          Returns whether a log likelihood value associated with the branch leading to the parent of this Node has been assigned.
 boolean isPseudoNode()
          Checks whether this Node is a pseudo Node, i.e.
 boolean isRoot()
          Checks whether this Node is a root.
 void preorderPrint()
          Prints to the console the subtree originating from this Node in preorder.
 void setBlOfSeqOnParentBranch(double d)
          Sets the resulting (ML) branch length of a Node placed on the parent branch of this Node to double d.
 void setBootstrap(int i)
          Sets the bootstrap value of this Node to i (int).
 void setChild1(Node n)
          Sets the first child Node of this Node to n.
 void setChild2(Node n)
          Sets the second child Node of this Node to n.
 void setCollapse(boolean b)
          Sets whether this Node should be drawn as collapsed.
 void setDistanceToParent(double d)
          Sets the length of the branch leading to the parent of this Node to double d.
 void setDuplication(boolean b)
          Sets whether this Node represents a duplication event or not.
 void setDuplicationOrSpecAssigned(boolean b)
          Sets whether a duplication or speciation event has been assigned for this Node.
 void setECnumber(java.lang.String s)
          Sets the EC number associated with this Node to String s.
 void setID(int i)
          Sets the ID of this Node to i (int).
 void setIndicator(int i)
          Sets the indicator value of this Node to i (int).
 void setLink(Node n)
          Sets the linked Node of this Node to n.
 void setLnLonParentBranch(double d)
          Sets the log likelihood value associated with the branch leading to the parent of this Node to double d.
 void setLnLonParentBranchAssigned(boolean b)
          Sets whether a log likelihood value associated with the branch leading to the parent of this Node has been assigned.
 void setNextExtNode(Node n)
          Sets the next external Node of this Node to n.
static void setNodeCount(int i)
          Sets the total number of all Nodes created so far to i (int).
 void setOrigSeqName(java.lang.String s)
          Sets the original (unchanged) name of the sequence associated with this Node to String s.
 void setParent(Node n)
          Sets the parent Node of this Node to n.
 void setPrevExtNode(Node n)
          Sets the previous external Node of this Node to n.
 void setSeqName(java.lang.String s)
          Sets the name of the sequence associated with this Node to String s.
 void setSignificantlyWorse(boolean b)
          Sets a boolean which could represent whether placement of an additional Node on the parent branch of this Node makes the likelihood of the resulting tree significantly worse.
 void setSpecies(java.lang.String s)
          Sets the name of the species associated with this Node to String s.
 void setSumExtNodes(int i)
          Sets the total number of external Nodes originating from this Node to i (int).
 void setTaxonomyID(int i)
          Sets the NCBI Taxonomy ID of this Node to i (int).
 void setVector(java.util.Vector v)
          Sets the Vector associated with this Node to v.
 void setXcoord(int i)
          Used for drawing of Trees.
 void setYcoord(int i)
          Used for drawing of Trees.
 boolean significantlyWorse()
          Returns a boolean which could represent whether placement of an additional Node on the parent branch of this Node makes the likelihood of the resulting tree significantly worse.
 java.lang.String toString()
          Converts this Node to a String, which looks pretty when printed to the console.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISTANCE_DEFAULT

public static final double DISTANCE_DEFAULT
Value of -99.0 is used as default value.

BOOTSTRAP_DEFAULT

public static final int BOOTSTRAP_DEFAULT
Value of -99 is used as default value.

TAXO_ID_DEFAULT

public static final int TAXO_ID_DEFAULT
Value of -99 is used as default value.

DISTANCE_NULL

public static final double DISTANCE_NULL
Value of -100 is used to indicate that the branch does not exist. I.e. to simulate nodes with more than two children.
Constructor Detail

Node

public Node()
Default constructor for Node.

Node

public Node(java.lang.String s)
     throws java.lang.Exception
Constructor for Node.
Parameters:
s - String representing one Node in New Hampshire (NH) or New Hampshire X (NHX) format.
Method Detail

getNodeCount

public static int getNodeCount()
Returns the total number of all Nodes created so far.
Returns:
total number of Nodes (int)

setNodeCount

public static void setNodeCount(int i)
Sets the total number of all Nodes created so far to i (int).

increaseNodeCount

public static void increaseNodeCount()
Increases the total number of all Nodes created so far by one.

getID

public int getID()
Returns the ID (int) of this Node.

setID

public void setID(int i)
Sets the ID of this Node to i (int). In most cases, this number should not be set to values lower than getNodeCount().

getBootstrap

public int getBootstrap()
Returns the bootstrap value (int) of this Node.

setBootstrap

public void setBootstrap(int i)
Sets the bootstrap value of this Node to i (int).

setTaxonomyID

public void setTaxonomyID(int i)
Sets the NCBI Taxonomy ID of this Node to i (int).

getTaxonomyID

public int getTaxonomyID()
Returns the NCBI Taxonomy ID (int) of this Node.

isPseudoNode

public boolean isPseudoNode()
Checks whether this Node is a pseudo Node, i.e. used to simulate nodes with more than two childrem. A pseudo node has no distance to its parent.
Returns:
true if this Node is a pseudo node, false otherwise

isExternal

public boolean isExternal()
Checks whether this Node is external (tip).
Returns:
true if this Node is external, false otherwise

isRoot

public boolean isRoot()
Checks whether this Node is a root.
Returns:
true if this Node is the root, false otherwise

getSumExtNodes

public int getSumExtNodes()
Returns the total number of external Nodes originating from this Node (int).

setSumExtNodes

public void setSumExtNodes(int i)
Sets the total number of external Nodes originating from this Node to i (int).

getIndicator

public int getIndicator()
Returns the indicator value of this Node (int).

setIndicator

public void setIndicator(int i)
Sets the indicator value of this Node to i (int).

getXcoord

public int getXcoord()
Used for drawing of Trees.

setXcoord

public void setXcoord(int i)
Used for drawing of Trees.

getYcoord

public int getYcoord()
Used for drawing of Trees.

setYcoord

public void setYcoord(int i)
Used for drawing of Trees.

isDuplication

public boolean isDuplication()
Returns true if this Node represents a duplication event, false otherwise.

setDuplication

public void setDuplication(boolean b)
Sets whether this Node represents a duplication event or not.

setSeqName

public void setSeqName(java.lang.String s)
Sets the name of the sequence associated with this Node to String s.

getSeqName

public java.lang.String getSeqName()
Returns the name of the sequence associated with this Node (String).

setECnumber

public void setECnumber(java.lang.String s)
Sets the EC number associated with this Node to String s.

getECnumber

public java.lang.String getECnumber()
Returns the EC number associated with this Node (as String).

setSpecies

public void setSpecies(java.lang.String s)
Sets the name of the species associated with this Node to String s.

getSpecies

public java.lang.String getSpecies()
Returns the name of the species associated with this Node (String).

setOrigSeqName

public void setOrigSeqName(java.lang.String s)
Sets the original (unchanged) name of the sequence associated with this Node to String s.

getOrigSeqName

public java.lang.String getOrigSeqName()
Returns the original (unchanged) name of the sequence associated with this Node (String).

getDistanceToParent

public double getDistanceToParent()
Returns the length of the branch leading to the parent of this Node (double).

setDistanceToParent

public void setDistanceToParent(double d)
Sets the length of the branch leading to the parent of this Node to double d.

getLnLonParentBranch

public double getLnLonParentBranch()
Returns the log likelihood value associated with the branch leading to the parent of this Node (double).

setLnLonParentBranch

public void setLnLonParentBranch(double d)
Sets the log likelihood value associated with the branch leading to the parent of this Node to double d.

significantlyWorse

public boolean significantlyWorse()
Returns a boolean which could represent whether placement of an additional Node on the parent branch of this Node makes the likelihood of the resulting tree significantly worse.

setSignificantlyWorse

public void setSignificantlyWorse(boolean b)
Sets a boolean which could represent whether placement of an additional Node on the parent branch of this Node makes the likelihood of the resulting tree significantly worse.

isLnLonParentBranchAssigned

public boolean isLnLonParentBranchAssigned()
Returns whether a log likelihood value associated with the branch leading to the parent of this Node has been assigned.

setLnLonParentBranchAssigned

public void setLnLonParentBranchAssigned(boolean b)
Sets whether a log likelihood value associated with the branch leading to the parent of this Node has been assigned.

getBlOfSeqOnParentBranch

public double getBlOfSeqOnParentBranch()
Returns the resulting (ML) branch length of a Node placed on the parent branch of this Node (double).

setBlOfSeqOnParentBranch

public void setBlOfSeqOnParentBranch(double d)
Sets the resulting (ML) branch length of a Node placed on the parent branch of this Node to double d.

isDuplicationOrSpecAssigned

public boolean isDuplicationOrSpecAssigned()
Returns whether a duplication or speciation event has been assigned for this Node.

setDuplicationOrSpecAssigned

public void setDuplicationOrSpecAssigned(boolean b)
Sets whether a duplication or speciation event has been assigned for this Node.

setCollapse

public void setCollapse(boolean b)
Sets whether this Node should be drawn as collapsed.

collapse

public boolean collapse()
Returns whether this Node should be drawn as collapsed.

getNextExtNode

public Node getNextExtNode()
Returns a refernce to the next external Node of this Node.

setNextExtNode

public void setNextExtNode(Node n)
Sets the next external Node of this Node to n.

getPrevExtNode

public Node getPrevExtNode()
Returns a refernce to the previous external Node of this Node.

setPrevExtNode

public void setPrevExtNode(Node n)
Sets the previous external Node of this Node to n.

getChild1

public Node getChild1()
Returns a refernce to the first child Node of this Node.

setChild1

public void setChild1(Node n)
Sets the first child Node of this Node to n.

getChild2

public Node getChild2()
Returns a refernce to the second child Node of this Node.

setChild2

public void setChild2(Node n)
Sets the second child Node of this Node to n.

getParent

public Node getParent()
Returns a refernce to the parent Node of this Node.

setParent

public void setParent(Node n)
Sets the parent Node of this Node to n.

setLink

public void setLink(Node n)
Sets the linked Node of this Node to n. Currently, this method is only used for the speciation-duplication assignment algorithms.

getLink

public Node getLink()
Returns a refernce to the linked Node of this Node. Currently, this method is only used for the speciation-duplication assignment algorithms.

setVector

public void setVector(java.util.Vector v)
Sets the Vector associated with this Node to v. Currently, this method is only used for Eulenstein's speciation-duplication assignment algorithm.

getVector

public java.util.Vector getVector()
Returns a refernce to the Vector associated with this Node. Currently, this method is only used for Eulenstein's speciation-duplication assignment algorithm.

isChild1

public boolean isChild1()
Returns true if this Node is the first child of its parent Node. Returns false if this Node is the second child of its parent or if this Node has no parent.

deleteData

public void deleteData()
Deletes data of this Node. Links to the other Nodes in the Tree are NOT deleted. Field "link" IS deleted.
See Also:
getLink()

copyNodeData

public Node copyNodeData()
Returns a new Node which has its data copied from this Node. Links to the other Nodes in the same Tree are NOT copied (e.g. link to parent). Field "link" IS copied.
See Also:
getLink()

preorderPrint

public void preorderPrint()
Prints to the console the subtree originating from this Node in preorder.

getAllExternalChildren

public java.util.Vector getAllExternalChildren()
Returns a Vector containing references to all external children of this Node. The order is the same as in the Tree.
Returns:
Vector of references to external Nodes, null if this node is external

getAllChildren

public java.util.Vector getAllChildren()
Returns a Vector containing references to all (both internal and external) children of this Node. Does not return pseudo Nodes (which are used to simulate nodes with more than two children).
Returns:
Vector of references to Nodes, null if this node is external

copyAllExtChildren

public Node[] copyAllExtChildren()
                          throws java.lang.Exception
Returns a array containing copies all external children of this Node.

toString

public java.lang.String toString()
Converts this Node to a String, which looks pretty when printed to the console.
Overrides:
toString in class java.lang.Object

equals

public boolean equals(Node node)
Compares this Node with Node node. Nodes are considered equal if their sequence name, species name, taxonomy ID, and EC number are exactly the same. Case sensitive.
Returns:
true if equal, false otherwise

compareArraysOfNodes

public static boolean compareArraysOfNodes(Node[] nodes1,
                                           Node[] nodes2)
                                    throws java.lang.Exception
Returns true if Node arrays nodes1 and nodes2 are equal, false otherwise. Uses sequence names, species names, taxonomy IDs, and EC numbers for comparison.

compareSeqNamesInArraysOfNodes

public static boolean compareSeqNamesInArraysOfNodes(Node[] nodes1,
                                                     Node[] nodes2)
                                              throws java.lang.Exception
Returns true if Node arrays nodes1 and nodes2 are equal, false otherwise. Uses sequence names and taxonomy IDs for comparison.

forester v1.3