-
Notifications
You must be signed in to change notification settings - Fork 9
/
Wildtype.pm
71 lines (48 loc) · 1.48 KB
/
Wildtype.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
=head1 NAME
Wildtype
=head1 SYNOPSIS
mv Wildtype.pm ~/.vep/Plugins
perl variant_effect_predictor.pl -i variations.vcf --plugin Wildtype
=head1 DESCRIPTION
This is a plugin for the Ensembl Variant Effect Predictor (VEP) that
provides the wildtype protein sequence of a transcript.
=cut
package Wildtype;
use strict;
use warnings;
use Bio::EnsEMBL::Variation::Utils::BaseVepPlugin;
use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepPlugin);
sub version {
return '1.0';
}
sub feature_types {
return ['Transcript'];
}
sub get_header_info {
return {
WildtypeProtein => "The normal, non-mutated protein sequence",
};
}
sub run {
my ($self, $tva) = @_;
my $tv = $tva->transcript_variation;
my $tr = $tv->transcript;
my $pep;
# this handles the case where VEP hasn't precached the translation data
if(!$tr->{_variation_effect_feature_cache}) {
# initialize so we don't try again on failure
$tr->{_variation_effect_feature_cache} = {};
if(my $translation = $tr->translate) {
# cache on transcript object so we're not refetching every call
$tr->{_variation_effect_feature_cache}->{peptide} = $translation->seq;
}
}
if(my $pep = $tr->{_variation_effect_feature_cache}->{peptide}) {
return { WildtypeProtein => $pep };
}
# some transcripts won't (or shouldn't) have translations e.g. non-protein coding transcripts
else {
return {};
}
}
1;