scatrans.pl.volcano_plot#
- scatrans.pl.volcano_plot(df, top_n=10, label_genes=None, save_path=None, title='Volcano Plot of Active Transcription', point_scale=1.0, min_size=2, max_size=160, s=None, alpha=0.75, figsize=(8, 6), dpi=300, fontsize=12, cmap='coolwarm', logfc_cutoff=0.5, pval_cutoff=0.05, color_by='active_score', style='auto', legend_position='UL', fills=None, colors=None, add_cutoff_lines=True, label_by='p_adj', ax=None, show=True, use_style=False, return_data=False, label_repel=True, label_fontsize=None, min_label_score=None)[source]#
2D volcano plot with ggVolcano-inspired flexibility and style options.
top_n: number of top genes (by active_score or p_adj) to label.
label_genes: iterable of gene names to force label (manual specification, even if not in top_n). This + top_n gives the common ggVolcano usage pattern (label_number + explicit genes). Duplicates are handled automatically.
color_by: if set to “active_score” (default) and the column exists, uses continuous colormap. If set to any other column present in the data, that column is used for continuous coloring (after numeric coercion). Otherwise falls back to classic up/down/ns significance categories (red/blue/gray) based on logfc_cutoff / pval_cutoff.
Cutoff lines are drawn with labels.
Supports ax for embedding.
- Size control (addresses “even smallest points are still too big”; modeled after flexible controls in omicverse.pl.volcano etc.):
s: if given, forces a fixed point size for all scatters (e.g. s=2 or s=1 for tiny points). This bypasses score-based variable sizing entirely — simplest for clean small-point volcanos.
point_scale: global multiplier.
min_size / max_size: bounds for the variable sizing case.
When no “active_score” (pure DE volcano), uses small p-value based base so points start small.
- style{“auto”, “ggvolcano”, “gradual”}, default “auto”
"auto": legacy scATrans behaviour (active_score colormap when present)."ggvolcano": classic three-colour volcano from ggVolcano (teal Down / grey Normal / orange Up,theme_bw, dashed cutoffs, labels by FDR)."gradual":gradual_volcanogradient fill/size by-log10(FDR).
- legend_position{“UL”, “UR”, “DL”, “DR”}, default “UL”
In-axes legend anchor (ggVolcano styles only).
- fills, colorstuple of 3 hex colours, optional
Override Down / Normal / Up fill and stroke (
style="ggvolcano").- add_cutoff_linesbool, default True
Draw dashed logFC and FDR threshold lines.
- label_by{“p_adj”, “active_score”}, default “p_adj”
Rank genes for automatic labels (
top_n). ggVolcano uses smallest FDR.
Style reference: BioSenior/ggVolcano