Annotate single cells using SingleR
Usage
RunSingleR(
srt_query,
srt_ref,
query_group = NULL,
ref_group = NULL,
query_assay = "RNA",
ref_assay = "RNA",
genes = "de",
de.method = "wilcox",
sd.thresh = 1,
de.n = NULL,
aggr.ref = FALSE,
aggr.args = list(),
quantile = 0.8,
fine.tune = TRUE,
tune.thresh = 0.05,
prune = TRUE,
cores = 1,
verbose = TRUE
)Arguments
- srt_query
An object of class Seurat to be annotated with cell types.
- srt_ref
An object of class Seurat storing the reference cells.
- query_group
Column name in the
srt_querymetadata that represents the cell grouping.- ref_group
Column name in the
srt_refmetadata that represents the cell grouping.- query_assay
Assay to be used for the query data. Default is the default assay of the
srt_queryobject.- ref_assay
Assay to be used for the reference data. Default is the default assay of the
srt_refobject.- quantile
"quantile" parameter in SingleR::SingleR function.
- fine.tune
"fine.tune"parameter in SingleR::SingleR function.- tune.thresh
"tune.thresh"parameter in SingleR::SingleR function.- prune
"prune"parameter in SingleR::SingleR function.- cores
The number of worker processes to use for parallelization. Default is
1.- verbose
Whether to print the message. Default is
TRUE.
Value
An annotate Seurat object.
The annotation results are stored in the singler_annotation column of the meta data,
and the corresponding scores are stored in the singler_score column.
Examples
data(panc8_sub)
keep <- panc8_sub$celltype %in% c("ductal", "alpha", "beta")
panc8_sub <- Seurat::NormalizeData(panc8_sub[, keep], verbose = FALSE)
reference <- panc8_sub[, panc8_sub$tech != "fluidigmc1"]
query <- panc8_sub[, panc8_sub$tech == "fluidigmc1"]
query <- RunSingleR(
srt_query = query, srt_ref = reference,
ref_group = "celltype", genes = "de", cores = 1, verbose = FALSE
)
#> ℹ [2026-10-11 23:48:48] Data type is log-normalized
#> ℹ [2026-10-11 23:48:48] Detected `srt_query` data type: "log_normalized_counts"
#> ℹ [2026-10-11 23:48:49] Data type is log-normalized
#> ℹ [2026-10-11 23:48:49] Detected `srt_ref` data type: "log_normalized_counts"
query <- RunStandardWorkflow(query, verbose = FALSE, linear_reduction_dims = 10)
#> ℹ [2026-10-11 23:48:50] Skip `log1p()` because `layer = data` is not "counts"
CellDimPlot(
query,
group.by = "singler_annotation",
label = TRUE, legend.position = "bottom"
)
FeatureStatPlot(
query,
stat.by = "singler_score",
group.by = "singler_annotation"
)