Mercurial > repos > dvanzessen > vep_emc
comparison dir_plugins/CADD.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 CADD | |
| 27 | |
| 28 =head1 SYNOPSIS | |
| 29 | |
| 30 mv CADD.pm ~/.vep/Plugins | |
| 31 ./vep -i variations.vcf --plugin CADD,whole_genome_SNVs.tsv.gz,InDels.tsv.gz | |
| 32 | |
| 33 =head1 DESCRIPTION | |
| 34 | |
| 35 A VEP plugin that retrieves CADD scores for variants from one or more | |
| 36 tabix-indexed CADD data files. | |
| 37 | |
| 38 Please cite the CADD publication alongside the VEP if you use this resource: | |
| 39 http://www.ncbi.nlm.nih.gov/pubmed/24487276 | |
| 40 | |
| 41 The tabix utility must be installed in your path to use this plugin. The CADD | |
| 42 data files can be downloaded from | |
| 43 http://cadd.gs.washington.edu/download | |
| 44 | |
| 45 =cut | |
| 46 | |
| 47 package CADD; | |
| 48 | |
| 49 use strict; | |
| 50 use warnings; | |
| 51 | |
| 52 use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp); | |
| 53 | |
| 54 use Bio::EnsEMBL::Variation::Utils::BaseVepTabixPlugin; | |
| 55 | |
| 56 use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepTabixPlugin); | |
| 57 | |
| 58 sub new { | |
| 59 my $class = shift; | |
| 60 | |
| 61 my $self = $class->SUPER::new(@_); | |
| 62 | |
| 63 $self->expand_left(0); | |
| 64 $self->expand_right(0); | |
| 65 | |
| 66 $self->get_user_params(); | |
| 67 | |
| 68 return $self; | |
| 69 } | |
| 70 | |
| 71 sub feature_types { | |
| 72 return ['Feature','Intergenic']; | |
| 73 } | |
| 74 | |
| 75 sub get_header_info { | |
| 76 my $self = shift; | |
| 77 return { | |
| 78 CADD_PHRED => 'PHRED-like scaled CADD score', | |
| 79 CADD_RAW => 'Raw CADD score' | |
| 80 } | |
| 81 } | |
| 82 | |
| 83 sub run { | |
| 84 my ($self, $tva) = @_; | |
| 85 | |
| 86 my $vf = $tva->variation_feature; | |
| 87 | |
| 88 # get allele, reverse comp if needed | |
| 89 my $allele = $tva->variation_feature_seq; | |
| 90 reverse_comp(\$allele) if $vf->{strand} < 0; | |
| 91 | |
| 92 return {} unless $allele =~ /^[ACGT-]+$/; | |
| 93 | |
| 94 my ($res) = grep { | |
| 95 $_->{alt} eq $allele && | |
| 96 $_->{start} eq $vf->{start} && | |
| 97 $_->{end} eq $vf->{end} | |
| 98 } @{$self->get_data($vf->{chr}, $vf->{start} - 2, $vf->{end})}; | |
| 99 | |
| 100 return $res ? $res->{result} : {}; | |
| 101 } | |
| 102 | |
| 103 sub parse_data { | |
| 104 my ($self, $line) = @_; | |
| 105 | |
| 106 my ($c, $s, $ref, $alt, $raw, $phred) = split /\t/, $line; | |
| 107 | |
| 108 # do VCF-like coord adjustment for mismatched subs | |
| 109 my $e = ($s + length($ref)) - 1; | |
| 110 if(length($alt) != length($ref)) { | |
| 111 $s++; | |
| 112 $ref = substr($ref, 1); | |
| 113 $alt = substr($alt, 1); | |
| 114 $ref ||= '-'; | |
| 115 $alt ||= '-'; | |
| 116 } | |
| 117 | |
| 118 return { | |
| 119 alt => $alt, | |
| 120 start => $s, | |
| 121 end => $e, | |
| 122 result => { | |
| 123 CADD_RAW => $raw, | |
| 124 CADD_PHRED => $phred | |
| 125 } | |
| 126 }; | |
| 127 } | |
| 128 | |
| 129 sub get_start { | |
| 130 return $_[1]->{start}; | |
| 131 } | |
| 132 | |
| 133 sub get_end { | |
| 134 return $_[1]->{end}; | |
| 135 } | |
| 136 | |
| 137 1; |
