| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# BioPerl module for Relationship |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Cared for by Christian M. Zmasek or |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# (c) Christian M. Zmasek, czmasek-at-burnham.org, 2002. |
|
9
|
|
|
|
|
|
|
# (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002. |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself. |
|
12
|
|
|
|
|
|
|
# Refer to the Perl Artistic License (see the license accompanying this |
|
13
|
|
|
|
|
|
|
# software package, or see http://www.perl.com/language/misc/Artistic.html) |
|
14
|
|
|
|
|
|
|
# for the terms under which you may use, modify, and redistribute this module. |
|
15
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
|
17
|
|
|
|
|
|
|
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
|
18
|
|
|
|
|
|
|
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Bio::Ontology::Relationship - a relationship for an ontology |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$rel = Bio::Ontology::Relationship->new( -identifier => "16847", |
|
31
|
|
|
|
|
|
|
-subject_term => $subj, |
|
32
|
|
|
|
|
|
|
-object_term => $obj, |
|
33
|
|
|
|
|
|
|
-predicate_term => $pred ); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This is a basic implementation of Bio::Ontology::RelationshipI. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The terminology we use here is the one commonly used for ontologies, |
|
40
|
|
|
|
|
|
|
namely the triple of (subject, predicate, object), which in addition |
|
41
|
|
|
|
|
|
|
is scoped in a namespace (ontology). It is called triple because it is |
|
42
|
|
|
|
|
|
|
a tuple of three ontology terms. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
There are other terminologies in use for expressing relationships. For |
|
45
|
|
|
|
|
|
|
those who it helps to better understand the concept, the triple of |
|
46
|
|
|
|
|
|
|
(child, relationship type, parent) would be equivalent to the |
|
47
|
|
|
|
|
|
|
terminology chosen here, disregarding the question whether the notion |
|
48
|
|
|
|
|
|
|
of parent and child is sensible in the context of the relationship |
|
49
|
|
|
|
|
|
|
type or not. Especially in the case of ontologies with a wide variety |
|
50
|
|
|
|
|
|
|
of predicates the parent/child terminology and similar ones can |
|
51
|
|
|
|
|
|
|
quickly become ambiguous (e.g., A synthesises B), meaningless (e.g., A |
|
52
|
|
|
|
|
|
|
binds B), or even conflicting (e.g., A is-parent-of B), and are |
|
53
|
|
|
|
|
|
|
therefore strongly discouraged. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 FEEDBACK |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 Mailing Lists |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
|
60
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to the |
|
61
|
|
|
|
|
|
|
Bioperl mailing lists Your participation is much appreciated. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
|
64
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 Support |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
I |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
|
73
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
|
74
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
|
75
|
|
|
|
|
|
|
with code and data examples if at all possible. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 Reporting Bugs |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
|
80
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via |
|
81
|
|
|
|
|
|
|
the web: |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Christian M. Zmasek |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Email: czmasek-at-burnham.org or cmzmasek@yahoo.com |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
WWW: http://monochrome-effect.net/ |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Address: |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Genomics Institute of the Novartis Research Foundation |
|
96
|
|
|
|
|
|
|
10675 John Jay Hopkins Drive |
|
97
|
|
|
|
|
|
|
San Diego, CA 92121 |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Hilmar Lapp, email: hlapp at gmx.net |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 APPENDIX |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
|
106
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# Let the code begin... |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
package Bio::Ontology::Relationship; |
|
115
|
5
|
|
|
5
|
|
1471
|
use strict; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
124
|
|
|
116
|
5
|
|
|
5
|
|
267
|
use Bio::Ontology::TermI; |
|
|
5
|
|
|
|
|
4
|
|
|
|
5
|
|
|
|
|
123
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
5
|
|
|
5
|
|
15
|
use base qw(Bio::Root::Root Bio::Ontology::RelationshipI); |
|
|
5
|
|
|
|
|
5
|
|
|
|
5
|
|
|
|
|
1748
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 new |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Title : new |
|
126
|
|
|
|
|
|
|
Usage : $rel = Bio::Ontology::Relationship->new(-identifier => "16847", |
|
127
|
|
|
|
|
|
|
-subject_term => $subject, |
|
128
|
|
|
|
|
|
|
-object_term => $object, |
|
129
|
|
|
|
|
|
|
-predicate_term => $type ); |
|
130
|
|
|
|
|
|
|
Function: Creates a new Bio::Ontology::Relationship. |
|
131
|
|
|
|
|
|
|
Returns : A new Bio::Ontology::Relationship object. |
|
132
|
|
|
|
|
|
|
Args : -identifier => the identifier of this relationship [scalar] |
|
133
|
|
|
|
|
|
|
-subject_term => the subject term [Bio::Ontology::TermI] |
|
134
|
|
|
|
|
|
|
-object_term => the object term [Bio::Ontology::TermI] |
|
135
|
|
|
|
|
|
|
-predicate_term => the predicate term [Bio::Ontology::TermI] |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub new { |
|
140
|
|
|
|
|
|
|
|
|
141
|
1350
|
|
|
1350
|
1
|
2572
|
my( $class, @args ) = @_; |
|
142
|
|
|
|
|
|
|
|
|
143
|
1350
|
|
|
|
|
2251
|
my $self = $class->SUPER::new( @args ); |
|
144
|
|
|
|
|
|
|
|
|
145
|
1350
|
|
|
|
|
3773
|
my ( $identifier, |
|
146
|
|
|
|
|
|
|
$subject_term, |
|
147
|
|
|
|
|
|
|
$child, # for backwards compatibility |
|
148
|
|
|
|
|
|
|
$object_term, |
|
149
|
|
|
|
|
|
|
$parent, # for backwards compatibility |
|
150
|
|
|
|
|
|
|
$predicate_term, |
|
151
|
|
|
|
|
|
|
$reltype, # for backwards compatibility |
|
152
|
|
|
|
|
|
|
$ont) |
|
153
|
|
|
|
|
|
|
= $self->_rearrange( [qw( IDENTIFIER |
|
154
|
|
|
|
|
|
|
SUBJECT_TERM |
|
155
|
|
|
|
|
|
|
CHILD_TERM |
|
156
|
|
|
|
|
|
|
OBJECT_TERM |
|
157
|
|
|
|
|
|
|
PARENT_TERM |
|
158
|
|
|
|
|
|
|
PREDICATE_TERM |
|
159
|
|
|
|
|
|
|
RELATIONSHIP_TYPE |
|
160
|
|
|
|
|
|
|
ONTOLOGY) |
|
161
|
|
|
|
|
|
|
], @args ); |
|
162
|
|
|
|
|
|
|
|
|
163
|
1350
|
|
|
|
|
3005
|
$self->init(); |
|
164
|
|
|
|
|
|
|
|
|
165
|
1350
|
|
|
|
|
1562
|
$self->identifier( $identifier ); |
|
166
|
1350
|
100
|
|
|
|
1802
|
$subject_term = $child unless $subject_term; |
|
167
|
1350
|
100
|
|
|
|
1606
|
$object_term = $parent unless $object_term; |
|
168
|
1350
|
100
|
|
|
|
1661
|
$predicate_term = $reltype unless $predicate_term; |
|
169
|
1350
|
100
|
|
|
|
2089
|
$self->subject_term( $subject_term) if $subject_term; |
|
170
|
1350
|
100
|
|
|
|
2223
|
$self->object_term( $object_term) if $object_term; |
|
171
|
1350
|
50
|
|
|
|
2015
|
$self->predicate_term( $predicate_term ) if $predicate_term; |
|
172
|
1350
|
100
|
|
|
|
2593
|
$self->ontology($ont) if $ont; |
|
173
|
|
|
|
|
|
|
|
|
174
|
1350
|
|
|
|
|
2935
|
return $self; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
} # new |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 init |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Title : init() |
|
183
|
|
|
|
|
|
|
Usage : $rel->init(); |
|
184
|
|
|
|
|
|
|
Function: Initializes this Relationship to all undef. |
|
185
|
|
|
|
|
|
|
Returns : |
|
186
|
|
|
|
|
|
|
Args : |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub init { |
|
191
|
1350
|
|
|
1350
|
1
|
1017
|
my( $self ) = @_; |
|
192
|
|
|
|
|
|
|
|
|
193
|
1350
|
|
|
|
|
1189
|
$self->{ "_identifier" } = undef; |
|
194
|
1350
|
|
|
|
|
1021
|
$self->{ "_subject_term" } = undef; |
|
195
|
1350
|
|
|
|
|
939
|
$self->{ "_object_term" } = undef; |
|
196
|
1350
|
|
|
|
|
963
|
$self->{ "_predicate_term" } = undef; |
|
197
|
1350
|
|
|
|
|
1502
|
$self->ontology(undef); |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
} # init |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 identifier |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Title : identifier |
|
206
|
|
|
|
|
|
|
Usage : $rel->identifier( "100050" ); |
|
207
|
|
|
|
|
|
|
or |
|
208
|
|
|
|
|
|
|
print $rel->identifier(); |
|
209
|
|
|
|
|
|
|
Function: Set/get for the identifier of this Relationship. |
|
210
|
|
|
|
|
|
|
Returns : The identifier [scalar]. |
|
211
|
|
|
|
|
|
|
Args : The identifier [scalar] (optional). |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub identifier { |
|
216
|
1352
|
|
|
1352
|
1
|
1336
|
my ( $self, $value ) = @_; |
|
217
|
|
|
|
|
|
|
|
|
218
|
1352
|
100
|
|
|
|
1661
|
if ( defined $value ) { |
|
219
|
1
|
|
|
|
|
3
|
$self->{ "_identifier" } = $value; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
1352
|
|
|
|
|
1057
|
return $self->{ "_identifier" }; |
|
223
|
|
|
|
|
|
|
} # identifier |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 subject_term |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Title : subject_term |
|
231
|
|
|
|
|
|
|
Usage : $rel->subject_term( $subject ); |
|
232
|
|
|
|
|
|
|
or |
|
233
|
|
|
|
|
|
|
$subject = $rel->subject_term(); |
|
234
|
|
|
|
|
|
|
Function: Set/get for the subject term of this Relationship. |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
The common convention for ontologies is to express |
|
237
|
|
|
|
|
|
|
relationships between terms as triples (subject, predicate, |
|
238
|
|
|
|
|
|
|
object). |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Returns : The subject term [Bio::Ontology::TermI]. |
|
241
|
|
|
|
|
|
|
Args : The subject term [Bio::Ontology::TermI] (optional). |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub subject_term { |
|
246
|
2772
|
|
|
2772
|
1
|
5077
|
my ( $self, $term ) = @_; |
|
247
|
|
|
|
|
|
|
|
|
248
|
2772
|
100
|
|
|
|
3173
|
if ( defined $term ) { |
|
249
|
1349
|
|
|
|
|
1548
|
$self->_check_class( $term, "Bio::Ontology::TermI" ); |
|
250
|
1349
|
|
|
|
|
1075
|
$self->{ "_subject_term" } = $term; |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
|
|
253
|
2772
|
|
|
|
|
3056
|
return $self->{ "_subject_term" }; |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
} # subject_term |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head2 object_term |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Title : object_term |
|
262
|
|
|
|
|
|
|
Usage : $rel->object_term( $object ); |
|
263
|
|
|
|
|
|
|
or |
|
264
|
|
|
|
|
|
|
$object = $rel->object_term(); |
|
265
|
|
|
|
|
|
|
Function: Set/get for the object term of this Relationship. |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
The common convention for ontologies is to express |
|
268
|
|
|
|
|
|
|
relationships between terms as triples (subject, predicate, |
|
269
|
|
|
|
|
|
|
object). |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Returns : The object term [Bio::Ontology::TermI]. |
|
272
|
|
|
|
|
|
|
Args : The object term [Bio::Ontology::TermI] (optional). |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=cut |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub object_term { |
|
277
|
2856
|
|
|
2856
|
1
|
4945
|
my ( $self, $term ) = @_; |
|
278
|
|
|
|
|
|
|
|
|
279
|
2856
|
100
|
|
|
|
3229
|
if ( defined $term ) { |
|
280
|
1349
|
|
|
|
|
1217
|
$self->_check_class( $term, "Bio::Ontology::TermI" ); |
|
281
|
1349
|
|
|
|
|
1023
|
$self->{ "_object_term" } = $term; |
|
282
|
|
|
|
|
|
|
} |
|
283
|
|
|
|
|
|
|
|
|
284
|
2856
|
|
|
|
|
2974
|
return $self->{ "_object_term" }; |
|
285
|
|
|
|
|
|
|
} |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head2 predicate_term |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
Title : predicate_term |
|
292
|
|
|
|
|
|
|
Usage : $rel->predicate_term( $type ); |
|
293
|
|
|
|
|
|
|
or |
|
294
|
|
|
|
|
|
|
$type = $rel->predicate_term(); |
|
295
|
|
|
|
|
|
|
Function: Set/get for the predicate (relationship type) of this |
|
296
|
|
|
|
|
|
|
relationship. |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
The common convention for ontologies is to express |
|
299
|
|
|
|
|
|
|
relationships between terms as triples (subject, predicate, |
|
300
|
|
|
|
|
|
|
object). |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
Returns : The predicate term [Bio::Ontology::TermI]. |
|
303
|
|
|
|
|
|
|
Args : The predicate term [Bio::Ontology::TermI] (optional). |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub predicate_term { |
|
308
|
1388
|
|
|
1388
|
1
|
2672
|
my ( $self, $term ) = @_; |
|
309
|
|
|
|
|
|
|
|
|
310
|
1388
|
100
|
|
|
|
1705
|
if ( defined $term ) { |
|
311
|
1350
|
|
|
|
|
1265
|
$self->_check_class( $term, "Bio::Ontology::TermI" ); |
|
312
|
1350
|
|
|
|
|
981
|
$self->{ "_predicate_term" } = $term; |
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
|
|
315
|
1388
|
|
|
|
|
1042
|
return $self->{ "_predicate_term" }; |
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=head2 ontology |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
Title : ontology |
|
322
|
|
|
|
|
|
|
Usage : $ont = $obj->ontology() |
|
323
|
|
|
|
|
|
|
Function: Get/set the ontology that defined this relationship. |
|
324
|
|
|
|
|
|
|
Example : |
|
325
|
|
|
|
|
|
|
Returns : an object implementing L |
|
326
|
|
|
|
|
|
|
Args : on set, undef or an object implementing |
|
327
|
|
|
|
|
|
|
Bio::Ontology::OntologyI (optional) |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
See L. |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=cut |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
sub ontology{ |
|
334
|
4041
|
|
|
4041
|
1
|
2773
|
my $self = shift; |
|
335
|
4041
|
|
|
|
|
2237
|
my $ont; |
|
336
|
|
|
|
|
|
|
|
|
337
|
4041
|
100
|
|
|
|
4879
|
if(@_) { |
|
338
|
2699
|
|
|
|
|
1872
|
$ont = shift; |
|
339
|
2699
|
100
|
|
|
|
3399
|
if($ont) { |
|
340
|
1349
|
50
|
|
|
|
1834
|
$ont = Bio::Ontology::Ontology->new(-name => $ont) if ! ref($ont); |
|
341
|
1349
|
50
|
|
|
|
2625
|
if(! $ont->isa("Bio::Ontology::OntologyI")) { |
|
342
|
0
|
|
|
|
|
0
|
$self->throw(ref($ont)." does not implement ". |
|
343
|
|
|
|
|
|
|
"Bio::Ontology::OntologyI. Bummer."); |
|
344
|
|
|
|
|
|
|
} |
|
345
|
|
|
|
|
|
|
} |
|
346
|
2699
|
|
|
|
|
2942
|
return $self->{"_ontology"} = $ont; |
|
347
|
|
|
|
|
|
|
} |
|
348
|
1342
|
|
|
|
|
1404
|
return $self->{"_ontology"}; |
|
349
|
|
|
|
|
|
|
} |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=head2 to_string |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
Title : to_string() |
|
354
|
|
|
|
|
|
|
Usage : print $rel->to_string(); |
|
355
|
|
|
|
|
|
|
Function: to_string method for Relationship. |
|
356
|
|
|
|
|
|
|
Returns : A string representation of this Relationship. |
|
357
|
|
|
|
|
|
|
Args : |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=cut |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub to_string { |
|
362
|
1
|
|
|
1
|
1
|
2
|
my( $self ) = @_; |
|
363
|
|
|
|
|
|
|
|
|
364
|
1
|
|
|
|
|
4
|
local $^W = 0; |
|
365
|
|
|
|
|
|
|
|
|
366
|
1
|
|
|
|
|
2
|
my $s = ""; |
|
367
|
|
|
|
|
|
|
|
|
368
|
1
|
|
|
|
|
2
|
$s .= "-- Identifier:\n"; |
|
369
|
1
|
|
|
|
|
3
|
$s .= $self->identifier()."\n"; |
|
370
|
1
|
|
|
|
|
1
|
$s .= "-- Subject Term Identifier:\n"; |
|
371
|
1
|
|
|
|
|
3
|
$s .= $self->subject_term()->identifier()."\n"; |
|
372
|
1
|
|
|
|
|
2
|
$s .= "-- Object Term Identifier:\n"; |
|
373
|
1
|
|
|
|
|
2
|
$s .= $self->object_term()->identifier()."\n"; |
|
374
|
1
|
|
|
|
|
1
|
$s .= "-- Relationship Type Identifier:\n"; |
|
375
|
1
|
|
|
|
|
2
|
$s .= $self->predicate_term()->identifier(); |
|
376
|
|
|
|
|
|
|
|
|
377
|
1
|
|
|
|
|
4
|
return $s; |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
} # to_string |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
sub _check_class { |
|
384
|
4048
|
|
|
4048
|
|
2984
|
my ( $self, $value, $expected_class ) = @_; |
|
385
|
|
|
|
|
|
|
|
|
386
|
4048
|
50
|
|
|
|
10969
|
if ( ! defined( $value ) ) { |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
387
|
0
|
|
|
|
|
|
$self->throw( "Found [undef] where [$expected_class] expected" ); |
|
388
|
|
|
|
|
|
|
} |
|
389
|
|
|
|
|
|
|
elsif ( ! ref( $value ) ) { |
|
390
|
0
|
|
|
|
|
|
$self->throw( "Found [scalar] where [$expected_class] expected" ); |
|
391
|
|
|
|
|
|
|
} |
|
392
|
|
|
|
|
|
|
elsif ( ! $value->isa( $expected_class ) ) { |
|
393
|
0
|
|
|
|
|
|
$self->throw( "Found [" . ref( $value ) . "] where [$expected_class] expected" ); |
|
394
|
|
|
|
|
|
|
} |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
} # _check_type |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
################################################################# |
|
399
|
|
|
|
|
|
|
# aliases for backwards compatibility |
|
400
|
|
|
|
|
|
|
################################################################# |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=head1 Deprecated Methods |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
These methods are deprecated and defined here solely to preserve |
|
405
|
|
|
|
|
|
|
backwards compatibility. |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=cut |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
*child_term = \&subject_term; |
|
410
|
|
|
|
|
|
|
*parent_term = \&object_term; |
|
411
|
|
|
|
|
|
|
*relationship_type = \&predicate_term; |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
1; |