comparison dir_plugins/LoFtool.pm @ 3:49397129aec0 draft

Uploaded
author dvanzessen
date Mon, 15 Jul 2019 05:20:39 -0400
parents e545d0a25ffe
children
comparison
equal deleted inserted replaced
2:17c98d091710 3:49397129aec0
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 LoFtool
27
28 =head1 SYNOPSIS
29
30 mv LoFtool.pm ~/.vep/Plugins
31 mv LoFtool_scores.txt ~/.vep/Plugins
32 ./vep -i variants.vcf --plugin LoFtool
33
34 =head1 DESCRIPTION
35
36 Add LoFtool scores to the VEP output.
37
38 LoFtool provides a rank of genic intolerance and consequent
39 susceptibility to disease based on the ratio of Loss-of-function (LoF)
40 to synonymous mutations for each gene in 60,706 individuals from ExAC,
41 adjusting for the gene de novo mutation rate and evolutionary protein
42 conservation. The lower the LoFtool gene score percentile the most
43 intolerant is the gene to functional variation. For more details please see
44 (Fadista J et al. 2017), PMID:27563026.
45 The authors would like to thank the Exome Aggregation Consortium and
46 the groups that provided exome variant data for comparison. A full
47 list of contributing groups can be found at http://exac.broadinstitute.org/about.
48
49 The LoFtool_scores.txt file is found alongside the plugin in the
50 VEP_plugins GitHub repo.
51
52 To use another scores file, add it as a parameter i.e.
53
54 ./vep -i variants.vcf --plugin LoFtool,scores_file.txt
55
56 =cut
57
58 package LoFtool;
59
60 use strict;
61 use warnings;
62
63 use DBI;
64
65 use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepPlugin);
66
67 sub new {
68 my $class = shift;
69
70 my $self = $class->SUPER::new(@_);
71
72 my $file = $self->params->[0];
73
74 if(!$file) {
75 my $plugin_dir = $INC{'LoFtool.pm'};
76 $plugin_dir =~ s/LoFtool\.pm//i;
77 $file = $plugin_dir.'/LoFtool_scores.txt';
78 }
79
80 die("ERROR: LoFtool scores file $file not found\n") unless $file && -e $file;
81
82 open IN, $file;
83 my %scores;
84
85 while(<IN>) {
86 chomp;
87 my ($gene, $score) = split;
88 next if !defined($score) || $score eq 'LoFtool_percentile';
89 $scores{lc($gene)} = sprintf("%g", $score);
90 }
91
92 close IN;
93
94 die("ERROR: No scores read from $file\n") unless scalar keys %scores;
95
96 $self->{scores} = \%scores;
97
98 return $self;
99 }
100
101 sub feature_types {
102 return ['Transcript'];
103 }
104
105 sub get_header_info {
106 return {
107 LoFtool => "LoFtool score for gene"
108 };
109 }
110
111 sub run {
112 my $self = shift;
113 my $tva = shift;
114
115 my $symbol = $tva->transcript->{_gene_symbol} || $tva->transcript->{_gene_hgnc};
116 return {} unless $symbol;
117
118 return $self->{scores}->{lc($symbol)} ? { LoFtool => $self->{scores}->{lc($symbol)}} : {};
119 }
120
121 1;
122