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
regressOut
function in R [Satija et al., 2015]. Note that this function tends to overcorrect in certain circumstances as described in issue526.- 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.
None
means usingscanpy._settings.ScanpyConfig.n_jobs
.- copy
bool
(default:False
) Determines whether a copy of
adata
is returned.
- adata
- Return type:
- Returns:
Returns
None
ifcopy=False
, else returns an updatedAnnData
object. Sets the following fields:adata.X
|adata.layers[layer]
numpy.ndarray
|scipy.sparse._csr.csr_matrix
(dtypefloat
)Corrected count data matrix.