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