#' ArchR function: Plot heatmap of cell counts
#'
#' This function plots a heatmap of cell counts split across two groups
#'
#' @param ArchR ArchR object
#' @param group1 first column to split cells by
#' @param group2 second column to split cells by
#' @return plot generated by pheatmap
#' @export
ArchRCellCountsHeatmap <- function(ArchR = ArchR, group1 = "scHelper_cell_type", group2 = "clusters") {
group1_data <- getCellColData(ArchR, select = group1)[,1]
group2_data <- getCellColData(ArchR, select = group2)[,1]
cM <- confusionMatrix(paste0(group2_data), paste0(group1_data))
cM <- cM / Matrix::rowSums(cM)
p <- pheatmap::pheatmap(
mat = cM,
color = paletteContinuous("whiteBlue"),
border_color = "black"
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.