Ztree2Hclust | R Documentation |
Transform a Z matrix representing the hierarchical clustering of elements into a valid hclust R object. The Z representation is used by scipy hierarchical clustering and in 10X single-cell CNV HDF5 files.
More info on the Ztree matrix: https://joernhees.de/blog/2015/08/26/scipy-hierarchical-clustering-and-dendrogram-tutorial/
Ztree2Hclust(Ztree)
Ztree |
(matrix) A matrix with 4 rows and num.elements - 1 columns. The first and second row represent the elements or clusters merged at each step and the third row the distance between the merged elements. This is the format used by scipy hierarchical clustering. |
A valid hclust object (standard R hierarchical clustering results)
ztree <- matrix(c(0,4,0.1,2,
1,3,0.2,2,
5,2,0.3,2,
6,7,0.4,2),
nrow=4)
hc.tree <- Ztree2Hclust(ztree)
plot(hc.tree)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.