The problem — High-throughput profiling experiments — whether RNA microarrays, sequencing, or image-based morphological profiles — are routinely split across reagent lots, operator shifts, or instrument calibration cycles. Each introduces a systematic technical offset that, if uncorrected, inflates false-discovery rates and obscures reproducible biology. The effect is especially pronounced in multi-site studies where a "batch" may correspond to a different laboratory entirely.
What it is / how it works — pyComBat is the Python implementation of the ComBat family of methods, providing both pycombat_norm (for continuous expression or feature data, using a normal-distribution model) and pycombat_seq (for count data, using a negative binomial model). ComBat's core insight is Bayesian: rather than estimating batch parameters independently for each feature, it pools information across all features to stabilise the estimates — a critical advantage when per-feature sample sizes are small. The estimated additive (location) and multiplicative (scale) batch parameters are then subtracted from the data, leaving a corrected matrix in the original feature space.
Unlike Harmony, which operates in PCA embedding space, pyComBat returns corrected values in the full feature space. This is practically important for Cell Painting workflows where downstream analyses (activity clustering, MoA matching) operate on the feature matrix directly rather than on a reduced embedding.
Where it fits in the pipeline — pyComBat belongs at the correct stage, applied to normalised well-level profiles. It requires explicit batch labels and, optionally, biological covariate labels (e.g., compound class or cell line) that should be preserved rather than removed. Supplying covariate information is not optional for screening data — omitting it risks removing the very biological variation the assay was designed to measure.
Where it breaks — ComBat's parametric model assumes batch effects are approximately normal and separable from the biological signal. When batch and biology are confounded — for instance, when all wells from a given treatment class were run on a single plate — the model has no way to distinguish the two, and correction will attenuate the biological signal. The empirical Bayes pooling also requires a minimum number of features to be stable; on very small feature sets (< ~30 features) the pooling advantage disappears. As with all correction methods, validate with Percent Replicating before and after to confirm the correction is additive to signal rather than subtractive.