7 Read Alignment: Implementations
Everything on this page is generated from tools/alignment.json. If something here is wrong or out of date, the fix belongs in that file, not in this prose — which is also why the page can carry an honest review date.
For the concepts these tools implement, see Section 6.1.
7.1 Start here
Three tools cover the overwhelming majority of read alignment work, split by the question being asked rather than by preference: short reads against a genome, long reads against anything, and short RNA-seq reads across splice junctions.
A vectorized reimplementation of BWA-MEM that produces the same alignments substantially faster. Because the output matches, adopting it in an existing short-read pipeline is a drop-in change rather than a revalidation. (Vasimuddin et al. 2019)
The default for long reads, and the only aligner in wide use that handles ONT, PacBio, spliced long reads and assembly-to-reference alignment with one preset system. Presets (-x map-ont, -x splice, -x asm5) carry most of the tuning that competing tools expose as loose flags. (Li 2018)
The default spliced aligner for short-read RNA-seq. Its manual recommends two-pass mode for the most sensitive novel-junction discovery: the first pass collects junctions, which are inserted into the index so the second pass can align across them. Upstream is careful about what this buys — not many more junctions, but more reads mapped to the ones found. (Dobin et al. 2013)
7.2 Short-read DNA
The short-read aligners have been stable for a decade, and the differences between them are smaller than the discourse suggests. Pick on the basis of what your downstream tools were validated against, and on index and memory constraints — not on published accuracy deltas, which are mostly within the noise of your library prep.
| Tool | Upstream | Languages | Why / why not |
|---|---|---|---|
| Bowtie 2 | maintained | C++ |
Competitive with BWA-MEM for short-read DNA and the expected input for several downstream tools that were built and validated against it. Choose it for those, not on alignment quality grounds alone. (Langmead and Salzberg 2012) |
| BWA | maintained | C |
Still the reference implementation of the MEM algorithm and still correct, but bwa-mem2 gives identical alignments faster. Reach for bwa when reproducing published results that specify it, or where the smaller index matters. (Li 2013) |
| strobealign | active | C++ |
Uses strobemer seeds rather than fixed-length minimizers. The paper reports it several times faster than traditional aligners at similar and sometimes higher accuracy, and both faster and more accurate than more recently proposed aligners for reads of 150 nt and longer. The newest entry here and the one most worth rechecking each review. (Sahlin 2022) |
7.3 Spliced alignment for RNA-seq
The real choice here is memory, not accuracy. Each tool’s own documentation makes the gap plain: STAR asks for at least 16 GB of RAM for a mammalian genome and recommends 32 GB, while HISAT2 reports a 6.2 GB human graph index and a 6.7 GB running footprint. On a laptop or a shared node with a hard memory limit, that decides it.
| Tool | Upstream | Languages | Why / why not |
|---|---|---|---|
| HISAT2 | active | C++ |
Aligns spliced short reads in a fraction of STAR’s memory, which is the reason to choose it: it runs where STAR will not. Its README puts the human graph index at 6.2 GB and the running footprint at 6.7 GB, against the 16-32 GB STAR asks for. The graph index also supports alignment against a population reference rather than a single haplotype. (Kim et al. 2019) |
7.4 Everything ends in SAMtools
No alignment step is finished when the aligner exits. The output is unsorted SAM on standard output, and almost every downstream tool requires a coordinate-sorted, indexed BAM — the type distinction from Section 6.6. In practice the aligner and the sort are a single piped command, so the unsorted intermediate never touches disk.
Not an aligner, but every alignment step ends in it: sorting, indexing and converting SAM to BAM or CRAM. In practice the aligner and the sort are one piped command, so the unsorted intermediate never reaches disk. (Danecek et al. 2021)
7.5 Language coverage: an honest gap
The chips above tell a story the book should state plainly rather than leave the reader to infer.
Read alignment is C and C++, essentially without exception. The performance demands are severe enough that no interpreted language is competitive for the inner loop, and the field settled on these tools before Rust was a plausible choice.
What exists in other languages is almost entirely bindings — mappy for minimap2, pysam and Rsamtools over htslib — rather than reimplementations. That is the right outcome: a binding to the reference implementation is strictly preferable to a reimplementation that may diverge from it.
Rust and Julia have real presence elsewhere in this book, particularly in downstream analysis and in newer file-format tooling, but for alignment itself there is simply nothing to show: no native library in either, and no binding worth naming. If that changes, this page changes with it — that is what the review date is for.
If you are working in R, Python or Julia, you are calling out to a command-line aligner and reading the BAM back in. Structuring your pipeline around that from the start is easier than discovering it partway through.