r794: fixed a bug in seed filtering

This commit is contained in:
Heng Li 2018-06-20 10:26:29 -04:00
parent e9ca0c9dab
commit 66674afd09
3 changed files with 13 additions and 12 deletions

21
align.c
View File

@ -376,7 +376,7 @@ static void mm_filter_bad_seeds(void *km, int as1, int cnt1, mm128_t *a, int min
if (k == n) break; if (k == n) break;
} }
i = K[k]; i = K[k];
gap = ((int32_t)a[as1 + i].y - a[as1 + i - 1].y) - ((int32_t)a[as1 + i].x - a[as1 + i - 1].x); gap = ((int32_t)a[as1 + i].y - (int32_t)a[as1 + i - 1].y) - (int32_t)(a[as1 + i].x - a[as1 + i - 1].x);
if (gap > 0) n_ins += gap; if (gap > 0) n_ins += gap;
else n_del += -gap; else n_del += -gap;
qs = (int32_t)a[as1 + i - 1].y; qs = (int32_t)a[as1 + i - 1].y;
@ -384,7 +384,7 @@ static void mm_filter_bad_seeds(void *km, int as1, int cnt1, mm128_t *a, int min
for (l = k + 1; l < n && l <= k + max_ext_cnt; ++l) { for (l = k + 1; l < n && l <= k + max_ext_cnt; ++l) {
int j = K[l], diff; int j = K[l], diff;
if ((int32_t)a[as1 + j].y - qs > max_ext_len || (int32_t)a[as1 + j].x - rs > max_ext_len) break; if ((int32_t)a[as1 + j].y - qs > max_ext_len || (int32_t)a[as1 + j].x - rs > max_ext_len) break;
gap = ((int32_t)a[as1 + j].y - (int32_t)a[as1 + j - 1].y) - (a[as1 + j].x - a[as1 + j - 1].x); gap = ((int32_t)a[as1 + j].y - (int32_t)a[as1 + j - 1].y) - (int32_t)(a[as1 + j].x - a[as1 + j - 1].x);
if (gap > 0) n_ins += gap; if (gap > 0) n_ins += gap;
else n_del += -gap; else n_del += -gap;
diff = n_ins + n_del - abs(n_ins - n_del); diff = n_ins + n_del - abs(n_ins - n_del);
@ -404,17 +404,18 @@ static void mm_filter_bad_seeds_alt(void *km, int as1, int cnt1, mm128_t *a, int
if (K == 0) return; if (K == 0) return;
for (k = 0; k < n;) { for (k = 0; k < n;) {
int i = K[k], l; int i = K[k], l;
int gap1 = ((int32_t)a[as1 + i].y - a[as1 + i - 1].y) - ((int32_t)a[as1 + i].x - a[as1 + i - 1].x); int gap1 = ((int32_t)a[as1 + i].y - (int32_t)a[as1 + i - 1].y) - ((int32_t)a[as1 + i].x - (int32_t)a[as1 + i - 1].x);
int re1 = (int32_t)a[as1 + i].x; int re1 = (int32_t)a[as1 + i].x;
int qe1 = (int32_t)a[as1 + i].y; int qe1 = (int32_t)a[as1 + i].y;
gap1 = gap1 > 0? gap1 : -gap1; gap1 = gap1 > 0? gap1 : -gap1;
for (l = k + 1; l < n && a[as1 + K[l]].y <= a[as1 + i].y + max_ext; ++l) { for (l = k + 1; l < n; ++l) {
int j = K[l]; int j = K[l], gap2, q_span_pre, rs2, qs2, m;
int gap2 = ((int32_t)a[as1 + j].y - a[as1 + j - 1].y) - ((int32_t)a[as1 + j].x - a[as1 + j - 1].x); if ((int32_t)a[as1 + j].y - qe1 > max_ext || (int32_t)a[as1 + j].x - re1 > max_ext) break;
int q_span_pre = a[as1 + j - 1].y >> 32 & 0xff; gap2 = ((int32_t)a[as1 + j].y - (int32_t)a[as1 + j - 1].y) - (int32_t)(a[as1 + j].x - a[as1 + j - 1].x);
int rs2 = (int32_t)a[as1 + j - 1].x + q_span_pre; q_span_pre = a[as1 + j - 1].y >> 32 & 0xff;
int qs2 = (int32_t)a[as1 + j - 1].x + q_span_pre; rs2 = (int32_t)a[as1 + j - 1].x + q_span_pre;
int m = rs2 - re1 < qs2 - qe1? rs2 - re1 : qs2 - qe1; qs2 = (int32_t)a[as1 + j - 1].x + q_span_pre;
m = rs2 - re1 < qs2 - qe1? rs2 - re1 : qs2 - qe1;
gap2 = gap2 > 0? gap2 : -gap2; gap2 = gap2 > 0? gap2 : -gap2;
if (m > gap1 + gap2) break; if (m > gap1 + gap2) break;
re1 = (int32_t)a[as1 + j].x; re1 = (int32_t)a[as1 + j].x;

2
main.c
View File

@ -10,7 +10,7 @@
#include "getopt.h" #include "getopt.h"
#endif #endif
#define MM_VERSION "2.10-r792-dirty" #define MM_VERSION "2.10-r794-dirty"
#ifdef __linux__ #ifdef __linux__
#include <sys/resource.h> #include <sys/resource.h>