rapids_singlecell.pp.regress_out

Contents

rapids_singlecell.pp.regress_out#

rapids_singlecell.pp.regress_out(adata, keys, *, layer=None, inplace=True, batchsize=100, verbose=False)[source]#

Use linear regression to adjust for the effects of unwanted noise and variation.

Parameters:
adata AnnData

AnnData object

keys str | list

Keys for numerical observation annotation on which to regress on.

layer str | None (default: None)

Layer to regress instead of X. If None, X is regressed.

inplace bool (default: True)

Whether to update adata or return the corrected matrix of adata.X and adata.layers.

batchsize int | Literal[‘all’] | None (default: 100)

Number of genes that should be processed together. If 'all' all genes will be processed together if .n_obs <100000. If None each gene will be analysed separately. Will be ignored if cuML version < 22.12

verbose bool (default: False)

Print debugging information

Return type:

cp.ndarray | None

Returns:

Returns a corrected copy or updates adata with a corrected version of the original adata.X and adata.layers['layer'], depending on inplace.