Skip to content

msmu.pp.correct_batch_effect

Batch correction methods for MuData object. GIS-based normalization, median centering, ComBat, and continuous batch correction (with lowess) are supported. ComBat uses inmoose (Colange et al., 2025), specifically its pycombat_norm function.

For 'gis', 'median_center', and 'continuous' the per-feature abundance scale is restored after correction (gis: the geometric mean of the per-batch GIS levels, i.e., classic IRS from Plubell et al. (2017); median_center/continuous: the per-feature overall median). Restoration is decided for the modality as a whole: when the matrix has cross-batch structure (at least one feature observed in >=2 batches, as at the peptide/protein level) every observed feature is restored -- a single-batch feature to its own level, so it stays on the same abundance scale as the rest. When the matrix is fully block-diagonal (no feature spans >=2 batches, e.g., a per-plex-split PSM matrix) nothing is restored and the output stays reference-relative, ready to roll up. ComBat scales itself.

Parameters:

Name Type Description Default
mdata MuData

MuData object to batch correct.

required
method Literal['gis', 'median_center', 'combat', 'continuous']

Batch correction method to use. Options are 'gis', 'median_center', 'combat', 'continuous'.

required
category str

Category in .obs to use for batch correction.

required
modality str

Modality to batch correct.

required
layer str | None

Layer to batch correct. If None, the default layer (.X) will be used.

None
gis_samples list[str] | None

List of GIS samples.

None
drop_gis bool

If True, GIS samples will be dropped after correction. Default is True.

True
log_transformed bool

If True, data is assumed to be log-transformed. Default is True.

True

Returns:

Type Description
MuData

Batch corrected MuData object.

References

Colange, M., Appé, G., Meunier, L., Weill, S., Johnson, W. E., Nordor, A., and Behdenna, A. Bridging the gap between R and Python in bulk transcriptomic data analysis with InMoose. Scientific Reports 15, 18104 (2025). https://doi.org/10.1038/s41598-025-03376-y.

Plubell, D. L. et al. Extended multiplexing of Tandem Mass Tags (TMT) labeling reveals age and high fat diet specific proteome changes in mouse epididymal adipose tissue. Molecular & Cellular Proteomics 16, 873–890 (2017). https://doi.org/10.1074/mcp.M116.065524.