* sync with trunk
[bioperl-live.git] / Bio / LiveSeq / Exon.pm
blob9413765ddc1b8c897fbea14d8d408c8d52b9bd0a
1 # $Id$
3 # bioperl module for Bio::LiveSeq::Exon
5 # Cared for by Joseph Insana <insana@ebi.ac.uk> <jinsana@gmx.net>
7 # Copyright Joseph Insana
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
13 =head1 NAME
15 Bio::LiveSeq::Exon - Range abstract class for LiveSeq
17 =head1 SYNOPSIS
19 # documentation needed
21 =head1 DESCRIPTION
23 Class for EXON objects. They consist of a beginlabel, an endlabel (both
24 referring to a LiveSeq DNA object) and a strand.
25 The strand could be 1 (forward strand, default), -1 (reverse strand).
27 =head1 AUTHOR - Joseph A.L. Insana
29 Email: Insana@ebi.ac.uk, jinsana@gmx.net
31 =head1 APPENDIX
33 The rest of the documentation details each of the object
34 methods. Internal methods are usually preceded with a _
36 =cut
38 # Let the code begin...
40 package Bio::LiveSeq::Exon;
42 use strict;
43 use base qw(Bio::LiveSeq::Range);
45 =head2 new
47 Title : new
48 Usage : $exon1 = Bio::LiveSeq::Exon-> new(-seq => $objref,
49 -start => $startlabel,
50 -end => $endlabel, -strand => 1);
52 Function: generates a new Bio::LiveSeq::Exon
53 Returns : reference to a new object of class Exon
54 Errorcode -1
55 Args : two labels and an integer
57 =cut
59 =head2 get_Transcript
61 Title : get_Transcript
62 Usage : $transcript = $obj->get_Transcript()
63 Function: retrieves the reference to the object of class Transcript (if any)
64 attached to a LiveSeq object
65 Returns : object reference
66 Args : none
67 Note : only Exons that compose a Transcript (i.e. those created out of
68 a CDS Entry-Feature) will have an attached Transcript
70 =cut
72 sub get_Transcript {
73 my $self=shift;
74 return ($self->{'transcript'}); # this is set on all Exons a Transcript is made of when Transcript->new is called
77 # this checks if the attached Transcript has a Gene object attached
78 sub gene {
79 my ($self,$value) = @_;
80 if (defined $value) {
81 $self->{'gene'} = $value;
83 unless (exists $self->{'gene'}) {
84 unless (exists $self->get_Transcript->{'gene'}) {
85 return (0);
86 } else {
87 return ($self->get_Transcript->{'gene'});
89 } else {
90 return $self->{'gene'};