From d316dd0a3c4cd4b5899f226e641557d5bb891b55 Mon Sep 17 00:00:00 2001 From: William McLaren Date: Thu, 22 Jun 2017 22:04:43 +0100 Subject: [PATCH] fix up for earlier change --- modules/Bio/EnsEMBL/VEP/InputBuffer.pm | 10 ++++---- t/InputBuffer.t | 32 ++++---------------------- 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/modules/Bio/EnsEMBL/VEP/InputBuffer.pm b/modules/Bio/EnsEMBL/VEP/InputBuffer.pm index 1f8d16b73..b121eec95 100644 --- a/modules/Bio/EnsEMBL/VEP/InputBuffer.pm +++ b/modules/Bio/EnsEMBL/VEP/InputBuffer.pm @@ -157,16 +157,16 @@ sub get_overlapping_vfs { ($start, $end) = ($end, $start) if $start > $end; if(my $tree = $self->interval_tree) { - return $tree->fetch($start - 1, $end); + return [ + grep { overlap($_->{start}, $_->{end}, $start, $end) } + @{$tree->fetch($start - 1, $end)} + ]; } else { my $hash_tree = $self->hash_tree; return [ - grep { # checking both overlaps is quicker than sorting here - overlap($_->{start}, $_->{end}, $start, $end) || - overlap($_->{end}, $_->{start}, $start, $end) - } + grep { overlap($_->{start}, $_->{end}, $start, $end) } values %{{ map {$_->{_hash_tree_id} => $_} # use _hash_tree_id to uniquify map {@{$hash_tree->{$_} || []}} # tree might be empty diff --git a/t/InputBuffer.t b/t/InputBuffer.t index 675dbdf03..9f47094a1 100644 --- a/t/InputBuffer.t +++ b/t/InputBuffer.t @@ -193,13 +193,13 @@ delete $ib->{temp}->{hash_tree}; is_deeply( $ib->get_overlapping_vfs(25592910, 25592911), - [$ib->buffer->[0]], + [], 'get_overlapping_vfs - ins 1' ); is_deeply( $ib->get_overlapping_vfs(25592912, 25592913), - [$ib->buffer->[0]], + [], 'get_overlapping_vfs - ins 2' ); @@ -209,18 +209,6 @@ is_deeply( 'get_overlapping_vfs - ins 3' ); -is_deeply( - $ib->get_overlapping_vfs(25592909, 25592910), - [], - 'get_overlapping_vfs - ins 4' -); - -is_deeply( - $ib->get_overlapping_vfs(25592913, 25592914), - [], - 'get_overlapping_vfs - ins 5' -); - $ib->buffer->[0]->{start}--; SKIP: { @@ -306,13 +294,13 @@ SKIP: { is_deeply( $ib->get_overlapping_vfs(25592910, 25592911), - [$ib->buffer->[0]], + [], 'get_overlapping_vfs no tree - ins 1' ); is_deeply( $ib->get_overlapping_vfs(25592912, 25592913), - [$ib->buffer->[0]], + [], 'get_overlapping_vfs no tree - ins 2' ); @@ -322,18 +310,6 @@ SKIP: { 'get_overlapping_vfs no tree - ins 3' ); - is_deeply( - $ib->get_overlapping_vfs(25592909, 25592910), - [], - 'get_overlapping_vfs no tree - ins 4' - ); - - is_deeply( - $ib->get_overlapping_vfs(25592913, 25592914), - [], - 'get_overlapping_vfs no tree - ins 5' - ); - $ib->buffer->[0]->{start}--; $Bio::EnsEMBL::VEP::InputBuffer::CAN_USE_INTERVAL_TREE = $orig;