public class Phylogeny
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
ALLOW_MULTIPLE_PARENTS_DEFAULT |
Constructor and Description |
---|
Phylogeny()
Default Phylogeny constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAsChild(PhylogenyNode parent)
Adds this Phylogeny to the list of child nodes of PhylogenyNode parent
and sets the parent of this to parent.
|
void |
addAsSibling(PhylogenyNode sibling) |
double |
calculateSubtreeHeight(PhylogenyNode n)
This calculates the height of the subtree emanating at n for rooted,
tree-shaped phylogenies
|
Phylogeny |
copy()
Returns a deep copy of this Phylogeny.
|
void |
deleteSubtree(PhylogenyNode remove_us,
boolean collapse_resulting_node_with_one_desc)
Need the delete and/or rehash _idhash (not done automatically
to allow client multiple deletions in linear time).
|
void |
externalNodesHaveChanged() |
java.lang.String[] |
getAllExternalNodeNames() |
Confidence |
getConfidence() |
java.lang.String |
getDescription() |
java.lang.String |
getDistanceUnit() |
java.util.Set<PhylogenyNode> |
getExternalNodes()
Warning.
|
PhylogenyNode |
getFirstExternalNode()
Returns the first external PhylogenyNode.
|
double |
getHeight()
This calculates the height for rooted, tree-shaped phylogenies.
|
Identifier |
getIdentifier() |
java.lang.String |
getName()
Returns the name of this Phylogeny.
|
PhylogenyNode |
getNode(int id)
Finds the PhylogenyNode of this Phylogeny which has a matching ID number.
|
PhylogenyNode |
getNode(java.lang.String name)
Returns a PhylogenyNode of this Phylogeny which has a matching name.
|
java.util.List<PhylogenyNode> |
getNodes(java.lang.String name)
Returns a List with references to all Nodes of this Phylogeny which have
a matching name.
|
java.util.List<PhylogenyNode> |
getNodesViaSequenceName(java.lang.String seq_name) |
java.util.List<PhylogenyNode> |
getNodesViaTaxonomyCode(java.lang.String taxonomy_code) |
java.util.List<PhylogenyNode> |
getNodesWithMatchingSpecies(java.lang.String specname)
Returns a Vector with references to all Nodes of this Phylogeny which
have a matching species name.
|
PhylogenyNode |
getNodeViaSequenceName(java.lang.String seq_name) |
PhylogenyNode |
getNodeViaTaxonomyCode(java.lang.String taxonomy_code) |
int |
getNumberOfBranches() |
int |
getNumberOfExternalNodes()
Returns the sum of external Nodes of this Phylogeny (int).
|
java.util.List<PhylogenyNode> |
getParalogousNodes(PhylogenyNode n,
java.lang.String[] taxonomyCodeRange)
Returns all paralogs of the external PhylogenyNode n of this Phylogeny.
|
PhylogenyNode |
getRoot()
Returns the root PhylogenyNode of this Phylogeny.
|
java.lang.String |
getType() |
void |
hashIDs()
Hashes the ID number of each PhylogenyNode of this Phylogeny to its
corresponding PhylogenyNode, in order to make method getNode( id ) run in
constant time.
|
void |
init()
Deletes this Phylogeny.
|
boolean |
isCompletelyBinary()
Returns whether this is a completely binary tree (i.e.
|
boolean |
isEmpty()
Checks whether a Phylogeny object is deleted (or empty).
|
boolean |
isRerootable() |
boolean |
isRooted()
Returns true is this Phylogeny is rooted.
|
boolean |
isTree() |
PhylogenyNodeIterator |
iteratorExternalForward() |
PhylogenyNodeIterator |
iteratorLevelOrder() |
PhylogenyNodeIterator |
iteratorPostorder() |
PhylogenyNodeIterator |
iteratorPreorder() |
int |
levelOrderReID(int start_label)
Resets the ID numbers of the nodes of this Phylogeny in level order,
starting with start_label (for the root).
|
void |
orderAppearance(boolean order)
Arranges the order of childern for each node of this Phylogeny in such a
way that either the branch with more children is on top (right) or on
bottom (left), dependent on the value of boolean order.
|
void |
preOrderReId() |
int |
preOrderReId(int start_label)
Resets the ID numbers of the Nodes of this Phylogeny in preorder,
starting with i.
WARNING. |
void |
printExtNodes()
Prints descriptions of all external Nodes of this Phylogeny to
System.out.
|
void |
recalculateNumberOfExternalDescendants(boolean consider_collapsed_nodes)
(Re)counts the number of children for each PhylogenyNode of this
Phylogeny.
|
void |
reRoot(int id)
Places the root of this Phylogeny on the parent branch of the
PhylogenyNode with a corresponding ID.
|
void |
reRoot(PhylogenyBranch b)
Places the root of this Phylogeny on Branch b.
|
void |
reRoot(PhylogenyNode n)
Places the root of this Phylogeny on the parent branch PhylogenyNode n.
|
void |
reRoot(PhylogenyNode n,
double distance_n_to_parent) |
void |
setAllNodesToNotCollapse()
Sets all Nodes of this Phylogeny to not-collapsed.
|
void |
setConfidence(Confidence confidence) |
void |
setDescription(java.lang.String description) |
void |
setDistanceUnit(java.lang.String _distance_unit) |
void |
setIdentifier(Identifier identifier) |
void |
setIndicatorsToZero()
Sets the indicators of all Nodes of this Phylogeny to 0.
|
void |
setName(java.lang.String s)
Sets the name of this Phylogeny to s.
|
void |
setRerootable(boolean rerootable) |
void |
setRoot(PhylogenyNode n) |
void |
setRooted(boolean b)
Sets whether this Phylogeny is rooted or not.
|
void |
setType(java.lang.String type) |
Phylogeny |
subTree(PhylogenyNode node) |
void |
swapChildren(PhylogenyNode node)
Swaps the the two childern of a PhylogenyNode node of this Phylogeny.
|
java.lang.String |
toNewHampshire(boolean simple_nh) |
java.lang.String |
toNewHampshireX() |
java.lang.String |
toNexus() |
java.lang.String |
toPhyloXML(int phyloxml_level) |
java.lang.String |
toString()
Converts this Phylogeny to a New Hampshire X (String) representation.
|
void |
unRoot()
Removes the root PhylogenyNode this Phylogeny.
|
public static final boolean ALLOW_MULTIPLE_PARENTS_DEFAULT
public Phylogeny()
public void addAsChild(PhylogenyNode parent)
n
- the PhylogenyNode to addpublic void addAsSibling(PhylogenyNode sibling)
public double calculateSubtreeHeight(PhylogenyNode n)
n
- the root-node of a subtreepublic Phylogeny copy()
(The resulting Phylogeny has its references in the external nodes corrected, if they are lacking/obsolete in this.)
public void deleteSubtree(PhylogenyNode remove_us, boolean collapse_resulting_node_with_one_desc)
remove_us
- the parent node of the subtree to be deletedpublic void externalNodesHaveChanged()
public java.lang.String[] getAllExternalNodeNames()
public Confidence getConfidence()
public java.lang.String getDescription()
public java.lang.String getDistanceUnit()
public java.util.Set<PhylogenyNode> getExternalNodes()
public PhylogenyNode getFirstExternalNode()
public double getHeight()
public Identifier getIdentifier()
public java.lang.String getName()
public PhylogenyNode getNode(int id) throws java.util.NoSuchElementException
id
- ID number (int) of the PhylogenyNode to findjava.util.NoSuchElementException
public PhylogenyNode getNode(java.lang.String name)
name
- name (String) of PhylogenyNode to findpublic java.util.List<PhylogenyNode> getNodes(java.lang.String name)
name
- name (String) of Nodes to findgetNodesWithMatchingSpecies(String)
public java.util.List<PhylogenyNode> getNodesViaSequenceName(java.lang.String seq_name)
public java.util.List<PhylogenyNode> getNodesViaTaxonomyCode(java.lang.String taxonomy_code)
public java.util.List<PhylogenyNode> getNodesWithMatchingSpecies(java.lang.String specname)
specname
- species name (String) of Nodes to findgetNodes(String)
public PhylogenyNode getNodeViaSequenceName(java.lang.String seq_name)
public PhylogenyNode getNodeViaTaxonomyCode(java.lang.String taxonomy_code)
public int getNumberOfBranches()
public int getNumberOfExternalNodes()
public java.util.List<PhylogenyNode> getParalogousNodes(PhylogenyNode n, java.lang.String[] taxonomyCodeRange)
PRECONDITION: This tree must be binary and rooted, and speciation - duplication need to be assigned for each of its internal Nodes.
Returns null if this Phylogeny is empty or if n is internal.
(Last modified: 11/22/00) Olivier CHABROL : olivier.chabrol@univ-provence.fr
n
- external PhylogenyNode whose orthologs are to be returnedpublic PhylogenyNode getRoot()
public java.lang.String getType()
public void hashIDs()
public void init()
public boolean isCompletelyBinary()
public boolean isEmpty()
public boolean isRerootable()
public boolean isRooted()
public boolean isTree()
public PhylogenyNodeIterator iteratorExternalForward()
public PhylogenyNodeIterator iteratorLevelOrder()
public PhylogenyNodeIterator iteratorPostorder()
public PhylogenyNodeIterator iteratorPreorder()
public int levelOrderReID(int start_label)
start_label
- the starting value for the ID numberspublic void orderAppearance(boolean order) throws java.lang.IllegalStateException
order
- decides in which direction to orderjava.lang.IllegalStateException
public void preOrderReId()
public int preOrderReId(int start_label)
start_label
- the starting value (int)public void printExtNodes()
public void recalculateNumberOfExternalDescendants(boolean consider_collapsed_nodes)
consider_collapsed_nodes
- set to true to take into account collapsed nodes (collapsed
nodes have 1 child).public void reRoot(int id)
id
- ID (int) of PhylogenyNode of this Phylogenypublic void reRoot(PhylogenyBranch b)
public void reRoot(PhylogenyNode n)
If the resulting reRooted Phylogeny is to be used any further, in most cases the following three methods have to be called on the resulting Phylogeny:
(Last modified: 10/01/01)
n
- PhylogenyNode of this Phylogeny\public void reRoot(PhylogenyNode n, double distance_n_to_parent)
public void setAllNodesToNotCollapse()
In most cases methods adjustNodeCount(false) and recalculateAndReset() need to be called after this method has been called.
public void setConfidence(Confidence confidence)
public void setDescription(java.lang.String description)
public void setDistanceUnit(java.lang.String _distance_unit)
public void setIdentifier(Identifier identifier)
public void setIndicatorsToZero()
public void setName(java.lang.String s)
public void setRerootable(boolean rerootable)
public void setRoot(PhylogenyNode n)
public void setRooted(boolean b)
public void setType(java.lang.String type)
public Phylogeny subTree(PhylogenyNode node) throws java.lang.IllegalStateException
java.lang.IllegalStateException
public void swapChildren(PhylogenyNode node) throws java.lang.IllegalStateException
(Last modified: 06/13/01)
node
- a PhylogenyNode of this Phylogenyjava.lang.IllegalStateException
public java.lang.String toNewHampshire(boolean simple_nh)
public java.lang.String toNewHampshireX()
public java.lang.String toNexus()
public java.lang.String toPhyloXML(int phyloxml_level)
public java.lang.String toString()
toString
in class java.lang.Object
toNewHampshireX()
public void unRoot() throws java.lang.IllegalStateException
java.lang.IllegalStateException