From 67812fbe2d5227c401f29087f91f45889999f859 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 21 May 2009 11:50:28 +0000 Subject: [PATCH] * samtools-0.1.3-23 (r295) * fixed a critical bug in the indel caller --- bam_maqcns.c | 8 +++++--- bamtk.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bam_maqcns.c b/bam_maqcns.c index 482f33c..230f891 100644 --- a/bam_maqcns.c +++ b/bam_maqcns.c @@ -397,7 +397,8 @@ bam_maqindel_ret_t *bam_maqindel(int n, int pos, const bam_maqindel_opt_t *mi, c bam_segreg(pos, c, cigar, &seg); for (ps = s = 0, l = seg.qbeg; c->pos + l < right && l < seg.qend; ++l) { int cq = bam1_seqi(bam1_seq(p->b), l), ct; - ct = c->pos + l >= left? ref2[c->pos + l - left] : 15; // "<" will happen if reads are too long + // in the following line, "<" will happen if reads are too long + ct = c->pos + l - seg.qbeg >= left? ref2[c->pos + l - seg.qbeg - left] : 15; if (cq < 15 && ct < 15) { s += cq == ct? 1 : -mi->mm_penalty; if (cq != ct) ps += bam1_qual(p->b)[l]; @@ -417,7 +418,8 @@ bam_maqindel_ret_t *bam_maqindel(int n, int pos, const bam_maqindel_opt_t *mi, c if (score[i*n+j] < s) score[i*n+j] = s; // choose the higher of the two scores if (pscore[i*n+j] > ps) pscore[i*n+j] = ps; if (types[i] != 0) score[i*n+j] -= mi->indel_err; - //printf("%d, %d, %d, %d\n", i, types[i], j, score[i*n+j]); + //printf("%d, %d, %d, %d, %d, %d, %d\n", p->b->core.pos + 1, seg.qbeg, i, types[i], j, + // score[i*n+j], pscore[i*n+j]); } } { // get final result @@ -471,7 +473,7 @@ bam_maqindel_ret_t *bam_maqindel(int n, int pos, const bam_maqindel_opt_t *mi, c ret->gl[0] = ret->gl[1] = 0; for (j = 0; j < n; ++j) { int s1 = pscore[max1_i*n + j], s2 = pscore[max2_i*n + j]; - //printf("%d, %d\n", s1, s2); + //printf("%d, %d, %d, %d, %d\n", pl[j].b->core.pos+1, max1_i, max2_i, s1, s2); if (s1 > s2) ret->gl[0] += s1 - s2 < mi->q_indel? s1 - s2 : mi->q_indel; else ret->gl[1] += s2 - s1 < mi->q_indel? s2 - s1 : mi->q_indel; } diff --git a/bamtk.c b/bamtk.c index fcac281..5280c1f 100644 --- a/bamtk.c +++ b/bamtk.c @@ -3,7 +3,7 @@ #include "bam.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.3-22 (r293)" +#define PACKAGE_VERSION "0.1.3-23 (r295)" #endif int bam_taf2baf(int argc, char *argv[]); -- 2.39.5