r1190: output unadjusted dp_max to ms:i

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
This commit is contained in:
Heng Li
2024-03-11 17:19:13 -04:00
parent 0efc886012
commit fcd4df2a73
3 changed files with 4 additions and 3 deletions

View File

@@ -344,7 +344,7 @@ static inline void write_tags(kstring_t *s, const mm_reg1_t *r)
if (r->id == r->parent) type = r->inv? 'I' : 'P';
else type = r->inv? 'i' : 'S';
if (r->p) {
mm_sprintf_lite(s, "\tNM:i:%d\tms:i:%d\tAS:i:%d\tnn:i:%d", r->blen - r->mlen + r->p->n_ambi, r->p->dp_max, r->p->dp_score, r->p->n_ambi);
mm_sprintf_lite(s, "\tNM:i:%d\tms:i:%d\tAS:i:%d\tnn:i:%d", r->blen - r->mlen + r->p->n_ambi, r->p->dp_max0, r->p->dp_score, r->p->n_ambi);
if (r->p->trans_strand == 1 || r->p->trans_strand == 2)
mm_sprintf_lite(s, "\tts:A:%c", "?+-?"[r->p->trans_strand]);
}