One Reference Cannot Represent Everyone
A read spanning an insertion can be perfectly correct and still look broken against one linear genome, and the mapper takes the blame for a reference that never contained the path.
pangraphmap builds a reference haplotype, an alternate structural-variant path, and reads that cross the bubble. Both mappers use the same mismatch rule. Only the reference representation changes.
Add the Path, Remove the Bias
The linear mapper searches one string. The graph-aware mapper scores both valid haplotype paths and keeps the best alignment. It's the smallest useful demonstration of why pangenomes matter: not because graphs are fashionable, but because missing variation turns into missing reads.
The Number
The linear reference maps 6 of 25 reads under the same edit threshold. The pangenome maps all 25, a 76-point gain. It's a seeded structural-variant simulation, not a replacement for vg or Minigraph-Cactus, and as the next section shows, the 25 of 25 was guaranteed.
A Perfect Score Was Reading a String Against Itself
Every read was sliced verbatim from the alternate haplotype, alt[i:i+36]. Scanning that haplotype for the best window always finds the exact window the read came from, at distance zero. So 25 of 25 wasn't showing that the graph helps. It was confirming that a string matches itself. Across 65 seeds it hit 25/25 every single time.
Real reads carry sequencing error, so the fix adds independent 8% per-base substitution error before mapping, and an exact match is no longer guaranteed. The graph's advantage survives as a real, varying number: a mean 58.4-point gain on 40 tuning seeds (36 to 80) and on a disjoint 25-seed holdout (40 to 68), evaluated once. Smaller than 76, never pinned to 100, and still large. Missing variation really does cost you reads.
The original module is untouched, so the published 6 / 25 / 76.0 still reproduce exactly. 10 tests pass on GitHub Actions across Python 3.9 through 3.13.
Research Basis
Inspired by Nature Genetics' 2025 pangenome graph review. Every number on this page comes from this repository's own controlled benchmark, not from the paper.
Try It
Standard library only:
git clone https://github.com/ahmeddoghri/pangraphmap && cd pangraphmap
python pangraphmap.py # pristine reads: 6 vs 25
python pangraphmap_v2.py # with 8% sequencing error: 3 vs 18
python eval_v2.py # 65 seeds: mean gain 58.4 points