EnsEMBL/PredictionExon.pm untested

filter: Statementstmt 0.0% 0 / 67 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 134 CC 8 SCAR 15.7
CC
8
Cov
0%
transform
12.0
score
6.0
p_value
6.0
CRAP 4.8
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::PredictionExon - A class representing an Exon from an ab
34 initio prediction method
35  
36 =head1 SYNOPSIS
37  
38 $exon = new Bio::EnsEMBL::PredictionExon(
39 -START => 100,
40 -END => 200,
41 -STRAND => 1,
42 -SLICE => $slice,
43 -DBID => $dbID,
44 -P_VALUE => 23.5,
45 -SCORE => 99
46 );
47  
48 # seq() returns a Bio::Seq
49 my $seq = $exon->seq->seq();
50  
51 # peptide() only makes sense within transcript context
52 my $pep = $exon->peptide($transcript)->seq();
53  
54 # Normal feature operations can be performed:
55 $exon = $exon->transform('clone');
56 $exon->move( $new_start, $new_end, $new_strand );
57 print $exon->slice->seq_region_name();
58  
59 =head1 DESCRIPTION
60  
61 This is a class which represents an prediction exon which is part of a
62 predcition transcript. See Bio::EnsEMBL:PredictionTranscript
63  
64 =head1 METHODS
65  
66 =cut
67  
68 package Bio::EnsEMBL::PredictionExon;
69 $Bio::EnsEMBL::PredictionExon::VERSION = '114.0.0';
70 use vars qw(@ISA);
71 use strict;
72  
73 use Bio::EnsEMBL::Feature;
74 use Bio::EnsEMBL::Exon;
75 use Bio::EnsEMBL::Utils::Exception qw( warning throw );
76 use Bio::EnsEMBL::Utils::Argument qw( rearrange );
77  
78  
79 @ISA = qw(Bio::EnsEMBL::Exon);
80  
81  
82 =head2 new
83  
84 Args : see SUPERCLASS Bio::EnsEMBL::Exon
85 Example : none
86 Description: create an Exon object
87 Returntype : Bio::EnsEMBL::PredictionExon
88 Exceptions : none
89 Caller : general
90 Status : Stable
91  
92 =cut
93  
94 sub new {
95 my $class = shift;
96  
97 $class = ref $class || $class;
98  
99 my $self = $class->SUPER::new( @_ );
100  
101 my ( $p_value, $score ) =
102 rearrange( [ "P_VALUE", "SCORE" ], @_ );
103  
104 $self->{'p_value'} = $p_value;
105 $self->{'score'} = $score;
106  
107 return $self;
108 }
109  
110  
111 =head2 score
112  
113 Arg [1] : string $newval (optional)
114 The new value to set the score attribute to
115 Example : $score = $obj->score()
116 Description: Getter/Setter for the score attribute
117 Returntype : string
118 Exceptions : none
119 Caller : general
120 Status : Stable
121  
122 =cut
123  
124 sub score{
125 my $self = shift;
126 $self->{'score'} = shift if(@_);
127 return $self->{'score'};
128 }
129  
130  
131  
132 =head2 p_value
133  
134 Arg [1] : string $newval (optional)
135 The new value to set the p_value attribute to
136 Example : $p_value = $obj->p_value()
137 Description: Getter/Setter for the p_value attribute
138 Returntype : string
139 Exceptions : none
140 Caller : general
141 Status : Stable
142  
143 =cut
144  
145 sub p_value{
146 my $self = shift;
147 $self->{'p_value'} = shift if(@_);
148 return $self->{'p_value'};
149 }
150  
151  
152 =head2 end_phase
153  
154 Arg [1] : (optional) int $end_phase
155 Example : $end_phase = $feat->end_phase;
156 Description: Gets/Sets the end phase of the exon.
157 end_phase = number of bases from the last incomplete codon of
158 this exon.
159 Usually, end_phase = (phase + exon_length)%3
160 but end_phase could be -1 if the exon is half-coding and its 3
161 prime end is UTR.
162 Returntype : int
163 Exceptions : warning if end_phase is called without an argument and the
164 value is not set.
165 Caller : general
166 Status : Stable
167  
168 =cut
169  
170  
171  
172 sub end_phase {
173 my $self = shift;
174 if( @_ ) {
175 throw( "End_phase setting not supported" );
176 }
177 return ($self->phase() + $self->length()) % 3;
178 }
179  
180  
181 =head2 transform
182  
183 Arg 1 : String $coordinate_system_name
184 Arg [2] : String $coordinate_system_version
185 Description: moves this exon to the given coordinate system. If this exon has
186 attached supporting evidence, they move as well.
187 Returntype : Bio::EnsEMBL::Exon
188 Exceptions : wrong parameters
189 Caller : general
190 Status : Stable
191  
192 =cut
193  
194  
195 sub transform {
196 my $self = shift;
197  
198 # catch for old style transform calls
199 if( !@_ || ( ref $_[0] && ($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" )))) {
200 throw( "transform needs coordinate systems details now," .
201 "please use transfer" );
202 }
203  
204 my $new_exon = Bio::EnsEMBL::Feature::transform( $self, @_ );
205 return undef unless $new_exon;
206  
207 #dont want to share the same sequence cache
208 delete $new_exon->{'_seq_cache'};
209  
210 return $new_exon;
211 }
212  
213  
214  
215 =head2 transfer
216  
217 Arg [1] : Bio::EnsEMBL::Slice $destination_slice
218 Example : none
219 Description: Moves this Exon to given target slice coordinates. If Features
220 are attached they are moved as well. Returns a new exon.
221 Returntype : Bio::EnsEMBL::Gene
222 Exceptions : none
223 Caller : general
224 Status : Stable
225  
226 =cut
227  
228 sub transfer {
229 my $self = shift;
230  
231 my $new_exon = Bio::EnsEMBL::Feature::transfer( $self, @_ );
232 return undef unless $new_exon;
233  
234 #dont want to share the same sequence cache
235 delete $new_exon->{'_seq_cache'};
236  
237 return $new_exon;
238 }
239  
240 =head2 summary_as_hash
241  
242 Example : $exon_summary = $exon->summary_as_hash();
243 Description : Extends Feature::summary_as_hash
244 Retrieves a summary of this prediction exon.
245 Returns : hashref of descriptive strings
246 Status : Intended for internal use
247 =cut
248  
249 sub summary_as_hash {
250 my $self = shift;
251 my $summary_ref = $self->SUPER::summary_as_hash;
252 delete $summary_ref->{'constitutive'};
253 delete $summary_ref->{'ensembl_phase'};
254 delete $summary_ref->{'ensembl_end_phase'};
255 $summary_ref->{'Parent'} = $self->transcript->dbID() if $self->transcript();
256 $summary_ref->{'source'} = $self->prediction_transcript->analysis->gff_source() || 'ensembl';
257 return $summary_ref;
258 }
259  
260 =head2 transcript
261 Example : $prediction_transcript = $exon->transcript;
262 Description : Locates the parent prediction transcript using an exon dbID
263 Same as prediction_transcript, duplicated for compatibility
264 with Exon feature
265 Returns : Bio::EnsEMBL::PredictionTranscript
266  
267 =cut
268  
269 sub transcript {
270 my $self = shift;
271 return $self->prediction_transcript;
272 }
273  
274 =head2 prediction_transcript
275  
276 Example : $prediction_transcript = $exon->prediction_transcript;
277 Description : Locates the parent prediction transcript using an exon dbID
278 Returns : Bio::EnsEMBL::PredictionTranscript
279  
280 =cut
281  
282 sub prediction_transcript{
283 my $self = shift;
284 my $prediction_transcript_adaptor = $self->adaptor->db->get_PredictionTranscriptAdaptor();
285 my $parent_prediction_transcript = $prediction_transcript_adaptor->fetch_by_prediction_exon_id($self->dbID);
286 return $parent_prediction_transcript;
287 }
288  
289  
290 =head2 add_supporting_features
291  
292 Description: For compatibility with Bio::EnsEMBL::Exon
293 Does nothing.
294 Returntype : none
295 Status : Stable
296  
297 =cut
298  
299 sub add_supporting_features { }
300  
301  
302 =head2 get_all_supporting_features
303  
304 Description: For compatibility with Bio::EnsEMBL::Exon
305 Does nothing and returns empty list
306 Returntype : empty list.
307 Status : Stable
308  
309 =cut
310  
311 sub get_all_supporting_features { return []; }
312  
313  
314 =head2 find_supporting_evidence
315  
316 Description: For compatibility with Bio::EnsEMBL::Exon
317 Does nothing.
318 Returntype : empty list.
319 Status : Stable
320  
321 =cut
322  
323 sub find_supporting_evidence { return []; }
324  
325  
326 1;