troutpy.tl.compute_source_cells

troutpy.tl.compute_source_cells#

troutpy.tl.compute_source_cells(sdata, expression_threshold=1, gene_key='gene', layer='transcripts', copy=False)#

Compute the source of extracellular RNA by linking detected extracellular transcripts to specific cell types in the spatial data.

Parameters:
  • sdata (spatialdata.SpatialData) – The input spatial data object containing spatial transcriptomics data.

  • expression_threshold (float) – Threshold for filtering transcripts based on expression levels.

  • gene_key (str) – Column name for gene identifiers in the transcripts data.

  • layer (str) – Layer in sdata.points containing the transcript information.

  • copy (bool) – If True, returns a modified copy of the spatial data object. Otherwise, modifies in place.

Returns:

sdata: spatialdata.SpatialData The modified spatial data object with added source metadata if copy=True. Otherwise, modifies the input object in place and returns None.