createTreeViz {scTreeViz} | R Documentation

## Creates 'TreeViz' object from hierarchy and count matrix

### 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

    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

    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)

[Package scTreeViz version 1.0.0 Index]