Skip to content

Commit b6f490c

Browse files
committed
Fix header formatting error for INFO/F_MISSING which must be Number=1
Resolves #2442
1 parent fc5b4a1 commit b6f490c

File tree

8 files changed

+35
-6
lines changed

8 files changed

+35
-6
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ Changes affecting specific commands:
2727

2828
- Add support for complex substitutions, such as AC>TAA
2929

30+
* bcftools +fill-tags
31+
32+
- Fix header formatting error for INFO/F_MISSING which must be Number=1 (#2442)
33+
3034
* bcftools gtcheck
3135

3236
- The program is now able to process gVCF blocks. Newly, monoallelic sites are excluded only

plugins/fill-tags.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ uint32_t parse_tags(args_t *args, const char *str)
490490
// include F_MISSING as part of 'all', which requires explicitly
491491
// initialising it as a filter expression not just setting a
492492
// bitfield flag.
493-
flag |= parse_func(args,"F_MISSING=F_MISSING","F_MISSING");
493+
flag |= parse_func(args,"F_MISSING:1=F_MISSING","F_MISSING");
494494
args->warned = ~(SET_END|SET_TYPE);
495495
args->unpack |= BCF_UN_FMT;
496496
}
@@ -508,7 +508,7 @@ uint32_t parse_tags(args_t *args, const char *str)
508508
else if ( !strcasecmp(tags[i],"VAF1") || !strcasecmp(tags[i],"FORMAT/VAF1") ) { flag |= SET_VAF1; args->unpack |= BCF_UN_FMT; }
509509
else if ( !strcasecmp(tags[i],"END") || !strcasecmp(tags[i],"INFO/END") ) flag |= SET_END;
510510
else if ( !strcasecmp(tags[i],"TYPE") || !strcasecmp(tags[i],"INFO/TYPE") ) flag |= SET_TYPE;
511-
else if ( !strcasecmp(tags[i],"F_MISSING") || !strcasecmp(tags[i],"INFO/F_MISSING") ) { flag |= parse_func(args,"F_MISSING=F_MISSING","F_MISSING"); args->unpack |= BCF_UN_FMT; }
511+
else if ( !strcasecmp(tags[i],"F_MISSING") || !strcasecmp(tags[i],"INFO/F_MISSING") ) { flag |= parse_func(args,"F_MISSING:1=F_MISSING","F_MISSING"); args->unpack |= BCF_UN_FMT; }
512512
else if ( (ptr=strchr(tags[i],'=')) ) { flag |= parse_func(args,tags[i],ptr+1); args->unpack |= BCF_UN_FMT; }
513513
else
514514
{

test/fill-tags-AN0.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
77
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data">
88
##INFO=<ID=AF,Number=A,Type=Float,Description="Allele frequency">
9-
##INFO=<ID=F_MISSING,Number=.,Type=Float,Description="Added by +fill-tags expression F_MISSING=F_MISSING">
9+
##INFO=<ID=F_MISSING,Number=1,Type=Float,Description="Added by +fill-tags expression F_MISSING:1=F_MISSING">
1010
##INFO=<ID=AC_Hom,Number=A,Type=Integer,Description="Allele counts in homozygous genotypes">
1111
##INFO=<ID=AC_Het,Number=A,Type=Integer,Description="Allele counts in heterozygous genotypes">
1212
##INFO=<ID=AC_Hemi,Number=A,Type=Integer,Description="Allele counts in hemizygous genotypes">

test/fill-tags-hemi.1.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
44
##contig=<ID=1,assembly=b37,length=249250621>
55
##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
6-
##INFO=<ID=F_MISSING,Number=.,Type=Float,Description="Added by +fill-tags expression F_MISSING=F_MISSING">
6+
##INFO=<ID=F_MISSING,Number=1,Type=Float,Description="Added by +fill-tags expression F_MISSING:1=F_MISSING">
77
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
88
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
99
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data">

test/fill-tags-hemi.2.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
44
##contig=<ID=1,assembly=b37,length=249250621>
55
##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
6-
##INFO=<ID=F_MISSING,Number=.,Type=Float,Description="Added by +fill-tags expression F_MISSING=F_MISSING">
6+
##INFO=<ID=F_MISSING,Number=1,Type=Float,Description="Added by +fill-tags expression F_MISSING:1=F_MISSING">
77
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
88
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
99
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data">

test/fill-tags-hwe.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
44
##contig=<ID=1,assembly=b37,length=249250621>
55
##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
6-
##INFO=<ID=F_MISSING,Number=.,Type=Float,Description="Added by +fill-tags expression F_MISSING=F_MISSING">
6+
##INFO=<ID=F_MISSING,Number=1,Type=Float,Description="Added by +fill-tags expression F_MISSING:1=F_MISSING">
77
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
88
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
99
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data">

test/fill-tags-rw.vcf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
##fileformat=VCFv4.2
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
4+
##contig=<ID=chr1,length=249250621,assembly=hg19>
5+
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
6+
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
7+
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data">
8+
##INFO=<ID=AF,Number=A,Type=Float,Description="Allele frequency">
9+
##INFO=<ID=F_MISSING,Number=1,Type=Float,Description="Added by +fill-tags expression F_MISSING:1=F_MISSING">
10+
##INFO=<ID=AC_Hom,Number=A,Type=Integer,Description="Allele counts in homozygous genotypes">
11+
##INFO=<ID=AC_Het,Number=A,Type=Integer,Description="Allele counts in heterozygous genotypes">
12+
##INFO=<ID=AC_Hemi,Number=A,Type=Integer,Description="Allele counts in hemizygous genotypes">
13+
##INFO=<ID=MAF,Number=1,Type=Float,Description="Frequency of the second most common allele">
14+
##INFO=<ID=HWE,Number=A,Type=Float,Description="HWE test (PMID:15789306); 1=good, 0=bad">
15+
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant">
16+
##INFO=<ID=TYPE,Number=.,Type=String,Description="Variant type">
17+
##INFO=<ID=ExcHet,Number=A,Type=Float,Description="Test excess heterozygosity; 1=good, 0=bad">
18+
##FORMAT=<ID=VAF,Number=A,Type=Float,Description="The fraction of reads with alternate allele (nALT/nSumAll)">
19+
##FORMAT=<ID=VAF1,Number=1,Type=Float,Description="The fraction of reads with alternate alleles (nSumALT/nSumAll)">
20+
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMP_A SAMP_B SAMP_C SAMP_E
21+
chr1 10146 . AC A . PASS NS=2;AN=4;AF=0.5;AC=2;F_MISSING=0.5;MAF=0.5;AC_Het=2;AC_Hom=0;AC_Hemi=0;HWE=1;ExcHet=0.666667;END=10147;TYPE=INDEL GT ./. 0/1 ./. 0/1
22+
chr1 10153 . A C . PASS NS=0;AN=0;AF=.;AC=0;F_MISSING=1;MAF=.;AC_Het=0;AC_Hom=0;AC_Hemi=0;HWE=1;ExcHet=1;END=10153;TYPE=SNP GT ./. ./. ./. ./.
23+
chr1 10154 . C G . PASS NS=0;AN=0;AF=.;AC=0;F_MISSING=1;MAF=.;AC_Het=0;AC_Hom=0;AC_Hemi=0;HWE=1;ExcHet=1;END=10154;TYPE=SNP GT ./. ./. ./. ./.
24+
chr1 10172 . C A . PASS NS=3;AN=6;AF=0;AC=0;F_MISSING=0.25;MAF=0;AC_Het=0;AC_Hom=0;AC_Hemi=0;HWE=1;ExcHet=1;END=10172;TYPE=SNP GT 0/0 0/0 0/0 ./.

test/test.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@
696696
run_test(\&test_vcf_plugin,$opts,in=>'fill-tags-hemi',out=>'fill-tags-hemi.2.out',cmd=>'+fill-tags --no-version',args=>'-- -d');
697697
run_test(\&test_vcf_plugin,$opts,in=>'fill-tags-hwe',out=>'fill-tags-hwe.out',cmd=>'+fill-tags --no-version');
698698
run_test(\&test_vcf_plugin,$opts,in=>'fill-tags-hwe',out=>'fill-tags-func.out',cmd=>'+fill-tags --no-version',args=>q[-- -t 'XX:1=F_PASS(GT="alt")']);
699+
run_test(\&test_vcf_plugin,$opts,in=>'fill-tags-rw',out=>'fill-tags-AN0.out',cmd=>'+fill-tags --no-version',args=>'-- -t all,END,TYPE,F_MISSING');
699700
run_test(\&test_vcf_plugin,$opts,in=>'fill-tags-AN0',out=>'fill-tags-AN0.out',cmd=>'+fill-tags --no-version',args=>'-- -t all,END,TYPE,F_MISSING');
700701
run_test(\&test_vcf_plugin,$opts,in=>'fill-tags-VAF',out=>'fill-tags-VAF.out',cmd=>'+fill-tags --no-version',args=>'-- -t VAF,VAF1');
701702
run_test(\&test_vcf_plugin,$opts,in=>'fill-tags-AD',out=>'fill-tags-AD.1.out',cmd=>'+fill-tags --no-version',args=>q[-- -t 'INFO/DP:1=int(sum(FMT/AD))']);

0 commit comments

Comments
 (0)