Runnable code:
library(cola)
process_counts = function(data, column = NULL) {
mat = assays(data)$counts
mat = as.matrix(mat)
s = colSums(mat)
fa = s/mean(s)
for(i in 1:ncol(mat)) mat[, i]/fa[i]
mat = adjust_matrix(log2(mat + 1))
anno = NULL
if(!is.null(column)) {
anno = colData(data)
anno = as.data.frame(anno)
anno = anno[, column, drop = FALSE]
}
list(mat = mat, anno = anno)
}
library(scRNAseq)
data = LaMannoBrainData('mouse-adult')
lt = process_counts(data, c("Cell_type"))
rh = hierarchical_partition(lt$mat, subset = 500, cores = 4, anno = lt$anno)
saveRDS(rh, file = "LaMannoBrain_mouse_adult_cola_rh.rds")
cola_report(rh, output = "LaMannoBrain_mouse_adult_cola_rh_report", title = "cola Report for Hierarchical Partitioning - 'LaMannoBrain_mouse_adult'")
The HTML report is here. (generated by cola version 2.0.0, R 4.1.0.)