]> git.donarmstrong.com Git - samtools.git/commitdiff
mpileup indel hotfix: fix in detecting long stretches of N's. The version string...
authorPetr Danecek <pd3@sanger.ac.uk>
Wed, 20 Mar 2013 15:56:50 +0000 (15:56 +0000)
committerPetr Danecek <pd3@sanger.ac.uk>
Wed, 20 Mar 2013 15:57:49 +0000 (15:57 +0000)
Makefile
bam.h
bam2bcf_indel.c
bcftools/bcf.h
misc/bamcheck.c

index 2f51bfcb920aef7cfada148a1743c1f1fa9b47db..a584c7aded36099624707490163d2c10ea7097d0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,11 @@
+# The default version string in bam.h and bcftools/bcf.h can be overriden directly
+#   make VERSION="-DVERSION='\\\"my-version\\\"'"
+# or using the git-stamp rule
+#   make git-stamp
+VERSION=
+
 CC=                    gcc
-CFLAGS=                -g -Wall -O2
+CFLAGS=                -g -Wall $(VERSION) -O2
 #LDFLAGS=              -Wl,-rpath,\$$ORIGIN/../lib
 DFLAGS=                -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1
 KNETFILE_O=    knetfile.o
@@ -17,6 +23,7 @@ SUBDIRS=      . bcftools misc
 LIBPATH=
 LIBCURSES=     -lcurses # -lXCurses
 
+
 .SUFFIXES:.c .o
 .PHONY: all lib
 
@@ -35,6 +42,9 @@ all-recur lib-recur clean-recur cleanlocal-recur install-recur:
 
 all:$(PROG)
 
+git-stamp:
+               make VERSION="-DVERSION='\\\"`git describe --always --dirty`\\\"'"
+
 .PHONY:all lib clean cleanlocal
 .PHONY:all-recur lib-recur clean-recur cleanlocal-recur install-recur
 
diff --git a/bam.h b/bam.h
index 6add34bc65a802eef4adad139573658c5b42e566..cd2455af2337cd2884249ed308cbbeb6873eea1a 100644 (file)
--- a/bam.h
+++ b/bam.h
   @copyright Genome Research Ltd.
  */
 
-#define BAM_VERSION "0.1.19-96b5f2294a"
+#ifndef VERSION
+#define BAM_VERSION "0.1.19+"
+#else
+#define BAM_VERSION VERSION
+#endif
 
 #include <stdint.h>
 #include <stdlib.h>
index 30b3f46f8431a184fc50524e8f339b70363f6af5..9933586ae0c21b9a1cb5f45fef3b56e6819343ed 100644 (file)
@@ -175,7 +175,7 @@ int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_calla
         // To prevent long stretches of N's to be mistaken for indels (sometimes thousands of bases),
         //  check the number of N's in the sequence and skip places where half or more reference bases are Ns.
         int nN=0; for (i=pos; i-pos<max_rd_len && ref[i]; i++) if ( ref[i]=='N' ) nN++;
-        if ( nN*2>i ) { free(aux); return -1; }
+        if ( nN*2>(i-pos) ) { free(aux); return -1; }
 
                ks_introsort(uint32_t, m, aux);
                // squeeze out identical types
index 3315809297221d64b04edf694b65f524a8385c23..4666a96a05d3a2a8568931933cce2f6716218f59 100644 (file)
 #ifndef BCF_H
 #define BCF_H
 
-#define BCF_VERSION "0.1.19-96b5f2294a"
+#ifndef VERSION
+#define BCF_VERSION "0.1.19+"
+#else
+#define BCF_VERSION VERSION
+#endif
 
 #include <stdint.h>
 #include <zlib.h>
index 352db21b12dbaf0edaa1a5d90f2e872aa258874f..b64c1690392bdf0bb1cca604c422f77df4fca9ca 100644 (file)
@@ -963,8 +963,8 @@ void output_stats(stats_t *stats)
     printf("SN\treads QC failed:\t%ld\n", (long)stats->nreads_QCfailed);
     printf("SN\tnon-primary alignments:\t%ld\n", (long)stats->nreads_secondary);
     printf("SN\ttotal length:\t%ld\n", (long)stats->total_len);
-    printf("SN\tbases mapped:\t%ld\n", (long)stats->nbases_mapped);
-    printf("SN\tbases mapped (cigar):\t%ld\n", (long)stats->nbases_mapped_cigar);
+    printf("SN\tbases mapped:\t%ld\n", (long)stats->nbases_mapped);                 // the length of the whole read goes here, including soft-clips etc.
+    printf("SN\tbases mapped (cigar):\t%ld\n", (long)stats->nbases_mapped_cigar);   // only matched and inserted bases are counted here
     printf("SN\tbases trimmed:\t%ld\n", (long)stats->nbases_trimmed);
     printf("SN\tbases duplicated:\t%ld\n", (long)stats->total_len_dup);
     printf("SN\tmismatches:\t%ld\n", (long)stats->nmismatches);