scmorph.pp.remove_batch_effects#
- scmorph.pp.remove_batch_effects(adata, batch_key, bio_key=None, treatment_key=None, control='DMSO', copy=False, progress=False, log=False)[source]#
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_keyto None.For details on scone, see Cole et al. [2019].
- Parameters:
- adata
AnnData Annotated data matrix
- batch_key
str Name of column used to delineate batch effects, e.g. plates. Will try to guess if no argument is given.
- bio_key
str|None(default:None) Name of column used to delineate biological entities, e.g. cell lines.
- 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.- copy
bool(default:False) If False, will perform operation in-place, else return a modified copy of the data.
- progress
bool(default:False) Whether to show a progress bar
- 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.
- adata
- Return type:
None|AnnData- Returns:
Annotated data matrix with batch effects removed. If
copyis False, will modify in-place and not return anything.