troutpy.tl.assess_diffusion#
- troutpy.tl.assess_diffusion(sdata, gene_key='gene', distance_key='distance', copy=False)#
Computes goodness-of-fit metrics for the diffusion pattern of unassigned RNA by testing against a Rayleigh distribution. Also estimates the diffusion coefficient (D) based on the mean squared displacement (MSD).
- Parameters:
sdata (spatialdata.SpatialData) – The spatial transcriptomics dataset.
gene_key (str) – The key for gene/transcript names in source_score.obs.
distance_key (str) – The key for RNA displacement distances.
copy (bool) – Whether to return a modified copy of sdata.
- Returns:
If copy=True, returns a modified SpatialData object with results in sdata[‘xrna_metadata’]. Otherwise, modifies sdata in place.