public class Phylogeny
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static boolean |
ALLOW_MULTIPLE_PARENTS_DEFAULT |
Constructor | Description |
---|---|
Phylogeny() |
Default Phylogeny constructor.
|
Modifier and Type | Method | 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
|
void |
clearHashIdToNodeMap() |
|
Phylogeny |
copy() |
Returns a deep copy of this Phylogeny.
|
Phylogeny |
copy(PhylogenyNode source) |
Returns a deep copy of this Phylogeny.
|
Phylogeny |
copyShallow() |
Returns a shallow copy of this Phylogeny.
|
Phylogeny |
copyShallow(PhylogenyNode source) |
|
static Phylogeny |
createInstanceFromNhxString(java.lang.String nhx) |
|
void |
deleteSubtree(PhylogenyNode remove_us,
boolean collapse_resulting_node_with_one_desc) |
Need to call clearHashIdToNodeMap() afterwards (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.List<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(long 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.
|
int |
getNodeCount() |
This is time-inefficient since it runs a iterator each time it is called.
|
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> |
getNodesViaGeneName(java.lang.String seq_name) |
|
java.util.List<PhylogenyNode> |
getNodesViaSequenceName(java.lang.String seq_name) |
|
java.util.List<PhylogenyNode> |
getNodesViaSequenceSymbol(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).
|
int |
getNumberOfInternalNodes() |
|
java.util.List<PhylogenyNode> |
getParalogousNodes(PhylogenyNode n,
java.lang.String[] taxonomyCodeRange) |
Returns all paralogs of the external PhylogenyNode n of this Phylogeny.
|
java.util.Collection<SequenceRelation.SEQUENCE_RELATION_TYPE> |
getRelevantSequenceRelationTypes() |
|
PhylogenyNode |
getRoot() |
Returns the root PhylogenyNode of this Phylogeny.
|
java.util.Collection<Sequence> |
getSequenceRelationQueries() |
|
java.lang.String |
getType() |
|
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() |
|
void |
levelOrderReID() |
Resets the ID numbers of the nodes of this Phylogeny in level order,
starting with start_label (for the root).
|
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(long id) |
Places the root of this Phylogeny on the parent branch of the
PhylogenyNode with a corresponding ID.
|
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 |
setIdToNodeMap(java.util.HashMap<java.lang.Long,PhylogenyNode> idhash) |
|
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 |
setRelevantSequenceRelationTypes(java.util.Collection<SequenceRelation.SEQUENCE_RELATION_TYPE> types) |
|
void |
setRerootable(boolean rerootable) |
|
void |
setRoot(PhylogenyNode n) |
|
void |
setRooted(boolean b) |
Sets whether this Phylogeny is rooted or not.
|
void |
setSequenceRelationQueries(java.util.Collection<Sequence> sequencesByName) |
|
void |
setType(java.lang.String type) |
|
java.lang.String |
toNewHampshire() |
|
java.lang.String |
toNewHampshire(PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE nh_conversion_support_style) |
|
java.lang.String |
toNewHampshireX() |
|
java.lang.String |
toNexus() |
|
java.lang.String |
toNexus(PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE svs) |
|
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 void clearHashIdToNodeMap()
public Phylogeny copy()
(The resulting Phylogeny has its references in the external nodes corrected, if they are lacking/obsolete in this.)
public Phylogeny copy(PhylogenyNode source)
(The resulting Phylogeny has its references in the external nodes corrected, if they are lacking/obsolete in this.)
public Phylogeny copyShallow()
(The resulting Phylogeny has its references in the external nodes corrected, if they are lacking/obsolete in this.)
public Phylogeny copyShallow(PhylogenyNode source)
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 static final Phylogeny createInstanceFromNhxString(java.lang.String nhx) throws java.io.IOException
java.io.IOException
public java.util.List<PhylogenyNode> getExternalNodes()
public PhylogenyNode getFirstExternalNode()
public double getHeight()
public Identifier getIdentifier()
public java.lang.String getName()
public PhylogenyNode getNode(long id) throws java.util.NoSuchElementException
java.util.NoSuchElementException
public PhylogenyNode getNode(java.lang.String name)
name
- name (String) of PhylogenyNode to findpublic int getNodeCount()
public 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> getNodesViaSequenceSymbol(java.lang.String seq_name)
public java.util.List<PhylogenyNode> getNodesViaGeneName(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 getNumberOfInternalNodes()
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 java.util.Collection<SequenceRelation.SEQUENCE_RELATION_TYPE> getRelevantSequenceRelationTypes()
public PhylogenyNode getRoot()
public java.util.Collection<Sequence> getSequenceRelationQueries()
public java.lang.String getType()
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 void levelOrderReID()
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(long id)
id
- ID (int) of PhylogenyNode of this Phylogenypublic 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 setIdToNodeMap(java.util.HashMap<java.lang.Long,PhylogenyNode> idhash)
public void setIndicatorsToZero()
public void setName(java.lang.String s)
public void setRelevantSequenceRelationTypes(java.util.Collection<SequenceRelation.SEQUENCE_RELATION_TYPE> types)
public void setRerootable(boolean rerootable)
public void setRoot(PhylogenyNode n)
public void setRooted(boolean b)
public void setSequenceRelationQueries(java.util.Collection<Sequence> sequencesByName)
public void setType(java.lang.String type)
public java.lang.String toNewHampshire()
public java.lang.String toNewHampshire(PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE nh_conversion_support_style)
public java.lang.String toNewHampshireX()
public java.lang.String toNexus()
public java.lang.String toNexus(PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE svs)
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.RuntimeException
java.lang.RuntimeException