Site icon Ampersand Tutorials

Read Mapping Explained: How Short Reads Find Their Place in a Reference Genome

Quick answer: Read mapping (read alignment) takes the millions of short sequences a sequencer produced and determines where each one originates in a known reference genome. Modern mappers do this with a fast seed-and-extend strategy — find exact short matches first, then score the alignment around them — rather than comparing every read against every position. The output is a SAM/BAM file where every read carries its position, a mapping-quality score, and flags describing how it aligned; filtering and trusting those fields is where most downstream results quietly succeed or fail.

Companion to the NGS quality control and variant calling guides on this blog: mapping is the middle step that both of those depend on.

What mapping is actually answering

After sequencing you hold a bag of reads: strings of 50–300 bases with no coordinates attached. Every downstream analysis — variant calling, differential expression, ChIP-seq peak calling — needs to know where each read came from. Mapping answers one question per read: given this sequence, which location(s) in the reference are the most plausible origin, and how confident am I?

That “how confident” matters more than beginners expect. A read that maps equally well to ten places (repeats, paralogs, segmental duplications) carries almost no information, yet a naive analysis counts it like any other. Mapping quality is the field’s mechanism for separating evidence from noise.

Two clarifications on vocabulary:

Why exact search is impossible, and what seed-and-extend does

A human genome is 3 billion positions; a lane of sequencing produces hundreds of millions of reads. Testing every read against every position with dynamic programming is arithmetically out of the question. The trick every modern mapper shares:

The dominant tools encode this pattern differently. BWA-MEM (and its successor bwa-mem2) uses short exact seeds then long-gap extension, making it the default for 70–250 bp genomic reads. Bowtie2 uses a different index (FMD-index) with a configurable seed strategy and is tuned for shorter reads and offers explicit end-to-end or local modes. HISAT2 adds a graph of known variants into the index so reads spanning known SNPs map more accurately — the reason it is the RNA-seq default for splice-aware alignment alongside STAR, which seeds from the read’s split segments to jump across introns.

Choosing a mapper is rarely the hard part: the defaults are good. Knowing what the outputs mean is where analysis quality lives.

Reading a SAM/BAM record: the fields that matter

Mappers write SAM (text) or BAM (compressed binary; samtools view converts between them). Each record is one read, with a fixed core:

A BAM is then sorted by coordinate and indexed (.bai or .csi), which is what lets tools — and genome browsers like IGV — jump to any region instantly instead of rescanning the file.

The filters between a raw BAM and a trustworthy one

Raw alignments are a starting inventory, not analysis-ready data. The standard conditioning steps:

Where mapping quietly goes wrong

What a completed mapping step should hand over

A defensible mapping deliverable is a coordinate-sorted, indexed BAM plus its QC: mapping rate, proper-pair rate, coverage distribution, duplication rate, and the exact reference and mapper versions used. Anything less — an unsorted BAM with no stats file — forces the next person (including future you) to redo the step to trust the analysis.

Key takeaways

Challenge

Take a public BAM (the 1000 Genomes or ENCODE portals host them) and open it in IGV alongside its reference. Find one read with MAPQ 0, decompose its FLAG by hand, and locate its CIGAR soft-clips. Then run samtools flagstat and samtools stats and see whether the numbers agree with what you observed visually. The loop of “look at the pileup, check the statistic, explain the discrepancy” is the working skill of every alignment QC session.

Want guided practice turning alignment QC into a defensible analysis? Ampersand Academy offers one-to-one mentoring in bioinformatics — part of Mahadhi, a development and digital marketing company.

FAQ

What is the difference between SAM and BAM?

SAM is the plain-text alignment format; BAM is the same content gzip-compressed and binary-indexed. They are interchangeable via samtools view; virtually all pipelines store BAM for size and speed, with a .bai index alongside for random access.

What does mapping quality (MAPQ) actually mean?

It is a phred-scaled estimate that the read is placed in the wrong location: MAPQ 20 implies roughly a 1-in-100 chance of misplacement, MAPQ 60 roughly 1-in-1,000,000. Values of 0 mean the read matches multiple locations equally well, so its position carries no information.

Should I remove secondary and supplementary alignments?

For variant calling and simple quantification, yes — keep primary alignments only. For structural-variant detection, splice-aware analysis, or long-read workflows, secondary and supplementary records are the evidence itself and must be kept.

BWA-MEM or Bowtie2 — which should I use?

For standard 100 bp+ paired-end genomic DNA, BWA-MEM2 is the default choice. Bowtie2 remains excellent for short reads and for its explicit end-to-end vs local modes. RNA-seq needs a splice-aware option (HISAT2 or STAR) rather than either.

Does duplicate marking delete my reads?

No. It sets a flag on records with identical coordinates, so the reads stay in the BAM and the decision is reversible. Removal (if wanted) happens later as an explicit filtering step, which matters in low-input libraries where duplicates can be real molecules.

Why did my mapping rate drop after switching references?

A mismatched reference build (or an unmasked contaminant sequence) reduces exact seed matches and MAPQ, even though many reads still place somewhere. Always confirm the FASTA build matches the annotation and known-sites resources before comparing mapping rates across runs.

How does read mapping differ from de novo assembly?

Mapping places reads against an existing reference; assembly reconstructs a genome without one by overlapping reads into contigs. Use mapping when a trustworthy reference exists, assembly when it does not — or when divergence from the reference is too great for reliable placement.

Exit mobile version