mantispy.tl.wasserstein_features#
- mantispy.tl.wasserstein_features(adata, groupby='Metadata_Perturbation', reference='negcon', key_added='wasserstein', copy=False)[source]#
Wasserstein-1 distance per feature between each group and the reference.
- Parameters:
- adata
AnnData Object to score. Most useful at single-cell resolution, where a group is a distribution rather than a point.
- groupby
str(default:'Metadata_Perturbation') As in
effect_size().- reference
str|None(default:'negcon') As in
effect_size().- key_added
str(default:'wasserstein') Name for the outputs.
- copy
bool(default:False) Return a modified copy instead of mutating in place.
- adata
- Return type:
- Returns:
None, or the modified copy. Writesvarm[key_added], a tidyuns["mantispy"][key_added]withgroup,featureanddistance, and the group order inuns["mantispy"][key_added + "_groups"], laid out as ineffect_size().- Raises:
ValueError –
referenceselects no rows.
Notes
The distance compares whole distributions, so a perturbation that widens a feature without moving its mean (a mixed response where only some cells react) is detected here but not by
effect_size(). The distance is in the feature’s units, so normalize first to compare features with each other.