delnx.pl.volcanoplotΒΆ

delnx.pl.volcanoplot(df, x='log2fc', y='-log10(pval)', effect_key='log2fc', pval_key='pval', feature_key='feature', effect_thresh=0.5, pval_thresh=0.01, thresh=None, label_top=0, color_legend_title=None, ax=None, figsize=(8, 6), show=True, save=None, return_fig=False)[source]ΒΆ

Create a volcano plot using matplotlib. Labels significant genes based on thresholds or uses β€œsignificant” column if present.

Parameters:
  • df (DataFrame) – DataFrame containing differential expression results.

  • x (str (default: 'log2fc')) – Column name for x-axis (effect size).

  • y (str (default: '-log10(pval)')) – Column name for y-axis (significance).

  • effect_key (str (default: 'log2fc')) – Column with effect size values for DE analysis.

  • pval_key (str (default: 'pval')) – Column with p-values for DE analysis.

  • feature_key (str (default: 'feature')) – Column containing gene names for labeling.

  • effect_thresh (float (default: 0.5)) – Threshold for absolute effect size.

  • pval_thresh (float (default: 0.01)) – Threshold for significance.

  • thresh (dict[str, float] | None (default: None)) – Dictionary mapping axis names to threshold values for plot lines, e.g. {β€˜log2fc’: 1.0, β€˜-log10(pval)’: 1.3}. If None, uses effect_thresh and -log10(pval_thresh).

  • label_top (int (default: 0)) – If > 0, label top N up/down genes by effect size.

  • color_legend_title (str | None (default: None)) – Title for the legend. Default: β€œ-log10(p-value)”.

  • ax (Axes | None (default: None)) – If provided, use this Axes for plotting instead of creating a new one. If None, a new Axes will be created.

  • figsize (tuple[float, float] (default: (8, 6))) – Size of the figure in inches.

  • show (bool | None (default: True)) – Whether to display the figure interactively.

  • save (str | bool | None (default: None)) – If str, path to save the image. If True, uses default name.

  • return_fig (bool (default: False)) – Whether to return the matplotlib Figure and Axes.

Returns:

VolcanoPlot or tuple[Figure, Axes] or None