Skip to contents

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 an Assay5 object if not called by IntegrateLayers)

orig

DimReduc object. Not to be set directly when called with IntegrateLayers, use orig.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

See also

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)
} # }