rapids_singlecell.pp.regress_out#
- rapids_singlecell.pp.regress_out(adata, covariates=None, *, use=None, out=False, batchsize=None, verbose=False, layer=None, inplace=True, copy=False, keys=None)[source]#
Use linear regression to adjust for the effects of unwanted noise and variation.
- Parameters:
- adata
AnnData AnnData object
- covariates
AdRef|str|Sequence[AdRef|str] |None(default:None) Observation annotation(s) to regress on, e.g.
A.obs['n_counts']. Strings name.obscolumns (resolved byanndata.acc.AdAcc.resolve()with thescanpy-v2-previewpreset). Supports both numerical and single categorical covariates.- use
LayerAcc|MultiAcc|str|None(default:None) Which matrix to regress, e.g.
A.XorA.layers['counts']. Strings are resolved byanndata.acc.AdAcc.resolve(), e.g.'layers.counts'.- out
LayerAcc|MultiAcc|str|bool(default:False) Where to write the result, e.g.
A.layers['k'](or'layers.k'). IfTrue, the result is returned instead of written. IfFalse, it is written to the placeusereads from.- batchsize
int|Literal['all'] |None(default:None) Number of genes that should be processed together. If
'all'all genes will be processed together if.n_obs<100000. IfNoneeach gene will be analysed separately. Only used for continuous covariates.- verbose
bool(default:False) Print debugging information
- adata
- Return type:
- Returns:
The corrected matrix if
out=True, elseNone.