jguhlin / minimap2-rs

Rust bindings to minimap2 library
Other
60 stars 13 forks source link

Bug: Supplementary mapping flag is not set correctly #72

Closed rob-p closed 2 weeks ago

rob-p commented 3 weeks ago

It seems that the is_supplementary flag in the Mapping structure actually records whether or not the alignment is primary not if it is supplementary. That is valid (and potentially equally optimal) alignments that are secondary (because by the SAM spec only one can be elected as primary) are instead marked as supplementary. The offending line of code seems to be:

let is_supplementary = reg.sam_pri() == 0;

The is_supplementary flag should record if the alignment is actually a supplementary alignment or not. If the mapping is “secondary” or not can already be obtained by the is_primary flag being set to false.

rob-p commented 2 weeks ago

This is addressed in the changes to the alignment-score branch, and supplementary mappings fully match those in minimap2 when including the query-name as is possible with the latest PR, so closing this.