]> git.donarmstrong.com Git - samtools.git/commitdiff
* samtools-0.1.2-9
authorHeng Li <lh3@live.co.uk>
Wed, 18 Feb 2009 22:23:27 +0000 (22:23 +0000)
committerHeng Li <lh3@live.co.uk>
Wed, 18 Feb 2009 22:23:27 +0000 (22:23 +0000)
 * fixed a bug in bam_fetch, caused by completely contained adjacent chunks

bam_index.c
bamtk.c

index 8c2555232772ee6571f0da19593c5b2764b04898..59deca071e00824630e076485f643c7bc4c0fa8a 100644 (file)
@@ -410,16 +410,20 @@ int bam_fetch(bamFile fp, const bam_index_t *idx, int tid, int beg, int end, voi
        free(bins);
        {
                bam1_t *b;
-               int ret, n_seeks;
+               int l, ret, n_seeks;
                uint64_t curr_off;
                b = (bam1_t*)calloc(1, sizeof(bam1_t));
                ks_introsort(off, n_off, off);
-               // resolve overlaps between adjecent blocks; this may happen due to the merge in indexing
+               // resolve completely contained adjacent blocks
+               for (i = 1, l = 0; i < n_off; ++i)
+                       if (off[l].v < off[i].v)
+                               off[++l] = off[i];
+               n_off = l + 1;
+               // resolve overlaps between adjacent blocks; this may happen due to the merge in indexing
                for (i = 1; i < n_off; ++i)
                        if (off[i-1].v >= off[i].u) off[i-1].v = off[i].u;
                { // merge adjacent blocks
 #if defined(BAM_TRUE_OFFSET) || defined(BAM_VIRTUAL_OFFSET16)
-                       int l;
                        for (i = 1, l = 0; i < n_off; ++i) {
 #ifdef BAM_TRUE_OFFSET
                                if (off[l].v + BAM_MIN_CHUNK_GAP > off[i].u) off[l].v = off[i].v;
diff --git a/bamtk.c b/bamtk.c
index f9df6782de513520406cf5a89c6bfa053f55f55e..950eae012925200dab2d060dc52d22a87e22a70b 100644 (file)
--- a/bamtk.c
+++ b/bamtk.c
@@ -3,7 +3,7 @@
 #include "bam.h"
 
 #ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.2-8"
+#define PACKAGE_VERSION "0.1.2-9"
 #endif
 
 int bam_taf2baf(int argc, char *argv[]);