Skip to content

Commit

Permalink
r436: fix rare MD/NM-CIGAR inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Feb 19, 2014
1 parent 4adc34e commit bdd14d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bwa.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ 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";
for (k = 0, x = y = u = 0; k < *n_cigar; ++k) {
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]) {
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[]);
Expand Down

0 comments on commit bdd14d2

Please sign in to comment.