Skip to contents

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 = NULL,
  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 Seurat object used for label transfer.

assay

Assay to use. NULL uses the default assay.

method

Label-transfer backend. One of "Seurat" or "scOMM".

prefix

Prefix used to resolve ATAC reductions.

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 srt used to weight transferred labels. If NULL, an ATAC linear reduction is resolved automatically from ATAC_default_linear_reduction, {prefix}lsi, {prefix}svd, or the current default reduction.

dims

Query reduction dimensions used by TransferData.

features

Features used by FindTransferAnchors. If NULL, reference variable features are used.

prediction_prefix

Prefix added to prediction metadata columns. If NULL, "predicted_" is used for method = "Seurat" and "scomm_" is used for method = "scOMM".

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 srt used as the truth label when evaluate = 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 scOMM backend. If NULL, SCOP_SCOMM_PYTHON is consulted and reticulate defaults are used otherwise.

scomm_hidden_nodes, scomm_epochs, scomm_batch_size, scomm_threshold, scomm_seed

Parameters passed to the optional scOMM backend.

verbose

Whether to print the message. Default is TRUE.

Value

A Seurat object with prediction metadata added.

Examples

data("pbmcmultiome_sub", package = "scop")
pbmcmultiome_sub <- RunStandardWorkflow(
  pbmcmultiome_sub,
  assay = "RNA",
  linear_reduction_dims = 20
)
#>  [2026-08-30 05:16:14] Start standard processing workflow...
#>  [2026-08-30 05:16:15] Checking a list of <Seurat>...
#> ! [2026-08-30 05:16:15] Data 1/1 of the `srt_list` is "unknown"
#> Warning: Data 1/1 of the `srt_list` is "unknown"
#>  [2026-08-30 05:16:15] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-08-30 05:16:15] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-08-30 05:16:15] Use the separate HVF from `srt_list`
#>  [2026-08-30 05:16:15] Number of available HVF: 2000
#>  [2026-08-30 05:16:15] Finished check
#>  [2026-08-30 05:16:15] Perform `ScaleData()`
#>  [2026-08-30 05:16:15] Perform pca linear dimension reduction
#>  [2026-08-30 05:16:16] Use stored estimated dimensions 1:9 for Standardpca
#>  [2026-08-30 05:16:16] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-08-30 05:16:16] Reorder clusters...
#>  [2026-08-30 05:16:17] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-08-30 05:16:17] Perform umap nonlinear dimension reduction
#>  [2026-08-30 05:16:26] 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 <- RunStandardWorkflow(
  query,
  assay = "peaks",
  normalization_method = "TFIDF",
  linear_reduction_dims = 20
)
#>  [2026-08-30 05:16:26] Start standard processing workflow...
#>  [2026-08-30 05:16:26] Checking a list of <Seurat>...
#> ! [2026-08-30 05:16:27] Data 1/1 of the `srt_list` is "raw_counts"
#> Warning: Data 1/1 of the `srt_list` is "raw_counts"
#>  [2026-08-30 05:16:27] Perform `RunTFIDF()` on 1/1 of `srt_list`...
#>  [2026-08-30 05:16:27] Perform `FindTopFeatures()` on 1/1 of `srt_list`...
#>  [2026-08-30 05:16:27] Use the separate HVF from `srt_list`
#>  [2026-08-30 05:16:27] Number of available HVF: 11426
#>  [2026-08-30 05:16:27] Finished check
#>  [2026-08-30 05:16:27] `normalization_method` is TFIDF. Use lsi workflow
#>  [2026-08-30 05:16:27] Perform svd linear dimension reduction
#> Running SVD
#> Scaling cell embeddings
#>  [2026-08-30 05:16:27] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-08-30 05:16:27] Reorder clusters...
#>  [2026-08-30 05:16:27] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-08-30 05:16:27] Perform umap nonlinear dimension reduction
#>  [2026-08-30 05:16:35] 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-08-30 05:16:35] Use existing query assay "RNA" as `gene_activity_assay`
#>  [2026-08-30 05:16:35] Use "ATAClsi" as the ATAC weight reduction
#>  [2026-08-30 05:16:35] Adjust `k.filter` from 200 to 99 for small-sample ATAC mapping
#>  [2026-08-30 05:16:35] Running RNA reference label transfer for ATAC cells...
#>  [2026-08-30 05:16:37] Adjust `k.weight` from 100 to 95 for small-sample ATAC mapping