diff --git a/bwa.c b/bwa.c index d08899b..42c1b7b 100644 --- a/bwa.c +++ b/bwa.c @@ -125,7 +125,7 @@ uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pa // NW alignment *score = ksw_global(l_query, query, rlen, rseq, 5, mat, q, r, w, n_cigar, &cigar); } - {// compute NM + {// compute NM and MD int k, x, y, u, n_mm = 0, n_gap = 0; str.l = str.m = *n_cigar * 4; str.s = (char*)cigar; // append MD to CIGAR int2base = rb < l_pac? "ACGTN" : "TGCAN"; @@ -133,6 +133,7 @@ uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pa int op, len; cigar = (uint32_t*)str.s; op = cigar[k]&0xf, len = cigar[k]>>4; + if (op == 2 && (k == 0 || k == *n_cigar - 1)) continue; // skip the leading or trailing deletions if (op == 0) { // match for (i = 0; i < len; ++i) { if (query[x + i] != rseq[y + i]) { diff --git a/main.c b/main.c index 55d43cf..bdcc476 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "utils.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.7.6a+dev-r435" +#define PACKAGE_VERSION "0.7.6a+dev-r436" #endif int bwa_fa2pac(int argc, char *argv[]);