comparison dir_plugins/FATHMM_MKL.pm @ 0:e545d0a25ffe draft

Uploaded
author dvanzessen
date Mon, 15 Jul 2019 05:17:17 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e545d0a25ffe
1 =head1 LICENSE
2
3 Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
4 Copyright [2016-2018] EMBL-European Bioinformatics Institute
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18 =head1 CONTACT
19
20 Ensembl <http://www.ensembl.org/info/about/contact/index.html>
21
22 =cut
23
24 =head1 NAME
25
26 FATHMM_MKL
27
28 =head1 SYNOPSIS
29
30 mv FATHMM_MKL.pm ~/.vep/Plugins
31 ./vep -i input.vcf --plugin FATHMM_MKL,fathmm-MKL_Current.tab.gz
32
33 =head1 DESCRIPTION
34
35 A VEP plugin that retrieves FATHMM-MKL scores for variants from a tabix-indexed
36 FATHMM-MKL data file.
37
38 See https://github.com/HAShihab/fathmm-MKL for details.
39
40 NB: The currently available data file is for GRCh37 only.
41
42 =cut
43
44 package FATHMM_MKL;
45
46 use strict;
47 use warnings;
48
49 use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp);
50
51 use Bio::EnsEMBL::Variation::Utils::BaseVepTabixPlugin;
52
53 use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepTabixPlugin);
54
55 sub new {
56 my $class = shift;
57
58 my $self = $class->SUPER::new(@_);
59
60 $self->expand_left(0);
61 $self->expand_right(0);
62
63 return $self;
64 }
65
66 sub feature_types {
67 return ['Feature','Intergenic'];
68 }
69
70 sub get_header_info {
71 my $self = shift;
72 return {
73 FATHMM_MKL_C => 'FATHMM-MKL coding score',
74 FATHMM_MKL_NC => 'FATHMM-MKL non-coding score',
75 }
76 }
77
78 sub run {
79 my ($self, $tva) = @_;
80
81 my $vf = $tva->variation_feature;
82
83 return {} unless $vf->{start} eq $vf->{end};
84
85 # get allele, reverse comp if needed
86 my $allele = $tva->variation_feature_seq;
87 reverse_comp(\$allele) if $vf->{strand} < 0;
88
89 return {} unless $allele =~ /^[ACGT]$/;
90
91 # adjust coords, file is BED-like (but not 0-indexed, go figure...)
92 my ($s, $e) = ($vf->{start}, $vf->{end} + 1);
93
94 foreach my $data(@{$self->get_data($vf->{chr}, $s, $e)}) {
95 if($data->{start} == $s && $allele eq $data->{alt}) {
96 return $data->{result};
97 }
98 }
99
100 return {};
101 }
102
103 sub parse_data {
104 my ($self, $line) = @_;
105
106 my ($c, $s, $e, $ref, $alt, $nc_score, $nc_groups, $c_score, $c_groups) = split /\t/, $line;
107
108 return {
109 start => $s,
110 end => $e - 1,
111 alt => $alt,
112 result => {
113 FATHMM_MKL_C => $c_score,
114 FATHMM_MKL_NC => $nc_score,
115 }
116 };
117 }
118
119 sub get_start {
120 return $_[1]->{start};
121 }
122
123 sub get_end {
124 return $_[1]->{end};
125 }
126
127 1;
128