From a9a8e7769267e5a39a10004f2e0a10bee9e33aaf Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 16 Feb 2012 14:33:07 +0000 Subject: [PATCH] bugfix: wrong SP; missing DV in the VCF header --- bam.h | 2 +- bam2bcf.c | 2 +- bcftools/call1.c | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bam.h b/bam.h index df345b6..11f8028 100644 --- a/bam.h +++ b/bam.h @@ -40,7 +40,7 @@ @copyright Genome Research Ltd. */ -#define BAM_VERSION "0.1.18-dev (r982:310)" +#define BAM_VERSION "0.1.18-dev (r982:313)" #include #include diff --git a/bam2bcf.c b/bam2bcf.c index 83f2e56..6ac5dce 100644 --- a/bam2bcf.c +++ b/bam2bcf.c @@ -328,7 +328,7 @@ int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bc if (bcr && fmt_flag) { uint16_t *dp = (fmt_flag & B2B_FMT_DP)? b->gi[1].data : 0; uint16_t *dv = (fmt_flag & B2B_FMT_DV)? b->gi[1 + ((fmt_flag & B2B_FMT_DP) != 0)].data : 0; - int32_t *sp = (fmt_flag & B2B_FMT_DV)? b->gi[1 + ((fmt_flag & B2B_FMT_DP) != 0) + ((fmt_flag & B2B_FMT_DV) != 0)].data : 0; + int32_t *sp = (fmt_flag & B2B_FMT_SP)? b->gi[1 + ((fmt_flag & B2B_FMT_DP) != 0) + ((fmt_flag & B2B_FMT_DV) != 0)].data : 0; for (i = 0; i < bc->n; ++i) { bcf_callret1_t *p = bcr + i; if (dp) dp[i] = p->depth < 0xffff? p->depth : 0xffff; diff --git a/bcftools/call1.c b/bcftools/call1.c index 3cc4649..f6717b3 100644 --- a/bcftools/call1.c +++ b/bcftools/call1.c @@ -33,6 +33,7 @@ KSTREAM_INIT(gzFile, gzread, 16384) #define VC_EM 0x10000 #define VC_PAIRCALL 0x20000 #define VC_QCNT 0x40000 +#define VC_INDEL_ONLY 0x80000 typedef struct { int flag, prior_type, n1, n_sub, *sublist, n_perm; @@ -283,6 +284,8 @@ static void write_header(bcf_hdr_t *h) kputs("##FORMAT=\n", &str); if (!strstr(str.s, "##FORMAT=\n", &str); + if (!strstr(str.s, "##FORMAT=\n", &str); if (!strstr(str.s, "##FORMAT=\n", &str); if (!strstr(str.s, "##FORMAT== 0) { + while ((c = getopt(argc, argv, "FN1:l:cC:eHAGvbSuP:t:p:QgLi:IMs:D:U:X:d:T:Yw")) >= 0) { switch (c) { case '1': vc.n1 = atoi(optarg); break; case 'l': vc.bed = bed_read(optarg); break; @@ -335,6 +338,7 @@ int bcfview(int argc, char *argv[]) case 'u': vc.flag |= VC_UNCOMP | VC_BCFOUT; break; case 'g': vc.flag |= VC_CALL_GT | VC_CALL; break; case 'I': vc.flag |= VC_NO_INDEL; break; + case 'w': vc.flag |= VC_INDEL_ONLY; break; case 'M': vc.flag |= VC_ANNO_MAX; break; case 'Y': vc.flag |= VC_QCNT; break; case 't': vc.theta = atof(optarg); break; @@ -482,6 +486,7 @@ int bcfview(int argc, char *argv[]) if (vc.flag & VC_FIX_PL) bcf_fix_pl(b); is_indel = bcf_is_indel(b); if ((vc.flag & VC_NO_INDEL) && is_indel) continue; + if ((vc.flag & VC_INDEL_ONLY) && !is_indel) continue; if ((vc.flag & VC_ACGT_ONLY) && !is_indel) { int x; if (b->ref[0] == 0 || b->ref[1] != 0) continue; -- 2.39.2