File Coverage

lib/Sanger/CGP/Vagrent/Data/Exon.pm
Criterion Covered Total %
branch 0 4 0.0
subroutine 6 8 75.0
pod 3 3 100.0
total 9 15 60.0


line bran sub pod code
1       package Sanger::CGP::Vagrent::Data::Exon;
2        
3       ##########LICENCE##########
4       # Copyright (c) 2014 Genome Research Ltd.
5       #
6       # Author: Cancer Genome Project cgpit@sanger.ac.uk
7       #
8       # This file is part of VAGrENT.
9       #
10       # VAGrENT is free software: you can redistribute it and/or modify it under
11       # the terms of the GNU Affero General Public License as published by the Free
12       # Software Foundation; either version 3 of the License, or (at your option) any
13       # later version.
14       #
15       # This program is distributed in the hope that it will be useful, but WITHOUT
16       # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17       # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18       # details.
19       #
20       # You should have received a copy of the GNU Affero General Public License
21       # along with this program. If not, see <http://www.gnu.org/licenses/>.
22       ##########LICENCE##########
23        
24        
25   4   use strict;
26   4   use Data::Dumper;
27   4   use Sanger::CGP::Vagrent qw($VERSION);
28   4   use base qw(Sanger::CGP::Vagrent::Data::AbstractGenomicPosition);
29        
30       1;
31        
32       sub _init {
33   0   my $self = shift;
34       my %vars = @_;
35       foreach my $k(keys(%vars)){
36 0     if($k eq 'rnaminpos'){
  0      
37       $self->{_rnaminpos} = $vars{rnaminpos};
38       } elsif($k eq 'rnamaxpos'){
39       $self->{_rnamaxpos} = $vars{rnamaxpos};
40       }
41       }
42       }
43        
44       sub getRnaMinPos {
45   61522 1 return shift->{_rnaminpos};
46       }
47        
48       sub getRnaMaxPos {
49   11675 1 return shift->{_rnamaxpos};
50       }
51        
52       sub toString {
53   0 1 my $self = shift;
54       print $self->getChr.':'.$self->getMinPos.'..'.$self->getMaxPos;
55       }
56        
57       __END__
58        
59       =head1 NAME
60        
61       Sanger::CGP::Vagrent::Data::Exon - Data object representing an exon
62        
63       =head1 DESCRIPTION
64        
65       This is a data class to hold details about an exon. This allows the exon information to be
66       abstracted away from its original source.
67        
68       It inherits from L<Sanger::CGP::Vagrent::Data::AbstractGenomicPosition|Sanger::CGP::Vagrent::Data::AbstractGenomicPosition>
69        
70       =head1 METHODS
71        
72       =head2 Constructor
73        
74       =head3 new
75        
76       =over
77        
78       =item Usage :
79        
80       my $exon = Sanger::CGP::Vagrent::Data::Exon->new(%params);
81        
82       =item Function :
83        
84       Builds a new Sanger::CGP::Vagrent::Data::Exon object
85        
86       =item Returns :
87        
88       Sanger::CGP::Vagrent::Data::Exon object initialized with parameter values
89        
90       =item Params :
91        
92       Same as the constructor from L<Sanger::CGP::Vagrent::Data::AbstractGenomicPosition|Sanger::CGP::Vagrent::Data::AbstractGenomicPosition> plus
93        
94       rnaminpos => minimum position of the exon in the mRNA
95       rnamaxpos => maximum position of the exon in the mRNA
96        
97       =back
98        
99       =head2 Attributes
100        
101       =head3 getRnaMinPos
102        
103       =over
104        
105       =item Usage :
106        
107       my $rnaMin = $exon->getRnaMinPos;
108        
109       =item Function :
110        
111       Returns the exons minimum position in the rna sequence
112        
113       =item Returns :
114        
115       Integer
116        
117       =back
118        
119       =head3 getRnaMaxPos
120        
121       =over
122        
123       =item Usage :
124        
125       my $rnaMax = $exon->getRnaMaxPos;
126        
127       =item Function :
128        
129       Returns the exons maximum position in the rna sequence
130        
131       =item Returns :
132        
133       Integer
134        
135       =back
136        
137       =head2 Functions
138        
139       =head3 toString
140        
141       =over
142        
143       =item Usage :
144        
145       print $exon->toString;
146        
147       =item Function :
148        
149       Returns a simple string representation of the genomic view of the exon (chr:min..max)
150        
151       =item Returns :
152        
153       String
154        
155       =back