R/runComBat.R
runComBat.RdThe 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.
runComBat( inSCE, useAssay = "logcounts", batch = "batch", par.prior = TRUE, covariates = NULL, mean.only = FALSE, ref.batch = NULL, assayName = "ComBat" )
| inSCE | SingleCellExperiment inherited object. Required. |
|---|---|
| useAssay | A single character indicating the name of the assay requiring
batch correction. Default |
| batch | A single character indicating a field in
|
| par.prior | A logical scalar. TRUE indicates parametric adjustments
will be used, FALSE indicates non-parametric adjustments will be used.
Default |
| covariates | List of other column names in colData to be added to the
ComBat model as covariates. Default |
| mean.only | If TRUE ComBat only corrects the mean of the batch effect.
Default |
| ref.batch | If given, will use the selected batch as a reference for
batch adjustment. Default |
| assayName | A single characeter. The name for the corrected assay. Will
be saved to |
The input SingleCellExperiment object with
assay(inSCE, assayName) updated.
if (FALSE) { 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') }