Skip to content

Commit 8d3f754

Browse files
committed
Fix the -v/V, --types/--exclude-types option to work with ref
and extend for all types supported by htslib: snps,indels,mnps,ref,bnd,other,overlap Fixes #2567
1 parent 4a59485 commit 8d3f754

11 files changed

Lines changed: 88 additions & 65 deletions

NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ Changes affecting specific commands:
115115

116116
bcftools +trio-dnm3 --use-ALM
117117

118+
* bcftools view
119+
120+
- Fix the -v/V, --types/--exclude-types option to work with ref and extend
121+
for all types supported by htslib: snps,indels,mnps,ref,bnd,other,overlap
122+
(#2567)
123+
118124

119125
## Release 1.23.1 (18th March 2026)
120126

test/test.pl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,13 @@
378378
run_test(\&test_vcf_norm,$opts,in=>'norm.split.merge',out=>'norm.split.merge.5.out',args=>q[-m - -i 'type="snp"']);
379379
run_test(\&test_vcf_norm,$opts,in=>'norm.merge.4',out=>'norm.merge.4.1.out',args=>'-m +any');
380380
run_test(\&test_vcf_norm,$opts,in=>'norm.merge.4',out=>'norm.merge.4.2.out',args=>'-m +both');
381+
run_test(\&test_vcf_view,$opts,in=>'view.types',out=>'view.types.1.out',args=>q[-Hv ref]);
382+
run_test(\&test_vcf_view,$opts,in=>'view.types',out=>'view.types.2.out',args=>q[-Hv snps]);
383+
run_test(\&test_vcf_view,$opts,in=>'view.types',out=>'view.types.3.out',args=>q[-Hv mnps]);
384+
run_test(\&test_vcf_view,$opts,in=>'view.types',out=>'view.types.4.out',args=>q[-Hv indels]);
385+
run_test(\&test_vcf_view,$opts,in=>'view.types',out=>'view.types.5.out',args=>q[-Hv other]);
386+
run_test(\&test_vcf_view,$opts,in=>'view.types',out=>'view.types.6.out',args=>q[-Hv bnd]);
387+
run_test(\&test_vcf_view,$opts,in=>'view.types',out=>'view.types.7.out',args=>q[-Hv overlap]);
381388
run_test(\&test_vcf_view,$opts,in=>'filter.mac',out=>'filter.mac.1.out',args=>q[-Hi 'MAC>=2']);
382389
run_test(\&test_vcf_view,$opts,in=>'filter.mac',out=>'filter.mac.1.out',args=>q[-Hi 'MAF>=0.09']);
383390
run_test(\&test_vcf_view,$opts,in=>'filter.mac',out=>'filter.mac.1.out',args=>q[-Hi 'MAF*AN>=2']);

test/view.types.1.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chr1 10 ref_only A . . PASS .

test/view.types.2.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
chr1 20 snp A C . PASS .
2+
chr1 90 mixed_snp_indel A C,AT . PASS .

test/view.types.3.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chr1 30 mnp AC GT . PASS .

test/view.types.4.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
chr1 40 ins A AT . PASS .
2+
chr1 50 del AT A . PASS .
3+
chr1 90 mixed_snp_indel A C,AT . PASS .

test/view.types.5.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chr1 60 other_symbolic N <DUP> . PASS END=100

test/view.types.6.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chr1 70 bnd N N]chr2:100] . PASS .

test/view.types.7.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chr1 80 overlap_star A * . PASS .

test/view.types.vcf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##fileformat=VCFv4.3
2+
##contig=<ID=chr1,length=1000000>
3+
##contig=<ID=chr2,length=1000000>
4+
##INFO=<ID=END,Number=1,Type=Integer,Description="End coordinate for symbolic alleles">
5+
#CHROM POS ID REF ALT QUAL FILTER INFO
6+
chr1 10 ref_only A . . PASS .
7+
chr1 20 snp A C . PASS .
8+
chr1 30 mnp AC GT . PASS .
9+
chr1 40 ins A AT . PASS .
10+
chr1 50 del AT A . PASS .
11+
chr1 60 other_symbolic N <DUP> . PASS END=100
12+
chr1 70 bnd N N]chr2:100] . PASS .
13+
chr1 80 overlap_star A * . PASS .
14+
chr1 90 mixed_snp_indel A C,AT . PASS .

0 commit comments

Comments
 (0)