createTreeViz: Creates 'TreeViz' object from hierarchy and count matrix

Description Usage Arguments Value Examples

View source: R/helper-functions.R

Description

Provided with a count matrix and a dataframe or 'ClusterHierarchy' object, this module runs the necessary checks on the dataframe and tries to convert it to a tree by making necessary changes. Returns the 'TreeViz' object if a tree is successfully generated from dataframe, throws error otherwise

Usage

1
createTreeViz(clusters, counts)

Arguments

clusters

'ClusterHierarchy' object or a dataframe containing cluster information at different resolutions

counts

matrix Dense or sparse matrix containing the count matrix

Value

'TreeViz“ Object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
n=64
# create a hierarchy
df<- data.frame(cluster0=rep(1,n))
for(i in seq_len(5)){
  df[[paste0("cluster",i)]]<- rep(seq(1:(2**i)),each=ceiling(n/(2**i)),len=n)
}
# generate a count matrix
counts <- matrix(rpois(6400, lambda = 10), ncol=n, nrow=100)
colnames(counts)<- seq_len(64)
# create a `TreeViz` object
treeViz <- createTreeViz(df, counts)

jkanche/TreeSE documentation built on Oct. 1, 2021, 8:31 p.m.