Skip to content

Commit

Permalink
fix when name is 0 in BED
Browse files Browse the repository at this point in the history
  • Loading branch information
William McLaren committed Nov 27, 2017
1 parent ac1ac35 commit f435d80
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/Bio/EnsEMBL/VEP/AnnotationSource/File.pm
Expand Up @@ -372,14 +372,14 @@ sub _get_record_name {

my $name = $parser->get_name;

return ($self->report_coords || !$name) ?
return ($self->report_coords || !defined($name)) ?
sprintf(
'%s:%i-%i',
$parser->get_seqname,
$parser->get_start,
$parser->get_end
) :
$parser->get_name;
$name;
}


Expand Down
26 changes: 26 additions & 0 deletions t/AnnotationSource_File_BED.t
Expand Up @@ -101,6 +101,32 @@ SKIP: {
'annotate_InputBuffer - exact, additive'
);

# 0 is a valid "name" field in BED
$ib = Bio::EnsEMBL::VEP::InputBuffer->new({
config => $cfg,
parser => Bio::EnsEMBL::VEP::Parser::VCF->new({
config => $cfg,
file => $test_cfg->create_input_file([qw(21 25585741 rs142513484 C T . . .)]),
valid_chromosomes => [21]
})
});
$ib->next();
$as->type('overlap');
$as->annotate_InputBuffer($ib);

is_deeply(
$ib->buffer->[0]->{_custom_annotations},
{
'foo' => [
{ name => 'test1' },
{ name => 0 }
]
},
'annotate_InputBuffer - 0 valid name in BED'
);
$as->type('exact');


# out by one
delete($ib->buffer->[0]->{_custom_annotations});

Expand Down
Binary file modified t/testdata/custom/test.bed.gz
Binary file not shown.
Binary file modified t/testdata/custom/test.bed.gz.tbi
Binary file not shown.

0 comments on commit f435d80

Please sign in to comment.