Skip to content

Commit

Permalink
Merge pull request #496 from at7/bugfix/resume_after_homref
Browse files Browse the repository at this point in the history
Bugfix/resume after homref
  • Loading branch information
at7 authored Jun 17, 2019
2 parents 0f37f44 + 60c752e commit dad1066
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/Bio/EnsEMBL/VEP/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use warnings;
use base qw(Exporter);

our $VEP_VERSION = 96;
our $VEP_SUB_VERSION = 2;
our $VEP_SUB_VERSION = 3;

our @EXPORT_OK = qw(
@FLAG_FIELDS
Expand Down
2 changes: 2 additions & 0 deletions modules/Bio/EnsEMBL/VEP/Runner.pm
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ sub _buffer_to_output {
else {
push @output, @{$output_factory->get_all_lines_by_InputBuffer($input_buffer)};
}
# if output is empty here rerun because there could still be VFs left coming from the parser
return $self->_buffer_to_output($input_buffer, $output_as_hash) unless scalar @output || $self->param('fork');

return \@output;
}
Expand Down
36 changes: 35 additions & 1 deletion t/Runner.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use strict;
use warnings;

use Test::More;
use Test::Exception;
use FindBin qw($Bin);
Expand Down Expand Up @@ -1023,6 +1022,41 @@ STACK S3
'warnings - with multiple'
);

# Test to check that after variant is filtered out because all individuals are homozygous for reference
# vep doesn't stop annotating because of empty output array in Runner.pm
$runner = Bio::EnsEMBL::VEP::Runner->new({
%$cfg_hash,
input_data => undef,
input_file => $test_cfg->{test_vcf5},
dir => $test_cfg->{cache_root_dir},
output_file => $test_cfg->{user_file}.'.out',
individual => 'all',
});
ok($runner->run, 'run - ok');
open IN, $test_cfg->{user_file}.'.out';
@tmp_lines = <IN>;
close IN;

is(scalar (grep {/^var5_chr22/} @tmp_lines), 5, 'run - individual all');

unlink($test_cfg->{user_file}.'.out');

$runner = Bio::EnsEMBL::VEP::Runner->new({
%$cfg_hash,
input_data => undef,
input_file => $test_cfg->{test_vcf6},
dir => $test_cfg->{cache_root_dir},
output_file => $test_cfg->{user_file}.'.out',
});
ok($runner->run, 'run - ok');
open IN, $test_cfg->{user_file}.'.out';
@tmp_lines = <IN>;
close IN;

is(scalar (grep {/^var5_chr22/} @tmp_lines), 5, 'run - ref and alt are the same');

unlink($test_cfg->{user_file}.'.out');

## run_rest
###########

Expand Down
2 changes: 2 additions & 0 deletions t/VEPTestingConfig.pm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ our %DEFAULTS = (
test_vcf2 => $Bin.'/testdata/input/test2.vcf',
test_vcf3 => $Bin.'/testdata/input/test3.vcf',
test_vcf4 => $Bin.'/testdata/input/test4.vcf',
test_vcf5 => $Bin.'/testdata/input/test5.vcf',
test_vcf6 => $Bin.'/testdata/input/test6.vcf',
vr_vcf => $Bin.'/testdata/input/idt_test.vcf',
windows_vcf => $Bin.'/testdata/input/windows.vcf',
test_gzvcf => $Bin.'/testdata/input/test.vcf.gz',
Expand Down
5 changes: 5 additions & 0 deletions t/testdata/input/test5.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##fileformat=VCFv4.1
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT P1
21 25585733 rs142513484 C T . . . GT 0/0
22 25769065 var5_chr22 G T . . . GT 0/1
4 changes: 4 additions & 0 deletions t/testdata/input/test6.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
##fileformat=VCFv4.1
#CHROM POS ID REF ALT QUAL FILTER INFO
21 25585733 rs142513484 C C . . .
22 25769065 var5_chr22 G T . . .

0 comments on commit dad1066

Please sign in to comment.