Skip to contents

Plot cell cluster probability distribution per label by group.

Usage

CellClusterProbabilityDistribution.SingleCellExperiment(
  object,
  label,
  group,
  probability
)

# S4 method for class 'SingleCellExperiment'
CellClusterProbabilityDistribution(
  object,
  label,
  group,
  probability = "scaled_mean_probs"
)

Arguments

object

An object of SingleCellExperiment class with aggregated cell cluster probability available in colData(object), which can be obtained after running SummariseCellClusterProbability().

label

Character specifying the colData variable to use as cell type/cluster label.

group

Character specifying the colData variable to use as categorical group variable.

probability

Character specifying the aggregated cell cluster probability variable available in colData, used to plot its distribution. One of "mean_probs", "scaled_mean_probs", "median_probs", "scaled_median_probs". The availability of these variables in colData depends on the parameters given to the function SummariseCellClusterProbability() beforehand. By default assumes that "scaled_mean_probs" is available in colData, which is only true if SummariseCellClusterProbability() function was run with funs = "mean" and scale.funs = TRUE.

Value

A plot of class ggplot.

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)

# Summarise cell cluster probability
sce <- SummariseCellClusterProbability(object = sce, icp.round = 4) # saved in 'colData'

# Search for differences in probabilities across group(s) 
# give an interesting variable to the "group" parameter
prob.dist <- CellClusterProbabilityDistribution(object = sce, label = "cell_type", 
                                                group = "batch", 
                                                probability = "scaled_mean_probs")
prob.dist # print plot
} # }