| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# $Id: Evidence.pm,v 1.5 2009/05/22 23:06:40 sjcarbon 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
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package GO::Model::Evidence; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
GO::Model::Evidence; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $ev_l = $association->evidence_list; |
|
20
|
|
|
|
|
|
|
foreach my $ev (@$ev_l) { |
|
21
|
|
|
|
|
|
|
print "Evidence for association %s : %s\n", |
|
22
|
|
|
|
|
|
|
$association->gene_product->symbol, |
|
23
|
|
|
|
|
|
|
$ev->code; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
evidence for an association |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
see http://www.geneontology.org/GO.evidence.html |
|
31
|
|
|
|
|
|
|
for a list of evidence codes |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
24
|
|
|
24
|
|
126
|
use Carp qw(confess cluck); |
|
|
24
|
|
|
|
|
43
|
|
|
|
24
|
|
|
|
|
1805
|
|
|
37
|
24
|
|
|
24
|
|
152
|
use Exporter; |
|
|
24
|
|
|
|
|
40
|
|
|
|
24
|
|
|
|
|
892
|
|
|
38
|
24
|
|
|
24
|
|
152
|
use GO::Utils qw(rearrange); |
|
|
24
|
|
|
|
|
48
|
|
|
|
24
|
|
|
|
|
1486
|
|
|
39
|
24
|
|
|
24
|
|
133
|
use GO::Model::Root; |
|
|
24
|
|
|
|
|
37
|
|
|
|
24
|
|
|
|
|
523
|
|
|
40
|
24
|
|
|
24
|
|
153
|
use strict; |
|
|
24
|
|
|
|
|
62
|
|
|
|
24
|
|
|
|
|
1076
|
|
|
41
|
24
|
|
|
24
|
|
358
|
use vars qw(@ISA); |
|
|
24
|
|
|
|
|
69
|
|
|
|
24
|
|
|
|
|
53172
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
@ISA = qw(GO::Model::Root Exporter); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _valid_params { |
|
47
|
402
|
|
|
402
|
|
1428
|
return qw(id code seq_acc xref seq_xref_list pub_xref_list); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 code |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Usage - $ev->code("IEA"); |
|
53
|
|
|
|
|
|
|
Returns - |
|
54
|
|
|
|
|
|
|
Args - |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
gets/sets the evidence code |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
see http://www.geneontology.org/GO.evidence.html |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# dynamic method |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 seq_acc |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Usage - |
|
67
|
|
|
|
|
|
|
Returns - |
|
68
|
|
|
|
|
|
|
Args - |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
gets/sets the sequence accesion GO::Model::Xref |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
ALPHA CODE - API may change |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
used to set the GO::Model::Xref list from a text string. eg |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$ev->seq_acc("SGD:RRP41; SGDID:L0003550"); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
will actually add two GO::Model::Xref objects |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This method doesnt really belong in the GO::Model::* hierarchy as it |
|
81
|
|
|
|
|
|
|
contains parsing code. Its a minor hack mainly due to the fact that |
|
82
|
|
|
|
|
|
|
this data is still denormalized in the database. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub seq_acc { |
|
87
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
88
|
0
|
0
|
|
|
|
0
|
if (@_) { |
|
89
|
0
|
|
|
|
|
0
|
my $acc = shift; |
|
90
|
0
|
0
|
|
|
|
0
|
if (ref($acc)) { |
|
91
|
0
|
0
|
|
|
|
0
|
if (ref($acc) eq "ARRAY") { |
|
92
|
0
|
|
|
|
|
0
|
foreach (@$acc) { |
|
93
|
0
|
|
|
|
|
0
|
$self->add_seq_xref($_); |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
else { |
|
97
|
0
|
0
|
|
|
|
0
|
if (UNIVERSAL::isa($acc, "GO::Model::Xref")) { |
|
98
|
0
|
|
|
|
|
0
|
$self->add_seq_xref($acc) |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
else { |
|
101
|
0
|
|
|
|
|
0
|
confess("$acc is not a valid argument for $self -> seq_acc()"); |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
else { |
|
106
|
|
|
|
|
|
|
# it's a string |
|
107
|
0
|
|
|
|
|
0
|
my @accs = |
|
108
|
|
|
|
|
|
|
split(/\;/, $acc); |
|
109
|
0
|
|
|
|
|
0
|
foreach my $acc (@accs) { |
|
110
|
0
|
|
|
|
|
0
|
$self->add_seq_xref($acc); |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
return |
|
115
|
0
|
|
|
|
|
0
|
join("; ", |
|
116
|
0
|
0
|
|
|
|
0
|
map {$_->as_str} @{$self->seq_xref_list || []}); |
|
|
0
|
|
|
|
|
0
|
|
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 add_seq_xref |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Usage - |
|
123
|
|
|
|
|
|
|
Returns - |
|
124
|
|
|
|
|
|
|
Args - |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
equivalent to WITH column in gene_association files, and evidence_dbxref tables in db |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub add_seq_xref { |
|
131
|
84
|
|
|
84
|
1
|
123
|
my $self = shift; |
|
132
|
84
|
|
|
|
|
98
|
my $xref = shift; |
|
133
|
84
|
100
|
|
|
|
186
|
if (ref($xref)) { |
|
134
|
42
|
50
|
|
|
|
143
|
if (UNIVERSAL::isa($xref, "GO::Model::Xref")) { |
|
135
|
42
|
100
|
|
|
|
153
|
$self->{seq_xref_list} = [] unless $self->{seq_xref_list}; |
|
136
|
42
|
|
|
|
|
52
|
push(@{$self->{seq_xref_list}}, $xref); |
|
|
42
|
|
|
|
|
194
|
|
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
else { |
|
139
|
0
|
|
|
|
|
0
|
confess("$xref is not a valid argument for $self -> add_seq_xref()"); |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
else { |
|
143
|
|
|
|
|
|
|
# string maybe in db:acc format |
|
144
|
42
|
50
|
|
|
|
249
|
if ($xref =~ /\s*(\S+?):(\S+)/) { |
|
145
|
42
|
|
|
|
|
144
|
my ($db, $acc) = ($1, $2); |
|
146
|
42
|
|
|
|
|
219
|
$acc =~ s/ *$//; |
|
147
|
42
|
|
|
|
|
227
|
$xref = |
|
148
|
|
|
|
|
|
|
GO::Model::Xref->new({xref_dbname=>$db, |
|
149
|
|
|
|
|
|
|
xref_key=>$acc}); |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
else { |
|
152
|
0
|
|
|
|
|
0
|
$xref = |
|
153
|
|
|
|
|
|
|
GO::Model::Xref->new({xref_dbname=>"UNKNOWN", |
|
154
|
|
|
|
|
|
|
xref_key=>"$xref"}); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
42
|
50
|
|
|
|
211
|
confess("Assertion error") unless $xref->isa("GO::Model::Xref"); |
|
157
|
42
|
|
|
|
|
115
|
$self->add_seq_xref($xref); |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 add_pub_xref |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Usage - |
|
165
|
|
|
|
|
|
|
Returns - |
|
166
|
|
|
|
|
|
|
Args - |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub add_pub_xref { |
|
171
|
546
|
|
|
546
|
1
|
703
|
my $self = shift; |
|
172
|
546
|
|
|
|
|
682
|
my $xref = shift; |
|
173
|
546
|
100
|
|
|
|
1149
|
if (ref($xref)) { |
|
174
|
273
|
50
|
|
|
|
983
|
if (UNIVERSAL::isa($xref, "GO::Model::Xref")) { |
|
175
|
273
|
100
|
|
|
|
905
|
$self->{pub_xref_list} = [] unless $self->{pub_xref_list}; |
|
176
|
273
|
|
|
|
|
347
|
push(@{$self->{pub_xref_list}}, $xref); |
|
|
273
|
|
|
|
|
1287
|
|
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
else { |
|
179
|
0
|
|
|
|
|
0
|
confess("$xref is not a valid argument for $self -> add_pub_xref()"); |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
else { |
|
183
|
|
|
|
|
|
|
# string maybe in db:acc format |
|
184
|
273
|
50
|
|
|
|
1429
|
if ($xref =~ /\s*(\S+?):(\S+)/) { |
|
185
|
273
|
|
|
|
|
926
|
my ($db, $acc) = ($1, $2); |
|
186
|
273
|
|
|
|
|
1312
|
$acc =~ s/ *$//; |
|
187
|
273
|
|
|
|
|
7160
|
$xref = |
|
188
|
|
|
|
|
|
|
GO::Model::Xref->new({xref_dbname=>$db, |
|
189
|
|
|
|
|
|
|
xref_key=>$acc}); |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
else { |
|
192
|
0
|
|
|
|
|
0
|
$xref = |
|
193
|
|
|
|
|
|
|
GO::Model::Xref->new({xref_dbname=>"UNKNOWN", |
|
194
|
|
|
|
|
|
|
xref_key=>"$xref"}); |
|
195
|
|
|
|
|
|
|
} |
|
196
|
273
|
50
|
|
|
|
1560
|
confess("Assertion error") unless $xref->isa("GO::Model::Xref"); |
|
197
|
273
|
|
|
|
|
592
|
$self->add_pub_xref($xref); |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head2 xref |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Usage - |
|
204
|
|
|
|
|
|
|
Returns - |
|
205
|
|
|
|
|
|
|
Args - |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
gets/sets the literature or sequence reference GO::Model::Xref |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
NOTE: at some point we may want to deprecate this method and persuade |
|
210
|
|
|
|
|
|
|
API client code to call |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
$ev->literature_xref |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
instead, to make explicit the fact that this is a literature reference |
|
215
|
|
|
|
|
|
|
as opposed to a sequence reference |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
# dynamic method |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 xref_list |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Usage - |
|
225
|
|
|
|
|
|
|
Returns - GO::Model::Xref listref |
|
226
|
|
|
|
|
|
|
Args - |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
returns all (sequence and literature) references |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub xref_list { |
|
233
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
234
|
0
|
0
|
|
|
|
0
|
if (@_) { |
|
235
|
0
|
|
|
|
|
0
|
confess("get only"); |
|
236
|
|
|
|
|
|
|
} |
|
237
|
0
|
0
|
|
|
|
0
|
my @x = @{$self->pub_xref_list || []}; |
|
|
0
|
|
|
|
|
0
|
|
|
238
|
0
|
0
|
|
|
|
0
|
push(@x, @{$self->seq_xref_list || []}); |
|
|
0
|
|
|
|
|
0
|
|
|
239
|
0
|
|
|
|
|
0
|
return \@x; |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 xref |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Usage - |
|
246
|
|
|
|
|
|
|
Returns - |
|
247
|
|
|
|
|
|
|
Args - |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
deprected - sets first pub_xref_list |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub xref { |
|
254
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
255
|
0
|
0
|
|
|
|
0
|
if (@_) { |
|
256
|
0
|
|
|
|
|
0
|
$self->pub_xref_list([@_]); |
|
257
|
|
|
|
|
|
|
} |
|
258
|
0
|
0
|
|
|
|
0
|
$self->pub_xref_list && $self->pub_xref_list->[0]; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head2 valid_codes |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Usage - print join("; ", GO::Model::Evidence->valid_codes); |
|
265
|
|
|
|
|
|
|
Returns - string array |
|
266
|
|
|
|
|
|
|
Args - |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
list of valid evidence codes |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=cut |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
## TODO: This should be fixed to get the values from the live DB. |
|
273
|
|
|
|
|
|
|
sub valid_codes { |
|
274
|
|
|
|
|
|
|
#qw(IMP IGI IPI ISS IDA IEP IEA TAS NAS ND NR); |
|
275
|
|
|
|
|
|
|
#qw(IC IDA IEP IGC IGI IMP IPI ISS NAS ND NR RCA TAS); |
|
276
|
|
|
|
|
|
|
## Latest scraped version: |
|
277
|
0
|
|
|
0
|
1
|
0
|
qw(EXP IC IDA IEA IEP IGC IGI IMP IPI ISA ISM ISO ISS NAS ND NR RCA TAS); |
|
278
|
|
|
|
|
|
|
} |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub _initialize |
|
282
|
|
|
|
|
|
|
{ |
|
283
|
|
|
|
|
|
|
|
|
284
|
201
|
|
|
201
|
|
263
|
my $self = shift; |
|
285
|
201
|
|
|
|
|
312
|
my $paramh = shift; |
|
286
|
201
|
50
|
|
|
|
447
|
if (!ref($paramh)) { |
|
287
|
0
|
|
|
|
|
0
|
confess("init param must be hash"); |
|
288
|
|
|
|
|
|
|
} |
|
289
|
201
|
50
|
|
|
|
503
|
if ($paramh->{reference}) { |
|
290
|
0
|
|
|
|
|
0
|
my ($db, @keyparts) = split (/:/, $paramh->{reference}); |
|
291
|
|
|
|
|
|
|
# usually there is only one : in the dbxref, but |
|
292
|
|
|
|
|
|
|
# MGI includes the dbname in the id, so their |
|
293
|
|
|
|
|
|
|
# dbxrefs look like this: |
|
294
|
|
|
|
|
|
|
# MGI:MGI:00000001 |
|
295
|
0
|
|
|
|
|
0
|
my $key = join(":", @keyparts); |
|
296
|
0
|
0
|
|
|
|
0
|
if (!$key) { |
|
297
|
0
|
|
|
|
|
0
|
$key = $db; |
|
298
|
0
|
|
|
|
|
0
|
$db = "U"; |
|
299
|
|
|
|
|
|
|
} |
|
300
|
|
|
|
|
|
|
else { |
|
301
|
0
|
|
|
|
|
0
|
($db) =~ tr/A-Z/a-z/; |
|
302
|
|
|
|
|
|
|
} |
|
303
|
0
|
|
|
|
|
0
|
my $xref = |
|
304
|
|
|
|
|
|
|
GO::Model::Xref->new({xref_key=>$key, |
|
305
|
|
|
|
|
|
|
xref_dbname=>$db}); |
|
306
|
|
|
|
|
|
|
|
|
307
|
0
|
|
|
|
|
0
|
$self->xref($xref); |
|
308
|
0
|
|
|
|
|
0
|
delete $paramh->{reference}; |
|
309
|
|
|
|
|
|
|
} |
|
310
|
201
|
|
|
|
|
622
|
$self->SUPER::_initialize($paramh); |
|
311
|
|
|
|
|
|
|
} |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
sub to_idl_struct { |
|
314
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
315
|
0
|
0
|
|
|
|
|
if (!$self->xref) { |
|
316
|
0
|
|
|
|
|
|
confess("$self has no xref"); |
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
return |
|
319
|
|
|
|
|
|
|
{ |
|
320
|
0
|
|
|
|
|
|
code=>$self->code, |
|
321
|
|
|
|
|
|
|
seq_acc=>$self->seq_acc, |
|
322
|
|
|
|
|
|
|
dbxref=>$self->xref->to_idl_struct, |
|
323
|
|
|
|
|
|
|
}; |
|
324
|
|
|
|
|
|
|
} |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
sub from_idl { |
|
328
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
329
|
0
|
|
|
|
|
|
my $h = shift; |
|
330
|
0
|
|
|
|
|
|
$h->{dbxref} = GO::Model::Xref->from_idl($h->{dbxref}); |
|
331
|
0
|
|
|
|
|
|
return $class->new($h); |
|
332
|
|
|
|
|
|
|
} |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
# **** EXPERIMENTAL CODE **** |
|
335
|
|
|
|
|
|
|
# the idea is to be homogeneous and use graphs for |
|
336
|
|
|
|
|
|
|
# everything; eg gene products are nodes in a graph, |
|
337
|
|
|
|
|
|
|
# associations are arcs |
|
338
|
|
|
|
|
|
|
# cf rdf, daml+oil etc |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
# args - optional graph to add to |
|
341
|
|
|
|
|
|
|
sub graphify { |
|
342
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
343
|
0
|
|
|
|
|
|
my ($ref, $subg, $opts) = |
|
344
|
|
|
|
|
|
|
rearrange([qw(ref graph opts)], @_); |
|
345
|
|
|
|
|
|
|
|
|
346
|
0
|
0
|
|
|
|
|
$opts = {} unless $opts; |
|
347
|
0
|
0
|
|
|
|
|
$subg = $self->apph->create_graph_obj unless $subg; |
|
348
|
|
|
|
|
|
|
|
|
349
|
0
|
|
|
|
|
|
my $acc = sprintf("%s", $self); |
|
350
|
0
|
|
|
|
|
|
my $t = |
|
351
|
|
|
|
|
|
|
$self->apph->create_term_obj({name=>$acc, |
|
352
|
|
|
|
|
|
|
acc=>$acc}); |
|
353
|
0
|
|
|
|
|
|
$subg->add_node($t); |
|
354
|
0
|
0
|
|
|
|
|
$subg->add_arc($t, $ref, "hasEvidence") if $ref; |
|
355
|
|
|
|
|
|
|
|
|
356
|
0
|
0
|
|
|
|
|
foreach my $xr (@{$self->xref_list || []}) { |
|
|
0
|
|
|
|
|
|
|
|
357
|
0
|
|
|
|
|
|
$xr->apph($self->apph); |
|
358
|
0
|
|
|
|
|
|
$xr->graphify($t, $subg); |
|
359
|
|
|
|
|
|
|
} |
|
360
|
0
|
|
|
|
|
|
my $code = $self->code; |
|
361
|
0
|
|
|
|
|
|
my $cn = $subg->get_node($code); |
|
362
|
0
|
0
|
|
|
|
|
if (!$cn) { |
|
363
|
0
|
|
|
|
|
|
$cn = |
|
364
|
|
|
|
|
|
|
$self->apph->create_term_obj({name=>$code, |
|
365
|
|
|
|
|
|
|
acc=>$code}); |
|
366
|
0
|
|
|
|
|
|
$subg->add_node($cn); |
|
367
|
|
|
|
|
|
|
} |
|
368
|
0
|
|
|
|
|
|
$subg->add_arc($cn, $t, "hasCode"); |
|
369
|
0
|
|
|
|
|
|
$subg; |
|
370
|
|
|
|
|
|
|
} |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
1; |