scanpy.pp.combat(adata, key='batch', covariates=None, inplace=True)

ComBat function for batch effect correction [Johnson07] [Leek12] [Pedersen12].

Corrects for batch effects by fitting linear models, gains statistical power via an EB framework where information is borrowed across genes. This uses the implementation of ComBat [Pedersen12].

adata : AnnData

Annotated data matrix

key : str, optional (default: "batch")

Key to a categorical annotation from adata.obs that will be used for batch effect removal

covariates : Collection[str], NoneOptional[Collection[str]]

Additional covariates such as adjustment variables or biological condition. Note that not including covariates may introduce bias or lead to the removal of biological signal in unbalanced designs.

inplace : bool, optional (default: True)

Wether to replace adata.X or to return the corrected data


Depending on the value of inplace, either returns an updated AnnData object or modifies the passed one.