Ztree2Hclust: Ztree2Hclust

Description Usage Arguments Value Examples

View source: R/utils.R

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

1
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

1
2
3
4
5
6
7
8
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)

CopyNumberPlots documentation built on Nov. 8, 2020, 6:51 p.m.