bento.io.prep

bento.io.prep(sdata, points_key='transcripts', feature_key='feature_name', instance_key='cell_boundaries', shape_keys=['cell_boundaries', 'nucleus_boundaries']) SpatialData

Computes spatial indices for elements in SpatialData to enable usage of bento-tools.

Specifically, this function indexes points to shapes and joins shapes to the instance shape. It also computes a count table for the points.

Parameters:
  • sdata (SpatialData) – Spatial formatted SpatialData object

  • points_key (str) – Key for points DataFrame in sdata.points

  • feature_key (str) – Key for the feature name in the points DataFrame

  • instance_key (str) – Key for the shape that will be used as the instance for all indexing. Usually the cell shape.

  • shape_keys (str, list) – List of shape names to index points to

Returns:

.shapes[shape_key]: Updated shapes GeoDataFrame with string index .points[points_key]: Updated points DataFrame with string index for each shape

Return type:

SpatialData