t/AlignIO/AlignIO.t: fix number of tests in plan (fixup c523e6bed866)
[bioperl-live.git] / Bio / LiveSeq / Exon.pm
blob83200c8b282b91b47b4860e3446f46101feccd53
2 # bioperl module for Bio::LiveSeq::Exon
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Joseph Insana <insana@ebi.ac.uk> <jinsana@gmx.net>
8 # Copyright Joseph Insana
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::LiveSeq::Exon - Range abstract class for LiveSeq
18 =head1 SYNOPSIS
20 # documentation needed
22 =head1 DESCRIPTION
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).
28 =head1 AUTHOR - Joseph A.L. Insana
30 Email: Insana@ebi.ac.uk, jinsana@gmx.net
32 =head1 APPENDIX
34 The rest of the documentation details each of the object
35 methods. Internal methods are usually preceded with a _
37 =cut
39 # Let the code begin...
41 package Bio::LiveSeq::Exon;
43 use strict;
44 use base qw(Bio::LiveSeq::Range);
46 =head2 new
48 Title : new
49 Usage : $exon1 = Bio::LiveSeq::Exon-> new(-seq => $objref,
50 -start => $startlabel,
51 -end => $endlabel, -strand => 1);
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
58 =cut
60 =head2 get_Transcript
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
71 =cut
73 sub get_Transcript {
74 my $self=shift;
75 return ($self->{'transcript'}); # this is set on all Exons a Transcript is made of when Transcript->new is called
78 # this checks if the attached Transcript has a Gene object attached
79 sub gene {
80 my ($self,$value) = @_;
81 if (defined $value) {
82 $self->{'gene'} = $value;
84 unless (exists $self->{'gene'}) {
85 unless (exists $self->get_Transcript->{'gene'}) {
86 return (0);
87 } else {
88 return ($self->get_Transcript->{'gene'});
90 } else {
91 return $self->{'gene'};