troutpy.tl.colocalization_proportion

troutpy.tl.colocalization_proportion#

troutpy.tl.colocalization_proportion(sdata, outpath, threshold_colocalized=1, filename='proportion_of_grouped_exRNA.parquet', save=True)#

Calculate the proportion of colocalized transcripts for each gene.

Parameters:
  • sdata (spatialdata.SpatialData) – SpatialData object with an "extracellular_transcripts_enriched" points layer (feature_name, bin_id columns) and a "segmentation_free_table" table whose .X holds per-bin transcript counts per gene.

  • outpath (str) – Directory path where the output file should be saved.

  • threshold_colocalized (int, optional) – Minimum per-bin count for a transcript to be considered colocalized. Defaults to 1.

  • filename (str, optional) – Name of the output Parquet file. Defaults to "proportion_of_grouped_exRNA.parquet".

  • save (bool, optional) – If True, write coloc to outpath/filename as a Parquet file. Defaults to True.

Returns:

pandas.DataFrame DataFrame indexed by gene with a single "proportion_of_colocalized" column.