Mercurial > repos > dvanzessen > vep_emc
comparison dir_plugins/Blosum62.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 Blosum62 | |
| 27 | |
| 28 =head1 SYNOPSIS | |
| 29 | |
| 30 mv Blosum62.pm ~/.vep/Plugins | |
| 31 ./vep -i variations.vcf --plugin Blosum62 | |
| 32 | |
| 33 =head1 DESCRIPTION | |
| 34 | |
| 35 This is a plugin for the Ensembl Variant Effect Predictor (VEP) that | |
| 36 looks up the BLOSUM 62 substitution matrix score for the reference | |
| 37 and alternative amino acids predicted for a missense mutation. It adds | |
| 38 one new entry to the VEP's Extra column, BLOSUM62 which is the | |
| 39 associated score. | |
| 40 | |
| 41 =cut | |
| 42 | |
| 43 package Blosum62; | |
| 44 | |
| 45 use strict; | |
| 46 use warnings; | |
| 47 | |
| 48 use base qw(Bio::EnsEMBL::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| |
| 67 0 -1 0 -1 -1 -1 -1 -2 -2 -1 -1 -1 -1 -2 -1 1 5 -2 -2 0 | |
| 68 -3 -3 -4 -4 -2 -2 -3 -2 -2 -3 -2 -3 -1 1 -4 -3 -2 11 2 -3 | |
| 69 -2 -2 -2 -3 -2 -1 -2 -3 2 -1 -1 -2 -1 3 -3 -2 -2 2 7 -1 | |
| 70 0 -3 -3 -3 -1 -2 -2 -3 -3 3 1 -2 1 -1 -2 -2 0 -3 -1 4 | |
| 71 ); | |
| 72 | |
| 73 my @AAs = qw(A R N D C Q E G H I L K M F P S T W Y V); | |
| 74 | |
| 75 sub new { | |
| 76 my $class = shift; | |
| 77 | |
| 78 my $self = $class->SUPER::new(@_); | |
| 79 | |
| 80 # construct a hash representing the matrix for quick lookups | |
| 81 | |
| 82 my $num = @AAs; | |
| 83 | |
| 84 for (my $i = 0; $i < $num; $i++) { | |
| 85 for (my $j = 0; $j < $num; $j++) { | |
| 86 $self->{matrix}->{$AAs[$i]}->{$AAs[$j]} = $BLOSUM_62[($i * $num) + $j]; | |
| 87 } | |
| 88 } | |
| 89 | |
| 90 return $self; | |
| 91 } | |
| 92 | |
| 93 sub version { | |
| 94 return '2.3'; | |
| 95 } | |
| 96 | |
| 97 sub feature_types { | |
| 98 return ['Transcript']; | |
| 99 } | |
| 100 | |
| 101 sub get_header_info { | |
| 102 return { | |
| 103 BLOSUM62 => "BLOSUM62 substitution score for the reference and alternative amino acids", | |
| 104 }; | |
| 105 } | |
| 106 | |
| 107 sub run { | |
| 108 my ($self, $tva) = @_; | |
| 109 | |
| 110 if ($tva->pep_allele_string && $tva->pep_allele_string =~ /^([A-Z])\/([A-Z])$/) { | |
| 111 | |
| 112 my $score = $self->{matrix}->{$1}->{$2}; | |
| 113 | |
| 114 if (defined $score) { | |
| 115 return { | |
| 116 BLOSUM62 => $score | |
| 117 }; | |
| 118 } | |
| 119 } | |
| 120 | |
| 121 return {}; | |
| 122 } | |
| 123 | |
| 124 1; | |
| 125 |
