]> git.donarmstrong.com Git - samtools.git/commitdiff
* samtools-0.1.10 (r841)
authorHeng Li <lh3@live.co.uk>
Fri, 19 Nov 2010 19:49:27 +0000 (19:49 +0000)
committerHeng Li <lh3@live.co.uk>
Fri, 19 Nov 2010 19:49:27 +0000 (19:49 +0000)
 * fixed a bug in pileup when the first CIGAR operation is D
 * fixed a bug in view with range query

bam_index.c
bam_pileup.c
bamtk.c

index 1ad2e93e5051972b084513d5d7391c45c6cf7bf2..f60a6f874b106f03c655d1207dddf21c4df7fc48 100644 (file)
@@ -608,6 +608,9 @@ bam_iter_t bam_iter_query(const bam_index_t *idx, int tid, int beg, int end)
                }
        }
        free(bins);
+       if (n_off == 0) {
+               free(off); return iter;
+       }
        {
                bam1_t *b = (bam1_t*)calloc(1, sizeof(bam1_t));
                int l;
index 55e51e27804cfc58fc5576b40ae7ba10416a3e8f..3e26f74c0e7dac3012ad5805a99d2311e6d274a6 100644 (file)
@@ -79,12 +79,12 @@ static inline int resolve_cigar2(bam_pileup1_t *p, uint32_t pos, cstate_t *s)
                is_head = 1;
                if (c->n_cigar == 1) { // just one operation, save a loop
                        if (_cop(cigar[0]) == BAM_CMATCH) s->k = 0, s->x = c->pos, s->y = 0;
-               } else { // find the first match
+               } else { // find the first match or deletion
                        for (k = 0, s->x = c->pos, s->y = 0; k < c->n_cigar; ++k) {
                                int op = _cop(cigar[k]);
                                int l = _cln(cigar[k]);
-                               if (op == BAM_CMATCH) break;
-                               else if (op == BAM_CDEL || op == BAM_CREF_SKIP) s->x += l;
+                               if (op == BAM_CMATCH || op == BAM_CDEL) break;
+                               else if (op == BAM_CREF_SKIP) s->x += l;
                                else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) s->y += l;
                        }
                        assert(k < c->n_cigar);
diff --git a/bamtk.c b/bamtk.c
index f3b09d64b8754ca05ad9295e46d3ad800cb53568..6d4eb7699b9e02809af110aa1c923f19314e675e 100644 (file)
--- a/bamtk.c
+++ b/bamtk.c
@@ -9,7 +9,7 @@
 #endif
 
 #ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.10-7 (r840)"
+#define PACKAGE_VERSION "0.1.10-8 (r841)"
 #endif
 
 int bam_taf2baf(int argc, char *argv[]);