| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# UMLS::Association |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Perl module for scoring the semantic association of terms in the Unified |
|
4
|
|
|
|
|
|
|
# Medical Language System (UMLS). |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# This module borrows heavily from the UMLS::Interface package so you will |
|
7
|
|
|
|
|
|
|
# see similarities |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Copyright (c) 2015 |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# Bridget T. McInnes, Virginia Commonwealth University |
|
12
|
|
|
|
|
|
|
# btmcinnes at vcu.edu |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# Keith Herbert, Virginia Commonwealth University |
|
15
|
|
|
|
|
|
|
# herbertkb at vcu.edu |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# Alexander D. McQuilkin, Virginia Commonwealth University |
|
18
|
|
|
|
|
|
|
# alexmcq99 at yahoo.com |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
|
21
|
|
|
|
|
|
|
# modify it under the terms of the GNU General Public License |
|
22
|
|
|
|
|
|
|
# as published by the Free Software Foundation; either version 2 |
|
23
|
|
|
|
|
|
|
# of the License, or (at your option) any later version. |
|
24
|
|
|
|
|
|
|
# |
|
25
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
26
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
27
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
28
|
|
|
|
|
|
|
# GNU General Public License for more details. |
|
29
|
|
|
|
|
|
|
# |
|
30
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
|
31
|
|
|
|
|
|
|
# along with this program; if not, write to |
|
32
|
|
|
|
|
|
|
# |
|
33
|
|
|
|
|
|
|
# The Free Software Foundation, Inc., |
|
34
|
|
|
|
|
|
|
# 59 Temple Place - Suite 330, |
|
35
|
|
|
|
|
|
|
# Boston, MA 02111-1307, USA. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
UMLS::Association - A suite of Perl modules that implement a number of semantic |
|
40
|
|
|
|
|
|
|
association measures in order to calculate the semantic association between two |
|
41
|
|
|
|
|
|
|
concepts in the UMLS. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 INSTALL |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
To install the module, run the following magic commands: |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
perl Makefile.PL |
|
51
|
|
|
|
|
|
|
make |
|
52
|
|
|
|
|
|
|
make test |
|
53
|
|
|
|
|
|
|
make install |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This will install the module in the standard location. You will, most |
|
56
|
|
|
|
|
|
|
probably, require root privileges to install in standard system |
|
57
|
|
|
|
|
|
|
directories. To install in a non-standard directory, specify a prefix |
|
58
|
|
|
|
|
|
|
during the 'perl Makefile.PL' stage as: |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
perl Makefile.PL PREFIX=/home/sid |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
It is possible to modify other parameters during installation. The |
|
63
|
|
|
|
|
|
|
details of these can be found in the ExtUtils::MakeMaker |
|
64
|
|
|
|
|
|
|
documentation. However, it is highly recommended not messing around |
|
65
|
|
|
|
|
|
|
with other parameters, unless you know what you're doing. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This package provides a Perl interface to |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 DATABASE SETUP |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The interface assumes that the CUI network extracted from the MetaMapped |
|
74
|
|
|
|
|
|
|
Medline Baseline is present in a mysql database. The name of the database |
|
75
|
|
|
|
|
|
|
can be passed as configuration options at initialization. However, if the |
|
76
|
|
|
|
|
|
|
names of the databases are not provided at initialization, then default |
|
77
|
|
|
|
|
|
|
value is used -- the database is called 'CUI_BIGRAMS'. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The CUI_BIGRAMS database must contain four? tables: |
|
80
|
|
|
|
|
|
|
1. N11 |
|
81
|
|
|
|
|
|
|
2. N1P |
|
82
|
|
|
|
|
|
|
3. NP1 |
|
83
|
|
|
|
|
|
|
4. NPP |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
All other tables in the databases will be ignored, and any of these |
|
86
|
|
|
|
|
|
|
tables missing would raise an error. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
A script explaining how to create the CUI network and the mysql database |
|
89
|
|
|
|
|
|
|
are in the INSTALL file. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 INITIALIZING THE MODULE |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
To create an instance of the interface object, using default values |
|
94
|
|
|
|
|
|
|
for all configuration options: |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
use UMLS::Association; |
|
97
|
|
|
|
|
|
|
my $associaton = UMLS::Association->new(); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Database connection options can be passed through the my.cnf file. For |
|
100
|
|
|
|
|
|
|
example: |
|
101
|
|
|
|
|
|
|
[client] |
|
102
|
|
|
|
|
|
|
user = |
|
103
|
|
|
|
|
|
|
password = |
|
104
|
|
|
|
|
|
|
port = 3306 |
|
105
|
|
|
|
|
|
|
socket = /tmp/mysql.sock |
|
106
|
|
|
|
|
|
|
database = mmb |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Or through the by passing the connection information when first |
|
109
|
|
|
|
|
|
|
instantiating an instance. For example: |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
$associaton = UMLS::Association->new({"driver" => "mysql", |
|
112
|
|
|
|
|
|
|
"database" => "$database", |
|
113
|
|
|
|
|
|
|
"username" => "$username", |
|
114
|
|
|
|
|
|
|
"password" => "$password", |
|
115
|
|
|
|
|
|
|
"hostname" => "$hostname", |
|
116
|
|
|
|
|
|
|
"socket" => "$socket"}); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
'driver' -> Default value 'mysql'. This option specifies the Perl |
|
119
|
|
|
|
|
|
|
DBD driver that should be used to access the |
|
120
|
|
|
|
|
|
|
database. This implies that the some other DBMS |
|
121
|
|
|
|
|
|
|
system (such as PostgresSQL) could also be used, |
|
122
|
|
|
|
|
|
|
as long as there exist Perl DBD drivers to |
|
123
|
|
|
|
|
|
|
access the database. |
|
124
|
|
|
|
|
|
|
'database' -> Default value 'CUI_BIGRAM'. This option specifies the name |
|
125
|
|
|
|
|
|
|
of the database. |
|
126
|
|
|
|
|
|
|
'hostname' -> Default value 'localhost'. The name or the IP address |
|
127
|
|
|
|
|
|
|
of the machine on which the database server is |
|
128
|
|
|
|
|
|
|
running. |
|
129
|
|
|
|
|
|
|
'socket' -> Default value '/tmp/mysql.sock'. The socket on which |
|
130
|
|
|
|
|
|
|
the database server is using. |
|
131
|
|
|
|
|
|
|
'port' -> The port number on which the database server accepts |
|
132
|
|
|
|
|
|
|
connections. |
|
133
|
|
|
|
|
|
|
'username' -> Username to use to connect to the database server. If |
|
134
|
|
|
|
|
|
|
not provided, the module attempts to connect as an |
|
135
|
|
|
|
|
|
|
anonymous user. |
|
136
|
|
|
|
|
|
|
'password' -> Password for access to the database server. If not |
|
137
|
|
|
|
|
|
|
provided, the module attempts to access the server |
|
138
|
|
|
|
|
|
|
without a password. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
More information is provided in the INSTALL file. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 PARAMETERS |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
You can also pass other parameters which controls the functionality |
|
145
|
|
|
|
|
|
|
of the Association.pm module. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
$assoc = UMLS::Association->new({"measure" => "lch"}); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
'measure' -> This modifies the association measure |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 FUNCTION DESCRIPTIONS |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
package UMLS::Association; |
|
156
|
|
|
|
|
|
|
|
|
157
|
1
|
|
|
1
|
|
595
|
use Fcntl; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
179
|
|
|
158
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
18
|
|
|
159
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
17
|
|
|
160
|
1
|
|
|
1
|
|
1324
|
use DBI; |
|
|
1
|
|
|
|
|
11109
|
|
|
|
1
|
|
|
|
|
39
|
|
|
161
|
1
|
|
|
1
|
|
468
|
use bytes; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
3
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
1
|
|
|
1
|
|
375
|
use UMLS::Association::CuiFinder; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
26
|
|
|
164
|
1
|
|
|
1
|
|
376
|
use UMLS::Association::StatFinder; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
165
|
1
|
|
|
1
|
|
338
|
use UMLS::Association::ErrorHandler; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
my $errorhandler = ""; |
|
169
|
|
|
|
|
|
|
my $cuifinder = ""; |
|
170
|
|
|
|
|
|
|
my $statfinder = ""; |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
my $pkg = "UMLS::Association"; |
|
173
|
|
|
|
|
|
|
|
|
174
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
487
|
|
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
$VERSION = '0.11'; |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $debug = 0; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
# UMLS-specific stuff ends ---------- |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# -------------------- Class methods start here -------------------- |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# method to create a new UMLS::Association object |
|
185
|
|
|
|
|
|
|
# input : $params <- reference to hash containing the parameters |
|
186
|
|
|
|
|
|
|
# output: |
|
187
|
|
|
|
|
|
|
sub new { |
|
188
|
1
|
|
|
1
|
0
|
37
|
my $self = {}; |
|
189
|
1
|
|
|
|
|
2
|
my $className = shift; |
|
190
|
1
|
|
|
|
|
2
|
my $params = shift; |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# bless the object. |
|
193
|
1
|
|
|
|
|
3
|
bless($self, $className); |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
# initialize error handler |
|
196
|
1
|
|
|
|
|
8
|
$errorhandler = UMLS::Association::ErrorHandler->new(); |
|
197
|
1
|
50
|
|
|
|
4
|
if(! defined $errorhandler) { |
|
198
|
0
|
|
|
|
|
0
|
print STDERR "The error handler did not get passed properly.\n"; |
|
199
|
0
|
|
|
|
|
0
|
exit; |
|
200
|
|
|
|
|
|
|
} |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# check options |
|
203
|
1
|
|
|
|
|
3
|
$self->_checkOptions($params); |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
# Initialize the object. |
|
206
|
1
|
|
|
|
|
2
|
$self->_initialize($params); |
|
207
|
|
|
|
|
|
|
|
|
208
|
0
|
|
|
|
|
0
|
return $self; |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
# initialize the variables and set the parameters |
|
212
|
|
|
|
|
|
|
# input : $params <- reference to hash containing the parameters |
|
213
|
|
|
|
|
|
|
# output: |
|
214
|
|
|
|
|
|
|
sub _initialize { |
|
215
|
|
|
|
|
|
|
|
|
216
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
217
|
1
|
|
|
|
|
1
|
my $params = shift; |
|
218
|
|
|
|
|
|
|
|
|
219
|
1
|
|
|
|
|
1
|
my $function = "_initialize"; |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
# check self |
|
222
|
1
|
50
|
33
|
|
|
5
|
if(!defined $self || !ref $self) { |
|
223
|
0
|
|
|
|
|
0
|
$errorhandler->_error($pkg, $function, "", 2); |
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# set the cuifinder |
|
227
|
1
|
|
|
|
|
7
|
$cuifinder = UMLS::Association::CuiFinder->new($params); |
|
228
|
0
|
0
|
|
|
|
0
|
if(! defined $cuifinder) { |
|
229
|
0
|
|
|
|
|
0
|
my $str = "The UMLS::Association::CuiFinder object was not created."; |
|
230
|
0
|
|
|
|
|
0
|
$errorhandler->_error($pkg, $function, $str, 8); |
|
231
|
|
|
|
|
|
|
} |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
# set the statfinder |
|
234
|
0
|
|
|
|
|
0
|
$statfinder = UMLS::Association::StatFinder->new($params, $cuifinder); |
|
235
|
0
|
0
|
|
|
|
0
|
if(! defined $statfinder) { |
|
236
|
0
|
|
|
|
|
0
|
my $str = "The UMLS::Association::StatFinder object was not created."; |
|
237
|
0
|
|
|
|
|
0
|
$errorhandler->_error($pkg, $function, $str, 8); |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
} |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
# method checks the parameters based to the UMLS::Association package |
|
242
|
|
|
|
|
|
|
# input : $params <- reference to hash containing the parameters |
|
243
|
|
|
|
|
|
|
# output: |
|
244
|
|
|
|
|
|
|
sub _checkOptions { |
|
245
|
|
|
|
|
|
|
|
|
246
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
247
|
1
|
|
|
|
|
1
|
my $params = shift; |
|
248
|
|
|
|
|
|
|
|
|
249
|
1
|
|
|
|
|
2
|
my $function = "_checkOptions"; |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# check self |
|
252
|
1
|
50
|
33
|
|
|
8
|
if(!defined $self || !ref $self) { |
|
253
|
0
|
|
|
|
|
0
|
$errorhandler->_error($pkg, $function, "", 2); |
|
254
|
|
|
|
|
|
|
} |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
# database options |
|
257
|
1
|
|
|
|
|
2
|
my $database = $params->{'database'}; |
|
258
|
1
|
|
|
|
|
2
|
my $hostname = $params->{'hostname'}; |
|
259
|
1
|
|
|
|
|
2
|
my $socket = $params->{'socket'}; |
|
260
|
1
|
|
|
|
|
1
|
my $port = $params->{'port'}; |
|
261
|
1
|
|
|
|
|
2
|
my $username = $params->{'username'}; |
|
262
|
1
|
|
|
|
|
2
|
my $password = $params->{'password'}; |
|
263
|
1
|
|
|
|
|
2
|
my $getDescendants = $params->{'getdescendants'}; |
|
264
|
1
|
|
|
|
|
1
|
my $umls = $params->{'umls'}; |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
# cuifinder options |
|
267
|
1
|
|
|
|
|
1
|
my $measure = $params->{'config'}; |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
# general options |
|
270
|
1
|
|
|
|
|
1
|
my $debugoption = $params->{'debug'}; |
|
271
|
1
|
|
|
|
|
2
|
my $verbose = $params->{'verbose'}; |
|
272
|
|
|
|
|
|
|
|
|
273
|
1
|
50
|
33
|
|
|
5
|
if( (defined $username) && (!defined $password) ) { |
|
274
|
0
|
|
|
|
|
0
|
my $str = "The --password option must be defined when using --username."; |
|
275
|
0
|
|
|
|
|
0
|
$errorhandler->_error($pkg, $function, $str, 10); |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
1
|
50
|
33
|
|
|
7
|
if( (!defined $username) && (defined $password) ) { |
|
279
|
0
|
|
|
|
|
0
|
my $str = "The --username option must be defined when using --password."; |
|
280
|
0
|
|
|
|
|
0
|
$errorhandler->_error($pkg, $function, $str, 10); |
|
281
|
|
|
|
|
|
|
} |
|
282
|
|
|
|
|
|
|
|
|
283
|
1
|
50
|
33
|
|
|
4
|
if((defined $getDescendants) && (!defined $umls)) |
|
284
|
|
|
|
|
|
|
{ |
|
285
|
0
|
|
|
|
|
|
my $str = "There must be a UMLS Interface object for getDescendants to be used."; |
|
286
|
0
|
|
|
|
|
|
$errorhandler->_error($pkg, $function, $str, 10); |
|
287
|
|
|
|
|
|
|
} |
|
288
|
|
|
|
|
|
|
} |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head3 exists |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
description: |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
function to check if a concept ID exists in the database. |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
input: |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
$concept <- string containing a cui |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
output: |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
1 | 0 <- integers indicating if the cui exists |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
example: |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
use UMLS::Association; |
|
307
|
|
|
|
|
|
|
my $umls = UMLS::Association->new(); |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
my $concept = "C0018563"; |
|
310
|
|
|
|
|
|
|
if($umls->exists($concept)) { |
|
311
|
|
|
|
|
|
|
print "$concept exists\n"; |
|
312
|
|
|
|
|
|
|
} |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=cut |
|
315
|
|
|
|
|
|
|
sub exists() { |
|
316
|
|
|
|
|
|
|
|
|
317
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
318
|
0
|
|
|
|
|
|
my $concept = shift; |
|
319
|
|
|
|
|
|
|
|
|
320
|
0
|
|
|
|
|
|
my $bool = $cuifinder->_exists($concept); |
|
321
|
|
|
|
|
|
|
|
|
322
|
0
|
|
|
|
|
|
return $bool; |
|
323
|
|
|
|
|
|
|
} |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=head3 getFrequency |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
description: |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
function returns the frequency of a given concept pair |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
input: |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
$concept1 <- cui |
|
335
|
|
|
|
|
|
|
$concept2 <- cui |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
output: |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
$frequency <- number |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
example: |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
use UMLS::Association; |
|
344
|
|
|
|
|
|
|
my $associator = UMLS::Association->new(); |
|
345
|
|
|
|
|
|
|
my $freq = $mmb->getFrequency($concept1, $concept2) |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=cut |
|
348
|
|
|
|
|
|
|
sub getFrequency { |
|
349
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
350
|
0
|
|
|
|
|
|
my $c1 = shift; |
|
351
|
0
|
|
|
|
|
|
my $c2 = shift; |
|
352
|
|
|
|
|
|
|
|
|
353
|
0
|
|
|
|
|
|
return $statfinder->_getFrequency($c1, $c2); |
|
354
|
|
|
|
|
|
|
} |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=head3 calculateStatistic |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
description: |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
function returns the given statistical score of a given concept pair |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
input: |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
$concept1 <- cui |
|
365
|
|
|
|
|
|
|
$concept2 <- cui |
|
366
|
|
|
|
|
|
|
$measure <- statistical measure |
|
367
|
|
|
|
|
|
|
output: |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
$score <- float |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
example: |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
use UMLS::Association; |
|
374
|
|
|
|
|
|
|
my $associator = UMLS::Association->new(); |
|
375
|
|
|
|
|
|
|
my $stat = $associator->calculateStatistic($concept1, $concept2, $measure) |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=cut |
|
378
|
|
|
|
|
|
|
sub calculateStatistic { |
|
379
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
380
|
0
|
|
|
|
|
|
my $c1 = shift; |
|
381
|
0
|
|
|
|
|
|
my $c2 = shift; |
|
382
|
0
|
|
|
|
|
|
my $meas = shift; |
|
383
|
|
|
|
|
|
|
|
|
384
|
0
|
|
|
|
|
|
return $statfinder->_calculateStatistic($c1, $c2, $meas); |
|
385
|
|
|
|
|
|
|
} |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=head3 getParents |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
description: |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
returns the parents of a concept - the relations that are considered parents |
|
392
|
|
|
|
|
|
|
are predefined by the user in the configuration file. The default is the PAR |
|
393
|
|
|
|
|
|
|
relation. |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
input: |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
$concept <- string containing cui |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
output: |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
$array <- reference to an array containing a list of cuis |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
example: |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
use UMLS::Association; |
|
406
|
|
|
|
|
|
|
my $umls = UMLS::Association->new(); |
|
407
|
|
|
|
|
|
|
my $concept = "C0018563"; |
|
408
|
|
|
|
|
|
|
my $parents = $umls->getParents($concept); |
|
409
|
|
|
|
|
|
|
print "The parents of $concept are:\n"; |
|
410
|
|
|
|
|
|
|
foreach my $parent (@{$parents}) { print " $parent\n"; } |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=cut |
|
413
|
|
|
|
|
|
|
sub getParents { |
|
414
|
|
|
|
|
|
|
|
|
415
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
416
|
0
|
|
|
|
|
|
my $concept = shift; |
|
417
|
|
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
|
my $array = $cuifinder->_getParents($concept); |
|
419
|
|
|
|
|
|
|
|
|
420
|
0
|
|
|
|
|
|
return $array; |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
} |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=head3 getChildren |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
description: |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
returns the children of a concept - the relations that are considered children |
|
429
|
|
|
|
|
|
|
are predefined by the user in the configuration file. The default is the CHD |
|
430
|
|
|
|
|
|
|
relation. |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
input: |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
$concept <- string containing cui |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
output: |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
$array <- reference to an array containing a list of cuis |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
example: |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
use UMLS::Association; |
|
443
|
|
|
|
|
|
|
my $umls = UMLS::Association->new(); |
|
444
|
|
|
|
|
|
|
my $concept = "C0018563"; |
|
445
|
|
|
|
|
|
|
my $children = $umls->getChildren($concept); |
|
446
|
|
|
|
|
|
|
print "The children of $concept are:\n"; |
|
447
|
|
|
|
|
|
|
foreach my $child (@{$children}) { print " $child\n"; } |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=cut |
|
450
|
|
|
|
|
|
|
sub getChildren { |
|
451
|
|
|
|
|
|
|
|
|
452
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
453
|
0
|
|
|
|
|
|
my $concept = shift; |
|
454
|
|
|
|
|
|
|
|
|
455
|
0
|
|
|
|
|
|
my $array = $cuifinder->_getChildren($concept); |
|
456
|
|
|
|
|
|
|
|
|
457
|
0
|
|
|
|
|
|
return $array; |
|
458
|
|
|
|
|
|
|
} |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
1; |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
__END__ |