]> git.donarmstrong.com Git - samtools.git/commitdiff
* samtools-0.1.2-20
authorHeng Li <lh3@live.co.uk>
Thu, 2 Apr 2009 14:14:56 +0000 (14:14 +0000)
committerHeng Li <lh3@live.co.uk>
Thu, 2 Apr 2009 14:14:56 +0000 (14:14 +0000)
 * check if file is truncated in flagstat

bam_stat.c
bamtk.c

index a4522daa49257b920ab26586a6062d046a26d9e3..b0cd3014f7f645fd608ceccb9993312c890274a4 100644 (file)
@@ -33,13 +33,15 @@ bam_flagstat_t *bam_flagstat_core(bamFile fp)
        bam_flagstat_t *s;
        bam1_t *b;
        bam1_core_t *c;
+       int ret;
        s = (bam_flagstat_t*)calloc(1, sizeof(bam_flagstat_t));
        b = bam_init1();
        c = &b->core;
-       while (bam_read1(fp, b) >= 0) {
+       while ((ret = bam_read1(fp, b)) >= 0)
                flagstat_loop(s, c);
-       }
        bam_destroy1(b);
+       if (ret != -1)
+               fprintf(stderr, "[bam_flagstat_core] Truncated file? Continue anyway.\n");
        return s;
 }
 int bam_flagstat(int argc, char *argv[])
diff --git a/bamtk.c b/bamtk.c
index 792699e957dcff54368e4d8b48bfbd15772e07e3..aeb7d0a77ecca4a0faef75eff8c559f87ff06cb3 100644 (file)
--- a/bamtk.c
+++ b/bamtk.c
@@ -3,7 +3,7 @@
 #include "bam.h"
 
 #ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.2-19"
+#define PACKAGE_VERSION "0.1.2-20"
 #endif
 
 int bam_taf2baf(int argc, char *argv[]);