EnsEMBL/IdMapping/TinyTranscript.pm untested

filter: Statementstmt 0.0% 0 / 52 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 8 Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 105 CC 10 SCAR 15.9
CC
10
Cov
0%
start
6.0
end
6.0
strand
6.0
CRAP 4.9
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::IdMapping::TinyTranscript - lightweight transcript object
34  
35 =head1 SYNOPSIS
36  
37 # fetch a transcript from the db and create a lightweight
38 # transcript object from it
39 my $tr = $transcript_adaptor->fetch_by_stable_id('ENST000345437');
40 my $lightweight_tr =
41 Bio::EnsEMBL::IdMapping::TinyTranscript->new_fast( [
42 $tr->dbID, $tr->stable_id,
43 $tr->version, $tr->created_date,
44 $tr->modified_date, $tr->start,
45 $tr->end, $tr->strand,
46 $tr->length, md5_hex( $tr->spliced_seq ),
47 ] );
48  
49 =head1 DESCRIPTION
50  
51 This is a lightweight transcript object for the stable Id mapping. See
52 the documentation in TinyFeature for general considerations about its
53 design.
54  
55 =head1 METHODS
56  
57 start
58 end
59 strand
60 length
61 seq_md5_sum
62 add_Translation
63 translation
64 add_Exon
65 get_all_Exons
66  
67 =cut
68  
69 package Bio::EnsEMBL::IdMapping::TinyTranscript;
70 $Bio::EnsEMBL::IdMapping::TinyTranscript::VERSION = '114.0.0_50'; # TRIAL
71 $Bio::EnsEMBL::IdMapping::TinyTranscript::VERSION = '114.0.050';
72 # internal data structure (array indices):
73 #
74 # 0-4 see TinyFeature
75 # 5 start
76 # 6 end
77 # 7 strand
78 # 8 length
79 # 9 seq_md5_sum
80 # 10 translation
81 # 11 [exons]
82 # 12 biotype
83 # 13 slice
84  
85  
86 use strict;
87 use warnings;
88 no warnings 'uninitialized';
89  
90 use Bio::EnsEMBL::IdMapping::TinyFeature;
91 our @ISA = qw(Bio::EnsEMBL::IdMapping::TinyFeature);
92  
93 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
94  
95  
96 =head2 start
97  
98 Arg[1] : (optional) Int - the transcript's start coordinate
99 Description : Getter/setter for the transcript's start coordinate.
100 Return type : Int
101 Exceptions : none
102 Caller : general
103 Status : At Risk
104 : under development
105  
106 =cut
107  
108 sub start {
109 my $self = shift;
110 $self->[5] = shift if (@_);
111 return $self->[5];
112 }
113  
114  
115 =head2 end
116  
117 Arg[1] : (optional) Int - the transcript's end coordinate
118 Description : Getter/setter for the transcript's end coordinate.
119 Return type : Int
120 Exceptions : none
121 Caller : general
122 Status : At Risk
123 : under development
124  
125 =cut
126  
127 sub end {
128 my $self = shift;
129 $self->[6] = shift if (@_);
130 return $self->[6];
131 }
132  
133  
134 =head2 strand
135  
136 Arg[1] : (optional) Int - the transcript's strand
137 Description : Getter/setter for the transcript's strand.
138 Return type : Int
139 Exceptions : none
140 Caller : general
141 Status : At Risk
142 : under development
143  
144 =cut
145  
146 sub strand {
147 my $self = shift;
148 $self->[7] = shift if (@_);
149 return $self->[7];
150 }
151  
152  
153 =head2 length
154  
155 Arg[1] : (optional) Int - the transcript's length
156 Description : Getter/setter for the transcript's length. Note that this is
157 *not* the distance between start and end, but rather the sum of
158 the lengths of all exons.
159 Return type : Int
160 Exceptions : none
161 Caller : general
162 Status : At Risk
163 : under development
164  
165 =cut
166  
167 sub length {
168 my $self = shift;
169 $self->[8] = shift if (@_);
170 return $self->[8];
171 }
172  
173  
174 =head2 seq_md5_sum
175  
176 Arg[1] : (optional) String - the md5 digest of the transcript's sequence
177 Description : Getter/setter for the md5 digest of the transcript's sequence.
178 Note that when used as a setter, you are expected to pass a
179 digest, not the raw sequence (i.e. the digest is not created for
180 you).
181 Return type : String
182 Exceptions : none
183 Caller : general
184 Status : At Risk
185 : under development
186  
187 =cut
188  
189 sub seq_md5_sum {
190 my $self = shift;
191 $self->[9] = shift if (@_);
192 return $self->[9];
193 }
194  
195  
196  
197 =head2 add_Translation
198  
199 Arg[1] : Bio::EnsEMBL::IdMapping::TinyTranslation $tl - the translation
200 to add
201 Example : $tiny_transcript->add_Translation($tiny_translation);
202 Description : Adds a translation to this transcript.
203 Return type : none
204 Exceptions : thrown on wrong or missing argument
205 Caller : general
206 Status : At Risk
207 : under development
208  
209 =cut
210  
211 sub add_Translation {
212 my $self = shift;
213 my $tl = shift;
214  
215 unless ($tl && $tl->isa('Bio::EnsEMBL::IdMapping::TinyTranslation')) {
216 throw('Need a Bio::EnsEMBL::IdMapping::TinyTranslation.');
217 }
218  
219 $self->[10] = $tl;
220 }
221  
222  
223 =head2 translation
224  
225 Description : Getter for the transcript's translation.
226 Return type : Bio::EnsEMBL::IdMapping::TinyTranslation
227 Exceptions : none
228 Caller : general
229 Status : At Risk
230 : under development
231  
232 =cut
233  
234 sub translation {
235 return $_[0]->[10];
236 }
237  
238  
239 =head2 add_Exon
240  
241 Arg[1] : Bio::EnsEMBL::IdMapping::TinyExon $exon - the exon to add
242 Example : $tiny_transcript->add_Exon($tiny_exon);
243 Description : Adds an exon to this transcript.
244 Return type : none
245 Exceptions : thrown on wrong or missing argument
246 Caller : general
247 Status : At Risk
248 : under development
249  
250 =cut
251  
252 sub add_Exon {
253 my $self = shift;
254 my $exon = shift;
255  
256 unless ($exon && $exon->isa('Bio::EnsEMBL::IdMapping::TinyExon')) {
257 throw('Need a Bio::EnsEMBL::IdMapping::TinyExon.');
258 }
259  
260 push @{ $self->[11] }, $exon;
261 }
262  
263  
264 =head2 get_all_Exons
265  
266 Example : foreach my $exon (@{ $tiny_transcript->get_all_Exons }) {
267 # do something with exon
268 }
269 Description : Returns all exons attached to that transcript.
270 Return type : Arrayref of Bio::EnsEMBL::IdMapping::TinyExon objects
271 Exceptions : none
272 Caller : general
273 Status : At Risk
274 : under development
275  
276 =cut
277  
278 sub get_all_Exons {
279 return $_[0]->[11] || [];
280 }
281  
282 =head2 biotype
283  
284 Arg[1] : (optional) String - the gene's biotype
285 Description : Getter/setter for the gene's biotype.
286 Return type : String
287 Exceptions : none
288 Caller : general
289 Status : At Risk
290 : under development
291  
292 =cut
293  
294 sub biotype {
295 my $self = shift;
296 $self->[12] = shift if (@_);
297 return $self->[12];
298 }
299  
300 =head2 seq_region_name
301  
302 Arg[1] : (optional) String - seq_region name
303 Description : Getter/setter for the seq_region name of the slice the gene is
304 on.
305 Return type : String
306 Exceptions : none
307 Caller : general
308 Status : At Risk
309 : under development
310  
311 =cut
312  
313 sub seq_region_name {
314 my $self = shift;
315 $self->[13] = shift if (@_);
316 return $self->[13];
317 }
318  
319  
320 1;
321