FindAllClusterMarkers
enables identifying feature markers for all
clusters at once. This is done by differential expresission analysis where
cells from one cluster are compared against the cells from the rest of the
clusters. Feature and cell filters can be applied to accelerate the analysis,
but this might lead to missing weak signals.
Usage
FindAllClusterMarkers.SingleCellExperiment(
object,
clustering.label,
test,
log2fc.threshold,
min.pct,
min.diff.pct,
min.cells.group,
max.cells.per.cluster,
return.thresh,
only.pos
)
# S4 method for class 'SingleCellExperiment'
FindAllClusterMarkers(
object,
clustering.label,
test = "wilcox",
log2fc.threshold = 0.25,
min.pct = 0.1,
min.diff.pct = NULL,
min.cells.group = 3,
max.cells.per.cluster = NULL,
return.thresh = 0.01,
only.pos = FALSE
)
Arguments
- object
A
SingleCellExperiment
object.- clustering.label
A variable name (of class
character
) available in the cell metadatacolData(object)
with the clustering labels (character
orfactor
) to use.- test
Which test to use. Only "wilcox" (the Wilcoxon rank-sum test, AKA Mann-Whitney U test) is supported at the moment.
- log2fc.threshold
Filters out features that have log2 fold-change of the averaged feature expression values below this threshold. Default is
0.25
.- min.pct
Filters out features that have dropout rate (fraction of cells expressing a feature) below this threshold in both comparison groups. Default is
0.1
.- min.diff.pct
Filters out features that do not have this minimum difference in the dropout rates (fraction of cells expressing a feature) between the two comparison groups. Default is
NULL
.- min.cells.group
The minimum number of cells in the two comparison groups to perform the DE analysis. If the number of cells is below the threshold, then the DE analysis of this cluster is skipped. Default is
3
.- max.cells.per.cluster
The maximum number of cells per cluster if downsampling is performed to speed up the DE analysis. Default is
NULL
, i.e., no downsampling.- return.thresh
If
only.pos=TRUE
, then return only features that have the adjusted p-value (adjusted by the Bonferroni method) below or equal to this threshold. Default is0.01
.- only.pos
Whether to return only features that have an adjusted p-value (adjusted by the Bonferroni method) below or equal to the threshold. Default is
FALSE
.
Examples
# Import package
suppressPackageStartupMessages(library("SingleCellExperiment"))
# Create toy SCE data
batches <- c("b1", "b2")
set.seed(239)
batch <- sample(x = batches, size = nrow(iris), replace = TRUE)
sce <- SingleCellExperiment(assays = list(logcounts = t(iris[,1:4])),
colData = DataFrame("Species" = iris$Species,
"Batch" = batch))
colnames(sce) <- paste0("samp", 1:ncol(sce))
# Markers
dge <- FindAllClusterMarkers(sce, clustering.label = "Species")
#> -----------------------------------
#> testing cluster setosa
#> 4 features left after min.pct filtering
#> 4 features left after min.diff.pct filtering
#> 4 features left after log2fc.threshold filtering
#> -----------------------------------
#> -----------------------------------
#> testing cluster versicolor
#> 4 features left after min.pct filtering
#> 4 features left after min.diff.pct filtering
#> 2 features left after log2fc.threshold filtering
#> -----------------------------------
#> -----------------------------------
#> testing cluster virginica
#> 4 features left after min.pct filtering
#> 4 features left after min.diff.pct filtering
#> 3 features left after log2fc.threshold filtering
#> -----------------------------------
dge
#> p.value adj.p.value log2FC pct.1 pct.2 diff.pct cluster
#> Sepal.Length 5.804234e-20 2.321694e-19 -1.256 1 1 0 setosa
#> Sepal.Width 3.027113e-14 1.210845e-13 0.556 1 1 0 setosa
#> Petal.Length 1.952841e-23 7.811364e-23 -3.444 1 1 0 setosa
#> Petal.Width 1.325346e-23 5.301384e-23 -1.430 1 1 0 setosa
#> Sepal.Width.1 3.919743e-09 1.567897e-08 -0.431 1 1 0 versicolor
#> Petal.Length.1 8.606063e-01 1.000000e+00 0.753 1 1 0 versicolor
#> Sepal.Length.1 1.150950e-14 4.603801e-14 1.117 1 1 0 virginica
#> Petal.Length.2 1.150453e-22 4.601814e-22 2.691 1 1 0 virginica
#> Petal.Width.1 9.465312e-23 3.786125e-22 1.240 1 1 0 virginica
#> marker
#> Sepal.Length Sepal.Length
#> Sepal.Width Sepal.Width
#> Petal.Length Petal.Length
#> Petal.Width Petal.Width
#> Sepal.Width.1 Sepal.Width
#> Petal.Length.1 Petal.Length
#> Sepal.Length.1 Sepal.Length
#> Petal.Length.2 Petal.Length
#> Petal.Width.1 Petal.Width