EnsEMBL/IdMapping/TinyFeature.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 10 Conditioncond n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 62 CC 6 SCAR 15.0
CC
6
Cov
0%
id
6.0
stable_id
6.0
version
6.0
CRAP 4.5
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::TinyFeature - lightweight feature object
34  
35 =head1 SYNOPSIS
36  
37 This object isn't instantiated. See objects which inherit from it
38 (TinyGene, TinyTranscript, etc.) for examples.
39  
40 =head1 DESCRIPTION
41  
42 This is the base class for the lightweight feature objects used by the
43 stable Id maping application. For performance reasons, these objects
44 are instantiated using a new_fast() method. The internal implementation
45 is an arrayref (rather than the more common hashref), which optimises
46 memory usage.
47  
48 There are no adaptors to fetch TinyFeatures from the database. You
49 rather use the normal feature adaptors and then create the TinyFeatures
50 from the heavy objects you get. The memory saving will therefore mainly
51 take effect when serialising and reloading these objects.
52  
53 Also note that TinyFeatures don't have a slice attached to them - all
54 location information (where required) is stored on the feature object
55 directly.
56  
57 =head1 METHODS
58  
59 new_fast
60 id
61 stable_id
62 version
63 created_date
64 modified_date
65 to_string
66  
67 =cut
68  
69 package Bio::EnsEMBL::IdMapping::TinyFeature;
70 $Bio::EnsEMBL::IdMapping::TinyFeature::VERSION = '114.0.0_50'; # TRIAL
71 $Bio::EnsEMBL::IdMapping::TinyFeature::VERSION = '114.0.050';
72 # internal data structure (array indices):
73 #
74 # 0 dbID
75 # 1 stable_id
76 # 2 version
77 # 3 created_date
78 # 4 modified_date
79 #
80 # other instance variables differ by subclass implementation, so look there.
81  
82  
83 use strict;
84 use warnings;
85 no warnings 'uninitialized';
86  
87 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
88  
89  
90 =head2 new_fast
91  
92 Arg[1] : Arrayref $array_ref - the arrayref to bless into the new object
93 Description : Constructor.
94 Return type : Bio::EnsEMBL::IdMapping::TinyFeature implementing class
95 Exceptions : none
96 Caller : Bio::EnsEMBL::IdMapping::Cache
97 Status : At Risk
98 : under development
99  
100 =cut
101  
102 sub new_fast {
103 my $class = shift;
104 my $array_ref = shift;
105 return bless $array_ref, $class;
106 }
107  
108  
109 =head2 id
110  
111 Arg[1] : (optional) Int - the feature's internal Id ("dbID")
112 Description : Getter/setter for the feature's internal Id.
113 Return type : Int
114 Exceptions : none
115 Caller : Bio::EnsEMBL::IdMapping::Cache
116 Status : At Risk
117 : under development
118  
119 =cut
120  
121 sub id {
122 my $self = shift;
123 $self->[0] = shift if (@_);
124 return $self->[0];
125 }
126  
127  
128 =head2 stable_id
129  
130 Arg[1] : (optional) String - the feature's stable Id
131 Description : Getter/setter for the feature's stable Id.
132 Return type : String
133 Exceptions : none
134 Caller : Bio::EnsEMBL::IdMapping::Cache
135 Status : At Risk
136 : under development
137  
138 =cut
139  
140 sub stable_id {
141 my $self = shift;
142 $self->[1] = shift if (@_);
143 return $self->[1];
144 }
145  
146  
147 =head2 version
148  
149 Arg[1] : (optional) Int - the feature's stable Id version
150 Description : Getter/setter for the feature's stable Id version.
151 Return type : Int
152 Exceptions : none
153 Caller : Bio::EnsEMBL::IdMapping::Cache
154 Status : At Risk
155 : under development
156  
157 =cut
158  
159 sub version {
160 my $self = shift;
161 $self->[2] = shift if (@_);
162 return $self->[2];
163 }
164  
165  
166 =head2 created_date
167  
168 Arg[1] : (optional) String - the feature's stable Id creation date
169 Description : Getter/setter for the feature's stable Id creation date.
170 Return type : String
171 Exceptions : none
172 Caller : Bio::EnsEMBL::IdMapping::Cache
173 Status : At Risk
174 : under development
175  
176 =cut
177  
178 sub created_date {
179 my $self = shift;
180 $self->[3] = shift if (@_);
181 return $self->[3];
182 }
183  
184  
185 =head2 modified_date
186  
187 Arg[1] : (optional) String - the feature's stable Id modification date
188 Description : Getter/setter for the feature's stable Id modification date.
189 Return type : String
190 Exceptions : none
191 Caller : Bio::EnsEMBL::IdMapping::Cache
192 Status : At Risk
193 : under development
194  
195 =cut
196  
197 sub modified_date {
198 my $self = shift;
199 $self->[4] = shift if (@_);
200 return $self->[4];
201 }
202  
203  
204 =head2 to_string
205  
206 Example : print LOG "Created ", $f->to_string, "\n";
207 Description : Prints a string representation of the feature for debug
208 purposes.
209 Return type : String
210 Exceptions : none
211 Caller : general
212 Status : At Risk
213 : under development
214  
215 =cut
216  
217 sub to_string {
218 my $self = shift;
219 return $self->id.':'.$self->stable_id.'.'.$self->version;
220 }
221  
222  
223 1;
224