Standalone label-transfer workflow for query cells using a reference object. The current implementation is optimized for scATAC query objects mapped to a scRNA-seq reference via gene activity.
Usage
RunLabelTransfer(
srt,
reference,
assay = NULL,
method = c("Seurat", "scOMM"),
prefix = "ATAC",
reference_assay = NULL,
reference_reduction = "pca",
reference_dims = 1:30,
reference_label = NULL,
add_gene_activity = TRUE,
gene_activity_assay = "ACTIVITY",
weight_reduction = NULL,
dims = 2:30,
features = NULL,
prediction_prefix = "predicted_",
k.weight = 100,
evaluate = FALSE,
truth_col = NULL,
tool_name = NULL,
rare_threshold = 0.05,
scomm_python = NULL,
scomm_hidden_nodes = c(128, 64),
scomm_epochs = 10,
scomm_batch_size = 32,
scomm_threshold = 0.5,
scomm_seed = 11,
verbose = TRUE
)Arguments
- srt
A Seurat object.
- reference
RNA reference
Seuratobject used for label transfer.- assay
Which assay to use. If
NULL, the default assay of the Seurat object will be used. When the object also containsChromatinAssay, the default assay and additionalChromatinAssaywill be preprocessed sequentially.- method
Label-transfer backend. One of
"Seurat"or"scOMM".- prefix
Prefix used to resolve ATAC reductions. Default is
"ATAC".- reference_assay
Assay used in the reference object.
- reference_reduction
Reduction used in the reference object.
- reference_dims
Dimensions used from the reference reduction.
- reference_label
Metadata column in the reference used as transfer labels.
- add_gene_activity
Whether to calculate a gene activity assay for the query.
- gene_activity_assay
Name of the gene activity assay used for mapping.
- weight_reduction
Reduction in
srtused to weight transferred labels. IfNULL, an ATAC linear reduction is resolved automatically fromATAC_default_linear_reduction,{prefix}lsi,{prefix}svd, or the current default reduction.- dims
Query reduction dimensions used by
TransferData.- features
Features used by
FindTransferAnchors. IfNULL, reference variable features are used.- prediction_prefix
Prefix added to prediction metadata columns.
- k.weight
Number of neighbors used when weighting transfer anchors.
- evaluate
Whether to compute mapping metrics against a truth label.
- truth_col
Metadata column in
srtused as the truth label whenevaluate = TRUE.- tool_name
Name used to store detailed results in
srt@tools.- rare_threshold
Maximum class proportion used to define rare classes when calculating
rare_recall.- scomm_python
Optional Python binary used by the
scOMMbackend. IfNULL,SCOP_SCOMM_PYTHONis consulted and reticulate defaults are used otherwise.Parameters passed to the optional
scOMMbackend.- verbose
Whether to print the message. Default is
TRUE.
Examples
data("pbmcmultiome_sub", package = "scop")
pbmcmultiome_sub <- standard_scop(
pbmcmultiome_sub,
assay = "RNA",
linear_reduction_dims = 20
)
#> ℹ [2026-05-14 07:30:00] Start standard processing workflow...
#> ℹ [2026-05-14 07:30:01] Checking a list of <Seurat>...
#> ! [2026-05-14 07:30:01] Data 1/1 of the `srt_list` is "unknown"
#> ℹ [2026-05-14 07:30:01] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#> ℹ [2026-05-14 07:30:03] Perform `Seurat::FindVariableFeatures()` on 1/1 of `srt_list`...
#> Warning: pseudoinverse used at -2.3979
#> Warning: neighborhood radius 0.30103
#> Warning: reciprocal condition number 1.2589e-15
#> ℹ [2026-05-14 07:30:03] Use the separate HVF from `srt_list`
#> ℹ [2026-05-14 07:30:03] Number of available HVF: 2000
#> ℹ [2026-05-14 07:30:04] Finished check
#> ℹ [2026-05-14 07:30:04] Perform `Seurat::ScaleData()`
#> ℹ [2026-05-14 07:30:04] Perform pca linear dimension reduction
#> ℹ [2026-05-14 07:30:04] Use stored estimated dimensions 1:20 for Standardpca
#> ℹ [2026-05-14 07:30:04] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#> ℹ [2026-05-14 07:30:05] Reorder clusters...
#> ℹ [2026-05-14 07:30:05] Skip `log1p()` because `layer = data` is not "counts"
#> ℹ [2026-05-14 07:30:05] Perform umap nonlinear dimension reduction
#> ℹ [2026-05-14 07:30:05] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#> ℹ [2026-05-14 07:30:11] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#> ✔ [2026-05-14 07:30:17] Standard processing workflow completed
reference <- subset(pbmcmultiome_sub, cells = colnames(pbmcmultiome_sub)[1:250])
query <- subset(pbmcmultiome_sub, cells = colnames(pbmcmultiome_sub)[251:350])
query <- standard_scop(
query,
assay = "peaks",
normalization_method = "TFIDF",
linear_reduction_dims = 20
)
#> ℹ [2026-05-14 07:30:17] Start standard processing workflow...
#> ℹ [2026-05-14 07:30:17] Checking a list of <Seurat>...
#> ! [2026-05-14 07:30:17] Data 1/1 of the `srt_list` is "raw_counts"
#> ℹ [2026-05-14 07:30:17] Perform `RunTFIDF()` on 1/1 of `srt_list`...
#> ℹ [2026-05-14 07:30:17] Perform `FindTopFeatures()` on 1/1 of `srt_list`...
#> ℹ [2026-05-14 07:30:17] Use the separate HVF from `srt_list`
#> ℹ [2026-05-14 07:30:17] Number of available HVF: 11426
#> ℹ [2026-05-14 07:30:17] Finished check
#> ℹ [2026-05-14 07:30:17] `normalization_method` is TFIDF. Use lsi workflow
#> ℹ [2026-05-14 07:30:17] Perform svd linear dimension reduction
#> Running SVD
#> Scaling cell embeddings
#> ℹ [2026-05-14 07:30:18] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#> ℹ [2026-05-14 07:30:18] Reorder clusters...
#> ℹ [2026-05-14 07:30:18] Skip `log1p()` because `layer = data` is not "counts"
#> ℹ [2026-05-14 07:30:18] Perform umap nonlinear dimension reduction
#> ℹ [2026-05-14 07:30:18] Perform umap nonlinear dimension reduction using ATACsvd (2:30)
#> ℹ [2026-05-14 07:30:24] Perform umap nonlinear dimension reduction using ATACsvd (2:30)
#> ✔ [2026-05-14 07:30:29] Standard processing workflow completed
query <- RunLabelTransfer(
srt = query,
reference = reference,
assay = "peaks",
reference_assay = "RNA",
reference_reduction = "Standardpca",
reference_label = "CellType",
reference_dims = 1:10,
dims = 2:10
)
#> ℹ [2026-05-14 07:30:29] Use "ATAClsi" as the ATAC weight reduction
#> ℹ [2026-05-14 07:30:29] Calculating gene activity assay...
#> Extracting gene coordinates
#> Error in atac_add_activity(srt = srt, assay = assay, gene_activity_assay = gene_activity_assay, verbose = verbose): Unable to calculate gene activity assay: "No fragment information found
#> for requested assay". Please provide a valid ATAC annotation.