troutpy.pl.distributions_by_cluster#
- troutpy.pl.distributions_by_cluster(sdata, gene_key='gene', cluster_key='kmeans_distribution', groups=None, distance_key='distance', n_bins=20)#
Plots the average normalized distance distribution for each cluster, overlaid with the expected (theoretical) diffusion pattern from a Rayleigh distribution computed from the global data (purely diffusion-based). Also displays statistics on how well the genes in the cluster match the expected diffusion pattern.
- Parameters:
sdata (spatialdata.SpatialData) – Spatial data object containing a ‘source_score’ layer with an obs DataFrame.
gene_key (str) – Column name that contains the gene names.
distance_key (str) – Column name that contains the distance from the source cell.
n_bins (int) – Number of bins to use for the histograms.