Performs a control-only batch-mean correction using ComBat-style empirical Bayes shrinkage across genes, with regression or subtraction correction.
CorrectSampleComBat(
object,
assay = NULL,
layer = "data",
batch_key = NULL,
condition_key = NULL,
control_label = NULL,
par.prior = TRUE,
method = c("regression", "subtraction"),
correct.attenuation = FALSE,
floor.beta = NULL,
verbose = TRUE
)A Seurat object (sample-level).
Name of the assay to correct.
Default is DefaultAssay(object).
Layer within the assay that contains the data to correct.
Default is "data".
Column name in object@meta.data identifying the
batch (e.g., plate, pool).
Column name in object@meta.data identifying the
experimental condition.
Value(s) in the condition_key column that mark
control samples.
Logical; if TRUE (default), uses parametric
empirical Bayes estimation (EM). If FALSE, uses non-parametric
Monte Carlo integration.
Correction method. "regression" (default) estimates a
per-sample scaling factor \(\beta_i\) via OLS regression of each
sample's profile on the shrunk batch mean. "subtraction" directly
subtracts the shrunk batch mean (\(\beta = 1\) for all samples).
Logical; if TRUE the OLS regression slope
is corrected for attenuation caused by measurement error in the shrunk
batch means. Default FALSE. Only used when
method = "regression".
Floor applied to per-sample \(\beta\) estimates.
Default NULL (no floor). Set to e.g. 0 to prevent negative
betas. Only used when method = "regression".
Print progress messages. Default TRUE.
The Seurat object with the corrected data written back to the specified assay layer.
This function estimates batch effects from control samples only and corrects all samples via regression or subtraction. It standardises the control means to z-scores, computes moment-based priors across genes (one set of hyper-parameters per batch), and shrinks via parametric EM (or non-parametric MC) estimation.
if (FALSE) { # \dontrun{
obj <- CorrectSampleComBat(obj, assay = "LMC",
batch_key = "plate",
condition_key = "Condition",
control_label = "ctrl-inj")
} # }