How to Turn RNA-seq DEG Tables into Volcano Plots, Heatmaps, and GSEA Figures
Converting raw count matrices and DESeq2 differential expression CSV tables into publication-grade figures requires rigorous FDR filtering, empirical Bayes fold-change shrinkage, variance stabilization, and calibrated background universes. Here is the practitioner guide for generating reproducible volcano plots, heatmaps, and enrichment analyses.
HumanPen Team
· 14 min read
Turning RNA-seq and Omics DEG Tables into Publication-Grade Figures
To turn an RNA-seq count matrix or DESeq2 differential expression CSV table into publication-grade figures, filter significance on Benjamini-Hochberg adjusted p-values (`padj < 0.05`), apply empirical Bayes log2 fold-change shrinkage (`lfcShrink`) for volcano plots, transform counts with variance-stabilizing transformation (`vst`) before generating z-score clustered heatmaps, and run Gene Set Enrichment Analysis or Over-Representation Analysis using an explicit measured-gene background universe to eliminate false functional discoveries.
Core takeaway: The most damaging pitfalls in omics visualization stem from treating statistical tables as raw plotting coordinates without addressing measurement variance. Filtering by raw p-values produces thousands of false positives, unmoderated fold changes distort volcano axes with low-count noise, unscaled heatmaps obscure relative patterns behind high-abundance housekeeping genes, and uncalibrated enrichment analyses yield false pathway discoveries.
Wet-lab molecular biologists, clinical investigators, and biomedical graduate students routinely receive spreadsheets from sequencing core facilities containing thousands of rows of transcriptomic read counts or differential expression outputs. When translating these tables into submission-ready manuscript figures under upcoming grant or revision deadlines, researchers face recurring technical hurdles. Scripting libraries across R and Python demand specific data transformations, subtle filtering choices alter downstream biological conclusions, and journal peer reviewers increasingly examine code reproducibility and multiple-testing corrections. Establishing a disciplined downstream pipeline ensures that volcano plots, clustered heatmaps, principal component projections, and pathway enrichment diagrams communicate true biological perturbation rather than computational artifacts.
Significance Thresholds: False Discovery Rates, Missing Values, and LFC Shrinkage
The primary methodological filter in differential expression analysis separates genuine biological variation from random sampling noise across thousands of parallel hypotheses. In a standard transcriptome profiling experiment evaluating 20,000 quantified genes, applying a conventional unadjusted threshold of `p < 0.05` produces approximately 1,000 false positive discoveries purely by chance under the complete null hypothesis. As established by Love, Huber, and Anders (2014) in the design of the Bioconductor package `DESeq2`, controlling the False Discovery Rate (FDR) via the Benjamini-Hochberg procedure adjusts significance thresholds to bound the expected proportion of false rejections. A frequent source of confusion occurs when `DESeq2` outputs `NA` within the `padj` column. Rather than reflecting an execution error, `NA` indicates that independent filtering dropped the gene because its mean normalized count fell below a data-driven threshold where statistical power after multiple testing correction is zero, or that the gene contained extreme count outliers identified via Cook's distance. Dropping these low-power tests reduces the multiple-testing penalty and preserves statistical power for moderately and highly expressed candidates.
| Statistical Metric | Computational Definition | Vulnerability in Downstream Plotting | Defensive Best Practice |
|---|---|---|---|
| Raw P-Value (`pvalue`) | Wald test or likelihood ratio test p-value without multi-test adjustment | High false discovery rate; testing 20,000 genes produces roughly 1,000 false positives at `p < 0.05` | Never use raw p-values for DEG lists; use strictly as input for family-wise or FDR correction procedures |
| Adjusted P-Value (`padj`) | Benjamini-Hochberg false discovery rate (FDR) controlling expected proportion of false positives | Misinterpreting `NA` values as technical software errors rather than independent filtering cutoffs | Filter at `padj < 0.05`; treat `padj = NA` as genes with mean counts too low for statistical significance |
| Raw Log2 Fold Change (MLE) | Maximum likelihood estimate of log2 ratio between treatment and control counts | Extreme noise and infinite fold changes for low-count genes (e.g. 0 vs 2 counts) distort volcano plots | Avoid raw MLE log2 fold changes when ranking genes or plotting volcano coordinates |
| Shrunken Log2 Fold Change | Empirical Bayes posterior fold-change shrinkage via `lfcShrink` (`apeglm` or `ashr`) | Misapplying normal shrinkage priors on experiments with large asymmetric transcriptional shifts | Use `lfcShrink` with `apeglm` to moderate noisy low-count estimates while preserving true biological effect sizes |
A parallel failure mode arises when researchers construct volcano plots using raw maximum likelihood estimates of log2 fold changes (`log2FoldChange`). In RNA-seq data, count variance naturally scales with the mean. A gene with an average of 1 count in the control cohort and 4 counts in the treated cohort exhibits an apparent four-fold change (`log2FC = 2`), yet represents negligible transcript abundance with substantial relative sampling error. Plotting unmoderated log2 fold changes scatters unstable low-count genes across the extreme outer wings of the volcano plot, misleading readers regarding effect magnitude. Applying empirical Bayes shrinkage algorithms through `lfcShrink`—such as the adaptive shrinkage model `ashr` or the approximate empirical Bayes model `apeglm` recommended by `DESeq2`—pulls estimates with high dispersion and low counts toward zero while leaving well-supported high-count estimates unchanged. When assembling volcano coordinates, plot shrunken `log2FoldChange` on the horizontal axis and `-log10(padj)` on the vertical axis, rendering genes with `padj = NA` in neutral grey baseline points to preserve full data transparency.
- Apply Dual Threshold Filtering: Require both statistical confidence (`padj < 0.05`) and substantive magnitude (shrunken `|log2FoldChange| > 1`) before categorizing a transcript as an activated or repressed DEG.
- Preserve Independent Filtering Annotations: Retain `padj = NA` flags in exported tables to document low-count filtering rather than replacing missing entries with arbitrary numerical values like 0 or 1.
- Execute Empirical Bayes Shrinkage: Run `lfcShrink` using `apeglm` or `ashr` before generating volcano plot coordinates or sorting gene candidate tables for biological follow-up.
- Maintain Gene Identifier Dictionaries: Track permanent accession keys (such as Ensembl gene IDs or Entrez IDs) alongside official gene symbols to prevent ambiguous cross-referencing in downstream databases.
Exploratory Quality Control: Variance Stabilization and Clustered Heatmap Scaling
Before selecting candidate genes for detailed functional analysis, researchers must evaluate overall sample distance, replicate coherence, and experimental batch effects. A frequent error in bioinformatics workflows involves computing Principal Component Analysis (PCA) directly on raw count matrices or simple logarithmic transformations such as `log2(counts + 1)`. In high-throughput sequencing datasets, the variance of count data grows quadratically with expected abundance, a mathematical property known as heteroskedasticity. Under uncorrected logarithmic transformations, genes with very low counts contribute excessive Poisson sampling noise to distance calculations, while highly expressed housekeeping genes dominate overall Euclidean geometry. To resolve this imbalance, statistical frameworks implement Variance Stabilizing Transformations (`vst`) or regularized log transformations (`rlog`), which calculate a homoscedastic variance structure across the entire dynamic range, allowing samples to cluster based on true systemic expression patterns.
Core takeaway: Principal Component Analysis is an exploratory diagnostic tool for experimental integrity, not a statistical test of treatment efficacy. Generating PCA plots from VST-transformed matrices reveals whether biological replicates cluster closely together, whether unmodeled technical batch effects (such as sequencing run dates or extraction kits) confound the primary condition, and whether unexpected sample swaps require correction before differential testing.
Following sample-level quality control, clustered heatmaps display expression dynamics across the most informative differentially expressed genes (typically the top 50 to 500 genes ranked by adjusted p-value). Plotting variance-stabilized values directly on a heatmap without row-level normalization produces an uninformative visualization: highly expressed housekeeping genes display intense coloration across every lane, while critical regulatory transcription factors with modest absolute counts appear uniformly dark, completely masking experimental contrast. To reveal differential patterns, researchers must apply row-wise z-score scaling across each gene: `z = (x - row_mean) / row_sd`. Row-wise standardization centers each transcript's mean expression at zero with unit variance, highlighting whether an individual sample shows relative up-regulation or down-regulation compared to the cross-cohort baseline.
| Data Representation | Mathematical Formulation | Optimal Downstream Application | Inappropriate Misuse |
|---|---|---|---|
| Raw Integer Counts | Unnormalized sequenced read fragments mapped to genomic gene features | Direct input into DESeq2 or edgeR negative binomial generalized linear models | Never use directly for PCA, Euclidean sample distances, or clustered heatmaps |
| DESeq2 Normalized Counts | Raw counts scaled by median-of-ratios library size factors | Comparing specific individual gene expression levels across treatment groups | Distorts multivariate ordination because low-count Poisson noise dominates variance |
| Variance-Stabilized Counts (`vst`) | Transformation yielding approximately constant variance across dynamic expression range | Exploratory sample PCA, hierarchical clustering, and batch-effect diagnosis | Do not use for formal differential expression hypothesis testing; use raw counts in GLM |
| Row-Wise Z-Scores | Per-gene standardization across samples: `z = (x - mean) / sd` | Clustered expression heatmaps of top differentially expressed genes | Do not compute z-scores across all 20,000 genes simultaneously; restrict to filtered DEGs |
Functional Enrichment: Over-Representation Analysis Versus Rank-Based GSEA
Extracting biological insight from differential gene lists requires mapping individual transcripts to structured functional knowledgebases, such as the Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG). Modern omics pipelines rely on computational frameworks such as `clusterProfiler 4.0`, developed by Wu et al. (2021), to conduct functional enrichment. Practitioners generally choose between two primary analytical paradigms: Over-Representation Analysis (ORA) and Gene Set Enrichment Analysis (GSEA). ORA applies a hypergeometric distribution or one-tailed Fisher's exact test to evaluate whether the proportion of differentially expressed genes annotated to a specific biological pathway exceeds what would occur by chance. A widespread methodological defect in published literature is running ORA without providing an explicit background gene universe (`universe`). When analysts omit the background parameter, software packages default to comparing the DEG list against the entire annotated genome (approximately 20,000 genes in human). Because sequencing assays only ever detect transcripts expressed in the sampled tissue (often 11,000 to 13,000 genes), testing against the full genome creates severe false enrichment of ubiquitous cell-survival and metabolic categories.
| Methodological Dimension | Over-Representation Analysis (ORA) | Gene Set Enrichment Analysis (GSEA) | Analytical Safeguard |
|---|---|---|---|
| Input Gene Selection | Discrete subset of significant DEGs filtered by threshold (`padj < 0.05`, `abs(log2FC) > 1`) | Complete ranked list of all measured genes passing pre-filtering without cutoffs | Avoid arbitrary threshold tuning to cherry-pick favorite biological pathways |
| Statistical Hypothesis Test | Hypergeometric distribution or one-tailed Fisher's exact test | Weighted Kolmogorov-Smirnov-like maximum deviation running enrichment score | Check whether test assumptions match discrete versus continuous data structures |
| Threshold Sensitivity | Highly sensitive; changing fold-change cutoffs from 1.5 to 2.0 alters enriched terms | Insensitive to discrete cutoffs; evaluates coordinated shifts across gene sets | Run GSEA when biological effects involve modest coordinated pathway shifts |
| Background Universe Requirement | Mandatory explicit universe vector of all detected genes in the experiment | Implicitly defined by the complete ranked gene list spanning all detected genes | Never omit the universe in ORA; genome-wide defaults produce false enrichment |
To overcome the sensitivity of ORA to arbitrary significance cutoffs, researchers employ rank-based Gene Set Enrichment Analysis. Rather than discarding transcripts that fall just short of statistical significance (such as a gene with `padj = 0.052`), GSEA assesses the entire continuum of quantified genes ranked by an objective metric of differential effect. The recommended ranking metric from a `DESeq2` analysis is the Wald test statistic (`stat`), or the directional significance metric defined as `sign(log2FoldChange) * (-log10(pvalue))`. GSEA calculates a running enrichment score across the ranked list, determining whether the members of a predefined biological pathway cluster predominantly at the top (activated) or bottom (suppressed) of the ranking. This rank-based approach provides superior statistical sensitivity for detecting subtle, coordinated transcriptional programs, such as metabolic rewiring or epigenetic remodeling, that operate through modest multi-gene shifts rather than dramatic single-gene spikes.
- Supply an Explicit Measured-Gene Background: Provide an explicit background universe vector containing all genes passing minimum detection thresholds in the experiment when running hypergeometric ORA.
- Rank Continuously for GSEA Execution: Rank the full list of detected genes using the signed Wald statistic (`stat`) sorted in descending order, resolving duplicate gene symbols before running enrichment algorithms.
- Generate Multi-Dimensional Visualizations: Present functional findings using dotplots displaying gene ratios and adjusted p-values, category network plots (`cnetplot`) showing shared genes across terms, and classical GSEA running enrichment score trajectories.
- Document Bioinformatic Thresholds Rigorously: Detail exact cutoffs, software version numbers, and background definitions in manuscript methods, aligning with our practical methods and results revision checklist.
End-to-End Omics Visualization Pipelines in HumanPen Start Project
Executing transcriptomic workflows from unformatted spreadsheets to publication-ready figure sets requires robust computational pipelines that eliminate manual transcription and formatting errors. Attach your data and papers, describe what you need, approve the plan before work starts, and get the reviewed report, charts, and code ready to preview online or download. By automating script execution, variance transformations, and graphic rendering in a verified computational environment, research groups ensure their figures remain fully reproducible from source counts to finalized panels.
Platform capabilities and boundaries: HumanPen Start Project supports Excel, CSV, Word, PDF, and zip archives up to 2 GB per project, executing statistical and data analysis in an isolated sandbox using Python or R (SPSS and Stata analyses are performed via Python or R scripts). Commercial databases such as Wind or CNKI must be exported by the user beforehand, GPU training is not supported, and projects are billed in real time with a 6-month retention window and immediate deletion on demand.
When using Start Project for downstream omics analysis, researchers upload raw integer count matrices or DESeq2 CSV result tables alongside sample metadata sheets specifying experimental conditions, batches, and biological replicates. The platform executes containerized R and Python workflows using `DESeq2`, `apeglm`, `ComplexHeatmap`, and `clusterProfiler 4.0` within an isolated sandbox. The analysis generates publication-grade 300 dpi vector and raster assets, including sample PCA scatter plots, dual-threshold volcano plots with shrunken fold changes, hierarchical clustered heatmaps with row-wise z-score scaling, and GSEA enrichment curves, alongside structured CSV summary tables and reproducible execution scripts. This structured delivery model mirrors the transparent scientific deliverables displayed in public example projects accessible on HumanPen Start Project.
For graduate researchers preparing doctoral dissertations, postdocs finalizing journal revisions, or investigators submitting grant proposals, deliverables produced through Start Project serve strictly as reproducible methodological scaffolds and learning reference drafts. Principal investigators and lead analysts retain full academic responsibility for inspecting underlying code, verifying biological plausibility against wet-lab experimental constraints, and disclosing computational tool usage in accordance with target journal and institutional policies. When translating complex omics discoveries for wider audiences or multidisciplinary grant panels, concise communication remains essential, as examined in our guide on plain-language summary guidelines.
Frequently Asked Questions About RNA-seq Downstream Analysis
Why does DESeq2 produce NA in the padj column, and should I replace them with 1 or 0?
Missing values (`NA`) in the `padj` column arise from three specific statistical mechanisms within `DESeq2`: independent filtering, zero-count rows, and extreme Cook's distance outliers. If all samples exhibit zero counts for a gene, its base mean is zero and both p-value and `padj` are set to `NA`. If a sample contains an extreme count outlier that distorts the dispersion fit, Cook's distance flags the gene and sets `padj` to `NA` to avoid false discoveries driven by single artifacts. Most commonly, independent filtering sets `padj` to `NA` for genes whose mean expression falls below an automatic threshold where multiple-testing correction cannot achieve significance. You should never replace `NA` with 0 or 1; keep them as missing values, exclude them from your significant DEG count, and explain the independent filtering cutoff in your figure legends.
Why do volcano plots require shrunken log2 fold changes instead of raw fold changes?
Volcano plots require shrunken log2 fold changes because raw maximum likelihood estimates suffer from severe variance inflation among genes with low sequencing counts. For a gene with 0 counts in control replicates and 3 counts in treated replicates, the calculated fold change can appear enormous, driving the gene to the far outer edges of the plot despite having minimal evidence of true biological activation. Empirical Bayes shrinkage algorithms, such as `apeglm` and `ashr`, evaluate the gene's dispersion and average count, shrinking noisy low-count estimates toward zero while preserving large fold changes for genes with robust, high-count expression. Plotting shrunken fold changes ensures that the visual spread of the volcano plot reflects genuine biological effect size rather than low-count sampling noise.
What happens if I run GO enrichment in clusterProfiler without specifying the universe parameter?
When you execute Over-Representation Analysis in `clusterProfiler` without specifying the `universe` parameter, the algorithm defaults to using all annotated genes in the organism database (approximately 20,000 genes for human or mouse) as the reference background. Because any given tissue or cell type only expresses a subset of the genome (typically 10,000 to 13,000 genes), transcripts that are transcriptionally silent in your model can never appear in your RNA-seq dataset. Comparing your differentially expressed genes against silent genomic regions inflates statistical significance for general cellular processes, housekeeping functions, and structural pathways. Providing an explicit background universe consisting of all genes detected above your experiment's filtering threshold ensures that enrichment scores reflect specific biological responses rather than baseline tissue-specific expression.
Can deliverables generated by HumanPen Start Project be directly included in journal manuscripts?
Deliverables generated by HumanPen Start Project are designed to provide publication-grade visual and quantitative assets, including 300 dpi figures, structured summary tables, and fully documented R and Python scripts. However, they serve as reproducible methodological reference drafts and analytical scaffolds. The submitting authors remain entirely responsible for reviewing the computational logic, confirming gene identity crosswalks, assessing biological validity within the context of their specific laboratory models, and complying with academic integrity and disclosure policies set by their target journal or university.
Sources and Bioinformatics Guidelines
The statistical modeling principles, variance transformations, and functional enrichment workflows outlined in this guide are derived from peer-reviewed bioinformatic literature and official software documentation:
- Bioconductor — Analyzing RNA-seq Data with DESeq2 (Love, Anders & Huber Official Vignette) — Official documentation covering negative binomial GLMs, independent filtering, and variance-stabilizing transformations.
- Love, Huber & Anders (2014, Genome Biology) — Moderated Estimation of Fold Change and Dispersion for RNA-seq Data with DESeq2 — Methodological foundation for empirical Bayes shrinkage of dispersion and log2 fold changes in high-throughput sequencing.
- Wu et al. (2021, The Innovation) — clusterProfiler 4.0: A Universal Enrichment Tool for Interpreting Omics Data — Universal bioinformatic framework for Over-Representation Analysis, GSEA, and multi-omics biological pathway visualization.
KEEP READING
Systematic Review & Meta-Analysis: PRISMA 2020 & Forest Plots
11 min read
Academic writingTable 1 Baseline Characteristics in Clinical Papers: P-Values vs SMD and Summary Statistics
11 min read
Academic writingClinical and Tabular Prediction Model Evaluation: TRIPOD+AI, Calibration Curves, and Decision Curve Analysis
13 min read