]> git.donarmstrong.com Git - samtools.git/commitdiff
Compile cleanly from top-level Makefile. Check for out of bounds tids.
authorPetr Danecek <pd3@sanger.ac.uk>
Thu, 29 Mar 2012 09:50:16 +0000 (17:50 +0800)
committerpd3 <pd3@sanger.ac.uk>
Thu, 29 Mar 2012 13:03:47 +0000 (21:03 +0800)
misc/Makefile
misc/bamcheck.c

index 9434399bdc6a08245a013d19c8a598b9151ce644..64aa9df7c1b6e86fafa14ba7b3040b163175b16f 100644 (file)
@@ -30,6 +30,9 @@ lib:
 bamcheck:bamcheck.o
                $(CC) $(CFLAGS) -o $@ bamcheck.o -lm -lz -L.. -lbam
 
+bamcheck.o:bamcheck.c ../faidx.h ../khash.h ../sam.h ../razf.h
+               $(CC) $(CFLAGS) -c -I.. -o $@ bamcheck.c
+
 ace2sam:ace2sam.o
                $(CC) $(CFLAGS) -o $@ ace2sam.o -lz
 
index 7b5fd029469aa2373d950a43fb92d68218d82f8c..03cf3b233fec3b7d976dc07ac82fad94fd47a70c 100644 (file)
@@ -12,7 +12,7 @@
             considered, even small overlap is good enough to include the read in the stats.
 */
 
-#define BAMCHECK_VERSION "2012-03-22"
+#define BAMCHECK_VERSION "2012-03-29"
 
 #define _ISOC99_SOURCE
 #define _GNU_SOURCE
@@ -1240,7 +1240,7 @@ int main(int argc, char *argv[])
         {
             if ( stats->regions )
             {
-                if ( bam_line->core.tid >= stats->nregions ) continue;
+                if ( bam_line->core.tid >= stats->nregions || bam_line->core.tid<0 ) continue;
                 if ( !stats->is_sorted ) error("The BAM must be sorted in order for -t to work.\n");
 
                 regions_t *reg = &stats->regions[bam_line->core.tid];