troutpy.pl.global_distribution_from_source

troutpy.pl.global_distribution_from_source#

troutpy.pl.global_distribution_from_source(sdata, cluster_key='kmeans_distribution', gene_key='gene', distance_key='distance', n_bins=20, how='full')#

Plot gene distance distributions, optionally grouped by cluster.

Depending on how, this shows either (1) a clustermap of all genes’ distance distributions sorted by cluster, with row colors ("full"), (2) a collapsed clustermap showing the mean distribution per cluster ("collapsed"), or (3) a line plot of the mean distribution for each cluster ("lineplot").

Parameters:
  • sdata (SpatialData) – Spatial data object containing source_score and xrna_metadata tables.

  • cluster_key (str (default: 'kmeans_distribution')) – Column in sdata["xrna_metadata"].var containing cluster assignments.

  • gene_key (str (default: 'gene')) – Column that contains gene names.

  • distance_key (str (default: 'distance')) – Column that contains the distances.

  • n_bins (int (default: 20)) – Number of bins for the histogram representation.

  • how (str (default: 'full')) – "full" shows a clustermap of all genes sorted by cluster with row colors, "collapsed" shows a clustermap of the mean distribution per cluster, and "lineplot" shows a line plot of the collapsed distributions per cluster.

Return type:

None

Returns:

None