fastMNN is a variant of the classic MNN method, modified for speed and more robust performance. For introduction of MNN, see runMNNCorrect.

runFastMNN(
  inSCE,
  useAssay = "logcounts",
  useReducedDim = NULL,
  batch = "batch",
  reducedDimName = "fastMNN",
  k = 20,
  propK = NULL,
  ndist = 3,
  minBatchSkip = 0,
  cosNorm = TRUE,
  nComponents = 50,
  weights = NULL,
  BPPARAM = BiocParallel::SerialParam()
)

Arguments

inSCE

Input SingleCellExperiment object

useAssay

A single character indicating the name of the assay requiring batch correction. Default "logcounts".

useReducedDim

A single character indicating the dimension reduction used for batch correction. Will ignore useAssay when using. Default NULL.

batch

A single character indicating a field in colData that annotates the batches of each cell; or a vector/factor with the same length as the number of cells. Default "batch".

reducedDimName

A single character. The name for the corrected low-dimensional representation. Default "fastMNN".

k

An integer scalar specifying the number of nearest neighbors to consider when identifying MNNs. See "See Also". Default 20.

propK

A numeric scalar in (0, 1) specifying the proportion of cells in each dataset to use for mutual nearest neighbor searching. See "See Also". Default NULL.

ndist

A numeric scalar specifying the threshold beyond which neighbours are to be ignored when computing correction vectors. See "See Also". Default 3.

minBatchSkip

Numeric scalar specifying the minimum relative magnitude of the batch effect, below which no correction will be performed at a given merge step. See "See Also". Default 0.

cosNorm

A logical scalar indicating whether cosine normalization should be performed on useAssay prior to PCA. See "See Also". Default TRUE.

nComponents

An integer scalar specifying the number of dimensions to produce. See "See Also". Default 50.

weights

The weighting scheme to use. Passed to multiBatchPCA. Default NULL.

BPPARAM

A BiocParallelParam object specifying whether the SVD should be parallelized.

Value

The input SingleCellExperiment object with reducedDim(inSCE, reducedDimName) updated.

References

Lun ATL, et al., 2016

See also

fastMNN for using useAssay, and reducedMNN for using useReducedDim

Examples

data('sceBatches', package = 'singleCellTK')
logcounts(sceBatches) <- log1p(counts(sceBatches))
sceCorr <- runFastMNN(sceBatches, useAssay = 'logcounts')
#> Warning: You're computing too large a percentage of total singular values, use a standard svd instead.