scanpy.pp.regress_out#
- scanpy.pp.regress_out(adata, keys, *, layer=None, n_jobs=None, copy=False)[source]#
Regress out (mostly) unwanted sources of variation.
Uses simple linear regression. This is inspired by Seurat’s
regressOutfunction in R [Satija et al., 2015]. Note that this function tends to overcorrect in certain circumstances as described in #526.- Parameters:
- adata
AnnData The annotated data matrix.
- keys
str|Sequence[str] Keys for observation annotation on which to regress on.
- layer
str|None(default:None) If provided, which element of layers to regress on.
- n_jobs
int|None(default:None) Number of jobs for parallel computation.
Nonemeans usingscanpy.settings.n_jobs.- copy
bool(default:False) Determines whether a copy of
adatais returned.
- adata
- Return type:
- Returns:
Returns
Noneifcopy=False, else returns an updatedAnnDataobject. Sets the following fields:adata.X|adata.layers[layer]numpy.ndarray|scipy.sparse.csr_matrix(dtypefloat)Corrected count data matrix.