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 deriveP(uRNA | cosine_similarity).- Parameters:
sdata (spatialdata.SpatialData) – SpatialData object with a
"transcripts"points layer containingoverlaps_cell,closest_cell_type, andenrichment_classcolumns, and a table atintensity_adata_keywith one row per transcript and the staining-intensity matrix in.X.intensity_adata_key (str, optional) – Key of the table in
sdataholding per-transcript image-intensity values. Defaults to"image_intensity_per_transcript".prob_threshold (float, optional) – Minimum
prob_is_urna_stainingsvalue for a transcript outside a cell to be classified as extracellular. Defaults to0.5.copy (bool, optional) – If
True, operate on and return a deep copy ofsdata. Otherwise modifysdatain place and returnNone. Defaults toFalse.
- Returns:
spatialdata.SpatialData or None SpatialData with
cosine_sim_stainings,prob_is_urna_stainings, andextracellular_stainingscolumns added to the"transcripts"layer ifcopy=True; otherwiseNone.