troutpy.pl.diffusion_results

troutpy.pl.diffusion_results#

troutpy.pl.diffusion_results(sdata, x_col='mean_displacement', y_col='-log_ks_pval', non_control_probes=None, label_top_n_x=0, label_top_n_y=0, label_bottom_n_x=0, label_bottom_n_y=0, y_logscale=False, title=None, palette='troutpy', save=False, figures_path='', custom_plot_filename=None)#

Scatter plot of two diffusion metrics per probe, colored by control-probe status.

Parameters:
  • sdata (SpatialData) – SpatialData object containing an xrna_metadata table whose .var holds the diffusion metrics and a boolean control_probe column.

  • x_col (str (default: 'mean_displacement')) – Column in sdata["xrna_metadata"].var to plot on the x-axis.

  • y_col (str (default: '-log_ks_pval')) – Column in sdata["xrna_metadata"].var to plot on the y-axis.

  • non_control_probes (Optional[list[str]] (default: None)) – If provided, probes are kept only if they are flagged as control probes or their name is in this list.

  • label_top_n_x (int (default: 0)) – Number of probes with the highest x_col values to label.

  • label_top_n_y (int (default: 0)) – Number of probes with the highest y_col values to label.

  • label_bottom_n_x (int (default: 0)) – Number of probes with the lowest x_col values to label.

  • label_bottom_n_y (int (default: 0)) – Number of probes with the lowest y_col values to label.

  • y_logscale (bool (default: False)) – Whether to plot the y-axis on a log scale.

  • title (Optional[str] (default: None)) – Custom title for the plot.

  • palette (str (default: 'troutpy')) – Two-color palette name, resolved via troutpy.pl.get_palette(), used for control vs. non-control probes. "default" uses a hardcoded crimson/blue pair.

  • save (bool (default: False)) – Whether to save the figure to figures_path instead of showing it.

  • figures_path (str (default: '')) – Directory to save the figure in, if save is True.

  • custom_plot_filename (Optional[str] (default: None)) – Custom filename for the saved figure. If None, defaults to f"diffusion_results_{x_col}_vs_{y_col}.pdf".

Return type:

None

Returns:

None