troutpy.pp.define_urna

Contents

troutpy.pp.define_urna#

troutpy.pp.define_urna(sdata, layer='transcripts', method='segmentation_free', min_prop_of_extracellular=0.8, unassigned_tag='UNASSIGNED', copy=False, prob_threshold=0.5)#

Identify extracellular RNA (uRNA) transcripts by classifying each transcript based on the specified segmentation method.

Parameters:
  • sdata (spatialdata.SpatialData) – SpatialData object containing a points layer with transcript coordinates and metadata columns used by the chosen method.

  • layer (str, optional) – Key in sdata.points that holds the transcript data. Defaults to "transcripts".

  • method (str, optional) –

    Classification strategy. One of:

    • "spots2regions" — uses segmentation-free cluster proportions.

    • "sainsc" — uses the Bayesian prob_is_urna column produced by SAiNSC.

    • "nuclei" — marks transcripts outside nucleus overlap as extracellular.

    • "cells" — marks transcripts with cell_id == unassigned_tag as extracellular.

    Defaults to "segmentation_free".

  • min_prop_of_extracellular (float, optional) – Minimum proportion of transcripts in a cluster that must be outside cells for the cluster to be considered extracellular (used by "spots2regions"). Defaults to 0.8.

  • unassigned_tag (str, optional) – String value in the cell_id column that indicates an unassigned transcript. Defaults to "UNASSIGNED".

  • copy (bool, optional) – If True, return the modified SpatialData object. If False, modify in place and return None. Defaults to False.

  • prob_threshold (float, optional) – Minimum prob_is_urna value for a transcript to be classified as extracellular (used by "sainsc"). Defaults to 0.5.

Returns:

spatialdata.SpatialData or None Modified SpatialData with an extracellular boolean column added to the points layer if copy=True; otherwise None.

Raises:
  • KeyError – If method="sainsc" and the prob_is_urna column is absent.

  • ValueError – If an unsupported method string is provided.