blib/lib/UMLS/Interface.pm

filter: Statementstmt 19.6% 75 / 382 Branchbran 30.0% 6 / 20 Conditioncond 33.3% 5 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 15.9% 14 / 88 Podpod 88.0% 66 / 75 totaltotal 28.1% 166 / 590 CC 16 SCAR 16.1
CC
16
Cov
21%
_initialize
31.5
_checkOptions
14.9
new
2.1
CRAP 5.0
« blib/script/getExtendedDef.pl ↑ Summary blib/script/findAncestors.pl »
1 # UMLS::Interface
2 # (Last Updated $Id: Interface.pm,v 1.150 2016/07/11 16:36:48 btmcinnes Exp $)
3 #
4 # Perl module that provides a perl interface to the
5 # Unified Medical Language System (UMLS)
6 #
7 # Copyright (c) 2004-2015,
8 #
9 # Bridget T. McInnes, University of Minnesota Twin Cities
10 # bthomson at cs.umn.edu
11 #
12 # Siddharth Patwardhan, University of Utah, Salt Lake City
13 # sidd at cs.utah.edu
14 #
15 # Serguei Pakhomov, University of Minnesota Twin Cities
16 # pakh0002 at umn.edu
17 #
18 # Ted Pedersen, University of Minnesota, Duluth
19 # tpederse at d.umn.edu
20 #
21 # Ying Liu, University of Minnesota
22 # liux0935 at umn.edu
23 #
24 # This program is free software; you can redistribute it and/or
25 # modify it under the terms of the GNU General Public License
26 # as published by the Free Software Foundation; either version 2
27 # of the License, or (at your option) any later version.
28 #
29 # This program is distributed in the hope that it will be useful,
30 # but WITHOUT ANY WARRANTY; without even the implied warranty of
31 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 # GNU General Public License for more details.
33 #
34 # You should have received a copy of the GNU General Public License
35 # along with this program; if not, write to
36 #
37 # The Free Software Foundation, Inc.,
38 # 59 Temple Place - Suite 330,
39 # Boston, MA 02111-1307, USA.
40  
41 =head1 NAME
42  
43 UMLS::Interface - Perl interface to the Unified Medical Language System (UMLS)
44  
45 =head1 SYNOPSIS
46  
47 use UMLS::Interface;
48  
49 $umls = UMLS::Interface->new();
50  
51 die "Unable to create UMLS::Interface object.\n" if(!$umls);
52  
53 my $root = $umls->root();
54  
55 my $term1 = "skull";
56  
57 my $tList1 = $umls->getConceptList($term1);
58 my $cui1 = pop @{$tList1};
59  
60 my $term2 = "hand";
61 my $tList2 = $umls->getDefConceptList($term2);
62  
63 my $cui2 = shift @{$tList2};
64 my $exists1 = $umls->exists($cui1);
65 my $exists2 = $umls->exists($cui2);
66  
67 if($exists1) { print "The concept $term1 ($cui1) exists in your UMLS view.\n"; }
68 else { print "The concept $term1 ($cui1) does not exist in your UMLS view.\n"; }
69  
70 if($exists2) { print "The concept $term2 ($cui2) exists in your UMLS view.\n"; }
71 else { print "The concept $term2 ($cui2) does not exist in your UMLS view.\n"; }
72 print "\n";
73  
74 my $cList1 = $umls->getTermList($cui1);
75 my $cList2 = $umls->getDefTermList($cui2);
76  
77 print "The terms associated with $term1 ($cui1) using the SAB parameter:\n";
78 foreach my $c1 (@{$cList1}) {
79 print " => $c1\n";
80 } print "\n";
81  
82 print "The terms associated with $term2 ($cui2) using the SABDEF parameter:\n";
83 foreach my $c2 (@{$cList2}) {
84 print " => $c2\n";
85 } print "\n";
86  
87 my $lcs = $umls->findLeastCommonSubsumer($cui1, $cui2);
88 print "The least common subsumer between $term1 ($cui1) and ";
89 print "$term2 ($cui2) is @{$lcs}\n\n";
90  
91 my $shortestpath = $umls->findShortestPath($cui1, $cui2);
92 print "The shortest path between $term1 ($cui1) and $term2 ($cui2):\n";
93 print " => @{$shortestpath}\n\n";
94  
95 my $pathstoroot = $umls->pathsToRoot($cui1);
96 print "The paths from $term1 ($cui1) and the root:\n";
97 foreach $path (@{$pathstoroot}) {
98 print " => $path\n";
99 } print "\n";
100  
101 my $mindepth = $umls->findMinimumDepth($cui1);
102 my $maxdepth = $umls->findMaximumDepth($cui1);
103 print "The minimum depth of $term1 ($cui1) is $mindepth\n";
104 print "The maximum depth of $term1 ($cui1) is $maxdepth\n\n";
105  
106 my $children = $umls->getChildren($cui2);
107 print "The child(ren) of $term2 ($cui2) are: @{$children}\n\n";
108  
109 my $parents = $umls->getParents($cui2);
110 print "The parent(s) of $term2 ($cui2) are: @{$parents}\n\n";
111  
112 my $relations = $umls->getRelations($cui2);
113 print "The relation(s) of $term2 ($cui2) are: @{$relations}\n\n";
114  
115 my $rels = $umls->getRelated($cui2, "PAR");
116 print "The parents(s) of $term2 ($cui2) are: @{$rels}\n\n";
117  
118 my $definitions = $umls->getCuiDef($cui1);
119 print "The definition(s) of $term1 ($cui1) are:\n";
120 foreach $def (@{$definitions}) {
121 print " => $def\n"; $i++;
122 } print "\n";
123  
124 my $sabs = $umls->getSab($cui1);
125  
126 print "The sources containing $term1 ($cui1) are: @{$sabs}\n\n";
127  
128 print "The semantic type(s) of $term1 ($cui1) and the semantic\n";
129  
130 print "definition are:\n";
131 my $sts = $umls->getSt($cui1);
132 foreach my $st (@{$sts}) {
133  
134 my $abr = $umls->getStAbr($st);
135 my $string = $umls->getStString($abr);
136 my $def = $umls->getStDef($abr);
137 print " => $string ($abr) : @{$def}\n";
138  
139 } print "\n";
140  
141 $umls->removeConfigFiles();
142  
143 $umls->dropConfigTable();
144  
145 =head1 ABSTRACT
146  
147 This package provides a Perl interface to the Unified Medical Language
148 System. The package is set up to access pre-specified sources of the UMLS
149 present in a mysql database. The package was essentially created for use
150 with the UMLS::Similarity package for measuring the semantic relatedness
151 of concepts.
152  
153 =head1 INSTALL
154  
155 To install the module, run the following magic commands:
156  
157 perl Makefile.PL
158 make
159 make test
160 make install
161  
162 This will install the module in the standard location. You will, most
163 probably, require root privileges to install in standard system
164 directories. To install in a non-standard directory, specify a prefix
165 during the 'perl Makefile.PL' stage as:
166  
167 perl Makefile.PL PREFIX=/home/sid
168  
169 It is possible to modify other parameters during installation. The
170 details of these can be found in the ExtUtils::MakeMaker
171 documentation. However, it is highly recommended not messing around
172 with other parameters, unless you know what you're doing.
173  
174 =head1 DESCRIPTION
175  
176 This package provides a Perl interface to the Unified Medical
177 Language System (UMLS). The UMLS is a knowledge representation
178 framework encoded designed to support broad scope biomedical
179 research queries. There exists three major sources in the UMLS.
180 The Metathesaurus which is a taxonomy of medical concepts, the
181 Semantic Network which categorizes concepts in the Metathesaurus,
182 and the SPECIALIST Lexicon which contains a list of biomedical
183 and general English terms used in the biomedical domain. The
184 UMLS-Interface package is set up to access the Metathesaurus
185 and the Semantic Network present in a mysql database.
186  
187 =head1 DATABASE SETUP
188  
189 The interface assumes that the UMLS is present as a mysql database.
190 The name of the database can be passed as configuration options at
191 initialization. However, if the names of the databases are not
192 provided at initialization, then default value is used -- the
193 database for the UMLS is called 'umls'.
194  
195 The UMLS database must contain six tables:
196 1. MRREL
197 2. MRCONSO
198 3. MRSAB
199 4. MRDOC
200 5. MRDEF
201 6. MRSTY
202 7. SRDEF
203  
204 All other tables in the databases will be ignored, and any of these
205 tables missing would raise an error.
206  
207 A script explaining how to install the UMLS and the mysql database
208 are in the INSTALL file.
209  
210 =head1 INITIALIZING THE MODULE
211  
212 To create an instance of the interface object, using default values
213 for all configuration options:
214  
215 use UMLS::Interface;
216 my $interface = UMLS::Interface->new();
217  
218 Database connection options can be passed through the my.cnf file. For
219 example:
220 [client]
221 user = <username>
222 password = <password>
223 port = 3306
224 socket = /tmp/mysql.sock
225 database = umls
226  
227 Or through the by passing the connection information when first
228 instantiating an instance. For example:
229  
230 $umls = UMLS::Interface->new({"driver" => "mysql",
231 "database" => "$database",
232 "username" => "$opt_username",
233 "password" => "$opt_password",
234 "hostname" => "$hostname",
235 "socket" => "$socket"});
236  
237 'driver' -> Default value 'mysql'. This option specifies the Perl
238 DBD driver that should be used to access the
239 database. This implies that the some other DBMS
240 system (such as PostgresSQL) could also be used,
241 as long as there exist Perl DBD drivers to
242 access the database.
243 'umls' -> Default value 'umls'. This option specifies the name
244 of the UMLS database.
245 'hostname' -> Default value 'localhost'. The name or the IP address
246 of the machine on which the database server is
247 running.
248 'socket' -> Default value '/tmp/mysql.sock'. The socket on which
249 the database server is using.
250 'port' -> The port number on which the database server accepts
251 connections.
252 'username' -> Username to use to connect to the database server. If
253 not provided, the module attempts to connect as an
254 anonymous user.
255 'password' -> Password for access to the database server. If not
256 provided, the module attempts to access the server
257 without a password.
258  
259 More information is provided in the INSTALL file Stage 5 Step D (search for
260 'Step D' and you will find it).
261  
262 =head1 PARAMETERS
263  
264 You can also pass other parameters which controls the functionality
265 of the Interface.pm module.
266  
267 $umls = UMLS::Interface->new({"forcerun" => "1",
268 "realtime" => "1",
269 "cuilist" => "file",
270 "verbose" => "1",
271 "debugpath" => "file"});
272  
273 'forcerun' -> This parameter will bypass any command prompts such
274 as asking if you would like to continue with the index
275 creation.
276  
277 'realtime' -> This parameter will not create a database of path
278 information (what we refer to as the index) but obtain
279 the path information about a concept on the fly
280  
281 'cuilist' -> This parameter contains a file containing a list
282 of CUIs in which the path information should be
283 store for - if the CUI isn't on the list the path
284 information for that CUI will not be stored
285  
286 'verbose' -> This parameter will print out the table information
287 to a config file in the UMLSINTERFACECONFIG directory
288  
289 'debugpath' -> This prints out the path information to a file during
290 any of the realtime runs
291  
292  
293 You can also reconfigure these options by calling the reConfig
294 method.
295  
296 $umls->reConfig({"forcerun" => "1",
297 "realtime" => "1",
298 "verbose" => "1",
299 "debugpath" => "file"});
300  
301  
302 =head1 CONFIGURATION FILE
303  
304 There exist a configuration files to specify which source and what
305 relations are to be used. The default source is the Medical Subject
306 Heading (MSH) vocabulary and the default relations are the PAR/CHD
307 relation.
308  
309 'config' -> File containing the source and relation parameters
310  
311 The configuration file can be passed through the instantiation of
312 the UMLS-Interface. Similar to passing the connection options. For
313 example:
314  
315 $umls = UMLS::Interface->new({"driver" => "mysql",
316 "database" => $database,
317 "username" => $opt_username,
318 "password" => $opt_password,
319 "hostname" => $hostname,
320 "socket" => $socket,
321 "config" => $configfile});
322  
323 or
324  
325 $umls = UMLS::Interface->new({"config" => $configfile});
326  
327 The format of the configuration file is as follows:
328  
329 SAB :: <include|exclude> <source1, source2, ... sourceN>
330 REL :: <include|exclude> <relation1, relation2, ... relationN>
331 RELA :: <include|exclude> <rela1, rela2, ... relaN>
332
333 SABDEF :: <include|exclude> <source1, source2, ... sourceN>
334 RELDEF :: <include|exclude> <relation1, relation2, ... relationN>
335  
336 The SAB, REL and RELA are for specifing what sources and relations
337 should be used when traversing the UMLS. For example, if we
338 wanted to use the MSH vocabulary with only the RB/RN relations
339 that have been identified as 'isa' RELAs, then the configuration
340 file would be:
341  
342 SAB :: include MSH
343 REL :: include RB, RN
344 RELA :: include inverse_isa, isa
345  
346 if we did not care what type of RELA the RB/RN relations were the
347 configuration would be:
348  
349 SAB :: include MSH
350 REL :: include RB, RN
351  
352  
353 if we wanted to use MSH and use any relation except for PAR/CHD,
354 the configuration would be:
355  
356 SAB :: include MSH
357 REL :: exclude PAR, CHD
358  
359 The SABDEF and RELDEF are for obtaining a definition or extended
360 definition of the CUI. SABDEF signifies which sources to extract
361 the definition from. For example,
362  
363 SABDEF :: include SNOMEDCT
364  
365 would only return definitions that exist in the SNOMEDCT source.
366 where as:
367  
368 SABDEF :: exclude SNOMEDCT
369  
370 would use the definitions from the entire UMLS except for SNOMEDCT.
371 The default, if you didn't specify SABDEF at all in the configuration
372 file, would use the entire UMLS.
373  
374 The RELDEF is from the extended definition. It signifies which
375 relations should be included when creating the extended definition
376 of a given CUI. For example,
377  
378 RELDEF :: include TERM, CUI, PAR, CHD, RB, RN
379  
380 This would include in the definition the terms associated with
381 the CUI, the CUI's definition and the definitions of the concepts
382 related to the CUI through either a PAR, CHD, RB or RN relation.
383 Similarly, using the exclude as in:
384  
385 RELDEF :: exclude TERM, CUI, PAR, CHD, RB, RN
386  
387 would use all of the relations except for the one's specified. If
388 RELDEF is not specified the default uses all of the relations which
389 consist of: TERM, CUI, PAR, CHD, RB, RN, RO, SYN, and SIB.
390  
391 I know that TERM and CUI are not 'relations' but we needed a way to
392 specify them and this seem to make the most sense at the time.
393  
394 An example of the configuration file can be seen in the samples/ directory.
395  
396 =head1 FUNCTION DESCRIPTIONS
397  
398 =cut
399  
400 package UMLS::Interface;
401  
402 58 ▶use Fcntl;
Subroutine BEGIN: called CC=1 SCAR=0.0
403 58 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
404 58 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
405 58 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
406 58 ▶use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
407  
408 58 ▶use UMLS::Interface::CuiFinder;
Subroutine BEGIN: called CC=1 SCAR=0.0
409 58 ▶use UMLS::Interface::PathFinder;
Subroutine BEGIN: called CC=1 SCAR=0.0
410 58 ▶use UMLS::Interface::ICFinder;
Subroutine BEGIN: called CC=1 SCAR=0.0
411 58 ▶use UMLS::Interface::STFinder;
Subroutine BEGIN: called CC=1 SCAR=0.0
412 58 ▶use UMLS::Interface::ErrorHandler;
Subroutine BEGIN: called CC=1 SCAR=0.0
413  
414 58 my $cuifinder = "";
415 58 my $pathfinder = "";
416 58 my $icfinder = "";
417 58 my $stfinder = "";
418 58 my $errorhandler = "";
419  
420 58 my $pkg = "UMLS::Interface";
421  
422 58 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
423  
424 58 $VERSION = '1.49';
425  
426 58 my $debug = 0;
427  
428 # UMLS-specific stuff ends ----------
429  
430 # -------------------- Class methods start here --------------------
431  
432 # method to create a new UMLS::Interface object
433 # input : $params <- reference to hash containing the parameters
434 # output:
435 sub new {
436  
437 36 ▶ my $self = {};
Subroutine new: called CC=2 SCAR=7.5
Pod undocumented
438 36 my $className = shift;
439 36 my $params = shift;
440  
441 # bless the object.
442 36 bless($self, $className);
443  
444 # initialize error handler
445 36 $errorhandler = UMLS::Interface::ErrorHandler->new();
446 36 ▶ if(! defined $errorhandler) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $errorhandler) 0 36 36
447 0 print STDERR "The error handler did not get passed properly.\n";
448 0 exit;
449 }
450  
451 # check options
452 36 $self->_checkOptions($params);
453  
454 # Initialize the object.
455 36 $self->_initialize($params);
456  
457 0 return $self;
458 }
459  
460 # initialize the variables and set the parameters
461 # input : $params <- reference to hash containing the parameters
462 # output:
463 sub _initialize {
464  
465 36 ▶ my $self = shift;
Subroutine _initialize: called CC=7 SCAR=34.5
466 36 my $params = shift;
467  
468 36 my $function = "_initialize";
469  
470 # check self
471 36 ▶ if(!defined $self || !ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self and ref $self) 0 36 36
Condition33%1/3
defined $self and ref $self
!ll&&!rl&&r
0036
MC/DC0%0/2
defined $self and ref $self
defined $self ref $self
Truth table33%1/3
A and B
A= defined $selfB= ref $self
ABresult
0X0
100
111
472 0 $errorhandler->_error($pkg, $function, "", 2);
473 }
474  
475 # NOTE: The PathFinder and ICFinder require the CuiFinder
476 # therefore it needs to be initialized the first
477  
478 # set the cuifinder
479 36 $cuifinder = UMLS::Interface::CuiFinder->new($params);
480 0 ▶ if(! defined $cuifinder) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $cuifinder) 0 0 0
481 0 my $str = "The UMLS::Interface::CuiFinder object was not created.";
482 0 $errorhandler->_error($pkg, $function, $str, 8);
483 }
484
485 # set the pathfinder
486 0 $pathfinder = UMLS::Interface::PathFinder->new($params, $cuifinder);
487 0 ▶ if(! defined $pathfinder) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pathfinder) 0 0 0
488 0 my $str = "The UMLS::Interface::PathFinder object was not created.";
489 0 $errorhandler->_error($pkg, $function, $str, 8);
490 }
491
492 # set the icfinder
493 0 $icfinder = UMLS::Interface::ICFinder->new($params, $cuifinder, $pathfinder);
494 0 ▶ if(! defined $icfinder) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $icfinder) 0 0 0
495 0 my $str = "The UMLS::Interface::ICFinder object was not created.";
496 0 $errorhandler->_error($pkg, $function, $str, 8);
497 }
498  
499 # set the stfinder
500 0 $stfinder = UMLS::Interface::STFinder->new($params, $cuifinder);
501 0 ▶ if(! defined $stfinder) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $stfinder) 0 0 0
502 0 my $str = "The UMLS::Interface::STFinder object was not created.";
503 0 $errorhandler->_error($pkg, $function, $str, 8);
504 }
505
506 }
507  
508 # method checks the parameters based to the UMLS::Interface package
509 # input : $params <- reference to hash containing the parameters
510 # output:
511 sub _checkOptions {
512  
513 36 ▶ my $self = shift;
Subroutine _checkOptions: called CC=9 SCAR=27.0
514 36 my $params = shift;
515  
516 36 my $function = "_checkOptions";
517  
518 # check self
519 36 ▶ if(!defined $self || !ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self and ref $self) 0 36 36
Condition33%1/3
defined $self and ref $self
!ll&&!rl&&r
0036
MC/DC0%0/2
defined $self and ref $self
defined $self ref $self
Truth table33%1/3
A and B
A= defined $selfB= ref $self
ABresult
0X0
100
111
520 0 $errorhandler->_error($pkg, $function, "", 2);
521 }
522  
523 # database options
524 36 my $database = $params->{'database'};
525 36 my $hostname = $params->{'hostname'};
526 36 my $socket = $params->{'socket'};
527 36 my $port = $params->{'port'};
528 36 my $username = $params->{'username'};
529 36 my $password = $params->{'password'};
530
531 # cuifinder options
532 36 my $config = $params->{'config'};
533
534 # pathfinder options
535 36 my $forcerun = $params->{'forcerun'};
536 36 my $realtime = $params->{'realtime'};
537 36 my $debugpath = $params->{'debugpath'};
538  
539 # general options
540 36 my $debugoption = $params->{'debug'};
541 36 my $verbose = $params->{'verbose'};
542 36 my $cuilist = $params->{'cuilist'};
543  
544 36 ▶ if( (defined $username) && (!defined $password) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $username and not defined $password) 0 36 36
Condition33%1/3
defined $username and not defined $password
!ll&&!rl&&r
3600
MC/DC0%0/2
defined $username and not defined $password
defined $username not defined $password
Truth table33%1/3
A and not(B)
A= defined $usernameB= not defined $password
ABresult
0X0
100
111
545 0 my $str = "The --password option must be defined when using --username.";
546 0 $errorhandler->_error($pkg, $function, $str, 10);
547 }
548  
549 36 ▶ if( (!defined $username) && (defined $password) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $username and defined $password) 0 36 36
Condition33%1/3
not defined $username and defined $password
!ll&&!rl&&r
0360
MC/DC0%0/2
not defined $username and defined $password
not defined $username defined $password
Truth table33%1/3
not(A) and B
A= not defined $usernameB= defined $password
ABresult
0X0
100
111
550 0 my $str = "The --username option must be defined when using --password.";
551 0 $errorhandler->_error($pkg, $function, $str, 10);
552 }
553  
554 36 ▶ if( (defined $forcerun) && (defined $realtime) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $forcerun and defined $realtime) 0 36 36
Condition33%1/3
defined $forcerun and defined $realtime
!ll&&!rl&&r
3600
MC/DC0%0/2
defined $forcerun and defined $realtime
defined $forcerun defined $realtime
Truth table33%1/3
A and B
A= defined $forcerunB= defined $realtime
ABresult
0X0
100
111
555 0 my $str = "The --forcerun and --realtime option ";
556 0 $str .= "can not be set at the same time.";
557 0 $errorhandler->_error($pkg, $function, $str, 10);
558 }
559
560 }
561  
562 =head2 Configuration Functions
563  
564 =head3 returnTableNames
565  
566 description:
567  
568 returns the table names in both human readable and hex form
569  
570 input:
571  
572 None
573
574 output:
575  
576 $hash <- reference to a hash containin the table names
577 in human readable and hex form
578  
579 example:
580  
581 use UMLS::Interface;
582 my $umls = UMLS::Interface->new();
583 my $hash = $umls->returnTableNames();
584 foreach my $table (sort keys %{$hash}) { print "$table\n"; }
585  
586 =cut
587 sub returnTableNames {
588  
589 0 ▶ my $self = shift;
Subroutine returnTableNames: not called CC=1 SCAR=6.9
Pod documented
590
591 0 my $hash = $cuifinder->_returnTableNames();
592  
593 0 return $hash;
594  
595 }
596  
597 =head3 dropConfigTable
598  
599 description:
600  
601 removes the configuration tables
602  
603 input:
604  
605 None
606
607 output:
608  
609 None
610  
611 example:
612  
613 use UMLS::Interface;
614 my $umls = UMLS::Interface->new();
615 $umls->dropConfigTable();
616  
617 =cut
618 sub dropConfigTable {
619
620 0 ▶ my $self = shift;
Subroutine dropConfigTable: not called CC=1 SCAR=6.9
Pod documented
621  
622 0 $cuifinder->_dropConfigTable();
623  
624 0 return;
625
626 }
627  
628 =head3 removeConfigFiles
629  
630 description:
631  
632 removes the configuration files
633  
634 input:
635  
636 None
637
638 output:
639  
640 None
641
642 example:
643  
644 use UMLS::Interface;
645 my $umls = UMLS::Interface->new();
646 $umls->removeConfigFiles();
647  
648 =cut
649 sub removeConfigFiles {
650  
651 0 ▶ my $self = shift;
Subroutine removeConfigFiles: not called CC=1 SCAR=6.9
Pod documented
652  
653 0 $cuifinder->_removeConfigFiles();
654  
655 0 return;
656 }
657  
658 =head3 reConfig
659  
660 description:
661  
662 function to re-initialize the interface configuration parameters
663  
664 input:
665
666 $hash -> reference to hash containing parameters
667  
668 output:
669  
670 None
671  
672 example:
673  
674 use UMLS::Interface;
675 my $umls = UMLS::Interface->new();
676 my %parameters = ();
677 $parameters{"verbose"} = 1;
678 $umls->reConfig(\%parameters);
679  
680 =cut
681 sub reConfig
682 {
683 0 ▶ my $self = shift;
Subroutine reConfig: not called CC=1 SCAR=6.9
Pod documented
684 0 my $params = shift;
685  
686 0 $cuifinder->_reConfig($params);
687 }
688  
689 # check that the parameters in config file match
690 # input : $string1 <- string containing parameter
691 # $string2 <- string containing configuratation parameter
692 # output: 0|1 <- true or false
693 sub checkParameters {
694 0 ▶ my $self = shift;
Subroutine checkParameters: not called CC=1 SCAR=6.9
Pod undocumented
695 0 my $string1 = shift;
696 0 my $string2 = shift;
697
698 0 return $icfinder->_checkParameters($string1, $string2);
699 }
700  
701 # check that the parameters in config file match
702 # input : $string <- string containing relation configuration parameter
703 # output: 0|1 <- true or false
704 sub checkHierarchicalRelations {
705 0 ▶ my $self = shift;
Subroutine checkHierarchicalRelations: not called CC=1 SCAR=6.9
Pod undocumented
706 0 my $string = shift;
707
708 0 return $icfinder->_checkHierarchicalRelations($string);
709 }
710  
711 =head2 UMLS Functions
712  
713 =head3 root
714  
715 description:
716  
717 returns the root
718  
719 input:
720  
721 None
722
723 output:
724  
725 $string -> string containing the root
726  
727 example:
728  
729 use UMLS::Interface;
730 my $umls = UMLS::Interface->new();
731 my $root = $umls->root();
732 print "The root is: $root\n";
733
734 =cut
735 sub root {
736  
737 0 ▶ my $self = shift;
Subroutine root: not called CC=1 SCAR=6.9
Pod documented
738  
739 0 my $root = $cuifinder->_root();
740  
741 0 return $root;
742 }
743  
744  
745 =head3 version
746  
747 description:
748  
749 returns the version of the UMLS currently being used
750  
751 input:
752  
753 None
754
755 output:
756  
757 $version -> string containing the version
758  
759 example:
760  
761 use UMLS::Interface;
762 my $umls = UMLS::Interface->new();
763 my $version = $umls->version();
764 print "The version of the UMLS is: $version\n";
765
766 =cut
767 sub version {
768  
769 0 ▶ my $self = shift;
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
770  
771 0 my $version = $cuifinder->_version();
772  
773 0 return $version;
774 }
775  
776 =head2 Parameter Functions
777  
778 =head3 getConfigParameters
779  
780 description:
781  
782 returns the SAB/REL or SABDEF/RELDEF parameters set in the configuration file
783  
784 input:
785  
786 None
787
788 output:
789  
790 $hash <- reference to hash containing parameters in the
791 configuration file - if there was not config
792 file the hash is empty and defaults are being
793 use
794  
795 example:
796  
797 use UMLS::Interface;
798 my $umls = UMLS::Interface->new();
799 my $hash = $umls->getConfigParameters;
800 print "The configuration parameters are: \n";
801 foreach my $param (sort keys %{$hash}) {
802 print " $param\n";
803 }
804  
805 =cut
806 sub getConfigParameters {
807 0 ▶ my $self = shift;
Subroutine getConfigParameters: not called CC=1 SCAR=6.9
Pod documented
808  
809 0 my $function = "getConfigParameters";
810  
811 0 return $cuifinder->_getConfigParameters();
812 }
813  
814 =head3 getSabString
815  
816 description:
817  
818 returns the sab (SAB) information from the configuration file
819  
820 input:
821  
822 None
823
824 output:
825  
826 $string <- containing the SAB line from the config file
827  
828 example:
829  
830 use UMLS::Interface;
831 my $umls = UMLS::Interface->new();
832 my $string = $umls->getSabString();
833 print "The SAB parameter is: $string\n";
834  
835 =cut
836 sub getSabString {
837
838 0 ▶ my $self = shift;
Subroutine getSabString: not called CC=1 SCAR=6.9
Pod documented
839
840 0 my $function = "getSabString";
841
842 0 return $cuifinder->_getSabString();
843 }
844  
845 =head3 getRelString
846  
847 description:
848  
849 returns the relation (REL) information from the configuration file
850  
851 input:
852  
853 None
854
855 output:
856  
857 $string <- containing the REL line from the config file
858  
859 example:
860  
861 use UMLS::Interface;
862 my $umls = UMLS::Interface->new();
863 my $string = $umls->getRelString();
864 print "The REL parameter is: $string\n";
865  
866 =cut
867 sub getRelString {
868
869 0 ▶ my $self = shift;
Subroutine getRelString: not called CC=1 SCAR=6.9
Pod documented
870
871 0 my $function = "getRelString";
872
873 0 return $cuifinder->_getRelString();
874 }
875  
876 =head3 getRelaString
877  
878 description:
879  
880 returns the rela (RELA) information from the configuration file
881  
882 input:
883  
884 None
885
886 output:
887  
888 $string <- containing the RELA line from the config fil
889  
890 example:
891  
892 use UMLS::Interface;
893 my $umls = UMLS::Interface->new();
894 my $string = $umls->getRelaString();
895 print "The RELA parameter is: $string\n";
896  
897 =cut
898 sub getRelaString {
899
900 0 ▶ my $self = shift;
Subroutine getRelaString: not called CC=1 SCAR=6.9
Pod documented
901
902 0 my $function = "getRelaString";
903
904 0 return $cuifinder->_getRelaString();
905 }
906  
907 =head2 Metathesaurus Concept Functions
908  
909 =head3 exists
910  
911 description:
912  
913 function to check if a concept ID exists in the database.
914  
915 input:
916  
917 $concept <- string containing a cui
918  
919 output:
920  
921 1 | 0 <- integers indicating if the cui exists
922  
923 example:
924  
925 use UMLS::Interface;
926 my $umls = UMLS::Interface->new();
927
928 my $concept = "C0018563";
929 if($umls->exists($concept)) {
930 print "$concept exists\n";
931 }
932  
933 =cut
934 sub exists() {
935
936 0 ▶ my $self = shift;
Subroutine exists: not called CC=1 SCAR=6.9
Pod documented
937 0 my $concept = shift;
938
939 0 my $bool = $cuifinder->_exists($concept);
940  
941 0 return $bool;
942 }
943  
944 =head3 getRelated
945  
946 description:
947  
948 function that returns a list of concepts (@concepts) related
949 to a concept $concept through a relation $rel
950  
951 input:
952  
953 $concept <- string containing cui
954 $rel <- string containing a relation
955  
956 output:
957  
958 $array <- reference to an array of cuis
959  
960 example:
961  
962 use UMLS::Interface;
963 my $umls = UMLS::Interface->new();
964 my $concept = "C0018563";
965 my $rel = "SIB";
966 my $array = $umls->getRelated($concept, $rel);
967 print "The concepts related to $concept using the $rel relation are: \n";
968 foreach my $related_concept (@{$array}) {
969 print "$related_concept\n";
970 }
971  
972 =cut
973 sub getRelated {
974  
975 0 ▶ my $self = shift;
Subroutine getRelated: not called CC=1 SCAR=6.9
Pod documented
976 0 my $concept = shift;
977 0 my $rel = shift;
978  
979 0 my $array = $cuifinder->_getRelated($concept, $rel);
980  
981 0 return $array;
982 }
983  
984 =head3 getPreferredTerm
985  
986 description:
987  
988 function that returns the preferred term of a cui from the sources
989 specified in the configuration file
990  
991 input:
992  
993 $concept <- string containing cui
994  
995 output:
996  
997 $string <- string containing the preferred term
998  
999 example:
1000  
1001 use UMLS::Interface;
1002 my $umls = UMLS::Interface->new();
1003 my $concept = "C0018563";
1004 my $string = $umls->getPreferredTerm($concept);
1005 print "The preferred term of $concept is $string\n";
1006  
1007 =cut
1008 sub getPreferredTerm {
1009 0 ▶ my $self = shift;
Subroutine getPreferredTerm: not called CC=1 SCAR=6.9
Pod documented
1010 0 my $concept = shift;
1011
1012 0 return $cuifinder->_getPreferredTerm($concept);
1013 }
1014  
1015  
1016 =head3 getAllPreferredTerm
1017  
1018 description:
1019  
1020 function that returns the preferred term of a cui from entire umls
1021  
1022 input:
1023  
1024 $concept <- string containing cui
1025  
1026 output:
1027  
1028 $string <- string containing the preferred term
1029  
1030 example:
1031  
1032 use UMLS::Interface;
1033 my $umls = UMLS::Interface->new();
1034 my $concept = "C0018563";
1035 my $string = $umls->getAllPreferredTerm($concept);
1036 print "The preferred term of $concept is $string\n";
1037
1038 =cut
1039 sub getAllPreferredTerm {
1040 0 ▶ my $self = shift;
Subroutine getAllPreferredTerm: not called CC=1 SCAR=6.9
Pod documented
1041 0 my $concept = shift;
1042
1043 0 return $cuifinder->_getAllPreferredTerm($concept);
1044 }
1045  
1046 =head3 getTermList
1047  
1048 description:
1049  
1050 function to map terms to a given cui from the sources
1051 specified in the configuration file using SAB
1052  
1053 input:
1054  
1055 $concept <- string containing cui
1056  
1057 output:
1058  
1059 $array <- reference to an array of terms (strings)
1060  
1061 example:
1062  
1063 use UMLS::Interface;
1064 my $umls = UMLS::Interface->new();
1065 my $concept = "C0018563";
1066 my $array = $umls->getTermList($concept);
1067 print "The terms associated with $concept are:\n";
1068 foreach my $term (@{$array}) { print " $term\n"; }
1069  
1070 =cut
1071 sub getTermList {
1072  
1073 0 ▶ my $self = shift;
Subroutine getTermList: not called CC=1 SCAR=6.9
Pod documented
1074 0 my $concept = shift;
1075
1076 0 my $array = $cuifinder->_getTermList($concept);
1077  
1078 0 return $array;
1079 }
1080  
1081 =head3 getDefTermList
1082  
1083 description:
1084  
1085 function to map terms to a given cui from the sources
1086 specified in the configuration file using SABDEF
1087  
1088 input:
1089  
1090 $concept <- string containing cui
1091  
1092 output:
1093  
1094 $array <- reference to an array of terms (strings)
1095  
1096 example:
1097  
1098 use UMLS::Interface;
1099 my $umls = UMLS::Interface->new();
1100 my $concept = "C0018563";
1101 my $array = $umls->getDefTermList($concept);
1102 print "The terms associated with $concept are:\n";
1103 foreach my $term (@{$array}) { print " $term\n"; }
1104  
1105 =cut
1106 sub getDefTermList {
1107  
1108 0 ▶ my $self = shift;
Subroutine getDefTermList: not called CC=1 SCAR=6.9
Pod documented
1109 0 my $concept = shift;
1110
1111 0 my $array = $cuifinder->_getDefTermList($concept);
1112  
1113 0 return $array;
1114 }
1115  
1116 =head3 getAllTerms
1117  
1118 description:
1119  
1120 function to map terms from the entire UMLS to a given cui
1121  
1122 input:
1123  
1124 $concept <- string containing cui
1125  
1126 output:
1127  
1128 $array <- reference to an array containing terms (strings)
1129  
1130 example:
1131  
1132 use UMLS::Interface;
1133 my $umls = UMLS::Interface->new();
1134 my $concept = "C0018563";
1135 my $array = $umls->getAllTerms($concept);
1136 print "The terms associated with $concept are:\n";
1137 foreach my $term (@{$array}) { print " $term\n"; }
1138  
1139 =cut
1140 sub getAllTerms {
1141  
1142 0 ▶ my $self = shift;
Subroutine getAllTerms: not called CC=1 SCAR=6.9
Pod documented
1143 0 my $concept = shift;
1144  
1145 0 my $array = $cuifinder->_getAllTerms($concept);
1146  
1147 0 return $array;
1148 }
1149  
1150 =head3 getConceptList
1151  
1152 description:
1153  
1154 function to maps a given term to a set cuis in the sources
1155 specified in the configuration file by SAB
1156  
1157 input:
1158  
1159 $term <- string containing a term
1160  
1161 output:
1162  
1163 $array <- reference to an array containing cuis
1164  
1165 example:
1166  
1167 use UMLS::Interface;
1168 my $umls = UMLS::Interface->new();
1169
1170 my $term = "hand";
1171 my $array = $umls->getConceptList($term);
1172 print "The concept associated with $term are:\n";
1173 foreach my $concept (@{$array}) { print " $concept\n"; }
1174  
1175 =cut
1176 sub getConceptList {
1177  
1178 0 ▶ my $self = shift;
Subroutine getConceptList: not called CC=1 SCAR=6.9
Pod documented
1179 0 my $term = shift;
1180  
1181 0 my $array = $cuifinder->_getConceptList($term);
1182  
1183 0 return $array;
1184 }
1185  
1186 =head3 getDefConceptList
1187  
1188 description:
1189  
1190 function to maps a given term to a set cuis in the sources
1191 specified in the configuration file by SABDEF
1192  
1193 input:
1194  
1195 $term <- string containing a term
1196  
1197 output:
1198  
1199 $array <- reference to an array containing cuis
1200  
1201 example:
1202  
1203 use UMLS::Interface;
1204 my $umls = UMLS::Interface->new();
1205 my $term = "hand";
1206 my $array = $umls->getDefConceptList($term);
1207 print "The concept associated with $term are:\n";
1208 foreach my $concept (@{$array}) { print " $concept\n"; }
1209  
1210 =cut
1211 sub getDefConceptList {
1212  
1213 0 ▶ my $self = shift;
Subroutine getDefConceptList: not called CC=1 SCAR=6.9
Pod documented
1214 0 my $term = shift;
1215  
1216 0 my $array = $cuifinder->_getDefConceptList($term);
1217  
1218 0 return $array;
1219 }
1220  
1221 =head3 getAllConcepts
1222  
1223 description:
1224  
1225 function to maps a given term to a set cuis all the sources
1226  
1227 input:
1228  
1229 $term <- string containing a term
1230  
1231 output:
1232  
1233 $array <- reference to an array containing cuis
1234  
1235 example:
1236  
1237 use UMLS::Interface;
1238 my $umls = UMLS::Interface->new();
1239 my $term = "hand";
1240 my $array = $umls->getAllConcepts($term);
1241 print "The concept associated with $term are:\n";
1242 foreach my $concept (@{$array}) { print " $concept\n"; }
1243  
1244 =cut
1245 sub getAllConcepts {
1246  
1247 0 ▶ my $self = shift;
Subroutine getAllConcepts: not called CC=1 SCAR=6.9
Pod documented
1248 0 my $term = shift;
1249  
1250 0 my $array = $cuifinder->_getAllConcepts($term);
1251  
1252 0 return $array;
1253 }
1254  
1255 # method to maps a given term to a set cuis in the sources
1256 # specified in the configuration file by SABDEF
1257 # input : $term <- string containing a term
1258 # output: $array <- reference to an array containing cuis
1259 sub getSabDefConcepts {
1260  
1261 0 ▶ my $self = shift;
Subroutine getSabDefConcepts: not called CC=1 SCAR=6.9
Pod undocumented
1262 0 my $term = shift;
1263  
1264 0 my $array = $cuifinder->_getSabDefConcepts($term);
1265  
1266 0 return $array;
1267 }
1268  
1269  
1270 =head3 getCompounds
1271  
1272 description:
1273  
1274 function returns all the compounds in the sources
1275 specified in the configuration file
1276  
1277 input:
1278  
1279 None
1280
1281 output:
1282  
1283 $hash <- reference to a hash containing cuis
1284  
1285 example:
1286  
1287 use UMLS::Interface;
1288 my $umls = UMLS::Interface->new();
1289 my $hash = $umls->getCompounds();
1290 foreach my $term (sort keys %{$hash}) {
1291 print "$term\n";
1292 }
1293  
1294 =cut
1295 sub getCompounds {
1296  
1297 0 ▶ my $self = shift;
Subroutine getCompounds: not called CC=1 SCAR=6.9
Pod documented
1298  
1299 0 my $hash = $cuifinder->_getCompounds();
1300  
1301 0 return $hash;
1302 }
1303  
1304 =head3 getCuiList
1305  
1306 description:
1307  
1308 returns all of the cuis in the sources specified in the configuration file
1309  
1310 input:
1311  
1312 None
1313
1314 output:
1315  
1316 $hash <- reference to a hash containing cuis
1317  
1318 example:
1319  
1320 use UMLS::Interface;
1321 my $umls = UMLS::Interface->new();
1322 my $hash = $umls->getCuiList();
1323 foreach my $concept (sort keys %{$hash}) {
1324 print "$concept\n";
1325 }
1326  
1327 =cut
1328 sub getCuiList {
1329  
1330 0 ▶ my $self = shift;
Subroutine getCuiList: not called CC=1 SCAR=6.9
Pod documented
1331  
1332 0 my $hash = $cuifinder->_getCuiList();
1333  
1334 0 return $hash;
1335 }
1336  
1337 =head3 getCuisFromSource
1338  
1339 description:
1340  
1341 returns the cuis from a specified source
1342  
1343 input:
1344  
1345 $sab <- string contain the sources abbreviation
1346  
1347 output:
1348  
1349 $array <- reference to an array containing cuis
1350  
1351 example:
1352  
1353 use UMLS::Interface;
1354 my $umls = UMLS::Interface->new();
1355 my $sab = "MSH";
1356 my $array = $umls->getCuisFromSource($sab);
1357 foreach my $concept (@{$array}) {
1358 print "$concept\n";
1359 }
1360  
1361 =cut
1362 sub getCuisFromSource {
1363
1364 0 ▶ my $self = shift;
Subroutine getCuisFromSource: not called CC=1 SCAR=6.9
Pod documented
1365 0 my $sab = shift;
1366
1367 0 my $array = $cuifinder->_getCuisFromSource($sab);
1368  
1369 0 return $array;
1370 }
1371  
1372 =head3 getSab
1373  
1374 description:
1375  
1376 takes as input a cui and returns all of the sources in which it originated
1377 from
1378  
1379 input:
1380  
1381 $concept <- string containing the cui
1382  
1383 output:
1384  
1385 $array <- reference to an array contain the sources (abbreviations)
1386  
1387 example:
1388  
1389 use UMLS::Interface;
1390 my $umls = UMLS::Interface->new();
1391 my $concept = "C0018563";
1392 my $array = $umls->getSab($concept);
1393 print "The concept ($concept) exists in sources:\n";
1394 foreach my $sab (@{$array}) { print " $sab\n"; }
1395  
1396 =cut
1397 sub getSab {
1398  
1399 0 ▶ my $self = shift;
Subroutine getSab: not called CC=1 SCAR=6.9
Pod documented
1400 0 my $concept = shift;
1401  
1402 0 my $array = $cuifinder->_getSab($concept);
1403  
1404 0 return $array;
1405 }
1406  
1407 =head3 getChildren
1408  
1409 description:
1410  
1411 returns the children of a concept - the relations that are considered children
1412 are predefined by the user in the configuration file. The default is the CHD
1413 relation.
1414  
1415 input:
1416  
1417 $concept <- string containing cui
1418  
1419 output:
1420  
1421 $array <- reference to an array containing a list of cuis
1422  
1423 example:
1424  
1425 use UMLS::Interface;
1426 my $umls = UMLS::Interface->new();
1427 my $concept = "C0018563";
1428 my $children = $umls->getChildren($concept);
1429 print "The children of $concept are:\n";
1430 foreach my $child (@{$children}) { print " $child\n"; }
1431  
1432 =cut
1433 sub getChildren {
1434  
1435 0 ▶ my $self = shift;
Subroutine getChildren: not called CC=1 SCAR=6.9
Pod documented
1436 0 my $concept = shift;
1437  
1438 0 my $array = $cuifinder->_getChildren($concept);
1439  
1440 0 return $array;
1441 }
1442  
1443 =head3 getParents
1444  
1445 description:
1446  
1447 returns the parents of a concept - the relations that are considered parents
1448 are predefined by the user in the configuration file.The default is the PAR
1449 relation.
1450  
1451 input:
1452  
1453 $concept <- string containing cui
1454  
1455 output:
1456  
1457 $array <- reference to an array containing a list of cuis
1458  
1459 example:
1460  
1461 use UMLS::Interface;
1462 my $umls = UMLS::Interface->new();
1463 my $concept = "C0018563";
1464 my $parents = $umls->getParents($concept);
1465 print "The parents of $concept are:\n";
1466 foreach my $parent (@{$parents}) { print " $parent\n"; }
1467  
1468 =cut
1469 sub getParents {
1470  
1471 0 ▶ my $self = shift;
Subroutine getParents: not called CC=1 SCAR=6.9
Pod documented
1472 0 my $concept = shift;
1473  
1474 0 my $array = $cuifinder->_getParents($concept);
1475  
1476 0 return $array;
1477
1478 }
1479  
1480 =head3 getRelations
1481  
1482 description:
1483  
1484 returns the relations of a concept in the source specified by the user in the
1485 configuration file
1486  
1487 input:
1488  
1489 $concept <- string containing a cui
1490  
1491 output:
1492  
1493 $array <- reference to an array containing strings of relations
1494  
1495 example:
1496  
1497 use UMLS::Interface;
1498 my $umls = UMLS::Interface->new();
1499
1500 my $concept = "C0018563";
1501 my $array = $umls->getRelations($concept);
1502 print "The relations associated with $concept are:\n";
1503 foreach my $relation (@{$array}) { print " $relation\n"; }
1504  
1505  
1506 =cut
1507 sub getRelations {
1508  
1509 0 ▶ my $self = shift;
Subroutine getRelations: not called CC=1 SCAR=6.9
Pod documented
1510 0 my $concept = shift;
1511
1512 0 my $array = $cuifinder->_getRelations($concept);
1513  
1514 0 return $array;
1515 }
1516  
1517 =head3 getRelationsBetweenCuis
1518  
1519 description:
1520  
1521 returns the relations and its source between two concepts
1522  
1523 input:
1524  
1525 $concept1 <- string containing a cui
1526 $concept2 <- string containing a cui
1527  
1528 output:
1529  
1530 $array <- reference to an array containing the relations
1531  
1532 example:
1533  
1534 use UMLS::Interface;
1535 my $umls = UMLS::Interface->new();
1536 my $concept1 = "C0018563";
1537 my $concept2 = "C0016129";
1538 my $array = $umls->getRelationsBetweenCuis($concept1,$concept2);
1539 print "The relations between $concept1 and $concept2 are:\n";
1540 foreach my $relation (@{$array}) { print " $relation\n"; }
1541  
1542 =cut
1543 sub getRelationsBetweenCuis {
1544  
1545 0 ▶ my $self = shift;
Subroutine getRelationsBetweenCuis: not called CC=1 SCAR=6.9
Pod documented
1546 0 my $concept1 = shift;
1547 0 my $concept2 = shift;
1548  
1549 0 my $array = $cuifinder->_getRelationsBetweenCuis($concept1, $concept2);
1550  
1551 0 return $array;
1552 }
1553  
1554  
1555 =head2 Metathesaurus Concept Definition Fuctions
1556  
1557 =head3 getExtendedDefinition
1558  
1559 description:
1560  
1561 returns the extended definition of a cui given the relation and source
1562 information in the configuration file
1563  
1564 input:
1565  
1566 $concept <- string containing a cui
1567  
1568 output:
1569  
1570 $array <- reference to an array containing the definitions
1571  
1572 example:
1573  
1574 use UMLS::Interface;
1575 my $umls = UMLS::Interface->new();
1576 my $concept = "C0018563";
1577 my $array = $umls->getExtendedDefinition($concept);
1578 print "The extended definition of $concept is:\n";
1579 foreach my $def (@{$array}) { print " $def\n"; }
1580  
1581 =cut
1582 sub getExtendedDefinition {
1583  
1584 0 ▶ my $self = shift;
Subroutine getExtendedDefinition: not called CC=1 SCAR=6.9
Pod documented
1585 0 my $concept = shift;
1586  
1587 0 my $array = $cuifinder->_getExtendedDefinition($concept);
1588  
1589 0 return $array;
1590 }
1591  
1592 =head3 getCuiDef
1593  
1594 description:
1595  
1596 returns the definition of the cui
1597  
1598 input:
1599  
1600 $concept <- string containing a cui
1601 $sabflag <- 0 | 1 whether to include the source in with the definition
1602  
1603 output:
1604  
1605 $array <- reference to an array of definitions (strings)
1606  
1607 example:
1608  
1609 use UMLS::Interface;
1610 my $umls = UMLS::Interface->new();
1611 my $concept = "C0018563";
1612 my $array = $umls->getCuiDef($concept);
1613 print "The definition of $concept is:\n";
1614 foreach my $def (@{$array}) { print " $def\n"; }
1615  
1616 =cut
1617 sub getCuiDef {
1618  
1619 0 ▶ my $self = shift;
Subroutine getCuiDef: not called CC=1 SCAR=6.9
Pod documented
1620 0 my $concept = shift;
1621 0 my $sabflag = shift;
1622  
1623 0 my $array = $cuifinder->_getCuiDef($concept, $sabflag);
1624  
1625 0 return $array;
1626 }
1627  
1628 =head2 Metathesaurus Concept Path Functions
1629  
1630 =head3 depth
1631  
1632 description:
1633  
1634 function to return the maximum depth of a taxonomy.
1635  
1636 input:
1637  
1638 None
1639
1640 output:
1641  
1642 $string <- string containing the depth
1643  
1644 example:
1645  
1646 use UMLS::Interface;
1647 my $umls = UMLS::Interface->new();
1648 my $string = $umls->depth();
1649
1650 =cut
1651 sub depth {
1652 0 ▶ my $self = shift;
Subroutine depth: not called CC=1 SCAR=6.9
Pod documented
1653  
1654 0 my $depth = $pathfinder->_depth();
1655  
1656 0 return $depth;
1657 }
1658  
1659 =head3 pathsToRoot
1660  
1661 description:
1662  
1663 function to find all the paths from a concept to the root node of the is-a taxonomy.
1664  
1665 input:
1666  
1667 $concept <- string containing cui
1668  
1669 output:
1670  
1671 $array <- array reference containing the paths
1672  
1673 example:
1674  
1675 use UMLS::Interface;
1676 my $umls = UMLS::Interface->new();
1677 my $concept = "C0018563";
1678 my $array = $umls->pathsToRoot($concept);
1679 print "The paths to the root for $concept are:\n";
1680 foreach my $path (@{$array}) { print " $path\n"; }
1681  
1682 =cut
1683 sub pathsToRoot
1684 {
1685 0 ▶ my $self = shift;
Subroutine pathsToRoot: not called CC=1 SCAR=6.9
Pod documented
1686 0 my $concept = shift;
1687  
1688 0 my $array = $pathfinder->_pathsToRoot($concept);
1689  
1690 0 return $array;
1691 }
1692  
1693 =head3 findMinimumDepth
1694  
1695 description:
1696  
1697
1698 function returns the minimum depth of a concept given the
1699 sources and relations specified in the configuration file
1700  
1701 input:
1702  
1703 $concept <- string containing the cui
1704  
1705 output:
1706  
1707 $int <- string containing the depth of the cui
1708  
1709 example:
1710  
1711 use UMLS::Interface;
1712 my $umls = UMLS::Interface->new();
1713 my $concept = "C0018563";
1714 my $int = $umls->findMinimumDepth($concept);
1715 print "The minimum depth of $concept is $int\n";
1716  
1717 =cut
1718 sub findMinimumDepth {
1719  
1720 0 ▶ my $self = shift;
Subroutine findMinimumDepth: not called CC=1 SCAR=6.9
Pod documented
1721 0 my $concept = shift;
1722
1723 0 my $depth = $pathfinder->_findMinimumDepth($concept);
1724  
1725 0 return $depth;
1726 }
1727
1728 =head3 findMaximumDepth
1729  
1730 description:
1731  
1732 returns the maximum depth of a concept given the sources and relations
1733 specified in the configuration file
1734  
1735 input:
1736  
1737 $concept <- string containing the cui
1738  
1739 output:
1740  
1741 $int <- string containing the depth of the cui
1742  
1743 example:
1744  
1745 use UMLS::Interface;
1746 my $umls = UMLS::Interface->new();
1747 my $concept = "C0018563";
1748 my $int = $umls->findMaximumDepth($concept);
1749 print "The maximum depth of $concept is $int\n";
1750  
1751 =cut
1752 sub findMaximumDepth {
1753  
1754 0 ▶ my $self = shift;
Subroutine findMaximumDepth: not called CC=1 SCAR=6.9
Pod documented
1755 0 my $concept = shift;
1756
1757 0 my $depth = $pathfinder->_findMaximumDepth($concept);
1758  
1759 0 return $depth;
1760 }
1761  
1762  
1763 =head3 findNumberOfCloserConcepts
1764  
1765 description:
1766  
1767 function that finds the DUI of a given CUI
1768  
1769 input:
1770  
1771 $concept <- the concept
1772  
1773 output:
1774  
1775 $dui <- the MSH DUI
1776  
1777 example:
1778  
1779 use UMLS::Interface;
1780 my $umls = UMLS::Interface->new();
1781 my $concept = "C0018563";
1782 my $cui = $umls->getDUI($concept);
1783 print "The DUI for $concept is $dui\n";
1784  
1785 =cut
1786 sub getDUI {
1787 0 ▶ my $self = shift;
Subroutine getDUI: not called CC=1 SCAR=6.9
Pod undocumented
1788 0 my $concept = shift;
1789  
1790 0 my $dui = $cuifinder->_getDUI($concept);
1791  
1792 0 return $dui;
1793 }
1794  
1795 =head3 findNumberOfCloserConcepts
1796  
1797 description:
1798  
1799 function that finds the number of cuis closer to concept1 than concept2
1800  
1801 input:
1802  
1803 $concept1 <- the first concept
1804 $concept2 <- the second concept
1805  
1806 output:
1807  
1808 $int <- number of cuis closer to concept1 than concept2
1809  
1810 example:
1811  
1812 use UMLS::Interface;
1813 my $umls = UMLS::Interface->new();
1814 my $concept1 = "C0018563";
1815 my $concept2 = "C0016129";
1816 my $int = $umls->findNumberOfCloserConcepts($concept1,$concept2);
1817 print "The number of closer concepts to $concept1 than $concept2 is $int\n";
1818  
1819 =cut
1820 sub findNumberOfCloserConcepts {
1821  
1822 0 ▶ my $self = shift;
Subroutine findNumberOfCloserConcepts: not called CC=1 SCAR=6.9
Pod documented
1823 0 my $concept1 = shift;
1824 0 my $concept2 = shift;
1825
1826 0 my $length = $pathfinder->_findNumberOfCloserConcepts($concept1, $concept2);
1827
1828 0 return $length;
1829 }
1830  
1831 =head3 findClosenessCentrality
1832  
1833 description:
1834  
1835 function that closeness centrality of a concept
1836  
1837 input:
1838  
1839 $concept <- the concept
1840  
1841 output:
1842  
1843 $double <- the closeness centrality
1844  
1845 example:
1846  
1847 use UMLS::Interface;
1848 my $umls = UMLS::Interface->new();
1849 my $concept = "C0018563";
1850 my $double = $umls->findClosenessCentrality($concept);
1851 print "The Closeness Centrality for $concept is $double\n";
1852  
1853 =cut
1854 sub findClosenessCentrality {
1855  
1856 0 ▶ my $self = shift;
Subroutine findClosenessCentrality: not called CC=1 SCAR=6.9
Pod documented
1857 0 my $concept = shift;
1858
1859 0 my $closeness = $pathfinder->_findClosenessCentrality($concept);
1860
1861 0 return $closeness;
1862 }
1863  
1864 =head3 findAncestors
1865  
1866 description:
1867  
1868 function that returns all the ancestors of a concept
1869  
1870 input:
1871  
1872 $concept <- the concept
1873  
1874 output:
1875  
1876 %hash <- reference to hash containing ancestors
1877  
1878 example:
1879  
1880 use UMLS::Interface;
1881 my $umls = UMLS::Interface->new();
1882 my $concept = "C0018563";
1883 my $hash = $umls->findAncestors($concept);
1884  
1885 =cut
1886 sub findAncestors {
1887  
1888 0 ▶ my $self = shift;
Subroutine findAncestors: not called CC=1 SCAR=6.9
Pod documented
1889 0 my $concept = shift;
1890
1891 0 my $hash = $pathfinder->_findAncestors($concept);
1892
1893 0 return $hash;
1894 }
1895  
1896 =head3 findShortestPathLength
1897  
1898 description:
1899  
1900 function that finds the length of the shortest path
1901  
1902 input:
1903  
1904 $concept1 <- the first concept
1905 $concept2 <- the second concept
1906  
1907 output:
1908  
1909 $int <- the length of the shortest path between them
1910  
1911 example:
1912  
1913 use UMLS::Interface;
1914 my $umls = UMLS::Interface->new();
1915 my $concept1 = "C0018563";
1916 my $concept2 = "C0016129";
1917 my $int = $umls->findShortestPathLength($concept1,$concept2);
1918 print "The shortest path length between $concept1 than $concept2 is $int\n";
1919  
1920 =cut
1921 sub findShortestPathLength {
1922  
1923 0 ▶ my $self = shift;
Subroutine findShortestPathLength: not called CC=1 SCAR=6.9
Pod documented
1924 0 my $concept1 = shift;
1925 0 my $concept2 = shift;
1926
1927 0 my $length = $pathfinder->_findShortestPathLength($concept1, $concept2);
1928
1929 0 return $length;
1930 }
1931  
1932 =head3 findShortestPath
1933  
1934 description:
1935  
1936 returns the shortest path between two concepts given the sources and
1937 relations specified in the configuration file
1938  
1939 input:
1940  
1941 $concept1 <- string containing the first cui
1942 $concept2 <- string containing the second
1943  
1944 output:
1945  
1946 $array <- reference to an array containing the shortest path(s)
1947  
1948 example:
1949  
1950 use UMLS::Interface;
1951 my $umls = UMLS::Interface->new();
1952 my $concept1 = "C0018563";
1953 my $concept2 = "C0016129";
1954 my $array = $umls->findShortestPath($concept1,$concept2);
1955 print "The shortest path(s) between $concept1 than $concept2 are:\n";
1956 foreach my $path (@{$array}) { print " $path\n"; }
1957  
1958 =cut
1959 sub findShortestPath {
1960  
1961 0 ▶ my $self = shift;
Subroutine findShortestPath: not called CC=1 SCAR=6.9
Pod documented
1962 0 my $concept1 = shift;
1963 0 my $concept2 = shift;
1964  
1965 0 my $array = $pathfinder->_findShortestPath($concept1, $concept2);
1966  
1967 0 return $array;
1968 }
1969
1970 =head3 findLeastCommonSubsumer
1971  
1972 description:
1973  
1974
1975 returns the least common subsummer between two concepts given the sources
1976 and relations specified in the configuration file
1977  
1978 input:
1979
1980 $concept1 <- string containing the first cui
1981 $concept2 <- string containing the second
1982  
1983 output:
1984  
1985 $array <- reference to an array containing the lcs(es)
1986  
1987 example:
1988  
1989 use UMLS::Interface;
1990 my $umls = UMLS::Interface->new();
1991 my $concept1 = "C0018563";
1992 my $concept2 = "C0016129";
1993 my $array = $umls->findLeastCommonSubsumer($concept1,$concept2);
1994 print "The LCS(es) between $concept1 than $concept2 iare:\n";
1995 foreach my $lcs (@{$array}) { print " $lcs\n"; }
1996  
1997 =cut
1998 sub findLeastCommonSubsumer {
1999  
2000 0 ▶ my $self = shift;
Subroutine findLeastCommonSubsumer: not called CC=1 SCAR=6.9
Pod documented
2001 0 my $concept1 = shift;
2002 0 my $concept2 = shift;
2003
2004 0 my $array = $pathfinder->_findLeastCommonSubsumer($concept1, $concept2);
2005  
2006 0 return $array;
2007 }
2008  
2009 =head3 setUndirectedPath
2010  
2011 description:
2012
2013 function set the undirected option for the path on or off
2014  
2015 input:
2016  
2017 $option <- 1 (true) 0 (false)
2018  
2019 output:
2020  
2021 example:
2022  
2023 use UMLS::Interface;
2024 my $umls = UMLS::Interface->new();
2025 $umls->setUndirectedOption(1);
2026  
2027 =cut
2028 sub setUndirectedOption {
2029  
2030 0 ▶ my $self = shift;
Subroutine setUndirectedOption: not called CC=1 SCAR=6.9
Pod undocumented
2031 0 my $option = shift;
2032
2033 0 $pathfinder->_setUndirectedOption($option);
2034 }
2035  
2036 =head3 setRealtimePath
2037  
2038 description:
2039
2040 function set the realtime option for the path on or off
2041  
2042 input:
2043  
2044 $option <- 1 (true) 0 (false)
2045  
2046 output:
2047  
2048 example:
2049  
2050 use UMLS::Interface;
2051 my $umls = UMLS::Interface->new();
2052 $umls->setRealtimeOption(1);
2053  
2054 =cut
2055 sub setRealtimeOption {
2056  
2057 0 ▶ my $self = shift;
Subroutine setRealtimeOption: not called CC=1 SCAR=6.9
Pod undocumented
2058 0 my $option = shift;
2059
2060 0 $pathfinder->_setRealtimeOption($option);
2061 0 $icfinder->_setRealtimeOption($option);
2062 }
2063  
2064 =head2 Metathesaurus Concept Propagation Functions
2065  
2066 =head3 setPropagationParameters
2067  
2068 description:
2069  
2070 sets the propagation counts
2071  
2072 input:
2073  
2074 $hash <- reference to hash containing parameters
2075 debug -> turn debug option on
2076 icpropagation -> file containing icpropagation counts
2077 icfrequency -> file containing icfrequency counts
2078 smooth -> whether you want to smooth the frequency counts
2079 realtime -> calculate the intrinsic ic in realtime
2080  
2081 example:
2082  
2083 use UMLS::Interface;
2084 my $umls = UMLS::Interface->new();
2085  
2086 $umls->setPropagationParameters(\%hash);
2087  
2088 =cut
2089 sub setPropagationParameters {
2090
2091 0 ▶ my $self = shift;
Subroutine setPropagationParameters: not called CC=1 SCAR=6.9
Pod documented
2092 0 my $parameters = shift;
2093
2094 0 $icfinder->_setPropagationParameters($parameters);
2095 }
2096  
2097 =head3 getIC
2098  
2099 description:
2100  
2101 returns the information content of a given cui
2102  
2103 input:
2104  
2105 $concept <- string containing a cui
2106  
2107 output:
2108  
2109 $double <- double containing its IC
2110  
2111 example:
2112  
2113 use UMLS::Interface;
2114 my $umls = UMLS::Interface->new();
2115 my $concept = "C0018563";
2116 my $double = $umls->getIC($concept);
2117 print "The IC of $concept is $double\n";
2118  
2119 =cut
2120 sub getIC {
2121 0 ▶ my $self = shift;
Subroutine getIC: not called CC=1 SCAR=6.9
Pod documented
2122 0 my $concept = shift;
2123
2124 0 my $ic = $icfinder->_getIC($concept);
2125  
2126 0 return $ic;
2127 }
2128  
2129 =head3 getSecoIntrinsicIC
2130  
2131 description:
2132  
2133 returns the intrinsic information content of a given cui using
2134 the formula proposed by Seco, Veale and Hayes 2004
2135  
2136 input:
2137  
2138 $concept <- string containing a cui
2139  
2140 output:
2141  
2142 $double <- double containing its IC
2143  
2144 example:
2145  
2146 use UMLS::Interface;
2147 my $umls = UMLS::Interface->new();
2148 my $concept = "C0018563";
2149 my $double = $umls->getSecoIntrinsicIC($concept);
2150 print "The Intrinsic IC of $concept is $double\n";
2151  
2152 =cut
2153 sub getSecoIntrinsicIC {
2154 0 ▶ my $self = shift;
Subroutine getSecoIntrinsicIC: not called CC=1 SCAR=6.9
Pod documented
2155 0 my $concept = shift;
2156
2157 0 my $ic = $icfinder->_getSecoIntrinsicIC($concept);
2158  
2159 0 return $ic;
2160 }
2161 =head3 getSanchezIntrinsicIC
2162  
2163 description:
2164  
2165 returns the intrinsic information content of a given cui using
2166 the formula proposed by Sanchez and Batet 2011
2167  
2168 input:
2169  
2170 $concept <- string containing a cui
2171  
2172 output:
2173  
2174 $double <- double containing its IC
2175  
2176 example:
2177  
2178 use UMLS::Interface;
2179 my $umls = UMLS::Interface->new();
2180 my $concept = "C0018563";
2181 my $double = $umls->getSanchezIntrinsicIC($concept);
2182 print "The Intrinsic IC of $concept is $double\n";
2183  
2184 =cut
2185 sub getSanchezIntrinsicIC {
2186 0 ▶ my $self = shift;
Subroutine getSanchezIntrinsicIC: not called CC=1 SCAR=6.9
Pod undocumented
2187 0 my $concept = shift;
2188
2189 0 my $ic = $icfinder->_getSanchezIntrinsicIC($concept);
2190  
2191 0 return $ic;
2192 }
2193  
2194 =head3 getProbability
2195  
2196 description:
2197  
2198 returns the probability of a given cui
2199  
2200 input:
2201  
2202 $concept <- string containing a cui
2203  
2204 output:
2205  
2206 $double <- double containing its probability
2207  
2208 example:
2209  
2210 use UMLS::Interface;
2211 my $umls = UMLS::Interface->new();
2212 my $concept = "C0018563";
2213 my $double = $umls->getProbability($concept);
2214 print "The probability of $concept is $double\n";
2215  
2216 =cut
2217 sub getProbability {
2218 0 ▶ my $self = shift;
Subroutine getProbability: not called CC=1 SCAR=6.9
Pod documented
2219 0 my $concept = shift;
2220
2221 0 my $prob = $icfinder->_getProbability($concept);
2222  
2223 0 return $prob;
2224 }
2225  
2226 =head3 getN
2227  
2228 description:
2229  
2230 returns the total number of CUIs (N)
2231  
2232 input:
2233  
2234 None
2235
2236 output:
2237  
2238 $int <- integer containing frequency
2239  
2240 example:
2241  
2242 use UMLS::Interface;
2243 my $umls = UMLS::Interface->new();
2244  
2245 my $int = $umls->getN();
2246  
2247 =cut
2248 sub getN {
2249 0 ▶ my $self = shift;
Subroutine getN: not called CC=1 SCAR=6.9
Pod documented
2250
2251 0 my $n = $icfinder->_getN();
2252  
2253 0 return $n;
2254 }
2255  
2256 =head3 getFrequency
2257  
2258 description:
2259  
2260 returns the propagation count (frequency) of a given cui
2261  
2262 input:
2263  
2264 $concept <- string containing a cui
2265  
2266 output:
2267  
2268 $double <- double containing its frequency
2269  
2270 example:
2271  
2272 use UMLS::Interface;
2273 my $umls = UMLS::Interface->new();
2274 my $concept = "C0018563";
2275 my $double = $umls->getFrequency($concept);
2276 print "The frequency of $concept is $double\n";
2277  
2278 =cut
2279 sub getFrequency {
2280 0 ▶ my $self = shift;
Subroutine getFrequency: not called CC=1 SCAR=6.9
Pod documented
2281 0 my $concept = shift;
2282
2283 0 my $ic = $icfinder->_getFrequency($concept);
2284  
2285 0 return $ic;
2286 }
2287  
2288 =head3 getPropagationCuis
2289  
2290 description:
2291  
2292 returns all of the cuis to be propagated given the sources
2293 and relations specified by the user in the configuration file
2294  
2295 input:
2296  
2297 None
2298
2299 output:
2300  
2301 $hash <- reference to hash containing the cuis
2302  
2303 example:
2304  
2305 use UMLS::Interface;
2306 my $umls = UMLS::Interface->new();
2307  
2308 my $hash = $umls->getPropagationCuis();
2309  
2310 =cut
2311 sub getPropagationCuis
2312 {
2313 0 ▶ my $self = shift;
Subroutine getPropagationCuis: not called CC=1 SCAR=6.9
Pod documented
2314
2315 0 my $hash = $icfinder->_getPropagationCuis();
2316  
2317 0 return $hash;
2318
2319 }
2320  
2321 =head3 propagateCounts
2322  
2323 description:
2324  
2325 propagates the given frequency counts
2326  
2327 input:
2328
2329 $hash <- reference to the hash containing the frequency counts
2330  
2331 output:
2332
2333 $hash <- containing the propagation counts of all the cuis
2334 given the sources and relations specified in the
2335 configuration file
2336  
2337 example:
2338  
2339 use UMLS::Interface;
2340 my $umls = UMLS::Interface->new();
2341  
2342 my $phash = $umls->propagateCounts(\%fhash);
2343  
2344 =cut
2345 sub propagateCounts
2346 {
2347  
2348 0 ▶ my $self = shift;
Subroutine propagateCounts: not called CC=1 SCAR=6.9
Pod documented
2349 0 my $fhash = shift;
2350
2351 0 my $hash = $icfinder->_propagateCounts($fhash);
2352  
2353 0 return $hash;
2354 }
2355  
2356  
2357 =head2 Semantic Network Functions
2358  
2359 =head3 getSemanticRelation
2360  
2361 description:
2362  
2363 subroutine to get the relation(s) between two semantic types
2364  
2365 input:
2366  
2367 $st1 <- semantic type abbreviation
2368 $st2 <- semantic type abbreviation
2369  
2370 output:
2371  
2372 $array <- reference to an array of semantic relation(s)
2373  
2374 example:
2375  
2376 use UMLS::Interface;
2377 my $umls = UMLS::Interface->new();
2378
2379 my $st1 = "blor";
2380 my $st2 = "bpoc";
2381 my $array = $umls->getSemanticRelation($st1,$st2);
2382 print "The relations between $st1 and $st2 are:\n";
2383 foreach my $relation (@{$array}) { print " $relation\n"; }
2384  
2385 =cut
2386 sub getSemanticRelation {
2387
2388 0 ▶ my $self = shift;
Subroutine getSemanticRelation: not called CC=1 SCAR=6.9
Pod documented
2389 0 my $st1 = shift;
2390 0 my $st2 = shift;
2391  
2392 0 my $array = $cuifinder->_getSemanticRelation($st1, $st2);
2393  
2394 0 return $array;
2395 }
2396  
2397
2398 =head3 getSt
2399  
2400 description:
2401  
2402 returns the semantic type(s) of a given concept
2403  
2404 input:
2405  
2406 $concept <- string containing a concept
2407  
2408 output:
2409  
2410 $array <- reference to an array containing the semantic type's TUIs
2411 associated with the concept
2412  
2413 example:
2414  
2415 use UMLS::Interface;
2416 my $umls = UMLS::Interface->new();
2417
2418 my $concept = "C0018563";
2419 my $array = $umls->getSts($concept);
2420 print "The semantic types associated with $concept are:\n";
2421 foreach my $st (@{$array}) { print " $st\n"; }
2422  
2423 =cut
2424 sub getSt {
2425  
2426 0 ▶ my $self = shift;
Subroutine getSt: not called CC=1 SCAR=6.9
Pod documented
2427 0 my $concept = shift;
2428  
2429 0 my $array = $cuifinder->_getSt($concept);
2430
2431 0 return $array;
2432 }
2433  
2434
2435 =head3 getSt
2436  
2437 description:
2438  
2439 returns the semantic type(s) of a given concept
2440  
2441 input:
2442  
2443 output:
2444  
2445 $array <- reference to an array containing all the semantic type's TUIs
2446
2447  
2448 example:
2449  
2450 use UMLS::Interface;
2451 my $umls = UMLS::Interface->new();
2452
2453 my $concept = "C0018563";
2454 my $array = $umls->getAllSts();
2455 print "The semantic types in the UMLS are: \n";
2456 foreach my $st (@{$array}) { print " $st\n"; }
2457  
2458 =cut
2459 sub getAllSts {
2460  
2461 0 ▶ my $self = shift;
Subroutine getAllSts: not called CC=1 SCAR=6.9
Pod undocumented
2462 0 my $concept = shift;
2463  
2464 0 my $array = $cuifinder->_getAllSts();
2465
2466 0 return $array;
2467 }
2468  
2469 =head3 getSemanticGroup
2470  
2471 description:
2472  
2473 function returns the semantic group(s) associated with the concept
2474  
2475 input:
2476  
2477 $concept <- string containing cuis
2478  
2479 output:
2480  
2481 $array <- $array reference containing semantic groups
2482  
2483 example:
2484  
2485 use UMLS::Interface;
2486 my $umls = UMLS::Interface->new();
2487
2488 my $concept = "C0018563";
2489 my $array = $umls->getSemanticGroup($concept);
2490 print "The semantic group associated with $concept are:\n";
2491 foreach my $sg (@{$array}) { print " $sg\n"; }
2492  
2493 =cut
2494 sub getSemanticGroup {
2495  
2496 0 ▶ my $self = shift;
Subroutine getSemanticGroup: not called CC=1 SCAR=6.9
Pod documented
2497 0 my $cui = shift;
2498
2499 0 my $array = $cuifinder->_getSemanticGroup($cui);
2500  
2501 0 return $array;
2502 }
2503  
2504 =head3 getAllSemanticGroups
2505  
2506 description:
2507  
2508 function returns all the semantic groups
2509  
2510 input:
2511  
2512 output:
2513  
2514 $array <- $array reference containing semantic groups
2515  
2516 example:
2517  
2518 use UMLS::Interface;
2519 my $umls = UMLS::Interface->new();
2520
2521 my $concept = "C0018563";
2522 my $array = $umls->getAllSemanticGroups();
2523 print "The semantic groups are:\n";
2524 foreach my $sg (@{$array}) { print " $sg\n"; }
2525  
2526 =cut
2527 sub getAllSemanticGroups {
2528  
2529 0 ▶ my $self = shift;
Subroutine getAllSemanticGroups: not called CC=1 SCAR=6.9
Pod documented
2530
2531 0 my $array = $cuifinder->_getAllSemanticGroups();
2532  
2533 0 return $array;
2534 }
2535  
2536 =head3 getStsFromSg
2537  
2538 description:
2539  
2540 function returns all the semantic types of a given semantic group
2541  
2542 input:
2543  
2544 $string <- semantic group code
2545  
2546 output:
2547  
2548 $array <- $array reference containing semantic types
2549  
2550 example:
2551  
2552 use UMLS::Interface;
2553 my $umls = UMLS::Interface->new();
2554
2555 my $sg = "PROC";
2556 my $array = $umls->getStsFromSg($sg);
2557 print "The semantic types are:\n";
2558 foreach my $st (@{$array}) { print " $st\n"; }
2559  
2560 =cut
2561 sub getStsFromSg {
2562  
2563 0 ▶ my $self = shift;
Subroutine getStsFromSg: not called CC=1 SCAR=6.9
Pod documented
2564 0 my $sg = shift;
2565
2566 0 my $array = $cuifinder->_getStsFromSg($sg);
2567  
2568 0 return $array;
2569 }
2570  
2571 =head3 stGetSemanticGroup
2572  
2573 description:
2574  
2575 function returns the semantic group(s) associated with a semantic type
2576  
2577 input:
2578  
2579 $st <- string containing semantic type abbreviations
2580  
2581 output:
2582  
2583 $array <- $array reference containing semantic groups
2584  
2585 example:
2586  
2587 use UMLS::Interface;
2588 my $umls = UMLS::Interface->new();
2589
2590 my $st = "pboc";
2591 my $array = $umls->stGetSemanticGroup($st);
2592 print "The semantic group associated with $st are:\n";
2593 foreach my $sg (@{$array}) { print " $sg\n"; }
2594  
2595 =cut
2596 sub stGetSemanticGroup {
2597
2598 0 ▶ my $self = shift;
Subroutine stGetSemanticGroup: not called CC=1 SCAR=6.9
Pod documented
2599 0 my $st = shift;
2600  
2601 0 my $array = $cuifinder->_stGetSemanticGroup($st);
2602
2603 0 return $array;
2604 }
2605  
2606 =head3 getStString
2607  
2608 description:
2609  
2610 returns the full name of a semantic type given its abbreviation
2611  
2612 input:
2613  
2614 $st <- string containing the abbreviation of the semantic type
2615  
2616 output:
2617  
2618 $string <- string containing the full name of the semantic type
2619  
2620 example:
2621  
2622 use UMLS::Interface;
2623 my $umls = UMLS::Interface->new();
2624
2625 my $st = "bpoc";
2626 my $string = $umls->getStString($st);
2627 print "The abbreviation $st stands for $string\n";
2628  
2629 =cut
2630 sub getStString {
2631  
2632 0 ▶ my $self = shift;
Subroutine getStString: not called CC=1 SCAR=6.9
Pod documented
2633 0 my $st = shift;
2634  
2635 0 my $string = $cuifinder->_getStString($st);
2636  
2637 0 return $string;
2638 }
2639  
2640 =head3 getStAbr
2641  
2642 description:
2643  
2644 returns the abreviation of a semantic type given its TUI (UI)
2645  
2646 input:
2647  
2648 $tui <- string containing the semantic type's TUI
2649  
2650 output:
2651  
2652 $string <- string containing the semantic type's abbreviation
2653  
2654 example:
2655  
2656 use UMLS::Interface;
2657 my $umls = UMLS::Interface->new();
2658
2659 my $tui = "T023"
2660 my $string = $umls->getStAbr($tui);
2661 print "The abbreviation of $tui is $string\n";
2662  
2663 =cut
2664 sub getStAbr {
2665  
2666 0 ▶ my $self = shift;
Subroutine getStAbr: not called CC=1 SCAR=6.9
Pod documented
2667 0 my $tui = shift;
2668  
2669 0 my $abr = $cuifinder->_getStAbr($tui);
2670  
2671 0 return $abr;
2672 }
2673  
2674 =head3 getStTui
2675  
2676 description:
2677  
2678 function to get the name of a semantic type's TUI given its abbrevation
2679  
2680 input:
2681  
2682 $string <- string containing the semantic type's abbreviation
2683  
2684 output:
2685  
2686 $tui <- string containing the semantic type's TUI
2687  
2688 example:
2689  
2690 use UMLS::Interface;
2691 my $umls = UMLS::Interface->new();
2692
2693 my $string = "bpoc"
2694 my $tui = $umls->getStAbr($tui);
2695 print "The tui of $string is $tui\n";
2696  
2697 =cut
2698 sub getStTui {
2699 0 ▶ my $self = shift;
Subroutine getStTui: not called CC=1 SCAR=6.9
Pod documented
2700 0 my $abbrev = shift;
2701  
2702 0 my $tui = $cuifinder->_getStTui($abbrev);
2703  
2704 0 return $tui;
2705 }
2706  
2707 =head3 getStDef
2708  
2709 description:
2710  
2711 returns the definition of the semantic type - expecting abbreviation
2712  
2713 input:
2714  
2715 $st <- string containing the semantic type's abbreviation
2716  
2717 output:
2718  
2719 $string <- string containing the semantic type's definition
2720  
2721 example:
2722  
2723 use UMLS::Interface;
2724 my $umls = UMLS::Interface->new();
2725
2726 my $st = "bpoc"
2727 my $string = $umls->getStDef($st);
2728 print "The definition of $st is $string\n";
2729  
2730 =cut
2731 sub getStDef {
2732  
2733 0 ▶ my $self = shift;
Subroutine getStDef: not called CC=1 SCAR=6.9
Pod documented
2734 0 my $st = shift;
2735  
2736 0 my $definition = $cuifinder->_getStDef($st);
2737  
2738 0 return $definition;
2739 }
2740  
2741  
2742 =head2 Semantic Network Path Functions
2743  
2744 =head3 stPathsToRoot
2745  
2746 description:
2747  
2748 This function to find all the paths from a semantic type (tui)
2749 to the root node of the is-a taxonomy in the semantic network
2750  
2751 input:
2752  
2753 $tui <- string containing tui
2754  
2755 output:
2756  
2757 $array <- array reference containing the paths
2758  
2759 example:
2760  
2761 use UMLS::Interface;
2762 my $umls = UMLS::Interface->new();
2763  
2764 my $tui = "T023"
2765 my $array = $umls->stPathsToRoot($tui);
2766 print "The paths from $tui to the root are:\n";
2767 foreach my $path (@{$array}) { print " $path\n";
2768  
2769 =cut
2770 sub stPathsToRoot
2771 {
2772 0 ▶ my $self = shift;
Subroutine stPathsToRoot: not called CC=1 SCAR=6.9
Pod documented
2773 0 my $tui = shift;
2774  
2775 0 my $array = $stfinder->_pathsToRoot($tui);
2776  
2777 0 return $array;
2778 }
2779  
2780 =head3 stFindShortestPath
2781  
2782  
2783 description:
2784  
2785 This function returns the shortest path between two semantic type TUIs.
2786  
2787 input:
2788  
2789 $st1 <- string containing the first tui
2790 $st2 <- string containing the second tui
2791  
2792 output:
2793  
2794 $array <- reference to an array containing paths
2795  
2796 example:
2797  
2798 use UMLS::Interface;
2799 my $umls = UMLS::Interface->new();
2800  
2801 my $st1 = "T023";
2802 my $st2 = "T029";
2803 my $array = $umls->stFindShortestPath($st1,$st2);
2804 print "The shortest path(s) between $st1 than $st2 are:\n";
2805 foreach my $path (@{$array}) { print " $path\n"; }
2806  
2807 =cut
2808 sub stFindShortestPath
2809 {
2810 0 ▶ my $self = shift;
Subroutine stFindShortestPath: not called CC=1 SCAR=6.9
Pod documented
2811 0 my $st1 = shift;
2812 0 my $st2 = shift;
2813
2814 0 my $array = $stfinder->_findShortestPath($st1, $st2);
2815
2816 0 return $array;
2817 }
2818  
2819  
2820 # returns the minimum depth of a semantic type in the network
2821 # input : $st <- string containing the semantic type
2822 # output: $int <- minimum depth of hte semantic type
2823 #sub getMinStDepth {
2824 # my $self = shift;
2825 # my $st = shift;
2826 #
2827 # my $depth = $stfinder->_getMinDepth($st);
2828 #
2829 # return $depth;
2830 #}
2831  
2832 # returns the maximum depth of a semantic type in the network
2833 # input : $st <- string containing the semantic type
2834 # output: $int <- maximum depth of hte semantic type
2835 #sub getMaxStDepth {
2836 # my $self = shift;
2837 # my $st = shift;
2838 #
2839 # my $depth = $stfinder->_getMaxDepth($st);
2840 #
2841 # return $depth;
2842 #}
2843  
2844 =head2 Semantic Network Propagation Functions
2845  
2846 =head3 loadStPropagationHash
2847  
2848 description:
2849  
2850 load the propagation hash for the semantic network
2851  
2852 input:
2853  
2854 $hash <- reference to a hash containing probability counts
2855  
2856 output:
2857  
2858 None
2859
2860 example:
2861  
2862 use UMLS::Interface;
2863 my $umls = UMLS::Interface->new();
2864  
2865 $umls->loadStPropagationHash(\%hash);
2866  
2867 =cut
2868 sub loadStPropagationHash {
2869 0 ▶ my $self = shift;
Subroutine loadStPropagationHash: not called CC=1 SCAR=6.9
Pod documented
2870 0 my $hash = shift;
2871
2872 0 $stfinder->_loadStPropagationHash($hash);
2873 }
2874  
2875 =head3 propagateStCounts
2876  
2877 description:
2878  
2879 propagates the given frequency counts of the semantic types
2880  
2881 input:
2882  
2883 $hash <- reference to the hash containing the frequency counts
2884  
2885 output:
2886  
2887 $hash <- containing the propagation counts of all the semantic types
2888  
2889 example:
2890  
2891 use UMLS::Interface;
2892 my $umls = UMLS::Interface->new();
2893  
2894 my $phash = $umls->propagateStCounts(\%fhash);
2895  
2896 =cut
2897 sub propagateStCounts
2898 {
2899  
2900 0 ▶ my $self = shift;
Subroutine propagateStCounts: not called CC=1 SCAR=6.9
Pod documented
2901 0 my $fhash = shift;
2902
2903 0 my $hash = $stfinder->_propagateStCounts($fhash);
2904  
2905 0 return $hash;
2906 }
2907  
2908 =head3 getStIC
2909  
2910 description:
2911  
2912 returns the information content of a given semantic type
2913  
2914 input:
2915  
2916 $st <- string containing a semantic type
2917  
2918 output:
2919  
2920 $double <- double containing its IC
2921  
2922 example:
2923  
2924 use UMLS::Interface;
2925 my $umls = UMLS::Interface->new();
2926 my $st = "bpoc";
2927 my $double = $umls->getStIC($st);
2928 print "The IC of $st is $double\n";
2929
2930 =cut
2931 sub getStIC {
2932 0 ▶ my $self = shift;
Subroutine getStIC: not called CC=1 SCAR=6.9
Pod documented
2933 0 my $st = shift;
2934
2935 0 my $ic = $stfinder->_getStIC($st);
2936  
2937 0 return $ic;
2938 }
2939  
2940 =head3 getStProbability
2941  
2942 description:
2943  
2944 returns the probability of a given semantic type
2945  
2946 input:
2947  
2948 $st <- string containing a semantic type
2949  
2950 output:
2951  
2952 $double <- double containing its probabilit
2953  
2954 example:
2955  
2956 use UMLS::Interface;
2957 my $umls = UMLS::Interface->new();
2958 my $st = "bpoc";
2959 my $double = $umls->getStProbability($st);
2960 print "The Probability of $st is $double\n";
2961  
2962 =cut
2963 sub getStProbability {
2964 0 ▶ my $self = shift;
Subroutine getStProbability: not called CC=1 SCAR=6.9
Pod documented
2965 0 my $st = shift;
2966
2967 0 my $prob = $stfinder->_getStProbability($st);
2968  
2969 0 return $prob;
2970 }
2971  
2972 =head3 getStN
2973  
2974 description:
2975  
2976 returns the total number of semantic types (N)
2977  
2978 input:
2979
2980 output:
2981  
2982 $int <- double containing frequency
2983  
2984 example:
2985  
2986 use UMLS::Interface;
2987 my $umls = UMLS::Interface->new();
2988 my $int = $umls->getStN();
2989  
2990 =cut
2991 sub getStN {
2992 0 ▶ my $self = shift;
Subroutine getStN: not called CC=1 SCAR=6.9
Pod documented
2993
2994 0 my $n = $stfinder->_getStN();
2995  
2996 0 return $n;
2997 }
2998  
2999 =head3 setStSmoothing
3000  
3001 description:
3002  
3003 function to set the smoothing parameter
3004  
3005 input:
3006  
3007 None
3008
3009 output:
3010  
3011 None
3012
3013 example:
3014  
3015 use UMLS::Interface;
3016 my $umls = UMLS::Interface->new();
3017 $umls->setStSmoothing();
3018  
3019 =cut
3020 sub setStSmoothing
3021 {
3022 0 ▶ my $self = shift;
Subroutine setStSmoothing: not called CC=1 SCAR=6.9
Pod documented
3023
3024 0 $stfinder->_setStSmoothing();
3025
3026 }
3027  
3028 58 1;
3029  
3030 __END__
« blib/script/getExtendedDef.pl ↑ Summary blib/script/findAncestors.pl »