Ztree2Hclust: Ztree2Hclust

View source: R/utils.R

Ztree2HclustR Documentation

Ztree2Hclust

Description

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/

Usage

Ztree2Hclust(Ztree)

Arguments

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.

Value

A valid hclust object (standard R hierarchical clustering results)

Examples


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)


bernatgel/CopyNumberPlots documentation built on Sept. 22, 2023, 1:53 a.m.