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.pointsthat holds the transcript data. Defaults to"transcripts".method (str, optional) –
Classification strategy. One of:
"spots2regions"— uses segmentation-free cluster proportions."sainsc"— uses the Bayesianprob_is_urnacolumn produced by SAiNSC."nuclei"— marks transcripts outside nucleus overlap as extracellular."cells"— marks transcripts withcell_id == unassigned_tagas 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 to0.8.unassigned_tag (str, optional) – String value in the
cell_idcolumn that indicates an unassigned transcript. Defaults to"UNASSIGNED".copy (bool, optional) – If
True, return the modified SpatialData object. IfFalse, modify in place and returnNone. Defaults toFalse.prob_threshold (float, optional) – Minimum
prob_is_urnavalue for a transcript to be classified as extracellular (used by"sainsc"). Defaults to0.5.
- Returns:
spatialdata.SpatialData or None Modified SpatialData with an
extracellularboolean column added to the points layer ifcopy=True; otherwiseNone.- Raises:
KeyError – If
method="sainsc"and theprob_is_urnacolumn is absent.ValueError – If an unsupported
methodstring is provided.