comparison dir_plugins/TSSDistance.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 TSSDistance
27
28 =head1 SYNOPSIS
29
30 mv TSSDistance.pm ~/.vep/Plugins
31 ./vep -i variations.vcf --plugin CCDSFilter
32
33 =head1 DESCRIPTION
34
35 A VEP plugin that calculates the distance from the transcription
36 start site for upstream variants.
37
38 =cut
39
40 package TSSDistance;
41
42 use Bio::EnsEMBL::Variation::Utils::BaseVepPlugin;
43
44 use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepPlugin);
45
46 sub get_header_info {
47 return {
48 TSSDistance => "Distance from the transcription start site"
49 };
50 }
51
52 sub feature_types {
53 return ['Transcript'];
54 }
55
56 sub variant_feature_types {
57 return ['BaseVariationFeature'];
58 }
59
60 sub run {
61 my ($self, $tva) = @_;
62
63 my $t = $tva->transcript;
64 my $vf = $tva->base_variation_feature;
65
66 my $dist;
67
68 if ($t->strand == 1) {
69 $dist = $t->start - $vf->end;
70 }
71 else {
72 $dist = $vf->start - $t->end;
73 }
74
75 if ($dist > 0) {
76 return {
77 TSSDistance => $dist,
78 }
79 }
80 else {
81 return {};
82 }
83 }
84
85 1;