File Coverage

Bio/LiveSeq/Exon.pm
Criterion Covered Total %
statement 11 16 68.7
branch 2 6 33.3
condition n/a
subroutine 3 4 75.0
pod 2 2 100.0
total 18 28 64.2


line stmt bran cond sub pod time code
1             #
2             # bioperl module for Bio::LiveSeq::Exon
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Joseph Insana
7             #
8             # Copyright Joseph Insana
9             #
10             # You may distribute this module under the same terms as perl itself
11             #
12             # POD documentation - main docs before the code
13              
14             =head1 NAME
15              
16             Bio::LiveSeq::Exon - Range abstract class for LiveSeq
17              
18             =head1 SYNOPSIS
19              
20             # documentation needed
21              
22             =head1 DESCRIPTION
23              
24             Class for EXON objects. They consist of a beginlabel, an endlabel (both
25             referring to a LiveSeq DNA object) and a strand.
26             The strand could be 1 (forward strand, default), -1 (reverse strand).
27              
28             =head1 AUTHOR - Joseph A.L. Insana
29              
30             Email: Insana@ebi.ac.uk, jinsana@gmx.net
31              
32             =head1 APPENDIX
33              
34             The rest of the documentation details each of the object
35             methods. Internal methods are usually preceded with a _
36              
37             =cut
38              
39             # Let the code begin...
40              
41             package Bio::LiveSeq::Exon;
42              
43 2     2   7 use strict;
  2         2  
  2         50  
44 2     2   6 use base qw(Bio::LiveSeq::Range);
  2         3  
  2         483  
45              
46             =head2 new
47              
48             Title : new
49             Usage : $exon1 = Bio::LiveSeq::Exon-> new(-seq => $objref,
50             -start => $startlabel,
51             -end => $endlabel, -strand => 1);
52              
53             Function: generates a new Bio::LiveSeq::Exon
54             Returns : reference to a new object of class Exon
55             Errorcode -1
56             Args : two labels and an integer
57              
58             =cut
59              
60             =head2 get_Transcript
61              
62             Title : get_Transcript
63             Usage : $transcript = $obj->get_Transcript()
64             Function: retrieves the reference to the object of class Transcript (if any)
65             attached to a LiveSeq object
66             Returns : object reference
67             Args : none
68             Note : only Exons that compose a Transcript (i.e. those created out of
69             a CDS Entry-Feature) will have an attached Transcript
70              
71             =cut
72              
73             sub get_Transcript {
74 0     0 1 0 my $self=shift;
75 0         0 return ($self->{'transcript'}); # this is set on all Exons a Transcript is made of when Transcript->new is called
76             }
77              
78             # this checks if the attached Transcript has a Gene object attached
79             sub gene {
80 9     9 1 5 my ($self,$value) = @_;
81 9 50       12 if (defined $value) {
82 9         15 $self->{'gene'} = $value;
83             }
84 9 50       9 unless (exists $self->{'gene'}) {
85 0 0       0 unless (exists $self->get_Transcript->{'gene'}) {
86 0         0 return (0);
87             } else {
88 0         0 return ($self->get_Transcript->{'gene'});
89             }
90             } else {
91 9         10 return $self->{'gene'};
92             }
93             }
94              
95             1;