bento.tl.comp_diff¶
- bento.tl.comp_diff(sdata, points_key, shape_names, groupby, ref_group) SpatialData¶
Calculate the average difference in gene composition for shapes across batches of cells.
Uses the Wasserstein distance to compare compositions.
- Parameters:
sdata (SpatialData) – SpatialData object.
points_key (str) – Key for points DataFrame in sdata.points.
shape_names (List[str]) – Names of shapes to calculate compositions for.
groupby (str) – Key in sdata.points[points_key] to group cells by.
ref_group (str) – Reference group to compare other groups to.
- Returns:
Updated SpatialData object with composition statistics for each group stored in sdata.tables[“table”].uns[“{groupby}_comp_stats”].
- Return type:
SpatialData