line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: GeneProduct.pm,v 1.11 2007/09/13 12:44:47 girlwithglasses 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::Model::GeneProduct; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
GO::Model::GeneProduct; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
represents a gene product in a particular species (this will |
19
|
|
|
|
|
|
|
effectively always be refered to implicitly by the gene symbol even |
20
|
|
|
|
|
|
|
though a gene may have >1 product) |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
24
|
|
|
24
|
|
162
|
use Carp; |
|
24
|
|
|
|
|
48
|
|
|
24
|
|
|
|
|
2937
|
|
26
|
24
|
|
|
24
|
|
141
|
use Exporter; |
|
24
|
|
|
|
|
41
|
|
|
24
|
|
|
|
|
908
|
|
27
|
24
|
|
|
24
|
|
123
|
use GO::Utils qw(rearrange); |
|
24
|
|
|
|
|
44
|
|
|
24
|
|
|
|
|
1036
|
|
28
|
24
|
|
|
24
|
|
209
|
use GO::Model::Root; |
|
24
|
|
|
|
|
177
|
|
|
24
|
|
|
|
|
768
|
|
29
|
24
|
|
|
24
|
|
119
|
use strict; |
|
24
|
|
|
|
|
48
|
|
|
24
|
|
|
|
|
848
|
|
30
|
24
|
|
|
24
|
|
112
|
use vars qw(@ISA); |
|
24
|
|
|
|
|
41
|
|
|
24
|
|
|
|
|
1041
|
|
31
|
24
|
|
|
24
|
|
126
|
use Data::Dumper; |
|
24
|
|
|
|
|
63
|
|
|
24
|
|
|
|
|
65148
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
@ISA = qw(GO::Model::Root Exporter); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _valid_params { |
36
|
982
|
|
|
982
|
|
4201
|
return qw(id acc symbol properties full_name type_id type xref speciesdb synonym_list seq_list species); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _initialize |
40
|
|
|
|
|
|
|
{ |
41
|
33
|
|
|
33
|
|
57
|
my $self = shift; |
42
|
33
|
|
|
|
|
57
|
my $paramh = shift; |
43
|
|
|
|
|
|
|
|
44
|
33
|
|
|
|
|
55
|
my $db; |
45
|
33
|
50
|
|
|
|
209
|
if ($paramh->{speciesdb}) { |
46
|
33
|
|
|
|
|
85
|
$db = $paramh->{speciesdb}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
0
|
|
|
|
|
0
|
$db = $paramh->{xref_dbname}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
33
|
|
|
|
|
330
|
my $xref = |
53
|
|
|
|
|
|
|
GO::Model::Xref->new({xref_key=>$paramh->{acc}, |
54
|
|
|
|
|
|
|
xref_keytype=>"acc", |
55
|
|
|
|
|
|
|
xref_dbname=>$db}); |
56
|
|
|
|
|
|
|
|
57
|
33
|
|
|
|
|
774
|
$self->xref($xref); |
58
|
33
|
|
|
|
|
91
|
delete $paramh->{acc}; |
59
|
33
|
|
|
|
|
85
|
delete $paramh->{speciesdb}; |
60
|
|
|
|
|
|
|
|
61
|
33
|
|
|
|
|
122
|
$self->SUPER::_initialize($paramh); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 acc |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Usage - |
67
|
|
|
|
|
|
|
Returns - |
68
|
|
|
|
|
|
|
Args - |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub acc { |
73
|
477
|
|
|
477
|
1
|
573
|
my $self = shift; |
74
|
477
|
|
|
|
|
580
|
my $acc = shift; |
75
|
477
|
50
|
|
|
|
810
|
if ($acc) { |
76
|
0
|
|
|
|
|
0
|
$self->xref->xref_key($acc); |
77
|
|
|
|
|
|
|
} |
78
|
477
|
|
|
|
|
2659
|
return $self->xref->xref_key; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 symbol |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Usage - |
85
|
|
|
|
|
|
|
Returns - |
86
|
|
|
|
|
|
|
Args - |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# AUTOGENERATED |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 type |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Usage - |
95
|
|
|
|
|
|
|
Returns - |
96
|
|
|
|
|
|
|
Args - |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# AUTOGENERATED |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 full_name |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Usage - |
105
|
|
|
|
|
|
|
Returns - |
106
|
|
|
|
|
|
|
Args - |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# AUTOGENERATED |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 as_str |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Usage - |
115
|
|
|
|
|
|
|
Returns - |
116
|
|
|
|
|
|
|
Args - |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub as_str { |
121
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
122
|
0
|
|
|
|
|
|
return "GP-".$self->xref->as_str; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 add_synonym |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub add_synonym { |
130
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
131
|
0
|
0
|
|
|
|
|
if (!$self->{synonym_list}) { |
132
|
0
|
|
|
|
|
|
$self->{synonym_list} = []; |
133
|
|
|
|
|
|
|
} |
134
|
0
|
|
|
|
|
|
push(@{$self->{synonym_list}}, (shift)); |
|
0
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
return $self->{synonym_list}; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 synonym_list |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
accessor: gets/set list of synonyms [array reference] |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# AUTOGENERATED |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 speciesdb |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Usage - |
150
|
|
|
|
|
|
|
Returns - |
151
|
|
|
|
|
|
|
Args - |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub speciesdb { |
156
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
157
|
0
|
|
|
|
|
|
my $db = shift; |
158
|
0
|
0
|
|
|
|
|
if ($db) { |
159
|
0
|
|
|
|
|
|
$self->xref->xref_dbname ($db); |
160
|
|
|
|
|
|
|
} |
161
|
0
|
|
|
|
|
|
return $self->xref->xref_dbname; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 add_seq |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Usage - |
168
|
|
|
|
|
|
|
Returns - |
169
|
|
|
|
|
|
|
Args - GO::Model::Seq |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub add_seq { |
174
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
175
|
0
|
|
|
|
|
|
my $seq = shift; |
176
|
|
|
|
|
|
|
|
177
|
0
|
0
|
|
|
|
|
if ($seq->isa("Bio::SeqI")) { |
178
|
0
|
|
|
|
|
|
my $bpseq = $seq; |
179
|
0
|
|
|
|
|
|
$seq = GO::Model::Seq->new; |
180
|
0
|
|
|
|
|
|
$seq->pseq($bpseq); |
181
|
|
|
|
|
|
|
} |
182
|
0
|
0
|
|
|
|
|
$seq->isa("GO::Model::Seq") or confess ("Not a seq object"); |
183
|
0
|
0
|
|
|
|
|
$self->{seq_list} = [] unless $self->{seq_list}; |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
|
|
|
|
push(@{$self->{seq_list}}, $seq); |
|
0
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
$self->{seq_list}; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
#indicate fetching seqs has been done: no need to try even if no seq (see seq_list) |
190
|
|
|
|
|
|
|
sub _seqs_obtained { |
191
|
0
|
|
|
0
|
|
|
my $self = shift; |
192
|
0
|
0
|
|
|
|
|
$self->{_seqs_obtained} = shift if @_; |
193
|
0
|
|
|
|
|
|
return $self->{_seqs_obtained}; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 seq_list |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Usage - |
199
|
|
|
|
|
|
|
Returns - GO::Model::Seq listref |
200
|
|
|
|
|
|
|
Args - |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=cut |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub seq_list { |
205
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
206
|
0
|
0
|
|
|
|
|
if (@_) { |
207
|
0
|
|
|
|
|
|
$self->{seq_list} = shift; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
else { |
210
|
0
|
0
|
|
|
|
|
if (!defined($self->{seq_list})) { |
211
|
0
|
0
|
|
|
|
|
$self->{seq_list} = |
212
|
|
|
|
|
|
|
$self->apph->get_seqs({product=>$self}) unless ($self->_seqs_obtained); |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
} |
215
|
0
|
|
|
|
|
|
return $self->{seq_list}; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head2 seq |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Usage - |
222
|
|
|
|
|
|
|
Returns - GO::Model::Seq |
223
|
|
|
|
|
|
|
Args - |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
returns representative sequence object for this product |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub seq { |
230
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
231
|
0
|
|
|
|
|
|
my $seqs = $self->seq_list; |
232
|
0
|
|
|
|
|
|
my $str = ""; |
233
|
|
|
|
|
|
|
# longest by default |
234
|
0
|
|
|
|
|
|
my $longest; |
235
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
foreach my $seq (@$seqs) { |
237
|
0
|
0
|
0
|
|
|
|
if (!defined($longest) || $seq->length > $longest->length) { |
238
|
0
|
|
|
|
|
|
$longest = $seq; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
} |
241
|
0
|
|
|
|
|
|
return $longest; |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head2 properties |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Usage - |
247
|
|
|
|
|
|
|
Returns - hashref |
248
|
|
|
|
|
|
|
Args - hashref |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head2 set_property |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Usage - $sf->set_property("wibble", "on"); |
256
|
|
|
|
|
|
|
Returns - |
257
|
|
|
|
|
|
|
Args - property key, property scalar |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
note: the property is assumed to be multivalued, therefore |
260
|
|
|
|
|
|
|
$sf->set_property($k, $scalar) will add to the array, and |
261
|
|
|
|
|
|
|
$sf->set_property($k, $arrayref) will set the array |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=cut |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
sub set_property { |
266
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
267
|
0
|
|
|
|
|
|
my $p = shift; |
268
|
0
|
|
|
|
|
|
my $v = shift; |
269
|
0
|
0
|
|
|
|
|
if (!$self->properties) { |
270
|
0
|
|
|
|
|
|
$self->properties({}); |
271
|
|
|
|
|
|
|
} |
272
|
0
|
0
|
|
|
|
|
if (ref($v) eq 'ARRAY') { |
273
|
0
|
0
|
|
|
|
|
confess("@$v is not all scalar") if grep {ref($_)} @$v; |
|
0
|
|
|
|
|
|
|
274
|
0
|
|
|
|
|
|
$self->properties->{$p} = $v; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
else { |
277
|
0
|
|
|
|
|
|
push(@{$self->properties->{$p}}, $v); |
|
0
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
# uniqify |
280
|
0
|
|
|
|
|
|
my @vals = @{$self->properties->{$p}}; |
|
0
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
my %h = (); |
282
|
0
|
|
|
|
|
|
my @nu_vals = (); |
283
|
0
|
|
|
|
|
|
foreach (@vals) { |
284
|
0
|
0
|
|
|
|
|
next if $h{$_}; |
285
|
0
|
|
|
|
|
|
$h{$_} = 1; |
286
|
0
|
|
|
|
|
|
push(@nu_vals, $_); |
287
|
|
|
|
|
|
|
} |
288
|
0
|
|
|
|
|
|
$self->properties->{$p} = \@nu_vals; |
289
|
0
|
|
|
|
|
|
$v; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head2 get_property |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Usage - |
295
|
|
|
|
|
|
|
Returns - first element of the property |
296
|
|
|
|
|
|
|
Args - property key |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=cut |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
sub get_property { |
301
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
302
|
0
|
|
|
|
|
|
my $p = shift; |
303
|
0
|
0
|
|
|
|
|
if (!$self->properties) { |
304
|
0
|
|
|
|
|
|
$self->properties({}); |
305
|
|
|
|
|
|
|
} |
306
|
0
|
|
|
|
|
|
my $val = $self->properties->{$p}; |
307
|
0
|
0
|
|
|
|
|
if ($val) { |
308
|
0
|
|
|
|
|
|
$val = $val->[0]; |
309
|
|
|
|
|
|
|
} |
310
|
0
|
|
|
|
|
|
return $val; |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=head2 get_property_list |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Usage - |
316
|
|
|
|
|
|
|
Returns - the property arrayref |
317
|
|
|
|
|
|
|
Args - property key |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub get_property_list { |
322
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
323
|
0
|
|
|
|
|
|
my $p = shift; |
324
|
0
|
0
|
|
|
|
|
if (!$self->properties) { |
325
|
0
|
|
|
|
|
|
$self->properties({}); |
326
|
|
|
|
|
|
|
} |
327
|
0
|
|
|
|
|
|
$self->properties->{$p}; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=head2 to_fasta |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
Usage - |
334
|
|
|
|
|
|
|
Returns - |
335
|
|
|
|
|
|
|
Args - |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
returns the longest seq by default |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=cut |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
sub to_fasta { |
342
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
343
|
0
|
|
|
|
|
|
my ($fullhdr, $hdrinfo, $gethdr) = |
344
|
|
|
|
|
|
|
rearrange([qw(fullheader headerinfo getheader)], @_); |
345
|
0
|
|
0
|
|
|
|
$hdrinfo = " " . ($hdrinfo || ""); |
346
|
0
|
|
|
|
|
|
my $seqs = $self->seq_list; |
347
|
0
|
|
|
|
|
|
my $str = ""; |
348
|
|
|
|
|
|
|
# longest by default |
349
|
0
|
|
|
|
|
|
my $longest; |
350
|
|
|
|
|
|
|
|
351
|
0
|
0
|
|
|
|
|
return "" unless @{$seqs || []}; |
|
0
|
0
|
|
|
|
|
|
352
|
|
|
|
|
|
|
|
353
|
0
|
|
|
|
|
|
foreach my $seq (@$seqs) { |
354
|
0
|
0
|
0
|
|
|
|
if (!defined($longest) || $seq->length > $longest->length) { |
355
|
0
|
|
|
|
|
|
$longest = $seq; |
356
|
|
|
|
|
|
|
} |
357
|
|
|
|
|
|
|
} |
358
|
0
|
|
|
|
|
|
$seqs = [$longest]; |
359
|
0
|
0
|
|
|
|
|
if ($gethdr) { |
360
|
0
|
|
|
|
|
|
my $apph = $self->get_apph; |
361
|
0
|
|
|
|
|
|
my $terms = $apph->get_terms({product=>$self}); |
362
|
0
|
|
|
|
|
|
my @h_elts = (); |
363
|
0
|
|
|
|
|
|
foreach my $term (@$terms) { |
364
|
0
|
|
|
|
|
|
my $al = $term->selected_association_list; |
365
|
0
|
|
|
|
|
|
my %codes = (); |
366
|
0
|
|
|
|
|
|
map { $codes{$_->code} = 1 } map { @{$_->evidence_list} } @$al; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
push(@h_elts, |
368
|
|
|
|
|
|
|
sprintf("%s evidence=%s", |
369
|
|
|
|
|
|
|
$term->public_acc, |
370
|
|
|
|
|
|
|
join(";", keys %codes), |
371
|
|
|
|
|
|
|
) |
372
|
|
|
|
|
|
|
); |
373
|
|
|
|
|
|
|
} |
374
|
0
|
|
|
|
|
|
$hdrinfo = join(", ", @h_elts); |
375
|
|
|
|
|
|
|
} |
376
|
0
|
|
|
|
|
|
foreach my $seq (@$seqs) { |
377
|
0
|
|
|
|
|
|
my $desc; |
378
|
0
|
0
|
|
|
|
|
if ($fullhdr) { |
379
|
0
|
|
|
|
|
|
$desc = $fullhdr; |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
else { |
382
|
0
|
|
|
|
|
|
$desc = |
383
|
|
|
|
|
|
|
sprintf("%s|%s symbol:%s %s %s %s", |
384
|
|
|
|
|
|
|
uc($self->xref->xref_dbname), |
385
|
|
|
|
|
|
|
$self->xref->xref_key, |
386
|
|
|
|
|
|
|
$self->symbol, |
387
|
|
|
|
|
|
|
$self->species ? sprintf("species:%s \"%s\"", $self->species->ncbi_taxa_id, $self->species->binomial) : '-', |
388
|
|
|
|
|
|
|
$hdrinfo, |
389
|
|
|
|
|
|
|
join(" ", |
390
|
0
|
0
|
|
|
|
|
map {$_->as_str} @{$seq->xref_list || []}) |
|
0
|
0
|
|
|
|
|
|
391
|
|
|
|
|
|
|
); |
392
|
|
|
|
|
|
|
} |
393
|
0
|
|
|
|
|
|
$seq->description($desc); |
394
|
0
|
|
|
|
|
|
$str.= $seq->to_fasta; |
395
|
|
|
|
|
|
|
} |
396
|
0
|
|
|
|
|
|
return $str; |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
sub to_idl_struct { |
400
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
401
|
|
|
|
|
|
|
return |
402
|
|
|
|
|
|
|
{ |
403
|
0
|
|
|
|
|
|
"symbol"=>$self->symbol, |
404
|
|
|
|
|
|
|
"full_name"=>$self->full_name, |
405
|
|
|
|
|
|
|
"acc"=>$self->xref->xref_key, |
406
|
|
|
|
|
|
|
"speciesdb"=>$self->xref->xref_dbname, |
407
|
|
|
|
|
|
|
}; |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
sub to_ptuples { |
411
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
412
|
0
|
|
|
|
|
|
my ($th) = |
413
|
|
|
|
|
|
|
rearrange([qw(tuples)], @_); |
414
|
0
|
|
|
|
|
|
my @s = (); |
415
|
0
|
|
|
|
|
|
push(@s, |
416
|
|
|
|
|
|
|
["product", |
417
|
|
|
|
|
|
|
$self->xref->as_str, |
418
|
|
|
|
|
|
|
$self->symbol, |
419
|
|
|
|
|
|
|
$self->full_name, |
420
|
|
|
|
|
|
|
]); |
421
|
0
|
|
|
|
|
|
push(@s, $self->xref->to_ptuples(-tuples=>$th)); |
422
|
0
|
|
|
|
|
|
@s; |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
# **** EXPERIMENTAL CODE **** |
426
|
|
|
|
|
|
|
# the idea is to be homogeneous and use graphs for |
427
|
|
|
|
|
|
|
# everything; eg gene products are nodes in a graph, |
428
|
|
|
|
|
|
|
# associations are arcs |
429
|
|
|
|
|
|
|
# cf rdf, daml+oil etc |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
# args - optional graph to add to |
432
|
|
|
|
|
|
|
sub graphify { |
433
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
434
|
0
|
|
|
|
|
|
my ($ref, $subg, $opts) = |
435
|
|
|
|
|
|
|
rearrange([qw(ref graph opts)], @_); |
436
|
|
|
|
|
|
|
|
437
|
0
|
0
|
|
|
|
|
$opts = {} unless $opts; |
438
|
0
|
0
|
|
|
|
|
$subg = $self->apph->create_graph_obj unless $subg; |
439
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
my $t = |
441
|
|
|
|
|
|
|
$self->apph->create_term_obj({name=>$self->as_str, |
442
|
|
|
|
|
|
|
acc=>$self->as_str}); |
443
|
0
|
|
|
|
|
|
$subg->add_node($t); |
444
|
0
|
|
|
|
|
|
$subg->add_arc($t, $ref, "hasProduct"); |
445
|
0
|
|
|
|
|
|
return $subg; |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
1; |