line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: ObjFactory.pm,v 1.6 2007/01/24 01:16:19 cmungall Exp $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This GO module is maintained by Chris Mungall |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# see also - http://www.geneontology.org |
6
|
|
|
|
|
|
|
# - http://www.godatabase.org/dev |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package GO::ObjFactory; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
GO::ObjFactory - GO Object Factory |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
You should not use this method directly |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
You only need to be aware of this class if you are generating new |
23
|
|
|
|
|
|
|
objects. You should not directly create objects like this: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$term = GO::Model::Term->new($h); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Instead you should create them like this: |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$fac = GO::ObjFactory->new(); |
30
|
|
|
|
|
|
|
$term = $fac->create_term_obj($h); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Usually you do not need to instantiate a factory, as all objects |
33
|
|
|
|
|
|
|
created with a factory carry around a reference to that factory, so |
34
|
|
|
|
|
|
|
you can do this: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# $graph object was previously created via a factory |
37
|
|
|
|
|
|
|
$term = $graph->create_term_obj($h); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
If you are only using the go-perl module, then factories do not buy |
40
|
|
|
|
|
|
|
you much. However, if you are also using go-db-perl and GO::AppHandle, |
41
|
|
|
|
|
|
|
then factories can be useful - all objects generated from the database |
42
|
|
|
|
|
|
|
will be attached to an AppHandle which means that "lazy loading" can |
43
|
|
|
|
|
|
|
be used. See GO::AppHandle in go-db-perl for details |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
14
|
|
|
14
|
|
75
|
use strict; |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
468
|
|
49
|
14
|
|
|
14
|
|
72
|
use Carp; |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
768
|
|
50
|
14
|
|
|
14
|
|
6714
|
use GO::Model::Seq; |
|
14
|
|
|
|
|
33
|
|
|
14
|
|
|
|
|
718
|
|
51
|
14
|
|
|
14
|
|
1236
|
use GO::Model::Term; |
|
14
|
|
|
|
|
32
|
|
|
14
|
|
|
|
|
654
|
|
52
|
14
|
|
|
14
|
|
85
|
use GO::Model::Xref; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
472
|
|
53
|
14
|
|
|
14
|
|
75
|
use GO::Model::GeneProduct; |
|
14
|
|
|
|
|
70
|
|
|
14
|
|
|
|
|
477
|
|
54
|
14
|
|
|
14
|
|
12816
|
use GO::Model::CrossProduct; |
|
14
|
|
|
|
|
39
|
|
|
14
|
|
|
|
|
663
|
|
55
|
14
|
|
|
14
|
|
18473
|
use GO::Model::LogicalDefinition; |
|
14
|
|
|
|
|
40
|
|
|
14
|
|
|
|
|
710
|
|
56
|
14
|
|
|
14
|
|
127
|
use GO::Model::Graph; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
451
|
|
57
|
14
|
|
|
14
|
|
6271
|
use GO::Model::DB; |
|
14
|
|
|
|
|
200
|
|
|
14
|
|
|
|
|
670
|
|
58
|
14
|
|
|
14
|
|
9497
|
use GO::Model::Ontology; |
|
14
|
|
|
|
|
37
|
|
|
14
|
|
|
|
|
404
|
|
59
|
14
|
|
|
14
|
|
5504
|
use GO::Model::Property; |
|
14
|
|
|
|
|
36
|
|
|
14
|
|
|
|
|
599
|
|
60
|
14
|
|
|
14
|
|
6013
|
use GO::Model::Restriction; |
|
14
|
|
|
|
|
35
|
|
|
14
|
|
|
|
|
974
|
|
61
|
14
|
|
|
14
|
|
5970
|
use GO::Model::Species; |
|
14
|
|
|
|
|
39
|
|
|
14
|
|
|
|
|
1042
|
|
62
|
14
|
|
|
14
|
|
84
|
use base qw(GO::Model::Root); |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
14286
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub apph{ |
65
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
66
|
0
|
0
|
|
|
|
0
|
$self->{apph} = shift if @_; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
0
|
|
|
0
|
my $apph = $self->{apph} || $self; |
69
|
0
|
|
|
|
|
0
|
return $apph; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 create_term_obj |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Usage - $term = $apph->create_term_obj; |
78
|
|
|
|
|
|
|
Returns - L |
79
|
|
|
|
|
|
|
Args - |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub create_term_obj { |
84
|
1409
|
|
|
1409
|
1
|
2131
|
my $self = shift; |
85
|
1409
|
|
|
|
|
4767
|
my $term = GO::Model::Term->new(@_); |
86
|
1409
|
|
|
|
|
4307
|
$term->apph( $self->apph ); |
87
|
1409
|
|
|
|
|
3054
|
return $term; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 create_relationship_obj |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Usage - $relationship = $apph->create_relationship_obj; |
93
|
|
|
|
|
|
|
Returns - L |
94
|
|
|
|
|
|
|
Args - |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub create_relationship_obj { |
99
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
100
|
0
|
|
|
|
|
0
|
my $term = GO::Model::Relationship->new(@_); |
101
|
0
|
|
|
|
|
0
|
$term->apph( $self->apph ); |
102
|
0
|
|
|
|
|
0
|
return $term; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 create_xref_obj |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Usage - $xref = $apph->create_xref_obj; |
108
|
|
|
|
|
|
|
Returns - L |
109
|
|
|
|
|
|
|
Args - |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub create_xref_obj { |
114
|
808
|
|
|
808
|
1
|
37870
|
my $self = shift; |
115
|
808
|
|
|
|
|
2864
|
my $xref = GO::Model::Xref->new(@_); |
116
|
|
|
|
|
|
|
# $xref->apph($self); |
117
|
808
|
|
|
|
|
1928
|
return $xref; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 create_evidence_obj |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Usage - $evidence = $apph->create_evidence_obj; |
123
|
|
|
|
|
|
|
Returns - L |
124
|
|
|
|
|
|
|
Args - |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub create_evidence_obj { |
129
|
201
|
|
|
201
|
1
|
14257
|
my $self = shift; |
130
|
201
|
|
|
|
|
678
|
my $ev = GO::Model::Evidence->new(@_); |
131
|
201
|
|
|
|
|
467
|
return $ev; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 create_seq_obj |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Usage - $seq = $apph->create_seq_obj; |
137
|
|
|
|
|
|
|
Returns - L |
138
|
|
|
|
|
|
|
Args - |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub create_seq_obj { |
143
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
144
|
0
|
|
|
|
|
0
|
my $seq = GO::Model::Seq->new(@_); |
145
|
0
|
|
|
|
|
0
|
$seq->apph( $self->apph ); |
146
|
0
|
|
|
|
|
0
|
return $seq; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 create_db_obj |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Usage - $db = $apph->create_db_obj; |
152
|
|
|
|
|
|
|
Returns - L |
153
|
|
|
|
|
|
|
Args - |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub create_db_obj { |
158
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
159
|
0
|
|
|
|
|
0
|
my $db = GO::Model::DB->new(@_); |
160
|
0
|
|
|
|
|
0
|
$db->apph( $self->apph ); |
161
|
0
|
|
|
|
|
0
|
return $db; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 create_association_obj |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Usage - $association = $apph->create_association_obj; |
167
|
|
|
|
|
|
|
Returns - L |
168
|
|
|
|
|
|
|
Args - |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub create_association_obj { |
173
|
173
|
|
|
173
|
1
|
20517
|
my $self = shift; |
174
|
173
|
|
|
|
|
769
|
my $association = GO::Model::Association->new(); |
175
|
173
|
|
|
|
|
579
|
$association->apph( $self->apph ); |
176
|
173
|
|
|
|
|
567
|
$association->_initialize(@_); |
177
|
173
|
|
|
|
|
895
|
return $association; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 create_gene_product_obj |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Usage - $gene_product = $apph->create_gene_product_obj; |
183
|
|
|
|
|
|
|
Synonym - create_product_obj |
184
|
|
|
|
|
|
|
Returns - L |
185
|
|
|
|
|
|
|
Args - |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub create_gene_product_obj { |
190
|
33
|
|
|
33
|
1
|
66
|
my $self = shift; |
191
|
33
|
|
|
|
|
239
|
my $gene_product = GO::Model::GeneProduct->new(@_); |
192
|
33
|
|
|
|
|
193
|
$gene_product->apph( $self->apph ); |
193
|
33
|
|
|
|
|
89
|
return $gene_product; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
*create_product_obj = \&create_gene_product_obj; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 create_species_obj |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Usage - $species = $apph->create_species_obj; |
200
|
|
|
|
|
|
|
Returns - L |
201
|
|
|
|
|
|
|
Args - |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub create_species_obj { |
206
|
33
|
|
|
33
|
1
|
76
|
my $self = shift; |
207
|
33
|
|
|
|
|
161
|
my $sp = GO::Model::Species->new(@_); |
208
|
33
|
|
|
|
|
127
|
$sp->apph( $self->apph ); |
209
|
33
|
|
|
|
|
80
|
return $sp; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 create_graph_obj |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Usage - $graph = $apph->create_graph_obj; |
215
|
|
|
|
|
|
|
Returns - L |
216
|
|
|
|
|
|
|
Args - |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=cut |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
sub create_graph_obj { |
221
|
14
|
|
|
14
|
1
|
34
|
my $self = shift; |
222
|
14
|
|
|
|
|
102
|
my $graph = GO::Model::Graph->new(@_); |
223
|
14
|
|
|
|
|
75
|
$graph->apph( $self->apph ); |
224
|
14
|
|
|
|
|
39
|
return $graph; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
# deprecated synonym for Graph |
228
|
|
|
|
|
|
|
sub create_ontology_obj { |
229
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
230
|
0
|
|
|
|
|
0
|
my $ontology = GO::Model::Ontology->new(@_); |
231
|
0
|
|
|
|
|
0
|
$ontology->apph( $self->apph ); |
232
|
0
|
|
|
|
|
0
|
return $ontology; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# alpha code |
236
|
|
|
|
|
|
|
sub create_property_obj { |
237
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
238
|
0
|
|
|
|
|
0
|
my $property = GO::Model::Property->new(@_); |
239
|
0
|
|
|
|
|
0
|
$property->apph( $self->apph ); |
240
|
0
|
|
|
|
|
0
|
return $property; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
# alpha code |
245
|
|
|
|
|
|
|
sub create_restriction_obj { |
246
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
247
|
0
|
|
|
|
|
0
|
my $restriction = GO::Model::Restriction->new(@_); |
248
|
0
|
|
|
|
|
0
|
$restriction->apph( $self->apph ); |
249
|
0
|
|
|
|
|
0
|
return $restriction; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub create_logical_definition_obj { |
253
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
254
|
2
|
|
|
|
|
16
|
my $ldef = GO::Model::LogicalDefinition->new(@_); |
255
|
2
|
|
|
|
|
7
|
$ldef->apph( $self->apph ); |
256
|
2
|
|
|
|
|
5
|
return $ldef; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# experimental/deprecated code |
261
|
|
|
|
|
|
|
sub create_cross_product_obj { |
262
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
263
|
0
|
|
|
|
|
|
my $cross_product = GO::Model::CrossProduct->new(@_); |
264
|
0
|
|
|
|
|
|
$cross_product->apph( $self->apph ); |
265
|
0
|
|
|
|
|
|
return $cross_product; |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
1; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|