comparison variant_effect_predictor/Bio/Tools/Sim4/Exon.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1
2 #
3 # BioPerl module for Bio::Tools::Sim4::Exon
4 #
5 # Cared for by Ewan Birney <birney@sanger.ac.uk>
6 # and Hilmar Lapp <hlapp@gmx.net>
7 #
8 # Copyright Ewan Birney, Hilmar Lapp
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::Tools::Sim4::Exon - A single exon determined by an alignment
17
18 =head1 SYNOPSIS
19
20 # See Bio::Tools::Sim4::Results for a description of the context.
21
22 # an instance of this class is-a Bio::SeqFeature::SimilarityPair
23
24 # coordinates of the exon (recommended way):
25 print "exon from ", $exon->start(),
26 " to ", $exon->end(), "\n";
27
28 # the same (feature1() inherited from Bio::SeqFeature::FeaturePair)
29 print "exon from ", $exon->feature1()->start(),
30 " to ", $exon->feature1()->end(), "\n";
31 # also the same (query() inherited from Bio::SeqFeature::SimilarityPair):
32 print "exon from ", $exon->query()->start(),
33 " to ", $exon->query()->end(), "\n";
34
35 # coordinates on the matching EST (recommended way):
36 print "matches on EST from ", $exon->est_hit()->start(),
37 " to ", $exon->est_hit()->end(), "\n";
38
39 # the same (feature2() inherited from Bio::SeqFeature::FeaturePair)
40 print "matches on EST from ", $exon->feature2()->start(),
41 " to ", $exon->feature2()->end(), "\n";
42 # also the same (subject() inherited from Bio::SeqFeature::SimilarityPair):
43 print "exon from ", $exon->subject()->start(),
44 " to ", $exon->subject()->end(), "\n";
45
46 =head1 DESCRIPTION
47
48 This class inherits from Bio::SeqFeature::SimilarityPair and represents an
49 exon on a genomic sequence determined by similarity, that is, by aligning an
50 EST sequence (using Sim4 in this case). Consequently, the notion of query and
51 subject is always from the perspective of the genomic sequence: query refers
52 to the genomic seq, subject to the aligned EST hit. Because of this,
53 $exon-E<gt>start(), $exon-E<gt>end() etc will always return what you expect.
54
55 To get the coordinates on the matching EST, refer to the properties of the
56 feature returned by L<est_hit>().
57
58 =head1 FEEDBACK
59
60 =head2 Mailing Lists
61
62 User feedback is an integral part of the evolution of this
63 and other Bioperl modules. Send your comments and suggestions preferably
64 to one of the Bioperl mailing lists.
65 Your participation is much appreciated.
66
67 bioperl-l@bioperl.org - General discussion
68 http://bio.perl.org/MailList.html - About the mailing lists
69
70 =head2 Reporting Bugs
71
72 Report bugs to the Bioperl bug tracking system to help us keep track
73 the bugs and their resolution.
74 Bug reports can be submitted via email or the web:
75
76 bioperl-bugs@bio.perl.org
77 http://bugzilla.bioperl.org/
78
79 =head1 AUTHOR - Ewan Birney, Hilmar Lapp
80
81 Email birney@sanger.ac.uk
82 Hilmar Lapp E<lt>hlapp@gmx.netE<gt> or E<lt>hilmar.lapp@pharma.novartis.comE<gt>.
83
84 Describe contact details here
85
86 =head1 APPENDIX
87
88 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
89
90 =cut
91
92
93 # Let the code begin...
94
95
96 package Bio::Tools::Sim4::Exon;
97 use vars qw(@ISA);
98 use strict;
99
100 use Bio::SeqFeature::FeaturePair;
101 use Bio::SeqFeature::Generic;
102 use Bio::SeqFeature::SimilarityPair;
103
104 @ISA = qw(Bio::SeqFeature::SimilarityPair);
105
106 sub new {
107 my ($class,@args) = @_;
108 my %param = @args;
109 my $self = $class->SUPER::new(@args);
110
111 my ($prim, $source) = $self->_rearrange([qw(PRIMARY SOURCE)], @args);
112
113 $self->primary_tag('exon') unless $prim;
114 $self->source_tag('Sim4') unless $source;
115 $self->strand(0) unless defined($self->strand());
116 $self->query();
117 return $self;
118 }
119
120 =head2 percentage_id
121
122 Title : percentage_id
123 Usage : $obj->percentage_id($newval)
124 Function: This is a synonym for 100 * $obj->est_hit()->frac_identical().
125 Returns : value of percentage_id
126 Args : newvalue (optional)
127
128
129 =cut
130
131 sub percentage_id {
132 my ($self, @args) = @_;
133 my $frac;
134 my $val;
135 my $delegated = 0;
136
137 if(@args) {
138 $frac = $args[0];
139 $frac /= 100.0 if defined($frac);
140 }
141 if($self->query()->can('frac_identical')) {
142 if(defined($frac)) {
143 $self->query()->frac_identical($frac);
144 }
145 $val = 100.0 * $self->query()->frac_identical();
146 $delegated = 1;
147 }
148 if($self->est_hit()->can('frac_identical')) {
149 if(defined($frac)) {
150 $self->est_hit()->frac_identical($frac);
151 }
152 # this intentiously overwrites previous $val
153 $val = 100.0 * $self->est_hit()->frac_identical();
154 $delegated = 1;
155 }
156 if(! $delegated) {
157 if(@args) {
158 $val = shift(@args);
159 $self->{'percentage_id'} = $val;
160 } else {
161 $val = $self->{'percentage_id'};
162 }
163 }
164 return $val;
165 }
166
167 =head2 est_hit
168
169 Title : est_hit
170 Usage : $est_feature = $obj->est_hit();
171 Function: Returns the EST hit pointing to (i.e., aligned to by Sim4) this
172 exon (i.e., genomic region). At present, merely a synonym for
173 $obj->feature2().
174 Returns : An Bio::SeqFeatureI implementing object.
175 Args :
176
177
178 =cut
179
180 sub est_hit {
181 my $self = shift;
182 return $self->feature2(@_);
183 }
184
185 1;