Since v2.19-ish, minimap2 rescores base alignment based on the best alignment
of a read. This heuristic sometimes improve the mapping accuracy of the best
alignment but may too aggressively filter weaker hits.
Resolve#969
Via larger batches and more short-read heuristics. Identical alignment on 2
million reads. Short DNA-seq read alignment may be improved in corner cases.
This was an oversight affecting v2.22+. The latest minimap2 ranks hits and
estimates mapping quality with an adjusted alignment score (see the minimap2
update paper). This score however is not calculated when there is only one hit.
As a result, the ms:i tag varies depends on other sequences in the reference
genome, which is confusing. This change lets minimap2 to output the unadjusted
score at ms:i. At present, the adjusted score is not outputted.
Resolves#1146
* Added the lr:hq preset suggested by Nanopore developers (#1127)
* Fixed transition scoring. It did not work with presets.
* Cleaned up preset documentation
* Implements a transition-aware alignment scoring scheme and configuration presets for ICLR
* Fix to enable use of general scoring matrix in ksw as suggested by lh3
---------
Co-authored-by: koadman <>
Give the CIGAR constants names to clarify the code. So that ksw2.h
remains self-contained, define KSW_* versions of the CIGAR operators
it needs for use within ksw2.h. Other code should in general use the
full set of MM_CIGAR_* constants in minimap.h.
Define MM_CIGAR_STR to the full string of CIGAR operators (including
the 'B' operator as well) and use it throughout the C code.
It would be possible to use it from the Cython code too, but it's easier
to keep that as a Cython string literal to avoid adding extra runtime
code to handle locale conversion.
We may use a large --end-bonus to mimic end-to-end alignment. In the short-read
mode, the candidate alignment region may be out of the band, which leads to
truncated alignment.
Fix the logic that calculates the number of CIGAR entries when
match "M" entries are expanded into "=" and "X". The number
of entries depends not on the number of mismatches but rather
on the number of transitions between "=" to "X".