Constructor and Description |
---|
ClusterTree(double distance,
int originalIndex,
ClusterTree<T>... subTrees)
Creates a new cluster tree with supplied sub-trees and given distance.
|
ClusterTree(StringBuffer xml)
Creates a cluster tree from its XML representation
|
ClusterTree(T leaf,
int originalIndex)
Creates a new cluster tree for a given leaf element (i.e., the tree comprises just this leaf) with the
supplied index in the set of cluster elements
|
Modifier and Type | Method and Description |
---|---|
<S> ClusterTree<S> |
dropBelow(IntList rootOriginalIndexes,
S[] newElements)
Removes all sub-trees below the inner nodes identified by the original indexes supplied
and creates new leaf nodes instead, which obtain the supplied leaf elements.
|
T[] |
getClusterElements()
Returns the elements at all leaves in this cluster tree, in the order
of the leaves, from left to right.
|
double |
getDistance()
Returns the distance between the child trees of this cluster tree root node.
|
ClusterTree<Integer> |
getIndexTree()
Returns a cluster tree with identical structure as this cluster tree but with all leaves replaced by
integer leaves holding the corresponding original indices.
|
ClusterTree<T>[] |
getLeaves()
Returns all leaves of this cluster tree as
ClusterTree objects comprising just the corresponding
leaf element |
double |
getMaximumDistance()
Returns the maximum distance of trees under this root node.
|
double |
getMinimumDistance()
Returns the minimum distance of trees under this root node.
|
int |
getMinimumOriginalIndex()
Returns the minimum original index in this cluster tree.
|
int |
getNumberOfElements()
Returns the number of leaves in this cluster tree.
|
int |
getOriginalIndex()
Returns the original index of the root node of this cluster tree
|
ClusterTree<T>[] |
getSubTrees()
Returns the sub-trees of this cluster tree root node
|
boolean |
isLeaf()
Returns
true if this cluster tree comprises just a leaf. |
void |
leafOrder(double[][] dmat)
Orders the leaves of this cluster tree such that adjacent nodes have minimal distance.
|
void |
reverseOrder()
Reverses the order of the child trees of this cluster tree root node.
|
void |
setElements()
Sets the copy references of the leave nodes of this cluster
tree to the elements of its leaves in the current order.
|
void |
setOriginalIndex(int used)
Sets the original index (e.g., if elements have been removed from the tree) referring to indexes
in the distance matrix that has been used to build a tree.
|
String |
toNewick()
Returns a string representation of this cluster tree in newick format.
|
String |
toString() |
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
public ClusterTree(T leaf, int originalIndex)
leaf
- the leaf elementoriginalIndex
- the index of the leaf element in the complete set of cluster elementspublic ClusterTree(double distance, int originalIndex, ClusterTree<T>... subTrees)
distance
- the distance between the sub-treesoriginalIndex
- the original index of this inner (or root) nodesubTrees
- the sub-treespublic ClusterTree(StringBuffer xml) throws NonParsableException
xml
- the XML representationNonParsableException
- if XML could not be parsedpublic ClusterTree<Integer> getIndexTree()
ClusterTree(Object, int)
public void leafOrder(double[][] dmat)
dmat
- the distance matrix that has also been used to build the tree (using the same indexes)public int getOriginalIndex()
public void reverseOrder()
public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.public void setElements()
public ClusterTree<T>[] getSubTrees()
public double getDistance()
public double getMaximumDistance()
getDistance()
.
Basically used for plotting the tree structure.public double getMinimumDistance()
public T[] getClusterElements()
public int getNumberOfElements()
public int getMinimumOriginalIndex()
public boolean isLeaf()
true
if this cluster tree comprises just a leaf.public ClusterTree<T>[] getLeaves()
ClusterTree
objects comprising just the corresponding
leaf elementpublic <S> ClusterTree<S> dropBelow(IntList rootOriginalIndexes, S[] newElements)
S
- the type of the new leavesrootOriginalIndexes
- the original indexes of the inner nodes to be replacednewElements
- the leaf element replacementspublic String toNewick()
public void setOriginalIndex(int used)
used
- the new index