scanpy.pp.regress_out

scanpy.pp.regress_out(adata, keys, n_jobs=None, copy=False)

Regress out (mostly) unwanted sources of variation.

Uses simple linear regression. This is inspired by Seurat’s regressOut function in R [Satija15]. Note that this function tends to overcorrect in certain circumstances as described in issue 526.

Parameters
adata : AnnDataAnnData

The annotated data matrix.

keys : str, Sequence[str]Union[str, Sequence[str]]

Keys for observation annotation on which to regress on.

n_jobs : int, NoneOptional[int] (default: None)

Number of jobs for parallel computation. None means using scanpy._settings.ScanpyConfig.n_jobs.

copy : boolbool (default: False)

Determines whether a copy of adata is returned.

Return type

AnnData, NoneOptional[AnnData]

Returns

Depending on copy returns or updates adata with the corrected data matrix.