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 : AnnData

The annotated data matrix.

keys : Union[str, Sequence[str]]

Keys for observation annotation on which to regress on.

n_jobs : Optional[int] (default: None)

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

copy : bool (default: False)

Determines whether a copy of adata is returned.

Return type:

Optional[AnnData]

Returns:

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