runHOPACH | R Documentation |
runHOPACH
runHOPACH(data, K = 10, kmax = 5, dissimilarity_metric = "cor")
data |
dataframe containing the median expression of the clusters/cell types |
K |
positive integer specifying the maximum number of levels in the tree. Must be 15 or less, due to computational limitations (overflow) |
kmax |
integer between 1 and 9 specifying the maximum number of children at each node in the tree |
dissimilarity_metric |
metric used to calculate dissimilarities between clusters/cell types |
a list containing the groups each cluster belongs to at each level of the hopach tree
library(SingleCellExperiment)
library(data.table)
data(COVIDSampleData)
sce <- DeBiasi_COVID_CD8_samp
exprs <- t(assay(sce, "exprs"))
clusters <- colData(sce)$cluster_id
classes <- colData(sce)$condition
samples <- colData(sce)$sample_id
clust_med_dt <- as.data.table(exprs)
clust_med_dt[, cluster_id := clusters]
res <- clust_med_dt[, lapply(.SD, median, na.rm=TRUE), by=cluster_id]
res2 <- res[,.SD, .SDcols = !c('cluster_id')]
hopach_res <- runHOPACH(as.data.frame(scale(res2)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.