FindClusterMarkers
enables identifying feature markers for one
cluster or two arbitrary combinations of clusters, e.g. 1_2 vs. 3_4_5. Feature
and cell filters can be applied to accelerate the analysis, but this might
lead to missing weak signals.
Usage
FindClusterMarkers.SingleCellExperiment(
object,
clustering.label,
clusters.1,
clusters.2,
test,
log2fc.threshold,
min.pct,
min.diff.pct,
min.cells.group,
max.cells.per.cluster,
return.thresh,
only.pos
)
# S4 method for class 'SingleCellExperiment'
FindClusterMarkers(
object,
clustering.label,
clusters.1 = NULL,
clusters.2 = NULL,
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.- clusters.1
a character or numeric vector denoting which clusters to use in the first group (named group.1 in the results)
- clusters.2
a character or numeric vector denoting which clusters to use in the second group (named group.2 in the results)
- test
Which test to use. Only "wilcoxon" (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 is not performed. Default is
3
.- max.cells.per.cluster
The maximun 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 is
0.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 between versicolor vs virginica
dge <- FindClusterMarkers(sce, clustering.label = "Species",
clusters.1 = "versicolor",
clusters.2 = "virginica")
#> testing cluster group.1
#> 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 marker
#> Sepal.Length 5.869006e-07 2.347603e-06 -0.652 1 1 0 Sepal.Length
#> Petal.Length 9.133545e-17 3.653418e-16 -1.292 1 1 0 Petal.Length
#> Petal.Width 9.698045e-17 3.879218e-16 -0.700 1 1 0 Petal.Width