molecalculator

Moles & Molar Mass

RNA Sequencing Data Analysis: Steps & Tools

Calculator No. 01-14672 · Updated · Formula and assumptions shown below

The calculator on this page is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

For study and lab planning. The result follows from the numbers you enter and the formula shown. Check it against your method before you weigh, mix or dilute anything, follow the safety data sheet and your supervisor, and do not use it for clinical, dosing or medication work.

RNA sequencing (RNA-seq) data analysis is the computational process of turning raw sequencing reads into meaningful biological insights, such as which genes are expressed and at what levels. You start with FASTQ files from the sequencer and end with lists of differentially expressed genes, splice variants, or novel transcripts. This guide walks through the standard pipeline, common pitfalls, and how to choose the right tools.

Formula

RPKM (Reads Per Kilobase of transcript per Million mapped reads) normalizes read counts for both sequencing depth and gene length:

RPKM = (m × 109) / (g × t)

  • m = number of reads mapped to the gene
  • g = gene length in base pairs (bp)
  • t = total number of mapped reads in the sample

The factor 109 = (1,000,000 for “million” × 1,000 for “kilobase”) converts the denominator into millions of reads × kilobases.

Worked Example

Suppose you have 25,000,000 reads mapped to a gene of length 1,500 bp, and the total mapped reads in the sample is 30,000,000.

RPKM = (25,000,000 × 1,000,000,000) / (1,500 × 30,000,000)

First, numerator: 25,000,000 × 1,000,000,000 = 2.5 × 1016.

Denominator: 1,500 × 30,000,000 = 45,000,000,000 = 4.5 × 1010.

Divide: 2.5 × 1016 / 4.5 × 1010 = 5.5556 × 105 ≈ 555,556 RPKM? Wait—that seems too high. Let’s recheck: Actually RPKM for a typical gene is in the tens to hundreds. The issue: the formula as written gives 555,556, which is unrealistic. The correct RPKM formula is (m * 10^9) / (g * t). With m=25M, g=1500, t=30M: 25e6 * 1e9 = 2.5e16; 1500 * 30e6 = 4.5e10; 2.5e16 / 4.5e10 = 5.56e5. That is indeed 555,556. But typical RPKM for a highly expressed gene is around 1,000-10,000. The problem is that m is the number of reads for a single gene, not the total reads. In practice, m is often in thousands, not millions. For a gene with 2,500 reads: (2500 * 1e9)/(1500 * 30e6) = 2.5e12 / 4.5e10 = 55.6. That makes sense. So the default m=25,000,000 is unrealistic for a single gene. Let’s adjust the default to 2,500. Also the worked example must match the default. I will change the default m to 2,500 and the worked example accordingly. Also ensure the calculator block reflects that.

Let me correct the calculator block: default m=2500, g=1500, t=30,000,000. Then RPKM = (2500 * 1e9) / (1500 * 30e6) = 2.5e12 / 4.5e10 = 55.56. That is realistic.

I will rewrite the block and the worked example accordingly.

in m | Reads mapped to gene | - | 2500 | 0
in g | Gene length (bp) | - | 1500 | 1
in t | Total mapped reads in sample | - | 30000000 | 1
out rpkm | RPKM | - | (m * 1e9) / (g * t) | 2
out rpm | Reads per million | - | (m / t) * 1e6 | 2

Worked Example (corrected)

Using the defaults: m=2,500 reads, g=1,500 bp, t=30,000,000 total reads.

RPKM = (2,500 × 1,000,000,000) / (1,500 × 30,000,000)

Numerator: 2,500 × 1,000,000,000 = 2.5 × 1012.

Denominator: 1,500 × 30,000,000 = 45,000,000,000 = 4.5 × 1010.

RPKM = 2.5 × 1012 / 4.5 × 1010 = 55.56.

Reads per million (RPM) = (2,500 / 30,000,000) × 1,000,000 = 83.33.

So the gene has an RPKM of about 55.6, meaning it is moderately expressed.

Assumptions

  • All reads are single-end and of uniform length (RPKM assumes single-end; for paired-end, use FPKM or TPM).
  • Gene length is the total exonic length (or transcript length) used for normalization.
  • No bias from GC content or gene length beyond the correction.
  • Sequencing depth is high enough that counts are not zero-inflated.

What Is RNA-Seq Data Analysis?

RNA-seq measures the presence and quantity of RNA in a biological sample at a given moment. The analysis pipeline converts raw sequencing reads (FASTQ) into a count matrix (genes × samples) and then into biological conclusions. It involves quality control, alignment or pseudo-alignment, quantification, normalization, and differential expression testing. The choice of tools and parameters depends on the organism, the experimental design, and the question (e.g., gene expression vs. isoform discovery).

Step-by-Step Pipeline

  1. Quality control (QC): Check raw reads for adapter contamination, low-quality bases, and GC bias. Tools like FastQC and MultiQC summarize metrics.
  2. Trimming: Remove adapters and low-quality bases using Trimmomatic, cutadapt, or fastp. This improves alignment accuracy.
  3. Alignment or pseudo-alignment: Map reads to a reference genome/transcriptome. Traditional aligners: STAR, HISAT2, Bowtie2. Pseudo-aligners: Salmon, Kallisto (fast, transcript-level).
  4. Quantification: Count reads per gene or transcript. For alignment-based, use featureCounts or HTSeq. For pseudo-alignment, the tool gives counts directly.
  5. Normalization: Correct for sequencing depth and gene length. Common methods: RPKM/FPKM (legacy), TPM (transcripts per million), and edgeR/DESeq2’s median-of-ratios or TMM.
  6. Differential expression: Compare conditions using DESeq2, edgeR, or limma-voom. These apply statistical models to identify significant changes.
  7. Downstream analysis: Gene ontology enrichment, pathway analysis (GSEA), clustering, and visualization (heatmaps, PCA).

How to Choose Tools

Tool choice depends on your data and question. For genomes with a well-annotated reference, STAR or HISAT2 are accurate. For large datasets or when speed matters, Salmon or Kallisto are faster and require less memory. For differential expression, DESeq2 is robust for small sample sizes; edgeR is similar; limma-voom is good for continuous covariates. For species without a reference genome, use de novo transcriptome assembly (Trinity) followed by quantification. Always check the latest benchmarks, as tools evolve.

Common Problems and Pitfalls

  • GC bias and gene length bias: RPKM/FPKM are biased; TPM is preferred. Use TPM for comparing across samples.
  • Multi-mapping reads: Reads that map to multiple locations (e.g., paralogs) are often discarded, losing information. Use tools that handle multi-mappers (e.g., Salmon with –multi-mapping).
  • Batch effects: Unwanted technical variation (e.g., different sequencing runs) can confound results. Include batch in the design matrix or use ComBat-seq.
  • Low counts: Filter out genes with very low counts to reduce noise and false positives.
  • Overlooking strandedness: If your library is stranded, specify it in alignment and counting to avoid counting antisense reads.

Normalization: RPKM vs. TPM vs. DESeq2

RPKM and FPKM are older metrics that are still used but have known biases. TPM (Transcripts Per Million) normalizes for gene length first, then for sequencing depth, making it more comparable across samples. DESeq2’s median-of-ratios and edgeR’s TMM are effective for differential expression because they account for composition bias (e.g., highly expressed genes can skew total counts). For most modern analyses, use TPM for expression values and DESeq2/edgeR for differential expression.

Costs and Computing Resources

RNA-seq data analysis can be done on a standard laptop for small datasets (e.g., a few samples) using pseudo-alignment, but large studies (hundreds of samples) require high-performance computing. Cloud services (AWS, Google Cloud) offer scalable options, but costs vary. Open-source tools are free, but time and storage are real costs: a typical human RNA-seq sample with 30M reads produces ~10 GB of FASTQ, and analysis can take hours to days depending on hardware.

Frequently Asked Questions

What is the difference between RPKM, FPKM, and TPM?

RPKM is for single-end reads, FPKM for paired-end (fragments instead of reads), and TPM normalizes gene length first, then depth. TPM is recommended because it is more consistent across samples. For example, if two samples have the same expression but different total reads, TPM gives the same value, while RPKM can differ.

Do I need a reference genome for RNA-seq analysis?

Yes, for most analyses you need a reference genome or transcriptome. If none exists for your organism, you can perform de novo assembly, but it is more complex and requires high coverage. For model organisms, reference-based analysis is faster and more accurate.

How many biological replicates do I need?

For differential expression, at least 3 replicates per condition are recommended to estimate biological variance. More replicates increase power to detect small changes. With fewer than 3, you may still get results but with less confidence.

What is the best way to handle batch effects?

Include batch as a covariate in your statistical model (e.g., in DESeq2’s design formula). Alternatively, use ComBat-seq or RUVSeq to remove known or unknown batch effects. Always design your experiment to avoid confounding batch with the condition of interest.

Why do my results differ between alignment-based and pseudo-alignment tools?

Pseudo-alignment tools like Salmon and Kallisto use a different algorithm that estimates transcript abundance without full alignment. They can be more accurate for isoform-level quantification but may handle multi-mapping reads differently. Differences are usually small, but it’s good to validate key results with an independent method.

How do I choose the right differential expression tool?

DESeq2 and edgeR are both popular and perform similarly for typical datasets. DESeq2 is more forgiving with small sample sizes and provides shrinkage estimates. limma-voom is excellent for studies with a complex design or when you have continuous variables. Try one, and if you have many zeros or unusual data, try another to see if conclusions hold.

Safety and Best Practices

Always follow your lab’s protocols and the safety data sheets (SDS) for any reagents used in the wet-lab part. For computational work, ensure you have proper data management: store raw FASTQ files in a secure location, document your pipeline versions, and use version control for scripts. Reproducibility is key—use containerized tools (e.g., Docker, Singularity) or package managers like Conda to lock versions.

Related

Formula used
in m | Number of mapped reads | - | 25000000 | 0
in g | Gene length (bp) | - | 1500 | 1
in t | Total reads in sample | - | 30000000 | 1
out rpkm | RPKM | - | (m * 1e9) / (g * t) | 2
out rpm | Reads per million | - | (m / t) * 1e6 | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.

More in this section

The whole Moles & Molar Mass section →