maint: restructure to use Dist::Zilla
[bioperl-live.git] / lib / Bio / Tools / Spidey / Exon.pm
blob38a89c10f8934e30f522ea0cef6339b441a24123
2 # BioPerl module for Bio::Tools::Spidey::Exon
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Ryan Golhar <golharam@umdnj.edu>
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::Tools::Spidey::Exon - A single exon determined by an alignment
17 =head1 SYNOPSIS
19 # See Bio::Tools::Spidey::Results for a description of the context.
21 # an instance of this class is-a Bio::SeqFeature::SimilarityPair
23 # coordinates of the exon (recommended way):
24 print "exon from ", $exon->start(),
25 " to ", $exon->end(), "\n";
27 # the same (feature1() inherited from Bio::SeqFeature::FeaturePair)
28 print "exon from ", $exon->feature1()->start(),
29 " to ", $exon->feature1()->end(), "\n";
30 # also the same (query() inherited from Bio::SeqFeature::SimilarityPair):
31 print "exon from ", $exon->query()->start(),
32 " to ", $exon->query()->end(), "\n";
34 # coordinates on the matching EST (recommended way):
35 print "matches on EST from ", $exon->est_hit()->start(),
36 " to ", $exon->est_hit()->end(), "\n";
38 # the same (feature2() inherited from Bio::SeqFeature::FeaturePair)
39 print "matches on EST from ", $exon->feature2()->start(),
40 " to ", $exon->feature2()->end(), "\n";
41 # also the same (subject() inherited from Bio::SeqFeature::SimilarityPair):
42 print "exon from ", $exon->subject()->start(),
43 " to ", $exon->subject()->end(), "\n";
45 =head1 DESCRIPTION
47 This class inherits from Bio::SeqFeature::SimilarityPair and represents an
48 exon on a genomic sequence determined by similarity, that is, by aligning an
49 EST sequence (using Spidey in this case). Consequently, the notion of query and
50 subject is always from the perspective of the genomic sequence: query refers
51 to the genomic seq, subject to the aligned EST hit. Because of this,
52 $exon-E<gt>start(), $exon-E<gt>end() etc will always return what you expect.
54 To get the coordinates on the matching EST, refer to the properties of the
55 feature returned by L<est_hit>().
57 =head1 FEEDBACK
59 =head2 Mailing Lists
61 User feedback is an integral part of the evolution of this
62 and other Bioperl modules. Send your comments and suggestions preferably
63 to one of the Bioperl mailing lists.
64 Your participation is much appreciated.
66 bioperl-l@bioperl.org - General discussion
67 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
69 =head2 Support
71 Please direct usage questions or support issues to the mailing list:
73 I<bioperl-l@bioperl.org>
75 rather than to the module maintainer directly. Many experienced and
76 reponsive experts will be able look at the problem and quickly
77 address it. Please include a thorough description of the problem
78 with code and data examples if at all possible.
80 =head2 Reporting Bugs
82 Report bugs to the Bioperl bug tracking system to help us keep track
83 the bugs and their resolution. Bug reports can be submitted via the
84 web:
86 https://github.com/bioperl/bioperl-live/issues
88 =head1 AUTHOR - Ryan Golhar
90 Email golharam@umdnj.edu
92 =head1 APPENDIX
94 The rest of the documentation details each of the object methods.
95 Internal methods are usually preceded with a _
97 =cut
100 # Let the code begin...
103 package Bio::Tools::Spidey::Exon;
104 use strict;
107 use base qw(Bio::SeqFeature::SimilarityPair);
109 sub new {
110 my ($class,@args) = @_;
111 my %param = @args;
112 my $self = $class->SUPER::new(@args);
114 my ($prim, $prim_tag, $source, $source_tag) =
115 $self->_rearrange([qw(PRIMARY
116 PRIMARY_TAG
117 SOURCE
118 SOURCE_TAG)],
119 @args);
121 $self->primary_tag('exon') unless $prim || $prim_tag;
122 $self->source_tag('Spidey') unless $source || $source_tag;
123 $self->strand(0) unless defined($self->strand());
124 $self->query();
125 return $self;
128 =head2 percentage_id
130 Title : percentage_id
131 Usage : $obj->percentage_id
132 Function: This is the percent id as reported by Spidey
133 Returns : value of percentage_id
134 Args :
137 =cut
139 sub percentage_id {
140 my ($self, @args) = @_;
141 my $val;
143 if(@args) {
144 $val = shift(@args);
145 $self->{'percentage_id'} = $val;
146 } else {
147 $val = $self->{'percentage_id'};
149 return $val;
152 =head2 est_hit
154 Title : est_hit
155 Usage : $est_feature = $obj->est_hit();
156 Function: Returns the EST hit pointing to (i.e., aligned to by Spidey) this
157 exon (i.e., genomic region). At present, merely a synonym for
158 $obj->feature2().
159 Returns : An Bio::SeqFeatureI implementing object.
160 Args :
163 =cut
165 sub est_hit {
166 my $self = shift;
167 return $self->feature2(@_);
170 =head2 mismatches
172 Title : mismatches
173 Usage : $obj->mismatches;
174 Function: Returns the mismatches of the cDNA to (i.e., aligned to by Spidey) this
175 exon (i.e., genomic region).
176 Returns : value of mismatches.
177 Args :
180 =cut
182 sub mismatches {
183 my ($self, @args) = @_;
184 my $val;
186 if(@args) {
187 $val = shift(@args);
188 $self->{'mismatches'} = $val;
189 } else {
190 $val = $self->{'mismatches'};
192 return $val;
195 =head2 gaps
197 Title : gaps
198 Usage : $obj->gaps;
199 Function: Returns the gaps of the cDNA to (i.e., aligned to by Spidey) this
200 exon (i.e., genomic region).
201 Returns : value of gaps.
202 Args :
205 =cut
207 sub gaps {
208 my ($self, @args) = @_;
209 my $val;
211 if(@args) {
212 $val = shift(@args);
213 $self->{'gaps'} = $val;
214 } else {
215 $val = $self->{'gaps'};
217 return $val;
220 =head2 donor
222 Title : donor
223 Usage : $obj->donor;
224 Function: Returns 0 if a splice donor site does not exist, or
225 1 if a splice donor site exists
226 Returns : value of existence of donor splice site (0 or 1)
227 Args :
230 =cut
232 sub donor {
233 my ($self, @args) = @_;
234 my $val;
236 if (@args) {
237 $val = shift @args;
238 $self->{'donor'} = $val;
239 } else {
240 $val = $self->{'donor'};
242 return $val;
245 =head2 acceptor
247 Title : acceptor
248 Usage : $obj->acceptor;
249 Function: Returns 0 if a splice acceptor site does not exist, or
250 1 if a splice acceptor site exists
251 Returns : value of existence of acceptor splice site (0 or 1)
252 Args :
255 =cut
257 sub acceptor {
258 my ($self, @args) = @_;
259 my $val;
261 if (@args) {
262 $val = shift @args;
263 $self->{'acceptor'} = $val;
264 } else {
265 $val = $self->{'acceptor'};
267 return $val;