Skip to content

Commit

Permalink
Merge branch 'htslib-1620' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pd3 committed Jul 20, 2023
2 parents e0e3bd4 + 9288357 commit acea5b7
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 3 deletions.
26 changes: 23 additions & 3 deletions test/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,19 @@
run_test(\&test_vcf_norm,$opts,in=>'norm.symbolic',fai=>'norm.symbolic',out=>'norm.symbolic.1.out',args=>'--old-rec-tag ORI');
run_test(\&test_vcf_norm,$opts,in=>'norm.right-align',fai=>'norm.right-align',out=>'norm.right-align.1.out',args=>'--old-rec-tag ORI');
run_test(\&test_vcf_norm,$opts,in=>'norm.right-align',fai=>'norm.right-align',out=>'norm.right-align.2.out',args=>'--old-rec-tag ORI -g {PATH}/norm.right-align.gff');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.1.out',args=>'',reg=>'-r 1');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.1.out',args=>'',reg=>'-r 1:1-2');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.1.out',args=>'',reg=>'-r 1:1,1:2');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.2.out',args=>'',reg=>'-r 1:1-1');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.3.out',args=>'',reg=>'-r {1:1}');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.3.out',args=>'',reg=>'-r {1:1}:1-2');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.3.out',args=>'',reg=>'-r {1:1}:1,{1:1}:2');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.4.out',args=>'',reg=>'-r {1:1}:1-1');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.5.out',args=>'',reg=>'-r {1:1-1}');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.5.out',args=>'',reg=>'-r {1:1-1}:1-2');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.5.out',args=>'',reg=>'-r {1:1-1}:1,{1:1-1}:2');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',out=>'weird-chr-names.6.out',args=>'',reg=>'-r {1:1-1}:1-1');
run_test(\&test_vcf_view,$opts,in=>'weird-chr-names',args=>'',reg=>'-r {1:1-1}-2',expected_failure=>1);
run_test(\&test_vcf_view,$opts,in=>'view',out=>'view.1.out',args=>'-aUc1 -C1 -s NA00002 -v snps',reg=>'');
run_test(\&test_vcf_view,$opts,in=>'view',out=>'view.2.out',args=>'-f PASS -Xks NA00003',reg=>'-r20,Y');
run_test(\&test_vcf_view,$opts,in=>'view',out=>'view.3.out',args=>'-xs NA00003',reg=>'');
Expand Down Expand Up @@ -1078,7 +1091,13 @@ sub test_cmd
my ($ret,$out,$err) = _cmd3("$args{cmd}");
if ( length($err) ) { $err =~ s/\n/\n\t\t/gs; $err = "\n\n\t\t$err\n"; }
if ( $ret ) { failed($opts,$test,"Non-zero status $ret$err"); return; }
if ( $ret && !$args{expected_failure} ) { failed($opts,$test,"Non-zero status $ret$err"); return; }
if ( $args{expected_failure} )
{
if ( !$ret ) { failed($opts,$test,"Expected failure but the test returned $ret$err"); }
else { passed($opts,$test,"ok, expected non-zero status"); }
return;
}
if ( $$opts{redo_outputs} && -e "$$opts{path}/$args{out}" )
{
rename("$$opts{path}/$args{out}","$$opts{path}/$args{out}.old");
Expand Down Expand Up @@ -1150,9 +1169,10 @@ sub failed
}
sub passed
{
my ($opts,$test) = @_;
my ($opts,$test,$reason) = @_;
$$opts{nok}++;
print ".. ok\n\n";
if ( !defined $reason ) { $reason = 'ok'; }
print ".. $reason\n\n";
}
sub is_file_newer
{
Expand Down
9 changes: 9 additions & 0 deletions test/weird-chr-names.1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##fileformat=VCFv4.3
##FILTER=<ID=PASS,Description="All filters passed">
##reference=ref.fa
##contig=<ID=1>
##contig=<ID=1:1>
##contig=<ID=1:1-1>
#CHROM POS ID REF ALT QUAL FILTER INFO
1 1 . C T . . .
1 2 . C T . . .
8 changes: 8 additions & 0 deletions test/weird-chr-names.2.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.3
##FILTER=<ID=PASS,Description="All filters passed">
##reference=ref.fa
##contig=<ID=1>
##contig=<ID=1:1>
##contig=<ID=1:1-1>
#CHROM POS ID REF ALT QUAL FILTER INFO
1 1 . C T . . .
9 changes: 9 additions & 0 deletions test/weird-chr-names.3.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##fileformat=VCFv4.3
##FILTER=<ID=PASS,Description="All filters passed">
##reference=ref.fa
##contig=<ID=1>
##contig=<ID=1:1>
##contig=<ID=1:1-1>
#CHROM POS ID REF ALT QUAL FILTER INFO
1:1 1 . C T . . .
1:1 2 . C T . . .
8 changes: 8 additions & 0 deletions test/weird-chr-names.4.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.3
##FILTER=<ID=PASS,Description="All filters passed">
##reference=ref.fa
##contig=<ID=1>
##contig=<ID=1:1>
##contig=<ID=1:1-1>
#CHROM POS ID REF ALT QUAL FILTER INFO
1:1 1 . C T . . .
9 changes: 9 additions & 0 deletions test/weird-chr-names.5.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##fileformat=VCFv4.3
##FILTER=<ID=PASS,Description="All filters passed">
##reference=ref.fa
##contig=<ID=1>
##contig=<ID=1:1>
##contig=<ID=1:1-1>
#CHROM POS ID REF ALT QUAL FILTER INFO
1:1-1 1 . C T . . .
1:1-1 2 . C T . . .
8 changes: 8 additions & 0 deletions test/weird-chr-names.6.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.3
##FILTER=<ID=PASS,Description="All filters passed">
##reference=ref.fa
##contig=<ID=1>
##contig=<ID=1:1>
##contig=<ID=1:1-1>
#CHROM POS ID REF ALT QUAL FILTER INFO
1:1-1 1 . C T . . .
12 changes: 12 additions & 0 deletions test/weird-chr-names.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
##fileformat=VCFv4.3
##reference=ref.fa
##contig=<ID=1>
##contig=<ID=1:1>
##contig=<ID=1:1-1>
#CHROM POS ID REF ALT QUAL FILTER INFO
1 1 . C T . . .
1 2 . C T . . .
1:1 1 . C T . . .
1:1 2 . C T . . .
1:1-1 1 . C T . . .
1:1-1 2 . C T . . .

0 comments on commit acea5b7

Please sign in to comment.