line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GO::AnnotatedGene; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# File : AnnotatedGene.pm |
5
|
|
|
|
|
|
|
# Author : Gavin Sherlock |
6
|
|
|
|
|
|
|
# Date Begun : March 9th 2003 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# $Id: AnnotatedGene.pm,v 1.2 2003/11/26 19:23:52 sherlock Exp $ |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# License information (the MIT license) |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Copyright (c) 2003 Gavin Sherlock; Stanford University |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person |
15
|
|
|
|
|
|
|
# obtaining a copy of this software and associated documentation files |
16
|
|
|
|
|
|
|
# (the "Software"), to deal in the Software without restriction, |
17
|
|
|
|
|
|
|
# including without limitation the rights to use, copy, modify, merge, |
18
|
|
|
|
|
|
|
# publish, distribute, sublicense, and/or sell copies of the Software, |
19
|
|
|
|
|
|
|
# and to permit persons to whom the Software is furnished to do so, |
20
|
|
|
|
|
|
|
# subject to the following conditions: |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# The above copyright notice and this permission notice shall be |
23
|
|
|
|
|
|
|
# included in all copies or substantial portions of the Software. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
26
|
|
|
|
|
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
27
|
|
|
|
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
28
|
|
|
|
|
|
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
29
|
|
|
|
|
|
|
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
30
|
|
|
|
|
|
|
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
31
|
|
|
|
|
|
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
32
|
|
|
|
|
|
|
# SOFTWARE. |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
237990
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
35
|
|
35
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
36
|
1
|
|
|
1
|
|
5
|
use diagnostics; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
8
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME - I provide an object to hold info about a gene with GO annotation |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
GO::AnnotatedGene |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
The GO::AnnotatedGene package allows creation of objects that contains |
47
|
|
|
|
|
|
|
the details of a gene as determined from a gene_associations file. |
48
|
|
|
|
|
|
|
Typically these objects will contain the following information: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Column Cardinality Contents |
51
|
|
|
|
|
|
|
------ ----------- ------------------------------------------------------------- |
52
|
|
|
|
|
|
|
1 1 Database identifier of the annotated gene |
53
|
|
|
|
|
|
|
2 1 Standard name of the annotated gene |
54
|
|
|
|
|
|
|
9 0,1 Name of the product of the annotated gene |
55
|
|
|
|
|
|
|
10 0,n Alias(es) of the annotated gene |
56
|
|
|
|
|
|
|
11 1 type of the annotated gene (one of gene, transcript, protein) |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Further details can be found at: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
http://www.geneontology.org/doc/GO.annotation.html#file |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
It is expected that AnnotatedGene objects will typically be created by |
64
|
|
|
|
|
|
|
concrete subclasses of AnnotationProvider |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 TODO |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
A lot.... |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
1
|
|
41
|
use vars qw ($PACKAGE $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
616
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$PACKAGE = "GO::AnnotatedGene"; |
75
|
|
|
|
|
|
|
$VERSION = "0.11"; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# CLASS Attributes |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
# These should be considered as constants, and are initialized here |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $kDatabaseId = $PACKAGE.'::__databaseId'; |
82
|
|
|
|
|
|
|
my $kStandardName = $PACKAGE.'::__standardName'; |
83
|
|
|
|
|
|
|
my $kType = $PACKAGE.'::__type'; |
84
|
|
|
|
|
|
|
my $kProductName = $PACKAGE.'::__productName'; |
85
|
|
|
|
|
|
|
my $kAliases = $PACKAGE.'::__aliases'; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=pod |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 Constructor |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
############################################################################ |
94
|
|
|
|
|
|
|
sub new{ |
95
|
|
|
|
|
|
|
############################################################################ |
96
|
|
|
|
|
|
|
=pod |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 new |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is the constructor for a GO::AnnotatedGene object |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
It expects to receive the following named arguments: |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
databaseId : The databaseId of the annotated gene |
105
|
|
|
|
|
|
|
standardName : The standardName of the annotated gene |
106
|
|
|
|
|
|
|
type : The type of the annotated gene (one of gene, transcript, protein) |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
In addition, the following optional arguments may also be provided: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
productName : The name of the product of the annotated gene |
111
|
|
|
|
|
|
|
aliases : A reference to an array of aliases |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Usage: |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
my $annotatedGene = GO::AnnotatedGene->new(databaseId => $databaseId, |
116
|
|
|
|
|
|
|
standardName => $standardName, |
117
|
|
|
|
|
|
|
type => $type, |
118
|
|
|
|
|
|
|
productName => $productName, |
119
|
|
|
|
|
|
|
aliases => $aliases); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
|
123
|
5
|
|
|
5
|
1
|
221
|
my $self = {}; |
124
|
|
|
|
|
|
|
|
125
|
5
|
|
|
|
|
11
|
my $class = shift; |
126
|
|
|
|
|
|
|
|
127
|
5
|
|
|
|
|
12
|
bless $self, $class; |
128
|
|
|
|
|
|
|
|
129
|
5
|
|
|
|
|
18
|
$self->__init(@_); |
130
|
|
|
|
|
|
|
|
131
|
2
|
|
|
|
|
8
|
return $self; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
############################################################################ |
136
|
|
|
|
|
|
|
sub __init{ |
137
|
|
|
|
|
|
|
############################################################################ |
138
|
|
|
|
|
|
|
# This private method initializes the object, dependent on what arguments |
139
|
|
|
|
|
|
|
# have been received. |
140
|
|
|
|
|
|
|
# |
141
|
|
|
|
|
|
|
|
142
|
5
|
|
|
5
|
|
30
|
my ($self, %args) = @_; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# check required arguments |
145
|
|
|
|
|
|
|
|
146
|
5
|
|
66
|
|
|
24
|
my $databaseId = $args{'databaseId'} || $self->_handleMissingArgument(argument => 'databaseId'); |
147
|
4
|
|
66
|
|
|
19
|
my $standardName = $args{'standardName'} || $self->_handleMissingArgument(argument => 'standardName'); |
148
|
3
|
|
66
|
|
|
14
|
my $type = $args{'type'} || $self->_handleMissingArgument(argument => 'type'); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# store them |
151
|
|
|
|
|
|
|
|
152
|
2
|
|
|
|
|
14
|
$self->{$kDatabaseId} = $databaseId; |
153
|
2
|
|
|
|
|
7
|
$self->{$kStandardName} = $standardName; |
154
|
2
|
|
|
|
|
6
|
$self->{$kType} = $type; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# now check and store optional arguments |
157
|
|
|
|
|
|
|
|
158
|
2
|
100
|
66
|
|
|
17
|
if (exists ($args{'productName'}) && defined ($args{'productName'})){ |
159
|
|
|
|
|
|
|
|
160
|
1
|
|
|
|
|
5
|
$self->{$kProductName} = $args{'productName'}; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
}else{ |
163
|
|
|
|
|
|
|
|
164
|
1
|
|
|
|
|
4
|
$self->{$kProductName} = undef; |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
2
|
100
|
66
|
|
|
14
|
if (exists ($args{'aliases'}) && defined ($args{'aliases'})){ |
169
|
|
|
|
|
|
|
|
170
|
1
|
|
|
|
|
7
|
$self->{$kAliases} = $args{'aliases'}; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
}else{ |
173
|
|
|
|
|
|
|
|
174
|
1
|
|
|
|
|
7
|
$self->{$kAliases} = []; # default to an empty list |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=pod |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 Public Instance Methods |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=cut |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
############################################################################ |
187
|
|
|
|
|
|
|
sub databaseId{ |
188
|
|
|
|
|
|
|
############################################################################ |
189
|
|
|
|
|
|
|
=pod |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 databaseId |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This public instance method returns the databaseId. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Usage : |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
my $databaseId = $annotatedGene->databaseId; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |
200
|
|
|
|
|
|
|
|
201
|
1
|
|
|
1
|
1
|
354
|
return $_[0]->{$kDatabaseId}; |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
############################################################################ |
206
|
|
|
|
|
|
|
sub standardName{ |
207
|
|
|
|
|
|
|
############################################################################ |
208
|
|
|
|
|
|
|
=pod |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 standardName |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
This public instance method returns the standardName. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Usage: |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
my $standardName = $annotatedGene->standardName; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=cut |
219
|
|
|
|
|
|
|
|
220
|
1
|
|
|
1
|
1
|
5
|
return $_[0]->{$kStandardName}; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
############################################################################ |
225
|
|
|
|
|
|
|
sub type{ |
226
|
|
|
|
|
|
|
############################################################################ |
227
|
|
|
|
|
|
|
=pod |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 type |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
This public instance method returns the type of the annotated gene. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Usage: |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
my $type = $annotatedGene->type; |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=cut |
238
|
|
|
|
|
|
|
|
239
|
1
|
|
|
1
|
1
|
5
|
return $_[0]->{$kType}; |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
############################################################################ |
244
|
|
|
|
|
|
|
sub productName{ |
245
|
|
|
|
|
|
|
############################################################################ |
246
|
|
|
|
|
|
|
=pod |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head2 productName |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
This public instance method returns the product name of the annotated |
252
|
|
|
|
|
|
|
gene, if one exists. Otherwise it returns undef. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Usage: |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
my $productName = $annotatedGene->productName; |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=cut |
259
|
|
|
|
|
|
|
|
260
|
2
|
|
|
2
|
1
|
25
|
return $_[0]->{$kProductName}; |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
############################################################################ |
265
|
|
|
|
|
|
|
sub aliases{ |
266
|
|
|
|
|
|
|
############################################################################ |
267
|
|
|
|
|
|
|
=pod |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head2 aliases |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
This public instance method returns an array of aliases for the |
272
|
|
|
|
|
|
|
annotated gene. If no aliases exist, then an empty array will be |
273
|
|
|
|
|
|
|
returned. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Usage: |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
my @aliases = $annotatedGene->aliases; |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut |
280
|
|
|
|
|
|
|
|
281
|
3
|
|
|
3
|
1
|
4
|
return @{$_[0]->{$kAliases}}; |
|
3
|
|
|
|
|
20
|
|
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=pod |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head1 Protected Methods |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=cut |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
# need to make this code common to all objects, or to |
292
|
|
|
|
|
|
|
# start using something like Params-Validate |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
############################################################################ |
295
|
|
|
|
|
|
|
sub _handleMissingArgument{ |
296
|
|
|
|
|
|
|
############################################################################ |
297
|
|
|
|
|
|
|
=pod |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head2 _handleMissingArgument |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
This protected method simply provides a simple way for concrete |
302
|
|
|
|
|
|
|
subclasses to deal with missing arguments from method calls. It will |
303
|
|
|
|
|
|
|
die with an appropriate error message. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Usage: |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
$self->_handleMissingArgument(argument=>'blah'); |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
############################################################################## |
311
|
|
|
|
|
|
|
|
312
|
3
|
|
|
3
|
|
11
|
my ($self, %args) = @_; |
313
|
|
|
|
|
|
|
|
314
|
3
|
|
33
|
|
|
11
|
my $arg = $args{'argument'} || $self->_handleMissingArgument(argument=>'argument'); |
315
|
|
|
|
|
|
|
|
316
|
3
|
|
|
|
|
22
|
my $receiver = (caller(1))[3]; |
317
|
3
|
|
|
|
|
17
|
my $caller = (caller(2))[3]; |
318
|
|
|
|
|
|
|
|
319
|
3
|
|
|
|
|
38
|
die "The method $caller did not provide a value for the '$arg' argument for the $receiver method"; |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
1; # to keep Perl happy |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=pod |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=head1 AUTHOR |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
Gavin Sherlock, sherlock@genome.stanford.edu |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=cut |