From: Petr Danecek Date: Wed, 20 Mar 2013 15:56:50 +0000 (+0000) Subject: mpileup indel hotfix: fix in detecting long stretches of N's. The version string... X-Git-Url: https://git.donarmstrong.com/?p=samtools.git;a=commitdiff_plain;h=fdec84077cb242e672bd3a62292c236edeb6236a mpileup indel hotfix: fix in detecting long stretches of N's. The version string can be now overriden, either directly or using git-stamp Makefile rule --- diff --git a/Makefile b/Makefile index 2f51bfc..a584c7a 100644 --- 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 6add34b..cd2455a 100644 --- a/bam.h +++ b/bam.h @@ -40,7 +40,11 @@ @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 #include diff --git a/bam2bcf_indel.c b/bam2bcf_indel.c index 30b3f46..9933586 100644 --- a/bam2bcf_indel.c +++ b/bam2bcf_indel.c @@ -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-posi ) { free(aux); return -1; } + if ( nN*2>(i-pos) ) { free(aux); return -1; } ks_introsort(uint32_t, m, aux); // squeeze out identical types diff --git a/bcftools/bcf.h b/bcftools/bcf.h index 3315809..4666a96 100644 --- a/bcftools/bcf.h +++ b/bcftools/bcf.h @@ -28,7 +28,11 @@ #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 #include diff --git a/misc/bamcheck.c b/misc/bamcheck.c index 352db21..b64c169 100644 --- a/misc/bamcheck.c +++ b/misc/bamcheck.c @@ -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);