Skip to content

Commit dfdb092

Browse files
committed
Make the -t ./x mode select both phased and unphased genotypes,
as advertised by the usage page. Fixes #1844
1 parent 63690a8 commit dfdb092

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ Changes affecting specific commands:
105105

106106
- Add new `--new-gt X` option (#1800)
107107

108+
- Fix a bug where `-t ./x` mode was advertised as selecting both phased and unphased
109+
half-missing genotypes, but was in fact selecting only unphased genotypes (#1844)
110+
108111
* bcftools +split-vep
109112

110113
- New options `-g, --gene-list` and `--gene-list-fields` which allow to prioritize
@@ -119,7 +122,7 @@ Changes affecting specific commands:
119122

120123
* bcftools +tag2tag
121124

122-
- Revamp of the plugin to allo wider range of tag conversions, specifically all combinations
125+
- Revamp of the plugin to allow wider range of tag conversions, specifically all combinations
123126
from FORMAT/GL,PL,GP to FORMAT/GL,PL,GP,GT
124127

125128
* bcftools +trio-dnm2

plugins/setGT.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* plugins/setGT.c -- set gentoypes to given values
22
3-
Copyright (C) 2015-2022 Genome Research Ltd.
3+
Copyright (C) 2015-2023 Genome Research Ltd.
44
55
Author: Petr Danecek <[email protected]>
66
@@ -570,7 +570,7 @@ bcf1_t *process(bcf1_t *rec)
570570
{
571571
if ( ptr[j]==bcf_int32_vector_end ) break;
572572
ploidy++;
573-
if ( ptr[j]==bcf_gt_missing ) nmiss++;
573+
if ( bcf_gt_is_missing(ptr[j]) ) nmiss++;
574574
}
575575

576576
int do_set = 0;

test/setGT.6.1.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
##fileformat=VCFv4.2
2+
##FILTER=<ID=PASS,Description="All filters passed">
3+
##contig=<ID=1,assembly=b37,length=249250621>
4+
##reference=file:ref.fa
5+
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
6+
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT A B C D
7+
1 1890 . A G . . . GT ./. ./. 1/1 1|1

test/setGT.6.vcf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
##fileformat=VCFv4.2
2+
##contig=<ID=1,assembly=b37,length=249250621>
3+
##reference=file:ref.fa
4+
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
5+
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT A B C D
6+
1 1890 . A G . . . GT 1/. 1|. 1/1 1|1

test/test.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@
522522
run_test(\&test_vcf_plugin,$opts,in=>'setGT.4',out=>'setGT.4.1.out',cmd=>'+setGT --no-version',args=>q[-- -t q -n . -e 'FMT/DP>90']);
523523
run_test(\&test_vcf_plugin,$opts,in=>'setGT.4',out=>'setGT.4.2.out',cmd=>'+setGT --no-version',args=>q[-- -t q -n . -e 'FMT/DP>100']);
524524
run_test(\&test_vcf_plugin,$opts,in=>'setGT.5',out=>'setGT.5.1.out',cmd=>'+setGT --no-version',args=>q[-- -t a -n X]);
525+
run_test(\&test_vcf_plugin,$opts,in=>'setGT.6',out=>'setGT.6.1.out',cmd=>'+setGT --no-version',args=>q[-- -t ./x -n .]);
526+
run_test(\&test_vcf_plugin,$opts,in=>'setGT.6',out=>'setGT.6.1.out',cmd=>'+setGT --no-version',args=>q[-- -t . -n .]);
525527
run_test(\&test_vcf_plugin,$opts,in=>'plugin1',out=>'fill-AN-AC.out',cmd=>'+fill-AN-AC --no-version');
526528
run_test(\&test_vcf_plugin,$opts,in=>'dosage',out=>'dosage.1.out',cmd=>'+dosage',args=>'-- -t PL');
527529
run_test(\&test_vcf_plugin,$opts,in=>'dosage',out=>'dosage.2.out',cmd=>'+dosage',args=>'-- -t GL');

0 commit comments

Comments
 (0)