runComBat {singleCellTK} | R Documentation

## Apply ComBat batch effect correction method to SingleCellExperiment object

### Description

The ComBat batch adjustment approach assumes that batch effects represent non-biological but systematic shifts in the mean or variability of genomic features for all samples within a processing batch. It uses either parametric or non-parametric empirical Bayes frameworks for adjusting data for batch effects.

### Usage

    runComBat(
      inSCE,
      useAssay = "logcounts",
      batch = "batch",
      par.prior = TRUE,
      covariates = NULL,
      mean.only = FALSE,
      ref.batch = NULL,
      assayName = "ComBat"
    )

### 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"`.
`par.prior` | A logical scalar. TRUE indicates parametric adjustments will be used, FALSE indicates non-parametric adjustments will be used. Default `TRUE`.
`covariates` | List of other column names in colData to be added to the ComBat model as covariates. Default `NULL`.
`mean.only` | If TRUE ComBat only corrects the mean of the batch effect. Default `FALSE`.
`ref.batch` | If given, will use the selected batch as a reference for batch adjustment. Default `NULL`.
`assayName` | A single characeter. The name for the corrected assay. Will be saved to `assay`. Default `"ComBat"`.

### Value

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

### Examples

    ## Not run:
    data('sceBatches', package = 'singleCellTK')
    # parametric adjustment
    sceCorr <- runComBat(sceBatches)
    # non-parametric adjustment, mean-only version
    sceCorr <- runComBat(sceBatches, par.prior=FALSE, mean.only=TRUE)
    # reference-batch version, with covariates
    sceCorr <- runComBat(sceBatches, covariates = "cell_type", ref.batch = 'w')

    ## End(Not run)

[Package singleCellTK version 2.0.0 Index]