metachat.pl.plot_DEG_volcano
- metachat.pl.plot_DEG_volcano(deg_result, name_col='names', logfc_col='logfoldchanges', pval_col='pvals_adj', logfc_thresh=1.0, pval_thresh=0.05, neglog10_cap=50.0, pointsize_min=5.0, pointsize_max=30.0, label_thresh_neglog10=10.0, label_fontsize=6, figsize=(5, 5), cbar_orientation='horizontal', cbar_pad=0.2, title='Volcano Plot', show_labels=True, ax=None, plot_savepath=None)[source]
Plot a volcano plot from differential MCC results.
This function visualizes log2 fold changes versus statistical significance (-log10 adjusted p-values) to highlight up- and down-regulated genes.
Parameters
- deg_resultpandas.DataFrame
DataFrame containing differential MCC results.
- name_colstr, default=’names’
Column name for gene or feature names.
- logfc_colstr, default=’logfoldchanges’
Column name for log2 fold changes.
- pval_colstr, default=’pvals_adj’
Column name for adjusted p-values.
- logfc_threshfloat, default=1.0
Threshold for absolute log2 fold change used to draw vertical reference lines.
- pval_threshfloat, default=0.05
Threshold for adjusted p-value used to draw a horizontal reference line.
- neglog10_capfloat, default=50.0
Cap for -log10(p-value) to avoid extreme values distorting visualization.
- pointsize_minfloat, default=5.0
Minimum scatter point size.
- pointsize_maxfloat, default=30.0
Maximum scatter point size.
- label_thresh_neglog10float, default=10.0
Threshold of -log10(p-value) above which gene labels are annotated.
- label_fontsizeint, default=6
Font size for gene labels.
- figsizetuple of float, default=(5, 5)
Figure size (width, height) in inches.
- cbar_orientation{‘horizontal’, ‘vertical’}, default=’horizontal’
Orientation of the colorbar.
- cbar_padfloat, default=0.2
Padding distance between colorbar and axis.
- titlestr, default=’Volcano Plot’
Title of the figure.
- show_labelsbool, default=True
Whether to show text labels for significant genes.
- axmatplotlib.axes.Axes, optional
Existing Matplotlib axis to draw on. If None, a new figure and axis are created.
- plot_savepathstr, optional
File path to save the figure (e.g.
'results/volcano_plot.pdf'). The format is inferred from the file extension. If None, the figure is shown interactively.
Returns
- axmatplotlib.axes.Axes
Matplotlib axis object containing the rendered volcano plot.
Notes
Points are colored by log2 fold change using a diverging colormap.
Vertical and horizontal dashed lines represent significance thresholds.
Extreme -log10(p-values) are capped at
neglog10_capto maintain scale.