bioalpha.singlecell.preprocessing.regress_out

bioalpha.singlecell.preprocessing.regress_out(adata: AnnData | H5ADMap, keys: str | Sequence[str], layer: str | None = None, key_added: str | None = None, copy: bool = False) AnnData | None

Regress out (mostly) unwanted sources of variation.

Parameters:
  • adata (Union[AnnData, H5ADMap]) – The annotated or mapping data matrix of shape n_obs * n_vars. Rows correspond to cells and columns to genes.

  • keys (Union[str, Sequence[str]]) – Keys for observation annotation on which to regress on.

  • layer (Optional[str], default = None) – Whether using layer for input data or not. Using .X when layer=None

  • key_added (Optional[str], default = None) – If not None, save result to .layers[key_added]. Required when run with H5ADMap data.

  • copy (bool, default = False) – Determines whether a copy of adata is returned. Ignore when running with H5ADMap data.

Return type:

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