Count-based differential expression analysis of RNA sequencing data using R and Bioconductor

Journal name:
Nature Protocols
Year published:
Published online


RNA sequencing (RNA-seq) has been rapidly adopted for the profiling of transcriptomes in many areas of biology, including studies into gene regulation, development and disease. Of particular interest is the discovery of differentially expressed genes across different conditions (e.g., tissues, perturbations) while optionally adjusting for other systematic factors that affect the data-collection process. There are a number of subtle yet crucial aspects of these analyses, such as read counting, appropriate treatment of biological variability, quality control checks and appropriate setup of statistical modeling. Several variations have been presented in the literature, and there is a need for guidance on current best practices. This protocol presents a state-of-the-art computational and statistical RNA-seq differential expression analysis workflow largely based on the free open-source R language and Bioconductor software and, in particular, on two widely used tools, DESeq and edgeR. Hands-on time for typical small experiments (e.g., 4–10 samples) can be <1 h, with computation time <1 d using a standard desktop PC.

At a glance


  1. Count-based differential expression pipeline for RNA-seq data using edgeR and/or DESeq.
    Figure 1: Count-based differential expression pipeline for RNA-seq data using edgeR and/or DESeq.

    Many steps are common to both tools, whereas the specific commands are different (Step 14). Steps within the edgeR or DESeq differential analysis can follow two paths, depending on whether the experimental design is simple or complex. Alternative entry points to the protocol are shown in orange boxes.

  2. Screenshot of Metadata available from SRA.
    Figure 2: Screenshot of Metadata available from SRA.
  3. Screenshot of reads aligning across exon junctions.
    Figure 3: Screenshot of reads aligning across exon junctions.
  4. Plots of sample relations.
    Figure 4: Plots of sample relations.

    (a) By using a count-specific distance measure, edgeR's plotMDS produces a multidimensional scaling plot showing the relationship between all pairs of samples. (b) DESeq's plotPCA makes a principal component (PC) plot of VST (variance-stabilizing transformation)-transformed count data. CT or CTL, control; KD, knockdown.

  5. Plots of mean-variance relationship and dispersion.
    Figure 5: Plots of mean-variance relationship and dispersion.

    (a) edgeR's plotMeanVar can be used to explore the mean-variance relationship; each dot represents the estimated mean and variance for each gene, with binned variances as well as the trended common dispersion overlaid. (b) edgeR's plotBCV illustrates the relationship of biological coefficient of variation versus mean log CPM. (c) DESeq's plotDispEsts shows the fit of dispersion versus mean. CPM, counts per million.

  6. M ('minus') versus A ('add') plots for RNA-seq data.
    Figure 6: M ('minus') versus A ('add') plots for RNA-seq data.

    (a) edgeR's plotSmear function plots the log-fold change (i.e., the log ratio of normalized expression levels between two experimental conditions) against the log counts per million (CPM). (b) Similarly, DESeq's plotMA displays differential expression (log-fold changes) versus expression strength (log average read count).

  7. Histogram of P values from gene-by-gene statistical tests.
    Figure 7: Histogram of P values from gene-by-gene statistical tests.

Accession codes

Referenced accessions

Gene Expression Omnibus


  1. Mortazavi, A., Williams, B.A., McCue, K., Schaeffer, L. & Wold, B. Mapping and quantifying mammalian transcriptomes by RNA-seq. Nat. Methods 5, 621628 (2008).
  2. Wang, Z., Gerstein, M. & Snyder, M. RNA-seq: a revolutionary tool for transcriptomics. Nat. Rev. Genet. 10, 5763 (2009).
  3. Anders, S. & Huber, W. Differential expression analysis for sequence count data. Genome Biol. 11, R106 (2010).
  4. Robinson, M.D. & Smyth, G.K. Moderated statistical tests for assessing differences in tag abundance. Bioinformatics 23, 28812887 (2007).
  5. Robinson, M.D. & Smyth, G.K. Small-sample estimation of negative binomial dispersion, with applications to SAGE data. Biostatistics 9, 321332 (2008).
  6. Robinson, M.D., McCarthy, D.J. & Smyth, G.K. edgeR: a Bioconductor package for differential expression analysis of digital gene expression data. Bioinformatics 26, 139140 (2010).
  7. McCarthy, D.J., Chen, Y. & Smyth, G.K. Differential expression analysis of multifactor RNA-seq experiments with respect to biological variation. Nucleic Acids Res. 40, 42884297 (2012).
  8. Gentleman, R.C. et al. Bioconductor: open software development for computational biology and bioinformatics. Genome Biol. 5, R80 (2004).
  9. Zemach, A. et al. The Arabidopsis nucleosome remodeler DDM1 allows DNA methyltransferases to access H1-containing heterochromatin. Cell 153, 193205 (2013).
  10. Lam, M.T. et al. Rev-Erbs repress macrophage gene expression by inhibiting enhancer-directed transcription. Nature 498, 511515 (2013).
  11. Ross-Innes, C.S. et al. Differential oestrogen receptor binding is associated with clinical outcome in breast cancer. Nature 481, 389393 (2012).
  12. Robinson, M.D. et al. Copy-number-aware differential analysis of quantitative DNA sequencing data. Genome Res. 22, 24892496 (2012).
  13. Vanharanta, S. et al. Epigenetic expansion of VHL-HIF signal output drives multiorgan metastasis in renal cancer. Nat. Med. 19, 5056 (2013).
  14. Samstein, R.M. et al. Foxp3 exploits a pre-existent enhancer landscape for regulatory T cell lineage specification. Cell 151, 153166 (2012).
  15. Johnson, E.K. et al. Proteomic analysis reveals new cardiac-specific dystrophin-associated proteins. PloS ONE 7, e43515 (2012).
  16. Fonseca, N.A., Rung, J., Brazma, A. & Marioni, J.C. Tools for mapping high-throughput sequencing data. Bioinformatics 28, 31693177 (2012).
  17. Trapnell, C. et al. Differential gene and transcript expression analysis of RNA-seq experiments with TopHat and Cufflinks. Nat. Protoc. 7, 562578 (2012).
  18. Bullard, J.H., Purdom, E., Hansen, K.D. & Dudoit, S. Evaluation of statistical methods for normalization and differential expression in mRNA-seq experiments. BMC Bioinform. 11, 94 (2010).
  19. Grabherr, M.G. et al. Full-length transcriptome assembly from RNA-seq data without a reference genome. Nat. Biotechnol. 29, 644652 (2011).
  20. Siebert, S. et al. Differential gene expression in the siphonophore Nanomia bijuga (Cnidaria) assessed with multiple next-generation sequencing workflows. PLoS ONE 6, 12 (2011).
  21. Trapnell, C., Pachter, L. & Salzberg, S.L. TopHat: discovering splice junctions with RNA-seq. Bioinformatics 25, 11051111 (2009).
  22. Trapnell, C. et al. Transcript assembly and quantification by RNA-seq reveals unannotated transcripts and isoform switching during cell differentiation. Nat. Biotechnol. 28, 511515 (2010).
  23. Hardcastle, T.J. & Kelly, K.A. baySeq: empirical Bayesian methods for identifying differential expression in sequence count data. BMC Bioinform. 11, 422 (2010).
  24. Zhou, Y.-H., Xia, K. & Wright, F.A. A powerful and flexible approach to the analysis of RNA sequence count data. Bioinformatics 27, 26722678 (2011).
  25. Tarazona, S., Garcia-Alcalde, F., Dopazo, J., Ferrer, A. & Conesa, A. Differential expression in RNA-seq: a matter of depth. Genome Res. 21, 22132223 (2011).
  26. Lund, S.P., Nettleton, D., McCarthy, D.J. & Smyth, G.K. Detecting differential expression in RNA-sequence data using quasi-likelihood with shrunken dispersion estimates. Stat. Appl. Genet. Mol. Biol. 11, pii (2012).
  27. Soneson, C. & Delorenzi, M. A comparison of methods for differential expression analysis of RNA-seq data. BMC Bioinform. 14, 91 (2013).
  28. Lareau, L.F., Inada, M., Green, R.E., Wengrod, J.C. & Brenner, S.E. Unproductive splicing of SR genes associated with highly conserved and ultraconserved DNA elements. Nature 446, 926929 (2007).
  29. Anders, S., Reyes, A. & Huber, W. Detecting differential usage of exons from RNA-seq data. Genome Res. 22, 20082017 (2012).
  30. Glaus, P., Honkela, A. & Rattray, M. Identifying differentially expressed transcripts from RNA-seq data with biological variation. Bioinformatics 28, 17211728 (2012).
  31. Van De Wiel, M.A. et al. Bayesian analysis of RNA sequencing data by estimating multiple shrinkage priors. Biostatistics 14, 113128 (2013).
  32. Blekhman, R., Marioni, J.C., Zumbo, P., Stephens, M. & Gilad, Y. Sex-specific and lineage-specific alternative splicing in primates. Genome Res. 20, 180189 (2010).
  33. Okoniewski, M.J. et al. Preferred analysis methods for single genomic regions in RNA sequencing revealed by processing the shape of coverage. Nucleic Acids Res. 40, e63 (2012).
  34. Hansen, K.D., Wu, Z., Irizarry, R.A. & Leek, J.T. Sequencing technology does not eliminate biological variability. Nat. Biotechnol. 29, 572573 (2011).
  35. Leek, J.T. et al. Tackling the widespread and critical impact of batch effects in high-throughput data. Nat. Rev. Genet. 11, 733739 (2010).
  36. Auer, P.L. & Doerge, R.W. Statistical design and analysis of RNA sequencing data. Genetics 185, 405416 (2010).
  37. Gagnon-Bartsch, J.A. & Speed, T.P. Using control genes to correct for unwanted variation in microarray data. Biostatistics 13, 539552 (2011).
  38. Leek, J.T. & Storey, J.D. Capturing heterogeneity in gene expression studies by surrogate variable analysis. PLoS Genet. 3, 17241735 (2007).
  39. Myers, R.M. Classical and Modern Regression with Applications 2nd edn. (Duxbury Classic Series, 2000).
  40. Gentleman, R. Reproducible research: a bioinformatics case study. Stat. Appl. Genet. Mol. Biol. 4, Article2 (2005).
  41. Trapnell, C. & Salzberg, S.L. How to map billions of short reads onto genomes. Nat. Biotechnol. 27, 455457 (2009).
  42. Wu, T.D. & Nacu, S. Fast and SNP-tolerant detection of complex variants and splicing in short reads. Bioinformatics 26, 873881 (2010).
  43. Wang, K. et al. MapSplice: Accurate mapping of RNA-seq reads for splice junction discovery. Nucleic Acids Res. 38, e178 (2010).
  44. Liao, Y., Smyth, G.K. & Shi, W. The Subread aligner: fast, accurate and scalable read mapping by seed-and-vote. Nucleic Acids Res. 41, e108 (2013).
  45. Dobin, A. et al. STAR: ultrafast universal RNA-seq aligner. Bioinformatics 29, 1521 (2013).
  46. Thorvaldsdóttir, H., Robinson, J.T. & Mesirov, J.P. Integrative Genomics Viewer (IGV): high-performance genomics data visualization and exploration. Brief. Bioinform. 14, 178192 (2013).
  47. Fiume, M., Williams, V., Brook, A. & Brudno, M. Savant: genome browser for high-throughput sequencing data. Bioinformatics 26, 19381944 (2010).
  48. Fiume, M. et al. Savant genome browser 2: visualization and analysis for population-scale genomics. Nucleic Acids Res. 40, 17 (2012).
  49. Morgan, M. et al. ShortRead: a Bioconductor package for input, quality assessment and exploration of high-throughput sequence data. Bioinformatics 25, 26072608 (2009).
  50. Li, H. et al. The sequence alignment/map format and SAMtools. Bioinformatics 25, 20782079 (2009).
  51. Brooks, A.N. et al. Conservation of an RNA regulatory map between Drosophila and mammals. Genome Res. 21, 193202 (2011).
  52. Edgar, R., Domrachev, M. & Lash, A.E. Gene expression omnibus: NCBI gene expression and hybridization array data repository. Nucleic Acids Res. 30, 207210 (2002).
  53. Cox, D.R. & Reid, N. Parameter orthogonality and approximate conditional inference. J. Roy. Stat. Soc. Ser. B Method. 49, 139 (1987).
  54. Dudoit, S., Yang, Y.H., Callow, M.J. & Speed, T.P. Statistical methods for identifying differentially expressed genes in replicated cDNA microarray experiments. Stat. Sinica 12, 111139 (2002).
  55. Bourgon, R., Gentleman, R. & Huber, W. Independent filtering increases detection power for high-throughput experiments. Proc. Natl. Acad. Sci. USA 107, 95469551 (2010).
  56. Robinson, M.D. & Oshlack, A. A scaling normalization method for differential expression analysis of RNA-seq data. Genome Biol. 11, R25 (2010).
  57. Cappiello, C., Francalanci, C. & Pernici, B. Data quality assessment from the user's perspective. Architecture 22, 6873 (2004).
  58. Benjamini, Y. & Hochberg, Y. Controlling the false discovery rate: a practical and powerful approach to multiple testing. J. Roy. Stat. Soc. Ser. B Methodol. 57, 289300 (1995).
  59. Wu, H., Wang, C. & Wu, Z. A new shrinkage estimator for dispersion improves differential expression detection in RNA-seq data. Biostatistics 14, 232243 (2012).
  60. Smyth, G.K. Limma: linear models for microarray data. In Bioinformatics and Computational Biology Solutions Using R and Bioconductor (eds. Gentleman, R. et al.) 397420 (Springer, 2005).
  61. Nookaew, I. et al. A comprehensive comparison of RNA-seq–based transcriptome analysis from reads to differential gene expression and cross-comparison with microarrays: a case study in Saccharomyces cerevisiae. Nucleic Acids Res. 40, 1008410097 (2012).
  62. Rapaport, F. et al. Comprehensive evaluation of differential expression analysis methods for RNA-seq data (23 January 2013).
  63. Hansen, K.D., Irizarry, R.A. & Wu, Z. Removing technical variability in RNA-seq data using conditional quantile normalization. Biostatistics 13, 204216 (2012).
  64. Risso, D., Schwartz, K., Sherlock, G. & Dudoit, S. GC-content normalization for RNA-seq data. BMC Bioinform. 12, 480 (2011).
  65. Delhomme, N., Padioleau, I., Furlong, E.E. & Steinmetz, L. easyRNASeq: a Bioconductor package for processing RNA-seq data. Bioinformatics 28, 25322533 (2012).
  66. Leisch, F. Sweave: dynamic generation of statistical reports using literate data analysis. In Compstat 2002 Proceedings in Computational Statistics Vol. 69 (eds. Härdle, W. & Rönz, B.) 575–580. Institut für Statistik und Wahrscheinlichkeitstheorie, Technische Universität Wien (Physica Verlag, 2002).

Download references

Author information


  1. Genome Biology Unit, European Molecular Biology Laboratory, Heidelberg, Germany.

    • Simon Anders &
    • Wolfgang Huber
  2. Department of Statistics, University of Oxford, Oxford, UK.

    • Davis J McCarthy
  3. Wellcome Trust Centre for Human Genetics, University of Oxford, Oxford, UK.

    • Davis J McCarthy
  4. Bioinformatics Division, Walter and Eliza Hall Institute, Parkville, Victoria, Australia.

    • Yunshun Chen &
    • Gordon K Smyth
  5. Department of Medical Biology, University of Melbourne, Melbourne, Victoria, Australia.

    • Yunshun Chen
  6. Functional Genomics Center UNI ETH, Zurich, Switzerland.

    • Michal Okoniewski
  7. Department of Mathematics and Statistics, University of Melbourne, Melbourne, Victoria, Australia.

    • Gordon K Smyth
  8. Institute of Molecular Life Sciences, University of Zurich, Zurich, Switzerland.

    • Mark D Robinson
  9. SIB Swiss Institute of Bioinformatics, University of Zurich, Zurich, Switzerland.

    • Mark D Robinson


S.A. and W.H. are authors of the DESeq package. D.J.M., Y.C., G.K.S. and M.D.R. are authors of the edgeR package. S.A., M.O., W.H. and M.D.R. initiated the protocol format on the basis of the ECCB 2012 Workshop. S.A. and M.D.R. wrote the first draft and additions were made from all authors.

Competing financial interests

The authors declare no competing financial interests.

Corresponding authors

Correspondence to:

Author details

Supplementary information

Zip files

  1. Supplementary Data (546 KB)

    Archive of files used in the protocol. This file is a compressed archive with the following files: the intermediate COUNT files used, a count table used in the statistical analysis, the metadata table and the original “SraRunInfo” CSV file that was downloaded from the NCBI's SRA.

Additional data