troutpy.pl.gene_distribution_from_source

troutpy.pl.gene_distribution_from_source#

troutpy.pl.gene_distribution_from_source(sdata, cool_pattern, gene_key='gene', distance_key='distance', bins=30, bar_color='lightblue', n_cols=3)#

Plots the diffusion distribution of specified genes as subplots in a grid.

Parameters:
  • sdata (spatialdata.SpatialData) – The spatial dataset containing gene expression and diffusion data.

  • cool_pattern (list) – List of gene names to analyze.

  • gene_key (str) – Column name for gene features (default: ‘gene’).

  • distance_key (str) – Column name for distance values (default: ‘distance’).

  • bins (int) – Number of bins for histogram (default: 30).

  • bar_color (str) – Color of histogram bars (default: ‘lightblue’).

  • n_cols (int) – Number of columns in the subplot grid (default: 3).

Raises:

ValueError – If no valid genes are found in the dataset.: