troutpy.pp.define_urna_probability_stainings

troutpy.pp.define_urna_probability_stainings#

troutpy.pp.define_urna_probability_stainings(sdata, intensity_adata_key='image_intensity_per_transcript', prob_threshold=0.5, copy=False)#

Classify transcripts as extracellular (uRNA) from image-staining intensity similarity.

Builds per-cell-type staining-intensity signatures from transcripts confidently assigned to a cell type, computes the cosine similarity of every transcript’s staining-intensity profile to its closest matching signature, and uses grid-interpolated KDEs (as in define_urna_probability()) to derive P(uRNA | cosine_similarity).

Parameters:
  • sdata (spatialdata.SpatialData) – SpatialData object with a "transcripts" points layer containing overlaps_cell, closest_cell_type, and enrichment_class columns, and a table at intensity_adata_key with one row per transcript and the staining-intensity matrix in .X.

  • intensity_adata_key (str, optional) – Key of the table in sdata holding per-transcript image-intensity values. Defaults to "image_intensity_per_transcript".

  • prob_threshold (float, optional) – Minimum prob_is_urna_stainings value for a transcript outside a cell to be classified as extracellular. Defaults to 0.5.

  • copy (bool, optional) – If True, operate on and return a deep copy of sdata. Otherwise modify sdata in place and return None. Defaults to False.

Returns:

spatialdata.SpatialData or None SpatialData with cosine_sim_stainings, prob_is_urna_stainings, and extracellular_stainings columns added to the "transcripts" layer if copy=True; otherwise None.