FastMNNIntegration: Run fastMNN in Seurat 5

View source: R/fast_mnn_v5.R

FastMNNIntegrationR Documentation

Run fastMNN in Seurat 5

Description

Run fastMNN in Seurat 5

Usage

FastMNNIntegration(
  object,
  assay = NULL,
  orig = NULL,
  groups = NULL,
  layers = NULL,
  scale.layer = NULL,
  features = 2000,
  new.reduction = "integrated.mnn",
  reduction.key = "mnn_",
  reconstructed.assay = "mnn.reconstructed",
  verbose = TRUE,
  ...
)

Arguments

object

A merged seurat object

assay

Assay to use, defaults to the default assay of the first object

groups

A one-column data frame with grouping information

layers

Layers to use

features

Either a list of features to use when calculating batch correction, or a number (2000 by default) of variable features to select.

reduction.key

Key for resulting DimReduc

reconstructed.assay

Name for the assay containing the low-rank reconstruction of the expression matrix.

verbose

Print messages

...

Extra parameters passed to fastMNN

reduction.name

Name to store resulting DimReduc object as

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 fastMNN is stored in the tool slot, accessible with Tool

Note

This function requires the batchelor package to be installed

See Also

fastMNN Tool

Examples

## Not run: 
# Preprocessing
obj <- 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 = FastMNNIntegration,
  new.reduction = 'integrated.mnn', verbose = FALSE)

# We can also add parameters specific to FastMNN.
# Here we set `k` to specify the number of nearest neighbors to use when identifying MNNs:
obj <- IntegrateLayers(object = obj, method = FastMNNIntegration,
  new.reduction = 'integrated.mnn', k = 15, verbose = FALSE)

## End(Not run)


satijalab/seurat-wrappers documentation built on April 10, 2024, 3:25 p.m.