MNN is designed for batch correction of single-cell RNA-seq data where the batches are partially confounded with biological conditions of interest. It does so by identifying pairs of MNN in the high-dimensional log-expression space. For each MNN pair, a pairwise correction vector is computed by applying a Gaussian smoothing kernel with bandwidth `sigma`.

runMNNCorrect(
  inSCE,
  useAssay = "logcounts",
  batch = "batch",
  assayName = "MNN",
  k = 20L,
  sigma = 0.1
)

Arguments

inSCE

SingleCellExperiment inherited object. Required.

useAssay

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

batch

A single character indicating a field in colData that annotates the batches. Default "batch".

assayName

A single characeter. The name for the corrected assay. Will be saved to assay. Default "MNN".

k

An integer. Specifies the number of nearest neighbours to consider when defining MNN pairs. This should be interpreted as the minimum frequency of each cell type or state in each batch. Larger values will improve the precision of the correction by increasing the number of MNN pairs, at the cost of reducing accuracy by allowing MNN pairs to form between cells of different type. Default 20L.

sigma

A Numeric scalar. Specifies how much information is shared between MNN pairs when computing the batch effect. Larger values will share more information, approaching a global correction for all cells in the same batch. Smaller values allow the correction to vary across cell types, which may be more accurate but comes at the cost of precision. Default 0.1.

Value

The input SingleCellExperiment object with assay(inSCE, assayName) updated.

References

Lun ATL, et al., 2016 & 2018

Examples

data('sceBatches', package = 'singleCellTK')
logcounts(sceBatches) <- log(counts(sceBatches) + 1)
sceCorr <- runMNNCorrect(sceBatches)