Skip to contents

Frequency of cells per cell cluster probability bin by group for each label. The label has to be specified beforehand to the function BinCellClusterProbability().

Usage

TabulateCellBinsByGroup.SingleCellExperiment(object, group, relative, margin)

# S4 method for class 'SingleCellExperiment'
TabulateCellBinsByGroup(object, group, relative = FALSE, margin = 1)

Arguments

object

An object of SingleCellExperiment class obtained with the function BinCellClusterProbability().

group

Character specifying the colData variable from the SingleCellExperiment object provided to the function BinCellClusterProbability() to use as categorical group variable.

relative

Logical specifying if relative proportions of cell bins per group should be returned. By default FALSE, i.e., absolute values are returned.

margin

If relative is TRUE, proportions should be calculated by: rows (1, the default); columns (2); or overall (NULL).

Value

A list of tables with the frequency of cells per bin of cell cluster probability by group for each label.

Examples

if (FALSE) { # \dontrun{
# Packages
suppressPackageStartupMessages(library("SingleCellExperiment"))

# Import data from Zenodo
data.url <- "https://zenodo.org/records/14845751/files/pbmc_10Xassays.rds?download=1"
sce <- readRDS(file = url(data.url))

# Prepare data
sce <- PrepareData(object = sce)

# Multi-level integration - 'L = 4' just for highlighting purposes
set.seed(123)
sce <- RunParallelDivisiveICP(object = sce, batch.label = "batch", L = 4, 
                              threads = 2)

# Cell states SCE object for a given cell type annotation or clustering
cellstate.sce <- BinCellClusterProbability(object = sce, label = "cell_type", 
                                           icp.round = 4, bins = 20) 
cellstate.sce

# Tabulate cell bins by group 
# give an interesting variable to the "group" parameter
cellbins.tables <- TabulateCellBinsByGroup(object = cellstate.sce, 
                                           group = "batch", 
                                           relative = TRUE, 
                                           margin = 1)
} # }