Before you start
- You understand where RNA-seq fits, for example from The RNA-seq Big Picture.
- Any term new? The Glossary has it.
Learning objectives
By the end of this lesson you will be able to: explain what a "count" is and where the count matrix that DESeq2 needs actually comes from, describe the two standard routes (align-then-count, and direct quantification), and say why raw counts, not TPM, go into differential-expression analysis.
The missing middle
The NGS track took you from raw reads to an aligned BAM file. The RNA-seq flagship starts from a finished table of gene counts. This lesson is the bridge between them: how sequencing reads become that table. It is the step almost every beginner is unsure about, and once you see it, the whole RNA-seq pipeline clicks together.
1What is a "count"?
A count is simply the number of sequencing reads that came from a given gene in a given sample. For the same gene, more reads (after adjusting for sequencing depth) means it was more highly expressed. Comparing different genes also needs a length correction, because longer genes collect more reads. To turn reads into counts, software needs two things: your reads, and an annotation (a file that says where each gene sits on the genome). It then assigns each read to the gene it overlaps and tallies them up.
Decode the jargonAnnotation (GTF/GFF)
An annotation file (usually a .gtf or .gff) is the map that lists every gene and exon and where it sits on the genome. Counting needs it to know which gene a read belongs to. You download it from Ensembl or GENCODE for your species, the same place you get the reference genome.
2The two routes from reads to counts
There are two standard ways to get counts. They reach the same kind of table by different paths.
Route A: align, then count
This is the classic route. You align reads to the genome (Track 2 taught the idea), then hand the BAM and an annotation to featureCounts, which assigns each read to a gene.
# align (a splice-aware aligner; STAR shown conceptually), then count featureCounts -a annotation.gtf -o counts.txt sample1.bam sample2.bam # paired-end reads: add -p --countReadPairs # counts.txt: one row per gene; after 6 annotation columns # (Geneid, Chr, Start, End, Strand, Length) come the sample counts
Route B: quantify directly (the fast modern default)
salmon skips the slow step of placing every read on the genome. It matches reads straight against the list of known transcripts (the transcriptome), a fast approach called selective alignment (older salmon versions used a simpler method called quasi-mapping; kallisto uses a related idea called pseudo-alignment), then you collapse transcript estimates to gene-level counts in R with tximport.
# build an index once, then quantify each sample salmon index -t transcripts.fa -i salmon_index salmon quant -i salmon_index -l A -r sample1.fastq.gz -o sample1_quant # paired-end: use -1 reads_1.fastq.gz -2 reads_2.fastq.gz instead of -r # then in R: tximport() reads the quant files into a gene-level count matrix
Decode the jargonSelective alignment (vs pseudo-alignment)
Instead of working out the exact position of every read on the genome, salmon's selective alignment (and kallisto's pseudo-alignment) just figures out which transcripts a read is compatible with. That is all you need to count expression, and it is dramatically faster and lighter, which is why salmon and kallisto are the common modern choice.
3Which route should a beginner use?
| Route A: align + featureCounts | Route B: salmon | |
|---|---|---|
| Speed / compute | Slower, needs more memory | Fast, light, laptop-friendly |
| You also get | A genome alignment (BAM) you can view in IGV | Just the quantification |
| Good when | You also need the alignment itself (for viewing reads, splicing or variant checks) | You only need expression counts (most of the time) |
For a first RNA-seq analysis, salmon is the friendliest default. If you have already aligned your reads for another reason, featureCounts on the BAM is just as valid.
4Why raw counts, not TPM, go into DESeq2
You will also see expression reported as TPM, CPM, or FPKM. These are normalized values, useful for rough, exploratory comparisons and plots (see the normalization lesson for their limits). but differential-expression tools like DESeq2 want the raw integer counts, because the statistical model needs to know the actual number of reads (the count size carries the uncertainty). DESeq2 does its own normalization internally. So: raw counts in, and let the tool normalize. (One exception in form, not in spirit: salmon gives estimated counts that are not whole numbers. Load those with tximport and DESeqDataSetFromTximport(), which handles them correctly.)
The one-line rule
Give DESeq2 raw counts. Use TPM/CPM only for visualization and quick comparisons, never as the input to differential testing.
Check your understanding
Sources & further reading
- Liao Y, Smyth GK, Shi W. featureCounts: an efficient general purpose program for assigning sequence reads to genomic features. Bioinformatics 30: 923-930, 2014. doi:10.1093/bioinformatics/btt656
- Patro R, Duggal G, Love MI, Irizarry RA, Kingsford C. Salmon provides fast and bias-aware quantification of transcript expression. Nature Methods 14: 417-419, 2017. doi:10.1038/nmeth.4197
- Soneson C, Love MI, Robinson MD. Differential analyses for RNA-seq: transcript-level estimates improve gene-level inferences. F1000Research 4: 1521, 2015. (tximport) doi:10.12688/f1000research.7563.2
- Zhao S, Ye Z, Stanton R. Misuse of RPKM or TPM normalization when comparing across samples and sequencing protocols. RNA 26: 903-909, 2020. doi:10.1261/rna.074922.120
Last reviewed: October 2026.