diff --git a/bwamem_pair.c b/bwamem_pair.c index 27973ca..a3aeb80 100644 --- a/bwamem_pair.c +++ b/bwamem_pair.c @@ -123,7 +123,7 @@ int mem_matesw(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, co if (skip[0] + skip[1] + skip[2] + skip[3] == 4) return 0; // consistent pair exist; no need to perform SW for (r = 0; r < 4; ++r) { int is_rev, is_larger; - uint8_t *seq, *rev = 0, *ref; + uint8_t *seq, *rev = 0, *ref = 0; int64_t rb, re; if (skip[r]) continue; is_rev = (r>>1 != (r&1)); // whether to reverse complement the mate @@ -142,8 +142,8 @@ int mem_matesw(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, co } if (rb < 0) rb = 0; if (re > l_pac<<1) re = l_pac<<1; - ref = bns_fetch_seq(bns, pac, &rb, (rb+re)>>1, &re, &rid); - if (a->rid == rid) { // no funny things happening + if (rb < re) ref = bns_fetch_seq(bns, pac, &rb, (rb+re)>>1, &re, &rid); + if (a->rid == rid && re - rb >= opt->min_seed_len) { // no funny things happening kswr_t aln; mem_alnreg_t b; int tmp, xtra = KSW_XSUBO | KSW_XSTART | (l_ms * opt->a < 250? KSW_XBYTE : 0) | (opt->min_seed_len * opt->a); diff --git a/main.c b/main.c index da7cd19..b3ce197 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.7.9-r783" +#define PACKAGE_VERSION "0.7.9a-r786" #endif int bwa_fa2pac(int argc, char *argv[]);