diff --git a/modules/Bio/EnsEMBL/VEP/AnnotationSource.pm b/modules/Bio/EnsEMBL/VEP/AnnotationSource.pm index f6b50f4c3..2edb5d36d 100644 --- a/modules/Bio/EnsEMBL/VEP/AnnotationSource.pm +++ b/modules/Bio/EnsEMBL/VEP/AnnotationSource.pm @@ -187,7 +187,7 @@ sub get_all_regions_by_InputBuffer { $max = $vf_e if $vf_e > $max; # convert to region-size - my ($r_s, $r_e) = map {int(($_ - 1) / $cache_region_size)} ($vf_s, $vf_e); + my ($r_s, $r_e) = map {int(($_ - 1) / $cache_region_size)} ($vf_s - $up_down_size, $vf_e + $up_down_size); # add all regions between r_s and r_e inclusive for(my $s = $r_s; $s <= $r_e; $s++) { diff --git a/t/AnnotationSource_Database_Transcript.t b/t/AnnotationSource_Database_Transcript.t index 00695c309..27df79754 100644 --- a/t/AnnotationSource_Database_Transcript.t +++ b/t/AnnotationSource_Database_Transcript.t @@ -402,6 +402,27 @@ SKIP: { $ib->next(); is_deeply($as->get_all_features_by_InputBuffer($ib), [], 'get_all_features_by_InputBuffer on empty buffer'); + # test upstream + $p = Bio::EnsEMBL::VEP::Parser::VCF->new({config => $cfg, file => $test_cfg->create_input_file([qw(21 13002936 . C A)])}); + $ib = Bio::EnsEMBL::VEP::InputBuffer->new({config => $cfg, parser => $p}); + $ib->next(); + + is_deeply( + $as->get_all_regions_by_InputBuffer($ib), + [ + [ + '21', + 259 + ], + [ + '21', + 260 + ], + ], + 'get_all_regions_by_InputBuffer - include upstream' + ); + + # reset $p = Bio::EnsEMBL::VEP::Parser::VCF->new({config => $cfg, file => $test_cfg->{test_vcf}}); $ib = Bio::EnsEMBL::VEP::InputBuffer->new({config => $cfg, parser => $p});