scmorph.pp.remove_batch_effects

scmorph.pp.remove_batch_effects#

scmorph.pp.remove_batch_effects(adata, bio_key=None, batch_key='infer', log=False, copy=False, treatment_key=None, control='DMSO')#

Remove batch effects

Remove batch effects using scone’s method of deconvoluting technical from biological effects through linear modeling. Note that this preserves biological differences and only removes technical effects. If no biological differences are expected (e.g. because data is all from the same cell line), set bio_key to None.

For details on scone, see Cole et al. [2019].

Parameters:
  • adata (AnnData) – Annotated data matrix

  • bio_key (Optional[str] (default: None)) – Name of column used to delineate biological entities, e.g. cell lines.

  • batch_key (str (default: 'infer')) – Name of column used to delineate batch effects, e.g. plates. Will try to guess if no argument is given.

  • log (bool (default: False)) – Whether to compute log-transformed batch effects. Caution: this will drop any feature with values smaller than -0.99, because it would result in non-finite values.

  • copy (bool (default: False)) – If False, will perform operation in-place, else return a modified copy of the data.

  • treatment_key (str) – Name of column used to delinate treatments. This is used when computing batch effects across drug-treated plates. In that case, we compute batch effects only on untreated cells and then apply the correction factors to all cells. If using, please also see control.

  • control (str) – Name of control treatment. Must be valid value in treatment_key.

Return type:

None | AnnData

Returns:

Annotated data matrix with batch effects removed. If copy is False, will modify in-place and not return anything.