]> git.donarmstrong.com Git - samtools.git/commitdiff
* samtools-0.1.6-21 (r508)
authorHeng Li <lh3@live.co.uk>
Fri, 6 Nov 2009 14:06:40 +0000 (14:06 +0000)
committerHeng Li <lh3@live.co.uk>
Fri, 6 Nov 2009 14:06:40 +0000 (14:06 +0000)
 * fixed a potential bug in the indel caller towards the end of a chromosome

bam_maqcns.c
bam_plcmd.c
bamtk.c
sam_view.c

index 7aed741ca9c5df15df51c0d72af743f23388ef0f..71c2185df0f27d53f74192d1d90625ca7ccb14ac 100644 (file)
@@ -399,6 +399,10 @@ bam_maqindel_ret_t *bam_maqindel(int n, int pos, const bam_maqindel_opt_t *mi, c
                left = pos > INDEL_WINDOW_SIZE? pos - INDEL_WINDOW_SIZE : 0;
                right = pos + INDEL_WINDOW_SIZE;
                if (types[0] < 0) right -= types[0];
+               // in case the alignments stand out the reference
+               for (i = pos; i < right; ++i)
+                       if (ref[i] == 0) break;
+               right = i;
        }
        { // the core part
                char *ref2, *rs, *inscns = 0;
index fff42f7c582b0f40947616723e3c3fc15ca630c9..e2601ecc3c26b41051d0148a9cf9696036d297fb 100644 (file)
@@ -182,7 +182,7 @@ static int pileup_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *p
        // call the consensus and indel
        if (d->format & BAM_PLF_CNS) // call consensus
                cns = bam_maqcns_call(n, pu, d->c);
-       if ((d->format & (BAM_PLF_CNS|BAM_PLF_INDEL_ONLY)) && d->ref) { // call indels
+       if ((d->format & (BAM_PLF_CNS|BAM_PLF_INDEL_ONLY)) && d->ref && pos < d->len) { // call indels
                if (proposed_indels) // the first element gives the size of the array
                        r = bam_maqindel(n, pos, d->ido, pu, d->ref, proposed_indels[0], proposed_indels+1);
                else r = bam_maqindel(n, pos, d->ido, pu, d->ref, 0, 0);
diff --git a/bamtk.c b/bamtk.c
index a6bf524802bb4af44d3b30643ef7c5c2c4dbfc6d..b4af0eca2037882ab1051eac41bbb502e8394225 100644 (file)
--- a/bamtk.c
+++ b/bamtk.c
@@ -9,7 +9,7 @@
 #endif
 
 #ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.6-19 (r494)"
+#define PACKAGE_VERSION "0.1.6-21 (r508)"
 #endif
 
 int bam_taf2baf(int argc, char *argv[]);
index 7e171b9702202271f2f76da45af2b28cd22dc21d..06dd01a5ffa951dcb950a97681e7c5aca0b88971 100644 (file)
@@ -21,8 +21,11 @@ static void sol2sanger(bam1_t *b)
                        if (g_sol2sanger_tbl[l] >= 93) g_sol2sanger_tbl[l] = 93;
                }
        }
-       for (l = 0; l < b->core.l_qseq; ++l)
-               qual[l] = g_sol2sanger_tbl[qual[l]];
+       for (l = 0; l < b->core.l_qseq; ++l) {
+               int q = qual[l];
+               if (q > 127) q = 127;
+               qual[l] = g_sol2sanger_tbl[q];
+       }
 }
 
 static inline int __g_skip_aln(const bam_header_t *h, const bam1_t *b)