Perform Hierarchical Clustering and tree pruning on a phylogenetic tree
Source:R/tree2clusters.R
tree2clusters.RdThe phylogenetic tree is pruned with
cutreeDynamic to get clusters.
Usage
tree2clusters(
treeStr,
treeDistances = NULL,
treeLabels = NULL,
cutHeight = NULL,
minClusterSize = 1,
extra = TRUE,
verbose = FALSE
)Arguments
- treeStr
A
character vectorof a phylogenetic tree in Newick format- treeDistances
numeric matrixof distances, that were used to generate the tree. If NULL, it will be inferred from tree branch lengths.- treeLabels
A
character vectorof tree leaf labels.- cutHeight
Define at which height to cut tree. Default automatically defined.
- minClusterSize
Minimum size of clusters. Default 1.
- extra
Boolean whether to use extra parameters for the
cutreeDynamic.- verbose
Logical. If TRUE, enables verbose output from the Java backend.
Value
character vectorof the clusters. Each row contains data for a cluster, separated by space. The id of the cluster, the size of the cluster (number of elements) and the names of its elements, Cluster id 0 contains all the objects not assigned to a cluster (singletons). Example clusters output :0 3 Sample1 Sample2 Sample3 1 3 Sample4 Sample5 Sample6 2 2 Sample7 Sample8 3 2 Sample9 Sample0
References
Java implementation: https://github.com/gkanogiannis/BioInfoJava-Utils
Author
Anestis Gkanogiannis, anestis@gkanogiannis.com
Examples
my.clust <- tree2clusters(
treeStr = dist2tree(
inputDist = system.file("extdata", "samples.vcf.dist.gz",
package = "fastreeR"
)
),
verbose = TRUE
)
#> ..cutHeight not given, setting it to 0.0793 ===> 99% of the (truncated) height range in dendro.
#> ..done.