% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fast_mnn_v5.R
\name{FastMNNIntegration}
\alias{FastMNNIntegration}
\title{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{
\item{object}{A merged seurat object}

\item{assay}{Assay to use, defaults to the default assay of the first object}

\item{groups}{A one-column data frame with grouping information}

\item{layers}{Layers to use}

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

\item{reduction.key}{Key for resulting DimReduc}

\item{reconstructed.assay}{Name for the assay containing the low-rank
reconstruction of the expression matrix.}

\item{verbose}{Print messages}

\item{...}{Extra parameters passed to \code{\link[batchelor]{fastMNN}}}

\item{reduction.name}{Name to store resulting DimReduc object as}
}
\value{
A Seurat object merged from the objects in \code{object.list} and a
new DimReduc of name \code{reduction.name} (key set to \code{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
\code{reconstructed.assay} assay; all other metadata info
\code{\link[batchelor]{fastMNN}} is stored in the \code{tool} slot,
accessible with \code{\link[Seurat]{Tool}}
}
\description{
Run fastMNN in Seurat 5
}
\note{
This function requires the
\href{https://rdrr.io/github/LTLA/batchelor/}{\pkg{batchelor}} package
to be installed
}
\examples{
\dontrun{
# 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)
}

}
\seealso{
\code{\link[batchelor]{fastMNN}} \code{\link[Seurat]{Tool}}
}
