6.4.9Bioinformatics & Computational Biology

Explain RNA-seq data analysis basics

1,861 words8 min readdifficulty · medium1 backlinks

WHAT is RNA-seq?

WHY do we care? Two cells with the same DNA can be wildly different (a neuron vs a skin cell) because they express different genes. Disease, drug response, and development all show up as changes in expression. RNA-seq is the standard tool to detect those changes.


HOW: the pipeline, step by step

The analysis is a chain. Each step's output is the next step's input.

Figure — Explain RNA-seq data analysis basics

1. Wet-lab → raw reads (FASTQ)

RNA is extracted, reverse-transcribed to cDNA, fragmented, and sequenced. You receive millions of short reads (~50–150 bp) in FASTQ files. Each read carries a base sequence + a per-base quality score.

2. Quality control & trimming

Tools (FastQC) flag low-quality tails and adapter contamination; trimming removes them. WHY? Bad bases cause wrong alignments downstream — garbage in, garbage out.

3. Alignment / mapping

Each read is placed onto a reference genome (aligners: STAR, HISAT2) or matched to a transcriptome (pseudo-aligners: Salmon, kallisto). RNA reads may span exon–exon junctions (introns removed), so aligners must be splice-aware.

4. Quantification → count matrix

Count how many reads fall on each gene. Result: a gene × sample count matrix CgsC_{gs} = number of reads for gene gg in sample ss.

5. Normalization

Raw counts aren't comparable because samples differ in sequencing depth (total reads) and genes differ in length. We must correct for both.

6. Differential expression (DE)

Compare a gene's counts between conditions (e.g. treated vs control) using tools like DESeq2 / edgeR, which model counts with the negative binomial distribution.


Worked examples


Common mistakes (steel-manned)


Recall

Recall Flashcards checkpoint (try before flipping)
  • What does TPM guarantee about each sample's column? → sums to 10610^6.
  • Why negative binomial over Poisson? → overdispersion (variance > mean).
  • Why FDR correction? → many-genes multiple testing.
Recall Feynman: explain to a 12-year-old

Every cell has the same giant recipe book (DNA). But a cell only cooks some recipes at a time. RNA-seq is like sneaking into the kitchen and counting how many copies of each recipe card are being used right now. If we count more chocolate-cake cards in a sick person than a healthy one, maybe "chocolate cake" (a gene) is involved in the sickness. Because we peeked at different amounts of paper in each kitchen, we first fairly rescale the counts, then compare which recipes changed the most.


Flashcards

What does RNA-seq measure?
The identity and abundance of RNA molecules, i.e. gene expression, via high-throughput sequencing.
What file format holds raw sequencing reads + quality scores?
FASTQ.
Formula linking Phred quality Q and error probability P?
Q=10log10PQ=-10\log_{10}P.
What does a Phred score of 30 mean?
Error probability 10310^{-3} (1 wrong base in 1000).
Why must aligners for RNA-seq be splice-aware?
Reads can span exon–exon junctions since introns are spliced out.
Define CPM.
Counts per million: Cgs/Ns×106C_{gs}/N_s \times 10^6, correcting for sequencing depth.
Why do we normalize by gene length?
Longer genes capture more read fragments at equal expression, biasing raw counts.
Key property of TPM across a sample?
The TPM values sum to 10610^6, making columns comparable proportions.
Difference in calculation order between RPKM and TPM?
TPM divides by length first, then by the per-sample total; RPKM divides by depth first.
Why negative binomial for count modeling?
RNA-seq counts are overdispersed (variance > mean); NB adds a dispersion term Var=μ+ϕμ2\text{Var}=\mu+\phi\mu^2.
What is log2FC and what does +1 mean?
log2\log_2(treated/control); +1 means expression doubled.
Why use FDR-adjusted p-values?
~20,000 simultaneous tests cause many false positives; BH controls the false discovery rate.
Why are biological replicates essential?
To estimate biological variability/dispersion for reliable DE calls (≥3 per group).
Two things raw counts fail to account for?
Sequencing depth and gene length.

Connections

Concept Map

goal

produces

encodes error

cleaned by

feeds

maps onto

feeds

corrected by

motivates

yields

infers

RNA-seq measures gene expression

Wet-lab: RNA to cDNA sequenced

Raw reads FASTQ + quality

Phred score Q = -10log P

QC and trimming

Alignment splice-aware

Reference genome / transcriptome

Gene x sample count matrix

Normalization

Sequencing depth + gene length bias

CPM RPKM TPM

Differential expression

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, har cell mein DNA same hota hai, lekin har cell alag genes ko "on" rakhta hai. RNA-seq ka kaam hai — jitni bhi RNA molecules cell mein active hain, unko count karna. Zyada RNA matlab wo gene zyada "busy" hai (high expression), kam RNA matlab wo gene lagbhag off hai. Isse hum compare kar sakte hain ki treated aur control sample mein kaunse genes badle.

Pipeline simple chain hai: pehle sequencer se short reads milte hain FASTQ file mein (saath quality score, jise Phred score kehte hain, formula Q=10log10PQ=-10\log_{10}P). Phir quality check aur trimming, phir reads ko genome pe align karna (splice-aware aligner, kyunki introns cut ho chuke hote hain), phir har gene ke reads count karke ek count matrix banate hain.

Yahan ek important baat: raw counts ko directly compare mat karo! Kyunki ek sample zyada deeply sequence hua ho sakta hai (zyada total reads) aur lambe genes zyada reads pakadte hain. Isliye normalize karte hain — CPM depth ka correction karta hai, aur TPM depth + length dono. TPM ki khaas baat: har sample ke TPM ka total hamesha 10610^6 hota hai, isliye columns fair comparison dete hain.

Aakhri step differential expression — DESeq2/edgeR negative binomial model use karte hain (kyunki counts mein variance mean se zyada hoti hai, overdispersion). log2 fold change batata hai kitna up/down gaya (+1 = double), aur kyunki hum ~20,000 genes ek saath test karte hain, FDR (Benjamini-Hochberg) correction lagana zaroori hai warna false positives aa jayenge. Bas yahi hai RNA-seq analysis ka core!

Test yourself — Bioinformatics & Computational Biology

Connections