troutpy.tl.compute_target_score#
- troutpy.tl.compute_target_score(sdata, layer='transcripts', gene_key='gene', coords_key=None, lambda_decay=0.1, copy=False, celltype_key='cell type', k_neighbors=50, batch_size=100000)#
Computes scores for each extracellular transcript targeting specific cell types using spatial proximity.
- Parameters:
sdata (spatialdata.SpatialData) – The input spatial data object.
layer (str) – The layer in
sdata.pointscontaining transcript data. Default is ‘transcripts’.gene_key (str) – Column name in the transcript data representing gene identifiers.
coords_key (list) – Column names for spatial coordinates of transcripts and cell centroids.
lambda_decay (float) – The exponential decay factor for distances.
copy (bool) – If True, returns a modified copy of the SpatialData object.
celltype_key (str) – Key for cell type annotations in the cell table.
k_neighbors (int) – Number of nearest cells to consider per transcript.
batch_size (int) – Number of transcripts to process per batch to limit memory usage.
- Returns:
-sdata (
SpatialData) SpatialData object with target score table added.