hest.readers.pool_transcripts_xenium

hest.readers.pool_transcripts_xenium(df: pd.DataFrame | dd.DataFrame, pixel_size_he: float, spot_size_um=100.0, key_x='he_x', key_y='he_y') sc.AnnData

Pool a xenium transcript dataframe by square spots of spot_size_um micrometers.

Parameters:
  • df (Union[pd.DataFrame, dd.DataFrame]) –

    xenium transcipts (dask) dataframe containing columns:

    • ’he_x’ and ‘he_y’ indicating the pixel coordinates of each transcripts in the morphology image

    • ’feature_name’ indicating the transcript name

  • pixel_size_he (float) – pixel size in um/px of ‘he_x’ and ‘he_y’

  • spot_size_um – pooling rectangle width in um

  • key_x – column name of pixel x coordinate of each transcript in df

  • key_y – column name of pixel y coordinate of each transcript in df

Returns:

AnnData object, each row in .obs represents a bin, each row in .X represents the sum of transcripts within that bin. Center coordinates of each bin (in pixel on WSI) are in adata.obsm[‘spatial’]

Return type:

sc.AnnData