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