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, percentile_threshold=10)#

Identifies unassigned transcripts based on the specified method and updates the spatial data object accordingly.

Parameters:
  • sdata (spatialdata.SpatialData) – A spatial data object containing transcriptomic information.

  • layer (str) – The layer in sdata.points containing the transcript data to process.

  • method (str) –

    The method to define extracellular transcripts. Options:
    • ’spots2regions’: Uses segmentation-free clustering results.

    • ’sainsc’: Uses sainsc-derived signature matching.

    • ’nuclei’: Uses overlap with nuclear annotations to classify extracellular transcripts.

    • ’cells’: Classifies transcripts not assigned to a cell as extracellular.

  • min_prop_of_extracellular (float) – Minimum proportion of transcripts in a cluster required to be extracellular for it to be classified as such (used only with the ‘spots2regions’ method).

  • unassigned_tag (str) – Tag indicating transcripts not assigned to any cell.

  • copy (bool) – If True, returns a copy of the updated spatial data. If False, updates the sdata object in-place.

Returns:

Optional: spatialdata.SpatialData If copy is True, returns a copy of the updated sdata object. Otherwise, updates the sdata object in-place and returns None.

Notes

  • For the ‘spots2regions’ method, clustering results are used to determine extracellular transcripts.

  • The ‘sainsc’ method defines extracellular transcripts as those that are not assigned to any cell and whose local signature (match_cell_signature) is not False.

  • The ‘nuclei’ method classifies transcripts outside nuclei as extracellular.

  • The ‘cells’ method classifies transcripts unassigned to cells as extracellular.