Skip to content

Commit

Permalink
fix up for earlier change
Browse files Browse the repository at this point in the history
  • Loading branch information
William McLaren committed Jun 22, 2017
1 parent 66a60eb commit d316dd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
10 changes: 5 additions & 5 deletions modules/Bio/EnsEMBL/VEP/InputBuffer.pm
Expand Up @@ -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
Expand Down
32 changes: 4 additions & 28 deletions t/InputBuffer.t
Expand Up @@ -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'
);

Expand All @@ -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: {
Expand Down Expand Up @@ -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'
);

Expand All @@ -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;
Expand Down

0 comments on commit d316dd0

Please sign in to comment.