EnsEMBL/PredictionExon.pm untested

filter: Statementstmt 0.0% 0 / 68 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 14 Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 126 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_50'; # TRIAL
70 $Bio::EnsEMBL::PredictionExon::VERSION = '114.0.050';
71 use vars qw(@ISA);
72 use strict;
73  
74 use Bio::EnsEMBL::Feature;
75 use Bio::EnsEMBL::Exon;
76 use Bio::EnsEMBL::Utils::Exception qw( warning throw );
77 use Bio::EnsEMBL::Utils::Argument qw( rearrange );
78  
79  
80 @ISA = qw(Bio::EnsEMBL::Exon);
81  
82  
83 =head2 new
84  
85 Args : see SUPERCLASS Bio::EnsEMBL::Exon
86 Example : none
87 Description: create an Exon object
88 Returntype : Bio::EnsEMBL::PredictionExon
89 Exceptions : none
90 Caller : general
91 Status : Stable
92  
93 =cut
94  
95 sub new {
96 my $class = shift;
97  
98 $class = ref $class || $class;
99  
100 my $self = $class->SUPER::new( @_ );
101  
102 my ( $p_value, $score ) =
103 rearrange( [ "P_VALUE", "SCORE" ], @_ );
104  
105 $self->{'p_value'} = $p_value;
106 $self->{'score'} = $score;
107  
108 return $self;
109 }
110  
111  
112 =head2 score
113  
114 Arg [1] : string $newval (optional)
115 The new value to set the score attribute to
116 Example : $score = $obj->score()
117 Description: Getter/Setter for the score attribute
118 Returntype : string
119 Exceptions : none
120 Caller : general
121 Status : Stable
122  
123 =cut
124  
125 sub score{
126 my $self = shift;
127 $self->{'score'} = shift if(@_);
128 return $self->{'score'};
129 }
130  
131  
132  
133 =head2 p_value
134  
135 Arg [1] : string $newval (optional)
136 The new value to set the p_value attribute to
137 Example : $p_value = $obj->p_value()
138 Description: Getter/Setter for the p_value attribute
139 Returntype : string
140 Exceptions : none
141 Caller : general
142 Status : Stable
143  
144 =cut
145  
146 sub p_value{
147 my $self = shift;
148 $self->{'p_value'} = shift if(@_);
149 return $self->{'p_value'};
150 }
151  
152  
153 =head2 end_phase
154  
155 Arg [1] : (optional) int $end_phase
156 Example : $end_phase = $feat->end_phase;
157 Description: Gets/Sets the end phase of the exon.
158 end_phase = number of bases from the last incomplete codon of
159 this exon.
160 Usually, end_phase = (phase + exon_length)%3
161 but end_phase could be -1 if the exon is half-coding and its 3
162 prime end is UTR.
163 Returntype : int
164 Exceptions : warning if end_phase is called without an argument and the
165 value is not set.
166 Caller : general
167 Status : Stable
168  
169 =cut
170  
171  
172  
173 sub end_phase {
174 my $self = shift;
175 if( @_ ) {
176 throw( "End_phase setting not supported" );
177 }
178 return ($self->phase() + $self->length()) % 3;
179 }
180  
181  
182 =head2 transform
183  
184 Arg 1 : String $coordinate_system_name
185 Arg [2] : String $coordinate_system_version
186 Description: moves this exon to the given coordinate system. If this exon has
187 attached supporting evidence, they move as well.
188 Returntype : Bio::EnsEMBL::Exon
189 Exceptions : wrong parameters
190 Caller : general
191 Status : Stable
192  
193 =cut
194  
195  
196 sub transform {
197 my $self = shift;
198  
199 # catch for old style transform calls
200 if( !@_ || ( ref $_[0] && ($_[0]->isa( "Bio::EnsEMBL::Slice" ) or $_[0]->isa( "Bio::EnsEMBL::LRGSlice" )))) {
201 throw( "transform needs coordinate systems details now," .
202 "please use transfer" );
203 }
204  
205 my $new_exon = Bio::EnsEMBL::Feature::transform( $self, @_ );
206 return undef unless $new_exon;
207  
208 #dont want to share the same sequence cache
209 delete $new_exon->{'_seq_cache'};
210  
211 return $new_exon;
212 }
213  
214  
215  
216 =head2 transfer
217  
218 Arg [1] : Bio::EnsEMBL::Slice $destination_slice
219 Example : none
220 Description: Moves this Exon to given target slice coordinates. If Features
221 are attached they are moved as well. Returns a new exon.
222 Returntype : Bio::EnsEMBL::Gene
223 Exceptions : none
224 Caller : general
225 Status : Stable
226  
227 =cut
228  
229 sub transfer {
230 my $self = shift;
231  
232 my $new_exon = Bio::EnsEMBL::Feature::transfer( $self, @_ );
233 return undef unless $new_exon;
234  
235 #dont want to share the same sequence cache
236 delete $new_exon->{'_seq_cache'};
237  
238 return $new_exon;
239 }
240  
241 =head2 summary_as_hash
242  
243 Example : $exon_summary = $exon->summary_as_hash();
244 Description : Extends Feature::summary_as_hash
245 Retrieves a summary of this prediction exon.
246 Returns : hashref of descriptive strings
247 Status : Intended for internal use
248 =cut
249  
250 sub summary_as_hash {
251 my $self = shift;
252 my $summary_ref = $self->SUPER::summary_as_hash;
253 delete $summary_ref->{'constitutive'};
254 delete $summary_ref->{'ensembl_phase'};
255 delete $summary_ref->{'ensembl_end_phase'};
256 $summary_ref->{'Parent'} = $self->transcript->dbID() if $self->transcript();
257 $summary_ref->{'source'} = $self->prediction_transcript->analysis->gff_source() || 'ensembl';
258 return $summary_ref;
259 }
260  
261 =head2 transcript
262 Example : $prediction_transcript = $exon->transcript;
263 Description : Locates the parent prediction transcript using an exon dbID
264 Same as prediction_transcript, duplicated for compatibility
265 with Exon feature
266 Returns : Bio::EnsEMBL::PredictionTranscript
267  
268 =cut
269  
270 sub transcript {
271 my $self = shift;
272 return $self->prediction_transcript;
273 }
274  
275 =head2 prediction_transcript
276  
277 Example : $prediction_transcript = $exon->prediction_transcript;
278 Description : Locates the parent prediction transcript using an exon dbID
279 Returns : Bio::EnsEMBL::PredictionTranscript
280  
281 =cut
282  
283 sub prediction_transcript{
284 my $self = shift;
285 my $prediction_transcript_adaptor = $self->adaptor->db->get_PredictionTranscriptAdaptor();
286 my $parent_prediction_transcript = $prediction_transcript_adaptor->fetch_by_prediction_exon_id($self->dbID);
287 return $parent_prediction_transcript;
288 }
289  
290  
291 =head2 add_supporting_features
292  
293 Description: For compatibility with Bio::EnsEMBL::Exon
294 Does nothing.
295 Returntype : none
296 Status : Stable
297  
298 =cut
299  
300 sub add_supporting_features { }
301  
302  
303 =head2 get_all_supporting_features
304  
305 Description: For compatibility with Bio::EnsEMBL::Exon
306 Does nothing and returns empty list
307 Returntype : empty list.
308 Status : Stable
309  
310 =cut
311  
312 sub get_all_supporting_features { return []; }
313  
314  
315 =head2 find_supporting_evidence
316  
317 Description: For compatibility with Bio::EnsEMBL::Exon
318 Does nothing.
319 Returntype : empty list.
320 Status : Stable
321  
322 =cut
323  
324 sub find_supporting_evidence { return []; }
325  
326  
327 1;