line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::Phenotype::MeSH::Term |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Heikki Lehvaslaiho, heikki-at-bioperl-dot-org |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Bio::Phenotype::MeSH::Term - A MeSH term |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Bio::Phenotype::MeSH::Term; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# create a term object |
21
|
|
|
|
|
|
|
my $term = Bio::Phenotype::MeSH::Term->new |
22
|
|
|
|
|
|
|
(-id => 'D000001', |
23
|
|
|
|
|
|
|
-name => 'Dietary Fats', |
24
|
|
|
|
|
|
|
-description => 'dietary fats are...' |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# get a Bio::Phenotype::MeSH::Twig somehow... |
28
|
|
|
|
|
|
|
$term->add_twig($twig1); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This class keeps information about MeSH terms. MeSH stands for Medical |
34
|
|
|
|
|
|
|
Subject Headings and is one of the ways for annotaing biomedical |
35
|
|
|
|
|
|
|
literature. The terminology is maintained by National Library of |
36
|
|
|
|
|
|
|
Medicine of USA . See http://www.nlm.nih.gov/mesh/meshhome.html. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
In addition to id, name and description a term can know about its |
39
|
|
|
|
|
|
|
surrounding terms (Bio::Phenotype::MeSH::Twig) in the term hierarchy. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This class is mainly used from Bio::DB::MeSH which retrieves terms |
42
|
|
|
|
|
|
|
over the Web. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SEE ALSO |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
L, |
47
|
|
|
|
|
|
|
L |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 FEEDBACK |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 Mailing Lists |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
54
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to the |
55
|
|
|
|
|
|
|
Bioperl mailing lists Your participation is much appreciated. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
58
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 Support |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
I |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
67
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
68
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
69
|
|
|
|
|
|
|
with code and data examples if at all possible. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 Reporting Bugs |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
report bugs to the Bioperl bug tracking system to help us keep track |
74
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the |
75
|
|
|
|
|
|
|
web: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Heikki Lehvaslaiho, heikki-at-bioperl-dot-org |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 APPENDIX |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
86
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Let the code begin... |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
package Bio::Phenotype::MeSH::Term; |
95
|
1
|
|
|
1
|
|
435
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
1
|
|
|
1
|
|
3
|
use base qw(Bio::Root::Root); |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
287
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub new { |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
1
|
1
|
10
|
my( $class,@args ) = @_; |
103
|
1
|
|
|
|
|
8
|
my $self = $class->SUPER::new( @args ); |
104
|
|
|
|
|
|
|
|
105
|
1
|
|
|
|
|
8
|
my ( $id, $name, $description, $comment ) = $self->_rearrange |
106
|
|
|
|
|
|
|
( [ qw( ID |
107
|
|
|
|
|
|
|
NAME |
108
|
|
|
|
|
|
|
DESCRIPTION |
109
|
|
|
|
|
|
|
SPECIES |
110
|
|
|
|
|
|
|
COMMENT |
111
|
|
|
|
|
|
|
) ], |
112
|
|
|
|
|
|
|
@args ); |
113
|
|
|
|
|
|
|
|
114
|
1
|
|
|
|
|
3
|
$self->{"_twigs"} = []; |
115
|
|
|
|
|
|
|
|
116
|
1
|
50
|
|
|
|
2
|
$id && $self->id( $id ); |
117
|
1
|
50
|
|
|
|
3
|
$name && $self->name( $name ); |
118
|
1
|
50
|
|
|
|
2
|
$description && $self->description( $description ); |
119
|
|
|
|
|
|
|
|
120
|
1
|
|
|
|
|
4
|
return $self; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 id |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Title : id |
127
|
|
|
|
|
|
|
Usage : $obj->id( "r1" ); |
128
|
|
|
|
|
|
|
or |
129
|
|
|
|
|
|
|
print $obj->id(); |
130
|
|
|
|
|
|
|
Function: Set/get for the id. |
131
|
|
|
|
|
|
|
Returns : A id [scalar]. |
132
|
|
|
|
|
|
|
Args : A id [scalar] (optional). |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub id { |
137
|
2
|
|
|
2
|
1
|
4
|
my ( $self, $value ) = @_; |
138
|
2
|
100
|
|
|
|
6
|
$self->{ "_id" } = $value if defined $value; |
139
|
2
|
|
|
|
|
5
|
return $self->{ "_id" }; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 name |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Title : name |
145
|
|
|
|
|
|
|
Usage : $obj->name( "r1" ); |
146
|
|
|
|
|
|
|
or |
147
|
|
|
|
|
|
|
print $obj->name(); |
148
|
|
|
|
|
|
|
Function: Set/get for the name. |
149
|
|
|
|
|
|
|
Returns : A name [scalar]. |
150
|
|
|
|
|
|
|
Args : A name [scalar] (optional). |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub name { |
155
|
2
|
|
|
2
|
1
|
3
|
my ( $self, $value ) = @_; |
156
|
2
|
100
|
|
|
|
6
|
$self->{ "_name" } = $value if defined $value; |
157
|
2
|
|
|
|
|
5
|
return $self->{ "_name" }; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 description |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Title : description |
163
|
|
|
|
|
|
|
Usage : $obj->description( "r1" ); |
164
|
|
|
|
|
|
|
or |
165
|
|
|
|
|
|
|
print $obj->description(); |
166
|
|
|
|
|
|
|
Function: Set/get for the description. |
167
|
|
|
|
|
|
|
Returns : A description [scalar]. |
168
|
|
|
|
|
|
|
Args : A description [scalar] (optional). |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub description { |
173
|
2
|
|
|
2
|
1
|
3
|
my ( $self, $value ) = @_; |
174
|
2
|
100
|
|
|
|
6
|
$self->{ "_description" } = $value if defined $value; |
175
|
2
|
|
|
|
|
6
|
return $self->{ "_description" }; |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 add_synonym |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Title : add_synonym |
182
|
|
|
|
|
|
|
Usage : $obj->add_synonym( @synonyms ); |
183
|
|
|
|
|
|
|
or |
184
|
|
|
|
|
|
|
$obj->add_synonym( $synonym ); |
185
|
|
|
|
|
|
|
Function: Pushes one or more synonyms for the term term |
186
|
|
|
|
|
|
|
into the list of synonyms. |
187
|
|
|
|
|
|
|
Returns : |
188
|
|
|
|
|
|
|
Args : scalar(s). |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub add_synonym { |
193
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @values ) = @_; |
194
|
0
|
|
|
|
|
0
|
push( @{ $self->{ "_synonyms" } }, @values ); |
|
0
|
|
|
|
|
0
|
|
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 each_synonym |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Title : each_synonym() |
200
|
|
|
|
|
|
|
Usage : @gs = $obj->each_synonym(); |
201
|
|
|
|
|
|
|
Function: Returns a list of gene symbols [scalars, most likely Strings] |
202
|
|
|
|
|
|
|
associated with this phenotype. |
203
|
|
|
|
|
|
|
Returns : A list of scalars. |
204
|
|
|
|
|
|
|
Args : |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub each_synonym { |
209
|
0
|
|
|
0
|
1
|
0
|
my ( $self ) = shift; |
210
|
0
|
|
|
|
|
0
|
return @{ $self->{ "_synonyms" } }; |
|
0
|
|
|
|
|
0
|
|
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 purge_synonyms |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Usage : $obj->purge_synonym(); |
216
|
|
|
|
|
|
|
Function: Deletes the list of synonyms to this term. |
217
|
|
|
|
|
|
|
Returns : A list of scalars. |
218
|
|
|
|
|
|
|
Args : |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub purge_synonyms { |
223
|
0
|
|
|
0
|
1
|
0
|
my ( $self ) = @_; |
224
|
0
|
|
|
|
|
0
|
$self->{ "_synonyms" } = []; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 Twig management |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Each MeSH term belongs to a complex tree like hierarchy of terms where |
231
|
|
|
|
|
|
|
each term can appear multiple times. The immediately surrounding nodes |
232
|
|
|
|
|
|
|
of the tree are modelled in twigs. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
See: L. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head2 add_twig |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Title : add_twig |
241
|
|
|
|
|
|
|
Usage : $obj->add_twig( @twigs ); |
242
|
|
|
|
|
|
|
or |
243
|
|
|
|
|
|
|
$obj->add_twig( $twig ); |
244
|
|
|
|
|
|
|
Function: Pushes one or more twig term names [scalars, most likely Strings] |
245
|
|
|
|
|
|
|
into the list of twigs. |
246
|
|
|
|
|
|
|
Returns : |
247
|
|
|
|
|
|
|
Args : scalar(s). |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=cut |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub add_twig { |
252
|
1
|
|
|
1
|
1
|
3
|
my ( $self, @values ) = @_; |
253
|
1
|
|
|
|
|
2
|
foreach my $twig (@values) { |
254
|
1
|
50
|
|
|
|
7
|
$self->warn ("Not a MeSH twig [$twig]") |
255
|
|
|
|
|
|
|
unless $twig->isa('Bio::Phenotype::MeSH::Twig'); |
256
|
1
|
|
|
|
|
3
|
$twig->term($self); |
257
|
1
|
|
|
|
|
0
|
push( @{ $self->{ "_twigs" } }, $twig ); |
|
1
|
|
|
|
|
3
|
|
258
|
|
|
|
|
|
|
} |
259
|
1
|
|
|
|
|
3
|
1; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head2 each_twig |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Title : each_twig() |
265
|
|
|
|
|
|
|
Usage : @gs = $obj->each_twig(); |
266
|
|
|
|
|
|
|
Function: Returns a list of gene symbols [scalars, most likely Strings] |
267
|
|
|
|
|
|
|
associated with this phenotype. |
268
|
|
|
|
|
|
|
Returns : A list of scalars. |
269
|
|
|
|
|
|
|
Args : |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=cut |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub each_twig { |
274
|
1
|
|
|
1
|
1
|
2
|
my ( $self ) = shift; |
275
|
1
|
|
|
|
|
1
|
return @{ $self->{ "_twigs" } }; |
|
1
|
|
|
|
|
4
|
|
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 purge_twigs |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
Usage : $obj->purge_twig(); |
281
|
|
|
|
|
|
|
Function: Deletes the list of twigs associated with this term. |
282
|
|
|
|
|
|
|
Returns : A list of scalars. |
283
|
|
|
|
|
|
|
Args : |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=cut |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub purge_twigs { |
288
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
289
|
0
|
|
|
|
|
|
$self->{ "_twigs" } = []; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head2 each_parent |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Title : each_parent() |
296
|
|
|
|
|
|
|
Usage : @gs = $obj->each_parent(); |
297
|
|
|
|
|
|
|
Function: Returns a list of names of parents for this term |
298
|
|
|
|
|
|
|
Returns : A list of scalars. |
299
|
|
|
|
|
|
|
Args : |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub each_parent { |
304
|
0
|
|
|
0
|
1
|
|
my ( $self ) = shift; |
305
|
0
|
|
|
|
|
|
return map {$_->parent()} @{ $self->{ "_twigs" } }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
1; |