This will find transfer anchors between query and reference, and map the query to the reference.
For SCT-normalized references, Seurat::FindTransferAnchors() handles query normalization internally
by recomputing residuals using the reference's SCT model (recompute.residuals = TRUE by default),
so a manual call to Seurat::SCTransform() on the query is NOT needed.
For LogNormalize references, the query is normalized with Seurat::NormalizeData() prior to anchor
finding.
Usage
RunSeuratMap2Ref(
object,
ref,
use,
ident = "seurat_clusters",
refnorm = c("auto", "LogNormalize", "SCT", "SCTransform"),
skip_if_normalized = TRUE,
split_by = NULL,
ncores = 1,
MapQueryArgs = list(refdata = list()),
FindTransferAnchorsArgs = list(),
SCTransformArgs = list(),
NormalizeDataArgs = list(),
log = NULL,
cache = NULL
)Arguments
- object
Seurat object
- ref
Reference Seurat object or a file path to a Seurat object with .rds or .h5seurat extension
- use
The name in the metadata of the reference to use as identity for the query after mapping
- ident
The name of the identity in metadata after mapping
- refnorm
The normalization method used by the reference. The same normalization method will be used for the query.
"auto": automatically detect the normalization method used by the reference
"LogNormalize": LogNormalize
"SCT": SCTransform
"SCTransform": SCTransform (alias for SCT)
- skip_if_normalized
For LogNormalize, skip
Seurat::NormalizeData()if the query's default assay is already 'RNA' (i.e., already log-normalized). For SCT withFindTransferAnchorsArgs$recompute.residuals = FALSE, skipSeurat::SCTransform()if the default assay is already 'SCT'. This parameter has no effect in the default SCT case (recompute.residuals = TRUE), whereSeurat::FindTransferAnchors()handles normalization internally using the reference model.- split_by
The name of the metadata to split the query object by and do the mapping separately
- ncores
Number of cores to use for parallel processing for the split query objects
- MapQueryArgs
Arguments to pass to
Seurat::MapQuery(). Theuseargument will be added to therefdatalist.- FindTransferAnchorsArgs
Arguments to pass to
Seurat::FindTransferAnchors().- SCTransformArgs
Arguments to pass to
Seurat::SCTransform(). Only used whenrefnormis set to "SCT" ANDFindTransferAnchorsArgs$recompute.residualsis explicitly set toFALSE. In the default case (recompute.residuals = TRUE),Seurat::FindTransferAnchors()recomputes query residuals from raw counts using the reference SCT model, making manualSeurat::SCTransform()on the query unnecessary.- NormalizeDataArgs
Arguments to pass to
Seurat::NormalizeData(). Will be used to normalize the query object ifrefnormis set to "LogNormalize"- log
Logger
- cache
Directory to cache the results. Set to
FALSEto disable caching