Mercurial > repos > dvanzessen > vep_emc
comparison dir_plugins/GO.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 GO | |
| 27 | |
| 28 =head1 SYNOPSIS | |
| 29 | |
| 30 mv GO.pm ~/.vep/Plugins | |
| 31 ./vep -i variations.vcf --plugin GO | |
| 32 | |
| 33 =head1 DESCRIPTION | |
| 34 | |
| 35 A VEP plugin that retrieves Gene Ontology terms associated with | |
| 36 transcripts/translations via the Ensembl API. Requires database connection. | |
| 37 | |
| 38 =cut | |
| 39 | |
| 40 package GO; | |
| 41 | |
| 42 use strict; | |
| 43 use warnings; | |
| 44 | |
| 45 use Bio::EnsEMBL::Variation::Utils::BaseVepPlugin; | |
| 46 | |
| 47 use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepPlugin); | |
| 48 | |
| 49 sub new { | |
| 50 my $class = shift; | |
| 51 | |
| 52 my $self = $class->SUPER::new(@_); | |
| 53 | |
| 54 # connect to DB for offline users | |
| 55 my $config = $self->{config}; | |
| 56 my $reg = $config->{reg}; | |
| 57 | |
| 58 if(!defined($self->{config}->{sa})) { | |
| 59 $reg = 'Bio::EnsEMBL::Registry'; | |
| 60 $reg->load_registry_from_db( | |
| 61 -host => $config->{host}, | |
| 62 -user => $config->{user}, | |
| 63 -pass => $config->{password}, | |
| 64 -port => $config->{port}, | |
| 65 -db_version => $config->{db_version}, | |
| 66 -species => $config->{species} =~ /^[a-z]+\_[a-z]+/i ? $config->{species} : undef, | |
| 67 -verbose => $config->{verbose}, | |
| 68 -no_cache => $config->{no_slice_cache}, | |
| 69 ); | |
| 70 } | |
| 71 | |
| 72 return $self; | |
| 73 } | |
| 74 | |
| 75 sub version { | |
| 76 return 73; | |
| 77 } | |
| 78 | |
| 79 sub feature_types { | |
| 80 return ['Transcript']; | |
| 81 } | |
| 82 | |
| 83 sub get_header_info { | |
| 84 return { 'GO' => 'GO terms associated with protein product'}; | |
| 85 } | |
| 86 | |
| 87 sub run { | |
| 88 my ($self, $tva) = @_; | |
| 89 | |
| 90 my $tr = $tva->transcript->translation; | |
| 91 return {} unless defined($tr); | |
| 92 | |
| 93 my $entries = $tr->get_all_DBEntries('GO'); | |
| 94 | |
| 95 my $string = join(",", map {$_->display_id.':'.$_->description} @$entries); | |
| 96 $string =~ s/\s+/\_/g; | |
| 97 | |
| 98 return { GO => $string }; | |
| 99 } | |
| 100 | |
| 101 1; | |
| 102 |
