Run classical MNN on Seurat's Assay5 object through IntegrateLayers
Source: R/MNN.R
MNNIntegration.Rd
A wrapper to run mnnCorrect
on multi-layered Seurat V5 object
Usage
MNNIntegration(
object,
orig = NULL,
groups = NULL,
layers = NULL,
scale.layer = NULL,
features = 2000,
reconstructed.assay = "mnn.reconstructed",
verbose = TRUE,
...
)
Arguments
- object
A
Seurat
object (or anAssay5
object if not called byIntegrateLayers
)- orig
DimReduc
object. Not to be set directly when called withIntegrateLayers
, useorig.reduction
argument instead- groups
Ignored
- layers
Name of the layers to use in the integration
- scale.layer
Name of the scaled layer in
Assay
- features
Either a list of features to use when calculating batch correction, or a number (2000 by default) of variable features to select.
- reconstructed.assay
Name for the assay containing the low-rank reconstruction of the expression matrix.
- verbose
Print messages. Set to
FALSE
to disable- ...
Extra parameters passed to
mnnCorrect
Value
A Seurat object merged from the objects in object.list
and a
new DimReduc of name reduction.name
(key set to reduction.key
)
with corrected embeddings matrix as well as the rotation matrix used for the
PCA stored in the feature loadings slot. Also returns an expression matrix
reconstructed from the low-rank approximation in the
reconstructed.assay
assay; all other metadata info
mnnCorrect
is stored in the tool
slot,
accessible with Tool
Note
This function requires the batchelor package to be installed
Examples
if (FALSE) { # \dontrun{
# Preprocessing
obj <- UpdateSeuratObject(SeuratData::LoadData("pbmcsca"))
obj[["RNA"]] <- split(obj[["RNA"]], f = obj$Method)
obj <- NormalizeData(obj)
obj <- FindVariableFeatures(obj)
obj <- ScaleData(obj)
obj <- RunPCA(obj)
# After preprocessing, we integrate layers:
obj <- IntegrateLayers(object = obj, method = MNNIntegration,
new.reduction = 'integrated.mnn', verbose = FALSE)
# We can also add parameters specific to mnnCorrect.
# Here we set `k` to specify the number of nearest neighbors
# to use when identifying MNNs:
obj <- IntegrateLayers(object = obj, method = MNNIntegration,
new.reduction = 'integrated.mnn', k = 15, verbose = FALSE)
} # }