0
|
1 =head1 LICENSE
|
|
2
|
|
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and
|
|
4 Genome Research Limited. All rights reserved.
|
|
5
|
|
6 This software is distributed under a modified Apache license.
|
|
7 For license details, please see
|
|
8
|
|
9 http://www.ensembl.org/info/about/code_licence.html
|
|
10
|
|
11 =head1 CONTACT
|
|
12
|
|
13 Please email comments or questions to the public Ensembl
|
|
14 developers list at <dev@ensembl.org>.
|
|
15
|
|
16 Questions may also be sent to the Ensembl help desk at
|
|
17 <helpdesk@ensembl.org>.
|
|
18
|
|
19 =cut
|
|
20
|
|
21 =head1 NAME
|
|
22
|
|
23 Bio::EnsEMBL::IdMapping::TinyExon - lightweight exon object
|
|
24
|
|
25 =head1 SYNOPSIS
|
|
26
|
|
27 # fetch an exon from the db and create a lightweight exon object
|
|
28 # from it
|
|
29 my $exon = $exon_adaptor->fetch_by_stable_id('ENSE000345437');
|
|
30 my $lightweight_exon = Bio::EnsEMBL::IdMapping::TinyExon->new_fast( [
|
|
31 $exon->dbID,
|
|
32 $exon->stable_id,
|
|
33 $exon->version,
|
|
34 $exon->created_date,
|
|
35 $exon->modified_date,
|
|
36 $exon->start,
|
|
37 $exon->end,
|
|
38 $exon->strand,
|
|
39 $exon->slice->seq_region_name,
|
|
40 $exon->slice->coord_system_name,
|
|
41 $exon->slice->coord_system->version,
|
|
42 $exon->slice->subseq( $exon->start, $exon->end, $exon->strand ),
|
|
43 $exon->phase,
|
|
44 $need_project,
|
|
45 ] );
|
|
46
|
|
47 =head1 DESCRIPTION
|
|
48
|
|
49 This is a lightweight exon object for the stable Id mapping. See the
|
|
50 documentation in TinyFeature for general considerations about its
|
|
51 design.
|
|
52
|
|
53 =head1 METHODS
|
|
54
|
|
55 start
|
|
56 end
|
|
57 strand
|
|
58 seq_region_name
|
|
59 coord_system_name
|
|
60 coord_system_version
|
|
61 seq
|
|
62 phase
|
|
63 need_project
|
|
64 common_start
|
|
65 common_end
|
|
66 common_strand
|
|
67 common_sr_name
|
|
68 length
|
|
69 is_known
|
|
70
|
|
71 =cut
|
|
72
|
|
73
|
|
74 package Bio::EnsEMBL::IdMapping::TinyExon;
|
|
75
|
|
76 # internal data structure (array indices):
|
|
77 #
|
|
78 # 0-4 see TinyFeature
|
|
79 # 5 start
|
|
80 # 6 end
|
|
81 # 7 strand
|
|
82 # 8 seq_region_name
|
|
83 # 9 coord_system_name
|
|
84 # 10 coord_system_version
|
|
85 # 11 seq
|
|
86 # 12 phase
|
|
87 # 13 need_project
|
|
88 # 14 common_start
|
|
89 # 15 common_end
|
|
90 # 16 common_strand
|
|
91 # 17 common_sr_name
|
|
92
|
|
93
|
|
94 use strict;
|
|
95 use warnings;
|
|
96 no warnings 'uninitialized';
|
|
97
|
|
98 use Bio::EnsEMBL::IdMapping::TinyFeature;
|
|
99 our @ISA = qw(Bio::EnsEMBL::IdMapping::TinyFeature);
|
|
100
|
|
101 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
|
|
102
|
|
103
|
|
104 =head2 start
|
|
105
|
|
106 Arg[1] : (optional) Int - the exon's start coordinate
|
|
107 Description : Getter/setter for the exon's start coordinate.
|
|
108 Return type : Int
|
|
109 Exceptions : none
|
|
110 Caller : general
|
|
111 Status : At Risk
|
|
112 : under development
|
|
113
|
|
114 =cut
|
|
115
|
|
116 sub start {
|
|
117 my $self = shift;
|
|
118 $self->[5] = shift if (@_);
|
|
119 return $self->[5];
|
|
120 }
|
|
121
|
|
122
|
|
123 =head2 end
|
|
124
|
|
125 Arg[1] : (optional) Int - the exon's end coordinate
|
|
126 Description : Getter/setter for the exon's end coordinate.
|
|
127 Return type : Int
|
|
128 Exceptions : none
|
|
129 Caller : general
|
|
130 Status : At Risk
|
|
131 : under development
|
|
132
|
|
133 =cut
|
|
134
|
|
135 sub end {
|
|
136 my $self = shift;
|
|
137 $self->[6] = shift if (@_);
|
|
138 return $self->[6];
|
|
139 }
|
|
140
|
|
141
|
|
142 =head2 strand
|
|
143
|
|
144 Arg[1] : (optional) Int - the exon's strand
|
|
145 Description : Getter/setter for the exon's strand.
|
|
146 Return type : Int
|
|
147 Exceptions : none
|
|
148 Caller : general
|
|
149 Status : At Risk
|
|
150 : under development
|
|
151
|
|
152 =cut
|
|
153
|
|
154 sub strand {
|
|
155 my $self = shift;
|
|
156 $self->[7] = shift if (@_);
|
|
157 return $self->[7];
|
|
158 }
|
|
159
|
|
160
|
|
161 =head2 seq_region_name
|
|
162
|
|
163 Arg[1] : (optional) String - seq_region name
|
|
164 Description : Getter/setter for the seq_region name of the slice the exon is
|
|
165 on.
|
|
166 Return type : String
|
|
167 Exceptions : none
|
|
168 Caller : general
|
|
169 Status : At Risk
|
|
170 : under development
|
|
171
|
|
172 =cut
|
|
173
|
|
174 sub seq_region_name {
|
|
175 my $self = shift;
|
|
176 $self->[8] = shift if (@_);
|
|
177 return $self->[8];
|
|
178 }
|
|
179
|
|
180
|
|
181 =head2 coord_system_name
|
|
182
|
|
183 Arg[1] : (optional) String - coord_system name
|
|
184 Description : Getter/setter for the coord_system name of the slice the exon is
|
|
185 on.
|
|
186 Return type : String
|
|
187 Exceptions : none
|
|
188 Caller : general
|
|
189 Status : At Risk
|
|
190 : under development
|
|
191
|
|
192 =cut
|
|
193
|
|
194 sub coord_system_name {
|
|
195 my $self = shift;
|
|
196 $self->[9] = shift if (@_);
|
|
197 return $self->[9];
|
|
198 }
|
|
199
|
|
200
|
|
201 =head2 coord_system_version
|
|
202
|
|
203 Arg[1] : (optional) String - coord_system version
|
|
204 Description : Getter/setter for the coord_system version of the slice the
|
|
205 exon is on.
|
|
206 Return type : String
|
|
207 Exceptions : none
|
|
208 Caller : general
|
|
209 Status : At Risk
|
|
210 : under development
|
|
211
|
|
212 =cut
|
|
213
|
|
214 sub coord_system_version {
|
|
215 my $self = shift;
|
|
216 $self->[10] = shift if (@_);
|
|
217 return $self->[10];
|
|
218 }
|
|
219
|
|
220
|
|
221 =head2 seq
|
|
222
|
|
223 Arg[1] : (optional) String - the exon's sequence
|
|
224 Description : Getter/setter for the exon's sequence.
|
|
225 Return type : String
|
|
226 Exceptions : none
|
|
227 Caller : general
|
|
228 Status : At Risk
|
|
229 : under development
|
|
230
|
|
231 =cut
|
|
232
|
|
233 sub seq {
|
|
234 my $self = shift;
|
|
235 $self->[11] = shift if (@_);
|
|
236 return $self->[11];
|
|
237 }
|
|
238
|
|
239
|
|
240 =head2 phase
|
|
241
|
|
242 Arg[1] : (optional) Int - the exon's phase
|
|
243 Description : Getter/setter for the exon's phase.
|
|
244 Return type : Int
|
|
245 Exceptions : none
|
|
246 Caller : general
|
|
247 Status : At Risk
|
|
248 : under development
|
|
249
|
|
250 =cut
|
|
251
|
|
252 sub phase {
|
|
253 my $self = shift;
|
|
254 $self->[12] = shift if (@_);
|
|
255 return $self->[12];
|
|
256 }
|
|
257
|
|
258
|
|
259 =head2 need_project
|
|
260
|
|
261 Arg[1] : (optional) Boolean - attribute to set
|
|
262 Description : Getter/setter for the attribute determining whether an exon
|
|
263 needs to be projected onto a common coord_system. You don't need
|
|
264 to do so if the native coord_system is common to the source and
|
|
265 target assemblies, or if no common coord_system is found (the
|
|
266 Cache object has methods to determine this).
|
|
267 Return type : Boolean
|
|
268 Exceptions : none
|
|
269 Caller : general
|
|
270 Status : At Risk
|
|
271 : under development
|
|
272
|
|
273 =cut
|
|
274
|
|
275 sub need_project {
|
|
276 my $self = shift;
|
|
277 $self->[13] = shift if (@_);
|
|
278 return $self->[13];
|
|
279 }
|
|
280
|
|
281
|
|
282 =head2 common_start
|
|
283
|
|
284 Arg[1] : (optional) Int - the exon's start in common coord_system
|
|
285 coordinates
|
|
286 Description : Getter/setter for the exon's start in common coord_system
|
|
287 coordinates. Will return $self->start if no projection to a
|
|
288 common coord_system is required.
|
|
289 Return type : Int
|
|
290 Exceptions : none
|
|
291 Caller : general
|
|
292 Status : At Risk
|
|
293 : under development
|
|
294
|
|
295 =cut
|
|
296
|
|
297 sub common_start {
|
|
298 my $self = shift;
|
|
299
|
|
300 # when used as a setter, always set a value
|
|
301 $self->[14] = shift if (@_);
|
|
302
|
|
303 # when used as a getter
|
|
304 if (scalar(@$self) > 14) {
|
|
305 # return value for common coord_system if available (but avoid
|
|
306 # autovivification gotcha!)
|
|
307 return $self->[14];
|
|
308 } elsif ($self->need_project) {
|
|
309 # return undef if common value expected but not there (e.g. no projection
|
|
310 # found
|
|
311 return undef;
|
|
312 } else {
|
|
313 # return native value
|
|
314 return $self->start;
|
|
315 }
|
|
316 }
|
|
317
|
|
318
|
|
319 =head2 common_end
|
|
320
|
|
321 Arg[1] : (optional) Int - the exon's end in common coord_system
|
|
322 coordinates
|
|
323 Description : Getter/setter for the exon's end in common coord_system
|
|
324 coordinates. Will return $self->end if no projection to a
|
|
325 common coord_system is required.
|
|
326 Return type : Int
|
|
327 Exceptions : none
|
|
328 Caller : general
|
|
329 Status : At Risk
|
|
330 : under development
|
|
331
|
|
332 =cut
|
|
333
|
|
334 sub common_end {
|
|
335 my $self = shift;
|
|
336
|
|
337 # when used as a setter, always set a value
|
|
338 $self->[15] = shift if (@_);
|
|
339
|
|
340 # when used as a getter
|
|
341 if (scalar(@$self) > 14) {
|
|
342 # return value for common coord_system if available (but avoid
|
|
343 # autovivification gotcha!)
|
|
344 return $self->[15];
|
|
345 } elsif ($self->need_project) {
|
|
346 # return undef if common value expected but not there (e.g. no projection
|
|
347 # found
|
|
348 return undef;
|
|
349 } else {
|
|
350 # return native value
|
|
351 return $self->end;
|
|
352 }
|
|
353 }
|
|
354
|
|
355
|
|
356 =head2 common_strand
|
|
357
|
|
358 Arg[1] : (optional) Int - the exon's strand in common coord_system
|
|
359 coordinates
|
|
360 Description : Getter/setter for the exon's strand in common coord_system
|
|
361 coordinates. Will return $self->strand if no projection to a
|
|
362 common coord_system is required.
|
|
363 Return type : Int
|
|
364 Exceptions : none
|
|
365 Caller : general
|
|
366 Status : At Risk
|
|
367 : under development
|
|
368
|
|
369 =cut
|
|
370
|
|
371 sub common_strand {
|
|
372 my $self = shift;
|
|
373
|
|
374 # when used as a setter, always set a value
|
|
375 $self->[16] = shift if (@_);
|
|
376
|
|
377 # when used as a getter
|
|
378 if (scalar(@$self) > 14) {
|
|
379 # return value for common coord_system if available (but avoid
|
|
380 # autovivification gotcha!)
|
|
381 return $self->[16];
|
|
382 } elsif ($self->need_project) {
|
|
383 # return undef if common value expected but not there (e.g. no projection
|
|
384 # found
|
|
385 return undef;
|
|
386 } else {
|
|
387 # return native value
|
|
388 return $self->strand;
|
|
389 }
|
|
390 }
|
|
391
|
|
392
|
|
393 =head2 common_sr_name
|
|
394
|
|
395 Arg[1] : (optional) String - seq_region name of the exon's slice on the
|
|
396 common coord_system
|
|
397 Description : Getter/setter for the seq_region name of the exon's slice on the
|
|
398 common coord_system coordinates. Will return
|
|
399 $self->seq_region_name if no projection to a common coord_system
|
|
400 is required.
|
|
401 Return type : String
|
|
402 Exceptions : none
|
|
403 Caller : general
|
|
404 Status : At Risk
|
|
405 : under development
|
|
406
|
|
407 =cut
|
|
408
|
|
409 sub common_sr_name {
|
|
410 my $self = shift;
|
|
411
|
|
412 # when used as a setter, always set a value
|
|
413 $self->[17] = shift if (@_);
|
|
414
|
|
415 # when used as a getter
|
|
416 if (scalar(@$self) > 14) {
|
|
417 # return value for common coord_system if available (but avoid
|
|
418 # autovivification gotcha!)
|
|
419 return $self->[17];
|
|
420 } elsif ($self->need_project) {
|
|
421 # return undef if common value expected but not there (e.g. no projection
|
|
422 # found
|
|
423 return undef;
|
|
424 } else {
|
|
425 # return native value
|
|
426 return $self->seq_region_name;
|
|
427 }
|
|
428 }
|
|
429
|
|
430
|
|
431 =head2 length
|
|
432
|
|
433 Description : Returns the exon length (distance between start and end).
|
|
434 Return type : Int
|
|
435 Exceptions : none
|
|
436 Caller : general
|
|
437 Status : At Risk
|
|
438 : under development
|
|
439
|
|
440 =cut
|
|
441
|
|
442 sub length {
|
|
443 my $self = shift;
|
|
444 return ($self->end - $self->start + 1);
|
|
445 }
|
|
446
|
|
447
|
|
448 =head2 is_known
|
|
449
|
|
450 Description : Determine whether an exon is known. In the context of stable Id
|
|
451 mapping, this is true for all exons.
|
|
452 Return type : Boolean
|
|
453 Exceptions : none
|
|
454 Caller : general
|
|
455 Status : At Risk
|
|
456 : under development
|
|
457
|
|
458 =cut
|
|
459
|
|
460 sub is_known {
|
|
461 return 1;
|
|
462 }
|
|
463
|
|
464
|
|
465 1;
|
|
466
|