cuspa.io.transcripts_from_spatialdata#

cuspa.io.transcripts_from_spatialdata(
sdata: Any,
points_key: str,
*,
gene_column: str | None = 'feature_name',
dtype: Any = None,
) → Transcripts#

Extract an (xy, gene_ids, gene_names) triple from a SpatialData points element.

Parameters:
sdata

A spatialdata.SpatialData object.

points_key

Name of a points element. sdata[points_key] is a dask.dataframe.DataFrame with at least x and y columns.

gene_column

Column name holding the per-transcript gene label. Values are encoded as a categorical and emitted as int32 codes suitable for cuspa.tl.aggregate_to_cells(). Set to None to skip.

dtype

Floating-point dtype for the xy tensor. Defaults to cupy.float32.

Returns:
Transcripts