Skip to content

Commit

Permalink
Add tests for #1123
Browse files Browse the repository at this point in the history
  • Loading branch information
pd3 committed Dec 16, 2019
1 parent 2782d9f commit 4b54f9d
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
test_vcf_view($opts,in=>'idx.2',out=>'idx.2.out',args=>q[-H -R {PATH}/idx.2.bed]);
test_vcf_view($opts,in=>'idx.3',out=>'idx.3.out',args=>q[-H -R {PATH}/idx.3.bed]);
test_vcf_view($opts,in=>'idx.4',out=>'idx.4.out',args=>q[-H -R {PATH}/idx.4.bed]);
test_vcf_64bit($opts,in=>'view64bit.1',out=>'view64bit.1.out',do_bcf=>1);
test_vcf_64bit($opts,in=>'view64bit.2',out=>'view64bit.2.out',do_bcf=>1);
test_vcf_64bit($opts,in=>'view64bit.3',out=>'view64bit.3.out'); # large coordinates don't work with BCF
test_vcf_64bit($opts,in=>'view64bit.4',out=>'view64bit.4.out',do_bcf=>1);
test_vcf_64bit($opts,in=>'view64bit.5',out=>'view64bit.5.out',do_bcf=>1);
test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.6.out',args=>q[-S. -e'TXT0="text"'],reg=>'');
test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.7.out',args=>q[-S. -e'FMT/FRS[*:1]="BB"'],reg=>'');
test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.8.out',args=>q[-S. -e'FMT/FGS[*:0]="AAAAAA"'],reg=>'');
Expand Down Expand Up @@ -959,6 +964,16 @@ sub test_vcf_view
test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -Ob $args{args} $$opts{tmp}/$args{in}.vcf.gz $args{reg} | $$opts{bin}/bcftools view | grep -v ^##bcftools_", exp_fix=>1);
}
}
sub test_vcf_64bit
{
my ($opts,%args) = @_;
test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view $$opts{path}/$args{in}.vcf -H", exp_fix=>1);
test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view $$opts{path}/$args{in}.vcf | $$opts{bin}/bcftools view -H", exp_fix=>1);
if ( $args{do_bcf} )
{
test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view $$opts{path}/$args{in}.vcf -Ou | $$opts{bin}/bcftools view -H", exp_fix=>1);
}
}
sub test_vcf_call
{
my ($opts,%args) = @_;
Expand Down
2 changes: 2 additions & 0 deletions test/view64bit.1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chr1 1 . G C . . MPOS=.;XPOS=.,.,.;NALOD=-0.8279;NLOD=15.45;POPAF=6
chr1 2 . G C . . MPOS=.;XPOS=.,.,.;NALOD=-0.8279;NLOD=15.45;POPAF=6
10 changes: 10 additions & 0 deletions test/view64bit.1.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##fileformat=VCFv4.2
##INFO=<ID=MPOS,Number=A,Type=Integer,Description="dummy">
##INFO=<ID=XPOS,Number=.,Type=Integer,Description="dummy">
##INFO=<ID=NALOD,Number=A,Type=Float,Description="dummy">
##INFO=<ID=NLOD,Number=A,Type=Float,Description="dummy">
##INFO=<ID=POPAF,Number=A,Type=Float,Description="dummy">
##contig=<ID=chr1,length=248956422>
#CHROM POS ID REF ALT QUAL FILTER INFO
chr1 1 . G C . . MPOS=-2147483641;XPOS=-2147483641,-2147483641,-2147483641;NALOD=-8.279e-01;NLOD=15.45;POPAF=6.00
chr1 2 . G C . . MPOS=-2147483648;XPOS=-2147483648,-2147483648,-2147483648;NALOD=-8.279e-01;NLOD=15.45;POPAF=6.00
1 change: 1 addition & 0 deletions test/view64bit.2.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chr1 1 . G C . . MPOS=.;XPOS=.,.,. MPOS:XPOS .:.,.,.
8 changes: 8 additions & 0 deletions test/view64bit.2.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.2
##INFO=<ID=MPOS,Number=A,Type=Integer,Description="dummy">
##INFO=<ID=XPOS,Number=.,Type=Integer,Description="dummy">
##FORMAT=<ID=MPOS,Number=.,Type=Integer,Description="dummy">
##FORMAT=<ID=XPOS,Number=.,Type=Integer,Description="dummy">
##contig=<ID=chr1,length=248956422>
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE
chr1 1 . G C . . MPOS=42949672950;XPOS=42949672950,42949672950,42949672950 MPOS:XPOS 42949672950:42949672950,42949672950,42949672950
1 change: 1 addition & 0 deletions test/view64bit.3.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chr1 42949672950 . G C . . MPOS=.;XPOS=.,.,. MPOS:XPOS .:.,.,.
8 changes: 8 additions & 0 deletions test/view64bit.3.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.2
##INFO=<ID=MPOS,Number=A,Type=Integer,Description="dummy">
##INFO=<ID=XPOS,Number=.,Type=Integer,Description="dummy">
##FORMAT=<ID=MPOS,Number=.,Type=Integer,Description="dummy">
##FORMAT=<ID=XPOS,Number=.,Type=Integer,Description="dummy">
##contig=<ID=chr1,length=248956422>
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE
chr1 42949672950 . G C . . MPOS=42949672950;XPOS=42949672950,42949672950,42949672950 MPOS:XPOS 42949672950:42949672950,42949672950,42949672950
1 change: 1 addition & 0 deletions test/view64bit.4.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chr1 1 . G C . . MPOS=.;XPOS=.,.,. MPOS:XPOS .:.,.,.
8 changes: 8 additions & 0 deletions test/view64bit.4.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.2
##INFO=<ID=MPOS,Number=A,Type=Integer,Description="dummy">
##INFO=<ID=XPOS,Number=.,Type=Integer,Description="dummy">
##FORMAT=<ID=MPOS,Number=.,Type=Integer,Description="dummy">
##FORMAT=<ID=XPOS,Number=.,Type=Integer,Description="dummy">
##contig=<ID=chr1,length=248956422>
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE
chr1 1 . G C . . MPOS=.;XPOS=.,.,. MPOS:XPOS .:.,.,.
6 changes: 6 additions & 0 deletions test/view64bit.5.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
chr1 1 . G C . . END=42949672,1,.;MPOS=100000000 XX 1,-2147483640,.,.,.,2147483647,.
chr1 1 . G C . . END=-2147483640 XX -2147483640
chr1 1 . G C . . END=. XX .
chr1 1 . G C . . END=. XX .
chr1 1 . G C . . END=. XX .
chr1 1 . G C . . END=. XX .
12 changes: 12 additions & 0 deletions test/view64bit.5.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
##fileformat=VCFv4.2
##INFO=<ID=END,Number=A,Type=Integer,Description="dummy">
##INFO=<ID=MPOS,Number=A,Type=Integer,Description="dummy">
##FORMAT=<ID=XX,Number=A,Type=Integer,Description="dummy">
##contig=<ID=chr1,length=248956422>
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT S1
chr1 1 . G C . . END=42949672,1,5000000000;MPOS=100000000 XX 1,-2147483640,-2147483641,-2147483647,-2147483648,2147483647,2147483648
chr1 1 . G C . . END=-2147483640 XX -2147483640
chr1 1 . G C . . END=-2147483641 XX -2147483641
chr1 1 . G C . . END=-2147483647 XX -2147483647
chr1 1 . G C . . END=-2147483648 XX -2147483648
chr1 1 . G C . . END=-2147483649 XX -2147483649

0 comments on commit 4b54f9d

Please sign in to comment.