Skip to content

Commit

Permalink
Merge pull request #132 from ens-lgil/postreleasefix/92
Browse files Browse the repository at this point in the history
Fix missing ';' character when the INFO column of the input VCF conta…
  • Loading branch information
sarahhunt committed Jan 24, 2018
2 parents a9236d6 + 39e406e commit 39fd57f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
5 changes: 3 additions & 2 deletions modules/Bio/EnsEMBL/VEP/OutputFactory/VCF.pm
Expand Up @@ -275,7 +275,8 @@ sub get_all_lines_by_InputBuffer {

# nuke existing CSQ field?
if($line->[7] =~ /(^|\;)$fieldname\=/ && !$self->{keep_csq}) {
$line->[7] =~ s/(^|\;)$fieldname\=\S+?(\;|$)(\S|$)/$3/;
$line->[7] =~ s/(^|\;)$fieldname\=\S+?(\;\S|$)/$2/;
$line->[7] =~ s/^\;//;
}
}

Expand Down Expand Up @@ -471,4 +472,4 @@ sub web_output_fh {
return $self->{_web_output_fh};
}

1;
1;
17 changes: 15 additions & 2 deletions t/OutputFactory_VCF.t
Expand Up @@ -412,6 +412,19 @@ is_deeply(
);

# test keep vs trash existing CSQ
$ib = get_runner({
input_file => $test_cfg->create_input_file([qw(21 25585733 . C T . . BAR=blah;CSQ=foo;BAR2=blah2)]),
dir => $test_cfg->{cache_root_dir},
})->get_InputBuffer;
$of = Bio::EnsEMBL::VEP::OutputFactory::VCF->new({config => $ib->config});

is_deeply(
$of->get_all_lines_by_InputBuffer($ib)->[0],
"21\t25585733\t.\tC\tT\t.\t.\t".
'BAR=blah;BAR2=blah2;CSQ=T|3_prime_UTR_variant|MODIFIER||ENSG00000154719|Transcript|ENST00000307301||||||1122|||||||-1|,T|missense_variant|MODERATE||ENSG00000154719|Transcript|ENST00000352957||||||1033|991|331|A/T|Gca/Aca|||-1|,T|upstream_gene_variant|MODIFIER||ENSG00000260583|Transcript|ENST00000567517||||||||||||2407|-1|',
"trash existing CSQ 1"
);

$ib = get_runner({
input_file => $test_cfg->create_input_file([qw(21 25585733 . C T . . CSQ=foo;BAR=blah)]),
dir => $test_cfg->{cache_root_dir},
Expand All @@ -422,7 +435,7 @@ is_deeply(
$of->get_all_lines_by_InputBuffer($ib)->[0],
"21\t25585733\t.\tC\tT\t.\t.\t".
'BAR=blah;CSQ=T|3_prime_UTR_variant|MODIFIER||ENSG00000154719|Transcript|ENST00000307301||||||1122|||||||-1|,T|missense_variant|MODERATE||ENSG00000154719|Transcript|ENST00000352957||||||1033|991|331|A/T|Gca/Aca|||-1|,T|upstream_gene_variant|MODIFIER||ENSG00000260583|Transcript|ENST00000567517||||||||||||2407|-1|',
"trash existing CSQ 1"
"trash existing CSQ 2"
);

$ib = get_runner({
Expand All @@ -435,7 +448,7 @@ is_deeply(
$of->get_all_lines_by_InputBuffer($ib)->[0],
"21\t25585733\t.\tC\tT\t.\t.\t".
'BAR=blah;CSQ=T|3_prime_UTR_variant|MODIFIER||ENSG00000154719|Transcript|ENST00000307301||||||1122|||||||-1|,T|missense_variant|MODERATE||ENSG00000154719|Transcript|ENST00000352957||||||1033|991|331|A/T|Gca/Aca|||-1|,T|upstream_gene_variant|MODIFIER||ENSG00000260583|Transcript|ENST00000567517||||||||||||2407|-1|',
"trash existing CSQ 2"
"trash existing CSQ 3"
);

$of->{keep_csq} = 1;
Expand Down

0 comments on commit 39fd57f

Please sign in to comment.