From f422175e4ed313135c227e42ce3578e6d08e6efc Mon Sep 17 00:00:00 2001 From: Heng Li Date: Fri, 8 Sep 2017 22:44:14 -0400 Subject: [PATCH] r344: avoid unnecessary refName retrieval --- main.c | 2 +- map.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 90ad92a..b99b48c 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "getopt.h" -#define MM_VERSION "2.1.1-r341" +#define MM_VERSION "2.1.1-r344-dirty" #ifdef __linux__ #include diff --git a/map.c b/map.c index 14366ad..2a81352 100644 --- a/map.c +++ b/map.c @@ -217,13 +217,15 @@ mm_reg1_t *mm_map_frag(const mm_mapopt_t *opt, const mm_idx_t *mi, mm_tbuf_t *b, if (i > 0 && p->x>>8 == b->mini.a[m_st + i - 1].x>>8) is_tandem = 1; if (i < n - 1 && p->x>>8 == b->mini.a[m_st + i + 1].x>>8) is_tandem = 1; for (k = 0; k < q->n; ++k) { - const char *tname = mi->seq[r[k]>>32].name; int32_t rpos = (uint32_t)r[k] >> 1; mm128_t *p; - if (qname && (opt->flag&MM_F_NO_SELF) && strcmp(qname, tname) == 0 && rpos == (q->qpos>>1)) // avoid the diagonal - continue; - if (qname && (opt->flag&MM_F_AVA) && strcmp(qname, tname) > 0) // all-vs-all mode: map once - continue; + if (qname && (opt->flag&(MM_F_NO_SELF|MM_F_AVA))) { + const char *tname = mi->seq[r[k]>>32].name; + if ((opt->flag&MM_F_NO_SELF) && strcmp(qname, tname) == 0 && rpos == (q->qpos>>1)) // avoid the diagonal + continue; + if ((opt->flag&MM_F_AVA) && strcmp(qname, tname) > 0) // all-vs-all mode: map once + continue; + } p = &a[j++]; if ((r[k]&1) == (q->qpos&1)) { // forward strand p->x = (r[k]&0xffffffff00000000ULL) | (uint32_t)r[k]>>1;