bento.tl.analyze_points

bento.tl.analyze_points(sdata, shape_keys, feature_names, points_key='transcripts', instance_key='cell_boundaries', groupby=None, recompute=False, progress=False)

Calculate features for each point group. Groups are always within each cell.

When creating the points_df, it first grabs sdata.points[points_key] and joins shape polygons from sdata.shapes[shape_keys]. The second join is to sdata.shapes[instance_key] to pull in cell polygons and cell features. The shape indices in the points object are renamed to have _index as a suffix to avoid conflicts. The joined polygons are named with it’s respective shape_key.

Parameters:
  • sdata (SpatialData) – Spatially formatted SpatialData

  • shape_keys (str or list of str) – Names of the shapes to analyze.

  • feature_names (str or list of str) – Names of the features to analyze.

  • groupby (str or list of str, optional) – Key(s) in `data.points[‘points’] to groupby, by default None. Always treats each cell separately

Returns:

sdata

table.uns[“point_feature”]

See the output of each PointFeature in features for keys added.

Return type:

spatialdata.SpatialData