diffsvg.pl.plot_volcano#

diffsvg.pl.plot_volcano(stats_df, x=None, pvalue=None, pvalue_adj=None, alpha=0.05, show_dots=True, n_label=20, highlight_genes=None, highlight_offset=(0.025, 1.25), ax=None, figsize=(4, 6), save_path=None)#

Volcano plot of per-gene curve difference vs. significance.

Parameters:
stats_df

A statistics table indexed by gene, e.g. adata.varm["dsvg_stats"].

x default: None

Column used for the x-axis. Defaults to "integral" (area between the two condition curves) for the Wald test and "slope_diff" (linear trend of f1 - f0 over the anchor range) for test="parallel"; "integral" there shows level against shape.

pvalue default: None

Column used for the y-axis, plotted as -log10(pvalue). Every point above the -log10(alpha) reference line is colored by the sign of x (blue = positive, red = negative); points at or below it are black. Defaults to "wald_pval" for the Wald test and "parallel_pval" for test="parallel". p-values of exactly 0 (underflow) are drawn at the smallest non-zero one; genes with a missing p-value or x (e.g. not fitted) are left out.

pvalue_adj default: None

Column used to rank genes for labeling (the n_label genes with the smallest pvalue_adj among those above the line get a text label). Defaults to the adjusted version of the default pvalue.

alpha default: 0.05

Significance threshold on pvalue, drawn as a horizontal reference line at -log10(alpha) and used for the color cutoff described under pvalue.

show_dots default: True

If True (default), every gene is drawn as a colored dot. If False, every gene’s name is drawn instead, in the same color, in place of a dot - there is no separate background scatter in that mode. Best suited to modest gene panels (a few hundred genes); subset stats_df first for larger ones.

n_label default: 20

Label at most this many of the genes above the line (the ones with the smallest pvalue_adj) with their gene name. Use None to label every gene above the line, or 0 to label none. Labels use the same collision-avoidance as highlight_genes (see below).

highlight_genes default: None

A gene name, or list of gene names, to draw with a larger red point and a bold, boxed, arrow-annotated label on top of the rest. Raises KeyError if any given gene is not in stats_df.index.

highlight_offset default: (0.025, 1.25)

(dx, dy) offset (in data units) tried first for each highlight_genes label; if that spot is already occupied (by a dot, another gene’s name, or another label), a nearby spot is used instead - so with several highlighted genes this is a preference, not a guarantee.

ax default: None

Existing axes to draw into; a new figure is created if omitted.

figsize default: (4, 6)

Passed to plt.subplots when ax is omitted.

save_path default: None

If given, save the figure here (dpi=300, bbox_inches="tight").

Returns:

matplotlib.axes.Axes