From 872f3009551ea912f495a85dbdb0969c54d3debd Mon Sep 17 00:00:00 2001 From: Heng Li Date: Wed, 30 May 2018 11:55:14 -0400 Subject: [PATCH] r781: fixed the buggy heapmerge (resolves #166) --- main.c | 2 +- map.c | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/main.c b/main.c index 28228f7..09c8677 100644 --- a/main.c +++ b/main.c @@ -10,7 +10,7 @@ #include "getopt.h" #endif -#define MM_VERSION "2.10-r777-dirty" +#define MM_VERSION "2.10-r781-dirty" #ifdef __linux__ #include diff --git a/map.c b/map.c index ebe4c61..79f0d0e 100644 --- a/map.c +++ b/map.c @@ -163,19 +163,20 @@ static mm128_t *collect_seed_hits_heap(void *km, const mm_mapopt_t *opt, int max mm128_t *p; uint64_t r = heap->x; int32_t is_self, rpos = (uint32_t)r >> 1; - if (skip_seed(opt->flag, r, q, qname, qlen, mi, &is_self)) continue; - if ((r&1) == (q->q_pos&1)) { // forward strand - p = &a[n_for++]; - p->x = (r&0xffffffff00000000ULL) | rpos; - p->y = (uint64_t)q->q_span << 32 | q->q_pos >> 1; - } else { // reverse strand - p = &a[(*n_a) - (++n_rev)]; - p->x = 1ULL<<63 | (r&0xffffffff00000000ULL) | rpos; - p->y = (uint64_t)q->q_span << 32 | (qlen - ((q->q_pos>>1) + 1 - q->q_span) - 1); + if (!skip_seed(opt->flag, r, q, qname, qlen, mi, &is_self)) { + if ((r&1) == (q->q_pos&1)) { // forward strand + p = &a[n_for++]; + p->x = (r&0xffffffff00000000ULL) | rpos; + p->y = (uint64_t)q->q_span << 32 | q->q_pos >> 1; + } else { // reverse strand + p = &a[(*n_a) - (++n_rev)]; + p->x = 1ULL<<63 | (r&0xffffffff00000000ULL) | rpos; + p->y = (uint64_t)q->q_span << 32 | (qlen - ((q->q_pos>>1) + 1 - q->q_span) - 1); + } + p->y |= (uint64_t)q->seg_id << MM_SEED_SEG_SHIFT; + if (q->is_tandem) p->y |= MM_SEED_TANDEM; + if (is_self) p->y |= MM_SEED_SELF; } - p->y |= (uint64_t)q->seg_id << MM_SEED_SEG_SHIFT; - if (q->is_tandem) p->y |= MM_SEED_TANDEM; - if (is_self) p->y |= MM_SEED_SELF; // update the heap if ((uint32_t)heap->y < q->n - 1) { ++heap[0].y;