r438: still an issue in MD

It occurs when the global alignment disagrees with the local alignment.
This commit is contained in:
Heng Li 2014-02-19 11:31:54 -05:00
parent 52391a9855
commit 17fb85a227
2 changed files with 8 additions and 7 deletions

13
bwa.c
View File

@ -133,7 +133,6 @@ uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pa
int op, len; int op, len;
cigar = (uint32_t*)str.s; cigar = (uint32_t*)str.s;
op = cigar[k]&0xf, len = cigar[k]>>4; 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 if (op == 0) { // match
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
if (query[x + i] != rseq[y + i]) { if (query[x + i] != rseq[y + i]) {
@ -144,11 +143,13 @@ uint32_t *bwa_gen_cigar(const int8_t mat[25], int q, int r, int w_, int64_t l_pa
} }
x += len; y += len; x += len; y += len;
} else if (op == 2) { // deletion } else if (op == 2) { // deletion
kputw(u, &str); kputc('^', &str); if (k > 0 && k < *n_cigar) { // don't do the following if D is the first or the last CIGAR
for (i = 0; i < len; ++i) kputw(u, &str); kputc('^', &str);
kputc(int2base[rseq[y+i]], &str); for (i = 0; i < len; ++i)
u = 0; kputc(int2base[rseq[y+i]], &str);
y += len, n_gap += len; u = 0; n_gap += len;
}
y += len;
} else if (op == 1) x += len, n_gap += len; // insertion } else if (op == 1) x += len, n_gap += len; // insertion
} }
kputw(u, &str); kputc(0, &str); kputw(u, &str); kputc(0, &str);

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h" #include "utils.h"
#ifndef PACKAGE_VERSION #ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.6a+dev-r437" #define PACKAGE_VERSION "0.7.6a+dev-r438"
#endif #endif
int bwa_fa2pac(int argc, char *argv[]); int bwa_fa2pac(int argc, char *argv[]);