r436: fix rare MD/NM-CIGAR inconsistencies

This commit is contained in:
Heng Li 2014-02-19 10:08:43 -05:00
parent 4adc34eccb
commit bdd14d2946
2 changed files with 3 additions and 2 deletions

3
bwa.c
View File

@ -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]) {

2
main.c
View File

@ -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[]);