FORESTER 1.8

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.600 -- last modified: 07/03/01
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 ORTHOLOGOUS_DEFAULT
           
static int SEQ_X
          Value of getOrthologous == -11 is used to indicate that this Node is sequence X in the context of orthologous relationships.
(package private) static long serialVersionUID
           
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
(package private)  void addExtNode(java.lang.String s)
          For building Trees.
 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.
(package private)  void connect(java.lang.String s)
          For building Trees.
 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.
(package private) static Node copyTree(Node source)
          Deep copies the Tree originating from this Node.
(package private) static void decreaseNodeCount()
          Decreases the total number of all Nodes created so far by one.
 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.
 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).
(package private)  Node getLastExtNode()
          Returns the last external Node.
 Node getLink()
          Returns a refernce to the linked Node of this Node.
 float getLnLonParentBranch()
          Returns the log likelihood value associated with the branch leading to the parent of this Node (float).
 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.
 int getOrthologous()
          Returns how many times this Node is orthologous to another one.
 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.
(package private)  Node getRoot()
          Returns the root Node of the tree of which this Node is member.
 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 getSuperOrthologous()
          Returns how many times this Node is super orthologous to another one.
 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 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).
(package private)  void setIndicatorsToZero()
          Sets the indicators of all the children of this Node to zero.
 void setLink(Node n)
          Sets the linked Node of this Node to n.
 void setLnLonParentBranch(float f)
          Sets the log likelihood value associated with the branch leading to the parent of this Node to float f.
 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 setOrthologous(int i)
          Sets how many times this Node is orthologous to another one.
 void setParent(Node n)
          Sets the parent Node of this Node to n.
(package private)  void setParents()
          Resets the parents of all Nodes of the subtree originating from this Node, given that child1 and child2 are correctly set.
 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 setSuperOrthologous(int i)
          Sets how many times this Node is super orthologous to another one.
 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.
(package private)  java.lang.String toNewHampshireX()
          Converts this Node to a New Hampshire X (NHX) String representation.
 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

serialVersionUID

static final long serialVersionUID

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.

SEQ_X

public static final int SEQ_X
Value of getOrthologous == -11 is used to indicate that this Node is sequence X in the context of orthologous relationships.

ORTHOLOGOUS_DEFAULT

public static final int ORTHOLOGOUS_DEFAULT
Constructor Detail

Node

public Node(java.lang.String s)
     throws java.lang.Exception
Constructor for Node.

(Last modified: 06/12/01)

Parameters:
s - String representing one Node in New Hampshire (NH) or New Hampshire X (NHX) format.

Node

public Node()
Default constructor for Node.

(Last modified: 06/12/01)

Method Detail

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()

deleteData

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

copyTree

static Node copyTree(Node source)
Deep copies the Tree originating from this Node.

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.

decreaseNodeCount

static void decreaseNodeCount()
Decreases 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).

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 float getLnLonParentBranch()
Returns the log likelihood value associated with the branch leading to the parent of this Node (float).

setLnLonParentBranch

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

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.

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.

getOrthologous

public int getOrthologous()
Returns how many times this Node is orthologous to another one. (Last modified: 12/05/00 )

setOrthologous

public void setOrthologous(int i)
Sets how many times this Node is orthologous to another one. (Last modified: 12/05/00 )

getSuperOrthologous

public int getSuperOrthologous()
Returns how many times this Node is super orthologous to another one. (Last modified: 12/05/00 )

setSuperOrthologous

public void setSuperOrthologous(int i)
Sets how many times this Node is super orthologous to another one. (Last modified: 12/05/00 )

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.

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.

toNewHampshireX

java.lang.String toNewHampshireX()
Converts this Node to a New Hampshire X (NHX) String representation.

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.

preorderPrint

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

setIndicatorsToZero

void setIndicatorsToZero()
Sets the indicators of all the children of this Node to zero.

setParents

void setParents()
Resets the parents of all Nodes of the subtree originating from this Node, given that child1 and child2 are correctly set.

addExtNode

void addExtNode(java.lang.String s)
          throws java.lang.Exception
For building Trees.

connect

void connect(java.lang.String s)
       throws java.lang.Exception
For building Trees.

getRoot

Node getRoot()
Returns the root Node of the tree of which this Node is member.

getLastExtNode

Node getLastExtNode()
Returns the last external Node.

FORESTER 1.8