blib/lib/UMLS/Interface.pm

filter: Statementstmt 19.4% 75 / 386 Branchbran 30.0% 6 / 20 Conditioncond 33.3% 5 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 15.7% 14 / 89 Podpod 86.8% 66 / 76 totaltotal 27.8% 166 / 596 CC 16 SCAR 16.1
CC
16
Cov
20%
_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.152 2016/10/18 16:13:28 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.51';
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 36 ▶sub new {
Subroutine new: called CC=2 SCAR=7.5
Pod undocumented
436  
437 36 my $self = {};
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 36 ▶sub _initialize {
Subroutine _initialize: called CC=7 SCAR=34.5
464  
465 36 my $self = shift;
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 36 ▶sub _checkOptions {
Subroutine _checkOptions: called CC=9 SCAR=27.0
512  
513 36 my $self = shift;
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 0 ▶sub returnTableNames {
Subroutine returnTableNames: not called CC=1 SCAR=6.9
Pod documented
588  
589 0 my $self = shift;
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 0 ▶sub dropConfigTable {
Subroutine dropConfigTable: not called CC=1 SCAR=6.9
Pod documented
619
620 0 my $self = shift;
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 0 ▶sub removeConfigFiles {
Subroutine removeConfigFiles: not called CC=1 SCAR=6.9
Pod documented
650  
651 0 my $self = shift;
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 0 ▶{
Subroutine reConfig: not called CC=1 SCAR=6.9
Pod documented
683 0 my $self = shift;
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 0 ▶sub checkParameters {
Subroutine checkParameters: not called CC=1 SCAR=6.9
Pod undocumented
694 0 my $self = shift;
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 0 ▶sub checkHierarchicalRelations {
Subroutine checkHierarchicalRelations: not called CC=1 SCAR=6.9
Pod undocumented
705 0 my $self = shift;
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 0 ▶sub root {
Subroutine root: not called CC=1 SCAR=6.9
Pod documented
736  
737 0 my $self = shift;
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 0 ▶sub version {
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
768  
769 0 my $self = shift;
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 0 ▶sub getConfigParameters {
Subroutine getConfigParameters: not called CC=1 SCAR=6.9
Pod documented
807 0 my $self = shift;
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 0 ▶sub getSabString {
Subroutine getSabString: not called CC=1 SCAR=6.9
Pod documented
837
838 0 my $self = shift;
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 0 ▶sub getRelString {
Subroutine getRelString: not called CC=1 SCAR=6.9
Pod documented
868
869 0 my $self = shift;
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 0 ▶sub getRelaString {
Subroutine getRelaString: not called CC=1 SCAR=6.9
Pod documented
899
900 0 my $self = shift;
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 0 ▶sub exists() {
Subroutine exists: not called CC=1 SCAR=6.9
Pod documented
935
936 0 my $self = shift;
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 0 ▶sub getRelated {
Subroutine getRelated: not called CC=1 SCAR=6.9
Pod documented
974  
975 0 my $self = shift;
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 0 ▶sub getPreferredTerm {
Subroutine getPreferredTerm: not called CC=1 SCAR=6.9
Pod documented
1009 0 my $self = shift;
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 0 ▶sub getAllPreferredTerm {
Subroutine getAllPreferredTerm: not called CC=1 SCAR=6.9
Pod documented
1040 0 my $self = shift;
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 0 ▶sub getTermList {
Subroutine getTermList: not called CC=1 SCAR=6.9
Pod documented
1072  
1073 0 my $self = shift;
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 0 ▶sub getDefTermList {
Subroutine getDefTermList: not called CC=1 SCAR=6.9
Pod documented
1107  
1108 0 my $self = shift;
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 0 ▶sub getAllTerms {
Subroutine getAllTerms: not called CC=1 SCAR=6.9
Pod documented
1141  
1142 0 my $self = shift;
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 0 ▶sub getConceptList {
Subroutine getConceptList: not called CC=1 SCAR=6.9
Pod documented
1177  
1178 0 my $self = shift;
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 0 ▶sub getDefConceptList {
Subroutine getDefConceptList: not called CC=1 SCAR=6.9
Pod documented
1212  
1213 0 my $self = shift;
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 0 ▶sub getAllConcepts {
Subroutine getAllConcepts: not called CC=1 SCAR=6.9
Pod documented
1246  
1247 0 my $self = shift;
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 0 ▶sub getSabDefConcepts {
Subroutine getSabDefConcepts: not called CC=1 SCAR=6.9
Pod undocumented
1260  
1261 0 my $self = shift;
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 0 ▶sub getCompounds {
Subroutine getCompounds: not called CC=1 SCAR=6.9
Pod documented
1296  
1297 0 my $self = shift;
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 0 ▶sub getCuiList {
Subroutine getCuiList: not called CC=1 SCAR=6.9
Pod documented
1329  
1330 0 my $self = shift;
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 0 ▶sub getCuisFromSource {
Subroutine getCuisFromSource: not called CC=1 SCAR=6.9
Pod documented
1363
1364 0 my $self = shift;
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 0 ▶sub getSab {
Subroutine getSab: not called CC=1 SCAR=6.9
Pod documented
1398  
1399 0 my $self = shift;
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 0 ▶sub getChildren {
Subroutine getChildren: not called CC=1 SCAR=6.9
Pod documented
1434  
1435 0 my $self = shift;
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 0 ▶sub getParents {
Subroutine getParents: not called CC=1 SCAR=6.9
Pod documented
1470  
1471 0 my $self = shift;
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 0 ▶sub getRelations {
Subroutine getRelations: not called CC=1 SCAR=6.9
Pod documented
1508  
1509 0 my $self = shift;
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 0 ▶sub getRelationsBetweenCuis {
Subroutine getRelationsBetweenCuis: not called CC=1 SCAR=6.9
Pod documented
1544  
1545 0 my $self = shift;
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 0 ▶sub getExtendedDefinition {
Subroutine getExtendedDefinition: not called CC=1 SCAR=6.9
Pod documented
1583  
1584 0 my $self = shift;
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 0 ▶sub getCuiDef {
Subroutine getCuiDef: not called CC=1 SCAR=6.9
Pod documented
1618  
1619 0 my $self = shift;
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 0 ▶sub depth {
Subroutine depth: not called CC=1 SCAR=6.9
Pod documented
1652 0 my $self = shift;
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 0 ▶{
Subroutine pathsToRoot: not called CC=1 SCAR=6.9
Pod documented
1685 0 my $self = shift;
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 0 ▶sub findMinimumDepth {
Subroutine findMinimumDepth: not called CC=1 SCAR=6.9
Pod documented
1719  
1720 0 my $self = shift;
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 0 ▶sub findMaximumDepth {
Subroutine findMaximumDepth: not called CC=1 SCAR=6.9
Pod documented
1753  
1754 0 my $self = shift;
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 0 ▶sub getDUI {
Subroutine getDUI: not called CC=1 SCAR=6.9
Pod undocumented
1787 0 my $self = shift;
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 0 ▶sub findNumberOfCloserConcepts {
Subroutine findNumberOfCloserConcepts: not called CC=1 SCAR=6.9
Pod documented
1821  
1822 0 my $self = shift;
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 0 ▶sub findClosenessCentrality {
Subroutine findClosenessCentrality: not called CC=1 SCAR=6.9
Pod documented
1855  
1856 0 my $self = shift;
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 0 ▶sub findAncestors {
Subroutine findAncestors: not called CC=1 SCAR=6.9
Pod documented
1887  
1888 0 my $self = shift;
1889 0 my $concept = shift;
1890
1891 0 my $hash = $pathfinder->_findAncestors($concept);
1892
1893 0 return $hash;
1894 }
1895  
1896 =head3 findDescendents
1897  
1898 description:
1899  
1900 function that returns all the ancestors of a concept
1901  
1902 input:
1903  
1904 $concept <- the concept
1905  
1906 output:
1907  
1908 %hash <- reference to hash containing ancestors
1909  
1910 example:
1911  
1912 use UMLS::Interface;
1913 my $umls = UMLS::Interface->new();
1914 my $concept = "C0018563";
1915 my $hash = $umls->findDescendents($concept);
1916  
1917 =cut
1918 0 ▶sub findDescendants {
Subroutine findDescendants: not called CC=1 SCAR=6.9
Pod undocumented
1919  
1920 0 my $self = shift;
1921 0 my $concept = shift;
1922
1923 0 my $hash = $pathfinder->_findDescendants($concept);
1924
1925 0 return $hash;
1926 }
1927  
1928 =head3 findShortestPathLength
1929  
1930 description:
1931  
1932 function that finds the length of the shortest path
1933  
1934 input:
1935  
1936 $concept1 <- the first concept
1937 $concept2 <- the second concept
1938  
1939 output:
1940  
1941 $int <- the length of the shortest path between them
1942  
1943 example:
1944  
1945 use UMLS::Interface;
1946 my $umls = UMLS::Interface->new();
1947 my $concept1 = "C0018563";
1948 my $concept2 = "C0016129";
1949 my $int = $umls->findShortestPathLength($concept1,$concept2);
1950 print "The shortest path length between $concept1 than $concept2 is $int\n";
1951  
1952 =cut
1953 0 ▶sub findShortestPathLength {
Subroutine findShortestPathLength: not called CC=1 SCAR=6.9
Pod documented
1954  
1955 0 my $self = shift;
1956 0 my $concept1 = shift;
1957 0 my $concept2 = shift;
1958
1959 0 my $length = $pathfinder->_findShortestPathLength($concept1, $concept2);
1960
1961 0 return $length;
1962 }
1963  
1964 =head3 findShortestPath
1965  
1966 description:
1967  
1968 returns the shortest path between two concepts given the sources and
1969 relations specified in the configuration file
1970  
1971 input:
1972  
1973 $concept1 <- string containing the first cui
1974 $concept2 <- string containing the second
1975  
1976 output:
1977  
1978 $array <- reference to an array containing the shortest path(s)
1979  
1980 example:
1981  
1982 use UMLS::Interface;
1983 my $umls = UMLS::Interface->new();
1984 my $concept1 = "C0018563";
1985 my $concept2 = "C0016129";
1986 my $array = $umls->findShortestPath($concept1,$concept2);
1987 print "The shortest path(s) between $concept1 than $concept2 are:\n";
1988 foreach my $path (@{$array}) { print " $path\n"; }
1989  
1990 =cut
1991 0 ▶sub findShortestPath {
Subroutine findShortestPath: not called CC=1 SCAR=6.9
Pod documented
1992  
1993 0 my $self = shift;
1994 0 my $concept1 = shift;
1995 0 my $concept2 = shift;
1996  
1997 0 my $array = $pathfinder->_findShortestPath($concept1, $concept2);
1998  
1999 0 return $array;
2000 }
2001
2002 =head3 findLeastCommonSubsumer
2003  
2004 description:
2005  
2006
2007 returns the least common subsummer between two concepts given the sources
2008 and relations specified in the configuration file
2009  
2010 input:
2011
2012 $concept1 <- string containing the first cui
2013 $concept2 <- string containing the second
2014  
2015 output:
2016  
2017 $array <- reference to an array containing the lcs(es)
2018  
2019 example:
2020  
2021 use UMLS::Interface;
2022 my $umls = UMLS::Interface->new();
2023 my $concept1 = "C0018563";
2024 my $concept2 = "C0016129";
2025 my $array = $umls->findLeastCommonSubsumer($concept1,$concept2);
2026 print "The LCS(es) between $concept1 than $concept2 iare:\n";
2027 foreach my $lcs (@{$array}) { print " $lcs\n"; }
2028  
2029 =cut
2030 0 ▶sub findLeastCommonSubsumer {
Subroutine findLeastCommonSubsumer: not called CC=1 SCAR=6.9
Pod documented
2031  
2032 0 my $self = shift;
2033 0 my $concept1 = shift;
2034 0 my $concept2 = shift;
2035
2036 0 my $array = $pathfinder->_findLeastCommonSubsumer($concept1, $concept2);
2037  
2038 0 return $array;
2039 }
2040  
2041 =head3 setUndirectedPath
2042  
2043 description:
2044
2045 function set the undirected option for the path on or off
2046  
2047 input:
2048  
2049 $option <- 1 (true) 0 (false)
2050  
2051 output:
2052  
2053 example:
2054  
2055 use UMLS::Interface;
2056 my $umls = UMLS::Interface->new();
2057 $umls->setUndirectedOption(1);
2058  
2059 =cut
2060 0 ▶sub setUndirectedOption {
Subroutine setUndirectedOption: not called CC=1 SCAR=6.9
Pod undocumented
2061  
2062 0 my $self = shift;
2063 0 my $option = shift;
2064
2065 0 $pathfinder->_setUndirectedOption($option);
2066 }
2067  
2068 =head3 setRealtimePath
2069  
2070 description:
2071
2072 function set the realtime option for the path on or off
2073  
2074 input:
2075  
2076 $option <- 1 (true) 0 (false)
2077  
2078 output:
2079  
2080 example:
2081  
2082 use UMLS::Interface;
2083 my $umls = UMLS::Interface->new();
2084 $umls->setRealtimeOption(1);
2085  
2086 =cut
2087 0 ▶sub setRealtimeOption {
Subroutine setRealtimeOption: not called CC=1 SCAR=6.9
Pod undocumented
2088  
2089 0 my $self = shift;
2090 0 my $option = shift;
2091
2092 0 $pathfinder->_setRealtimeOption($option);
2093 0 $icfinder->_setRealtimeOption($option);
2094 }
2095  
2096 =head2 Metathesaurus Concept Propagation Functions
2097  
2098 =head3 setPropagationParameters
2099  
2100 description:
2101  
2102 sets the propagation counts
2103  
2104 input:
2105  
2106 $hash <- reference to hash containing parameters
2107 debug -> turn debug option on
2108 icpropagation -> file containing icpropagation counts
2109 icfrequency -> file containing icfrequency counts
2110 smooth -> whether you want to smooth the frequency counts
2111 realtime -> calculate the intrinsic ic in realtime
2112  
2113 example:
2114  
2115 use UMLS::Interface;
2116 my $umls = UMLS::Interface->new();
2117  
2118 $umls->setPropagationParameters(\%hash);
2119  
2120 =cut
2121 0 ▶sub setPropagationParameters {
Subroutine setPropagationParameters: not called CC=1 SCAR=6.9
Pod documented
2122
2123 0 my $self = shift;
2124 0 my $parameters = shift;
2125
2126 0 $icfinder->_setPropagationParameters($parameters);
2127 }
2128  
2129 =head3 getIC
2130  
2131 description:
2132  
2133 returns the information content of a given cui
2134  
2135 input:
2136  
2137 $concept <- string containing a cui
2138  
2139 output:
2140  
2141 $double <- double containing its IC
2142  
2143 example:
2144  
2145 use UMLS::Interface;
2146 my $umls = UMLS::Interface->new();
2147 my $concept = "C0018563";
2148 my $double = $umls->getIC($concept);
2149 print "The IC of $concept is $double\n";
2150  
2151 =cut
2152 0 ▶sub getIC {
Subroutine getIC: not called CC=1 SCAR=6.9
Pod documented
2153 0 my $self = shift;
2154 0 my $concept = shift;
2155
2156 0 my $ic = $icfinder->_getIC($concept);
2157  
2158 0 return $ic;
2159 }
2160  
2161 =head3 getSecoIntrinsicIC
2162  
2163 description:
2164  
2165 returns the intrinsic information content of a given cui using
2166 the formula proposed by Seco, Veale and Hayes 2004
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->getSecoIntrinsicIC($concept);
2182 print "The Intrinsic IC of $concept is $double\n";
2183  
2184 =cut
2185 0 ▶sub getSecoIntrinsicIC {
Subroutine getSecoIntrinsicIC: not called CC=1 SCAR=6.9
Pod documented
2186 0 my $self = shift;
2187 0 my $concept = shift;
2188
2189 0 my $ic = $icfinder->_getSecoIntrinsicIC($concept);
2190  
2191 0 return $ic;
2192 }
2193 =head3 getSanchezIntrinsicIC
2194  
2195 description:
2196  
2197 returns the intrinsic information content of a given cui using
2198 the formula proposed by Sanchez and Batet 2011
2199  
2200 input:
2201  
2202 $concept <- string containing a cui
2203  
2204 output:
2205  
2206 $double <- double containing its IC
2207  
2208 example:
2209  
2210 use UMLS::Interface;
2211 my $umls = UMLS::Interface->new();
2212 my $concept = "C0018563";
2213 my $double = $umls->getSanchezIntrinsicIC($concept);
2214 print "The Intrinsic IC of $concept is $double\n";
2215  
2216 =cut
2217 0 ▶sub getSanchezIntrinsicIC {
Subroutine getSanchezIntrinsicIC: not called CC=1 SCAR=6.9
Pod undocumented
2218 0 my $self = shift;
2219 0 my $concept = shift;
2220
2221 0 my $ic = $icfinder->_getSanchezIntrinsicIC($concept);
2222  
2223 0 return $ic;
2224 }
2225  
2226 =head3 getProbability
2227  
2228 description:
2229  
2230 returns the probability of a given cui
2231  
2232 input:
2233  
2234 $concept <- string containing a cui
2235  
2236 output:
2237  
2238 $double <- double containing its probability
2239  
2240 example:
2241  
2242 use UMLS::Interface;
2243 my $umls = UMLS::Interface->new();
2244 my $concept = "C0018563";
2245 my $double = $umls->getProbability($concept);
2246 print "The probability of $concept is $double\n";
2247  
2248 =cut
2249 0 ▶sub getProbability {
Subroutine getProbability: not called CC=1 SCAR=6.9
Pod documented
2250 0 my $self = shift;
2251 0 my $concept = shift;
2252
2253 0 my $prob = $icfinder->_getProbability($concept);
2254  
2255 0 return $prob;
2256 }
2257  
2258 =head3 getN
2259  
2260 description:
2261  
2262 returns the total number of CUIs (N)
2263  
2264 input:
2265  
2266 None
2267
2268 output:
2269  
2270 $int <- integer containing frequency
2271  
2272 example:
2273  
2274 use UMLS::Interface;
2275 my $umls = UMLS::Interface->new();
2276  
2277 my $int = $umls->getN();
2278  
2279 =cut
2280 0 ▶sub getN {
Subroutine getN: not called CC=1 SCAR=6.9
Pod documented
2281 0 my $self = shift;
2282
2283 0 my $n = $icfinder->_getN();
2284  
2285 0 return $n;
2286 }
2287  
2288 =head3 getFrequency
2289  
2290 description:
2291  
2292 returns the propagation count (frequency) of a given cui
2293  
2294 input:
2295  
2296 $concept <- string containing a cui
2297  
2298 output:
2299  
2300 $double <- double containing its frequency
2301  
2302 example:
2303  
2304 use UMLS::Interface;
2305 my $umls = UMLS::Interface->new();
2306 my $concept = "C0018563";
2307 my $double = $umls->getFrequency($concept);
2308 print "The frequency of $concept is $double\n";
2309  
2310 =cut
2311 0 ▶sub getFrequency {
Subroutine getFrequency: not called CC=1 SCAR=6.9
Pod documented
2312 0 my $self = shift;
2313 0 my $concept = shift;
2314
2315 0 my $ic = $icfinder->_getFrequency($concept);
2316  
2317 0 return $ic;
2318 }
2319  
2320 =head3 getPropagationCuis
2321  
2322 description:
2323  
2324 returns all of the cuis to be propagated given the sources
2325 and relations specified by the user in the configuration file
2326  
2327 input:
2328  
2329 None
2330
2331 output:
2332  
2333 $hash <- reference to hash containing the cuis
2334  
2335 example:
2336  
2337 use UMLS::Interface;
2338 my $umls = UMLS::Interface->new();
2339  
2340 my $hash = $umls->getPropagationCuis();
2341  
2342 =cut
2343 sub getPropagationCuis
2344 0 ▶{
Subroutine getPropagationCuis: not called CC=1 SCAR=6.9
Pod documented
2345 0 my $self = shift;
2346
2347 0 my $hash = $icfinder->_getPropagationCuis();
2348  
2349 0 return $hash;
2350
2351 }
2352  
2353 =head3 propagateCounts
2354  
2355 description:
2356  
2357 propagates the given frequency counts
2358  
2359 input:
2360
2361 $hash <- reference to the hash containing the frequency counts
2362  
2363 output:
2364
2365 $hash <- containing the propagation counts of all the cuis
2366 given the sources and relations specified in the
2367 configuration file
2368  
2369 example:
2370  
2371 use UMLS::Interface;
2372 my $umls = UMLS::Interface->new();
2373  
2374 my $phash = $umls->propagateCounts(\%fhash);
2375  
2376 =cut
2377 sub propagateCounts
2378 0 ▶{
Subroutine propagateCounts: not called CC=1 SCAR=6.9
Pod documented
2379  
2380 0 my $self = shift;
2381 0 my $fhash = shift;
2382
2383 0 my $hash = $icfinder->_propagateCounts($fhash);
2384  
2385 0 return $hash;
2386 }
2387  
2388  
2389 =head2 Semantic Network Functions
2390  
2391 =head3 getSemanticRelation
2392  
2393 description:
2394  
2395 subroutine to get the relation(s) between two semantic types
2396  
2397 input:
2398  
2399 $st1 <- semantic type abbreviation
2400 $st2 <- semantic type abbreviation
2401  
2402 output:
2403  
2404 $array <- reference to an array of semantic relation(s)
2405  
2406 example:
2407  
2408 use UMLS::Interface;
2409 my $umls = UMLS::Interface->new();
2410
2411 my $st1 = "blor";
2412 my $st2 = "bpoc";
2413 my $array = $umls->getSemanticRelation($st1,$st2);
2414 print "The relations between $st1 and $st2 are:\n";
2415 foreach my $relation (@{$array}) { print " $relation\n"; }
2416  
2417 =cut
2418 0 ▶sub getSemanticRelation {
Subroutine getSemanticRelation: not called CC=1 SCAR=6.9
Pod documented
2419
2420 0 my $self = shift;
2421 0 my $st1 = shift;
2422 0 my $st2 = shift;
2423  
2424 0 my $array = $cuifinder->_getSemanticRelation($st1, $st2);
2425  
2426 0 return $array;
2427 }
2428  
2429
2430 =head3 getSt
2431  
2432 description:
2433  
2434 returns the semantic type(s) of a given concept
2435  
2436 input:
2437  
2438 $concept <- string containing a concept
2439  
2440 output:
2441  
2442 $array <- reference to an array containing the semantic type's TUIs
2443 associated with the concept
2444  
2445 example:
2446  
2447 use UMLS::Interface;
2448 my $umls = UMLS::Interface->new();
2449
2450 my $concept = "C0018563";
2451 my $array = $umls->getSts($concept);
2452 print "The semantic types associated with $concept are:\n";
2453 foreach my $st (@{$array}) { print " $st\n"; }
2454  
2455 =cut
2456 0 ▶sub getSt {
Subroutine getSt: not called CC=1 SCAR=6.9
Pod documented
2457  
2458 0 my $self = shift;
2459 0 my $concept = shift;
2460  
2461 0 my $array = $cuifinder->_getSt($concept);
2462
2463 0 return $array;
2464 }
2465  
2466
2467 =head3 getSt
2468  
2469 description:
2470  
2471 returns the semantic type(s) of a given concept
2472  
2473 input:
2474  
2475 output:
2476  
2477 $array <- reference to an array containing all the semantic type's TUIs
2478
2479  
2480 example:
2481  
2482 use UMLS::Interface;
2483 my $umls = UMLS::Interface->new();
2484
2485 my $concept = "C0018563";
2486 my $array = $umls->getAllSts();
2487 print "The semantic types in the UMLS are: \n";
2488 foreach my $st (@{$array}) { print " $st\n"; }
2489  
2490 =cut
2491 0 ▶sub getAllSts {
Subroutine getAllSts: not called CC=1 SCAR=6.9
Pod undocumented
2492  
2493 0 my $self = shift;
2494 0 my $concept = shift;
2495  
2496 0 my $array = $cuifinder->_getAllSts();
2497
2498 0 return $array;
2499 }
2500  
2501 =head3 getSemanticGroup
2502  
2503 description:
2504  
2505 function returns the semantic group(s) associated with the concept
2506  
2507 input:
2508  
2509 $concept <- string containing cuis
2510  
2511 output:
2512  
2513 $array <- $array reference containing semantic groups
2514  
2515 example:
2516  
2517 use UMLS::Interface;
2518 my $umls = UMLS::Interface->new();
2519
2520 my $concept = "C0018563";
2521 my $array = $umls->getSemanticGroup($concept);
2522 print "The semantic group associated with $concept are:\n";
2523 foreach my $sg (@{$array}) { print " $sg\n"; }
2524  
2525 =cut
2526 0 ▶sub getSemanticGroup {
Subroutine getSemanticGroup: not called CC=1 SCAR=6.9
Pod documented
2527  
2528 0 my $self = shift;
2529 0 my $cui = shift;
2530
2531 0 my $array = $cuifinder->_getSemanticGroup($cui);
2532  
2533 0 return $array;
2534 }
2535  
2536 =head3 getAllSemanticGroups
2537  
2538 description:
2539  
2540 function returns all the semantic groups
2541  
2542 input:
2543  
2544 output:
2545  
2546 $array <- $array reference containing semantic groups
2547  
2548 example:
2549  
2550 use UMLS::Interface;
2551 my $umls = UMLS::Interface->new();
2552
2553 my $concept = "C0018563";
2554 my $array = $umls->getAllSemanticGroups();
2555 print "The semantic groups are:\n";
2556 foreach my $sg (@{$array}) { print " $sg\n"; }
2557  
2558 =cut
2559 0 ▶sub getAllSemanticGroups {
Subroutine getAllSemanticGroups: not called CC=1 SCAR=6.9
Pod documented
2560  
2561 0 my $self = shift;
2562
2563 0 my $array = $cuifinder->_getAllSemanticGroups();
2564  
2565 0 return $array;
2566 }
2567  
2568 =head3 getStsFromSg
2569  
2570 description:
2571  
2572 function returns all the semantic types of a given semantic group
2573  
2574 input:
2575  
2576 $string <- semantic group code
2577  
2578 output:
2579  
2580 $array <- $array reference containing semantic types
2581  
2582 example:
2583  
2584 use UMLS::Interface;
2585 my $umls = UMLS::Interface->new();
2586
2587 my $sg = "PROC";
2588 my $array = $umls->getStsFromSg($sg);
2589 print "The semantic types are:\n";
2590 foreach my $st (@{$array}) { print " $st\n"; }
2591  
2592 =cut
2593 0 ▶sub getStsFromSg {
Subroutine getStsFromSg: not called CC=1 SCAR=6.9
Pod documented
2594  
2595 0 my $self = shift;
2596 0 my $sg = shift;
2597
2598 0 my $array = $cuifinder->_getStsFromSg($sg);
2599  
2600 0 return $array;
2601 }
2602  
2603 =head3 stGetSemanticGroup
2604  
2605 description:
2606  
2607 function returns the semantic group(s) associated with a semantic type
2608  
2609 input:
2610  
2611 $st <- string containing semantic type abbreviations
2612  
2613 output:
2614  
2615 $array <- $array reference containing semantic groups
2616  
2617 example:
2618  
2619 use UMLS::Interface;
2620 my $umls = UMLS::Interface->new();
2621
2622 my $st = "pboc";
2623 my $array = $umls->stGetSemanticGroup($st);
2624 print "The semantic group associated with $st are:\n";
2625 foreach my $sg (@{$array}) { print " $sg\n"; }
2626  
2627 =cut
2628 0 ▶sub stGetSemanticGroup {
Subroutine stGetSemanticGroup: not called CC=1 SCAR=6.9
Pod documented
2629
2630 0 my $self = shift;
2631 0 my $st = shift;
2632  
2633 0 my $array = $cuifinder->_stGetSemanticGroup($st);
2634
2635 0 return $array;
2636 }
2637  
2638 =head3 getStString
2639  
2640 description:
2641  
2642 returns the full name of a semantic type given its abbreviation
2643  
2644 input:
2645  
2646 $st <- string containing the abbreviation of the semantic type
2647  
2648 output:
2649  
2650 $string <- string containing the full name of the semantic type
2651  
2652 example:
2653  
2654 use UMLS::Interface;
2655 my $umls = UMLS::Interface->new();
2656
2657 my $st = "bpoc";
2658 my $string = $umls->getStString($st);
2659 print "The abbreviation $st stands for $string\n";
2660  
2661 =cut
2662 0 ▶sub getStString {
Subroutine getStString: not called CC=1 SCAR=6.9
Pod documented
2663  
2664 0 my $self = shift;
2665 0 my $st = shift;
2666  
2667 0 my $string = $cuifinder->_getStString($st);
2668  
2669 0 return $string;
2670 }
2671  
2672 =head3 getStAbr
2673  
2674 description:
2675  
2676 returns the abreviation of a semantic type given its TUI (UI)
2677  
2678 input:
2679  
2680 $tui <- string containing the semantic type's TUI
2681  
2682 output:
2683  
2684 $string <- string containing the semantic type's abbreviation
2685  
2686 example:
2687  
2688 use UMLS::Interface;
2689 my $umls = UMLS::Interface->new();
2690
2691 my $tui = "T023"
2692 my $string = $umls->getStAbr($tui);
2693 print "The abbreviation of $tui is $string\n";
2694  
2695 =cut
2696 0 ▶sub getStAbr {
Subroutine getStAbr: not called CC=1 SCAR=6.9
Pod documented
2697  
2698 0 my $self = shift;
2699 0 my $tui = shift;
2700  
2701 0 my $abr = $cuifinder->_getStAbr($tui);
2702  
2703 0 return $abr;
2704 }
2705  
2706 =head3 getStTui
2707  
2708 description:
2709  
2710 function to get the name of a semantic type's TUI given its abbrevation
2711  
2712 input:
2713  
2714 $string <- string containing the semantic type's abbreviation
2715  
2716 output:
2717  
2718 $tui <- string containing the semantic type's TUI
2719  
2720 example:
2721  
2722 use UMLS::Interface;
2723 my $umls = UMLS::Interface->new();
2724
2725 my $string = "bpoc"
2726 my $tui = $umls->getStAbr($tui);
2727 print "The tui of $string is $tui\n";
2728  
2729 =cut
2730 0 ▶sub getStTui {
Subroutine getStTui: not called CC=1 SCAR=6.9
Pod documented
2731 0 my $self = shift;
2732 0 my $abbrev = shift;
2733  
2734 0 my $tui = $cuifinder->_getStTui($abbrev);
2735  
2736 0 return $tui;
2737 }
2738  
2739 =head3 getStDef
2740  
2741 description:
2742  
2743 returns the definition of the semantic type - expecting abbreviation
2744  
2745 input:
2746  
2747 $st <- string containing the semantic type's abbreviation
2748  
2749 output:
2750  
2751 $string <- string containing the semantic type's definition
2752  
2753 example:
2754  
2755 use UMLS::Interface;
2756 my $umls = UMLS::Interface->new();
2757
2758 my $st = "bpoc"
2759 my $string = $umls->getStDef($st);
2760 print "The definition of $st is $string\n";
2761  
2762 =cut
2763 0 ▶sub getStDef {
Subroutine getStDef: not called CC=1 SCAR=6.9
Pod documented
2764  
2765 0 my $self = shift;
2766 0 my $st = shift;
2767  
2768 0 my $definition = $cuifinder->_getStDef($st);
2769  
2770 0 return $definition;
2771 }
2772  
2773  
2774 =head2 Semantic Network Path Functions
2775  
2776 =head3 stPathsToRoot
2777  
2778 description:
2779  
2780 This function to find all the paths from a semantic type (tui)
2781 to the root node of the is-a taxonomy in the semantic network
2782  
2783 input:
2784  
2785 $tui <- string containing tui
2786  
2787 output:
2788  
2789 $array <- array reference containing the paths
2790  
2791 example:
2792  
2793 use UMLS::Interface;
2794 my $umls = UMLS::Interface->new();
2795  
2796 my $tui = "T023"
2797 my $array = $umls->stPathsToRoot($tui);
2798 print "The paths from $tui to the root are:\n";
2799 foreach my $path (@{$array}) { print " $path\n";
2800  
2801 =cut
2802 sub stPathsToRoot
2803 0 ▶{
Subroutine stPathsToRoot: not called CC=1 SCAR=6.9
Pod documented
2804 0 my $self = shift;
2805 0 my $tui = shift;
2806  
2807 0 my $array = $stfinder->_pathsToRoot($tui);
2808  
2809 0 return $array;
2810 }
2811  
2812 =head3 stFindShortestPath
2813  
2814  
2815 description:
2816  
2817 This function returns the shortest path between two semantic type TUIs.
2818  
2819 input:
2820  
2821 $st1 <- string containing the first tui
2822 $st2 <- string containing the second tui
2823  
2824 output:
2825  
2826 $array <- reference to an array containing paths
2827  
2828 example:
2829  
2830 use UMLS::Interface;
2831 my $umls = UMLS::Interface->new();
2832  
2833 my $st1 = "T023";
2834 my $st2 = "T029";
2835 my $array = $umls->stFindShortestPath($st1,$st2);
2836 print "The shortest path(s) between $st1 than $st2 are:\n";
2837 foreach my $path (@{$array}) { print " $path\n"; }
2838  
2839 =cut
2840 sub stFindShortestPath
2841 0 ▶{
Subroutine stFindShortestPath: not called CC=1 SCAR=6.9
Pod documented
2842 0 my $self = shift;
2843 0 my $st1 = shift;
2844 0 my $st2 = shift;
2845
2846 0 my $array = $stfinder->_findShortestPath($st1, $st2);
2847
2848 0 return $array;
2849 }
2850  
2851  
2852 # returns the minimum depth of a semantic type in the network
2853 # input : $st <- string containing the semantic type
2854 # output: $int <- minimum depth of hte semantic type
2855 #sub getMinStDepth {
2856 # my $self = shift;
2857 # my $st = shift;
2858 #
2859 # my $depth = $stfinder->_getMinDepth($st);
2860 #
2861 # return $depth;
2862 #}
2863  
2864 # returns the maximum depth of a semantic type in the network
2865 # input : $st <- string containing the semantic type
2866 # output: $int <- maximum depth of hte semantic type
2867 #sub getMaxStDepth {
2868 # my $self = shift;
2869 # my $st = shift;
2870 #
2871 # my $depth = $stfinder->_getMaxDepth($st);
2872 #
2873 # return $depth;
2874 #}
2875  
2876 =head2 Semantic Network Propagation Functions
2877  
2878 =head3 loadStPropagationHash
2879  
2880 description:
2881  
2882 load the propagation hash for the semantic network
2883  
2884 input:
2885  
2886 $hash <- reference to a hash containing probability counts
2887  
2888 output:
2889  
2890 None
2891
2892 example:
2893  
2894 use UMLS::Interface;
2895 my $umls = UMLS::Interface->new();
2896  
2897 $umls->loadStPropagationHash(\%hash);
2898  
2899 =cut
2900 0 ▶sub loadStPropagationHash {
Subroutine loadStPropagationHash: not called CC=1 SCAR=6.9
Pod documented
2901 0 my $self = shift;
2902 0 my $hash = shift;
2903
2904 0 $stfinder->_loadStPropagationHash($hash);
2905 }
2906  
2907 =head3 propagateStCounts
2908  
2909 description:
2910  
2911 propagates the given frequency counts of the semantic types
2912  
2913 input:
2914  
2915 $hash <- reference to the hash containing the frequency counts
2916  
2917 output:
2918  
2919 $hash <- containing the propagation counts of all the semantic types
2920  
2921 example:
2922  
2923 use UMLS::Interface;
2924 my $umls = UMLS::Interface->new();
2925  
2926 my $phash = $umls->propagateStCounts(\%fhash);
2927  
2928 =cut
2929 sub propagateStCounts
2930 0 ▶{
Subroutine propagateStCounts: not called CC=1 SCAR=6.9
Pod documented
2931  
2932 0 my $self = shift;
2933 0 my $fhash = shift;
2934
2935 0 my $hash = $stfinder->_propagateStCounts($fhash);
2936  
2937 0 return $hash;
2938 }
2939  
2940 =head3 getStIC
2941  
2942 description:
2943  
2944 returns the information content 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 IC
2953  
2954 example:
2955  
2956 use UMLS::Interface;
2957 my $umls = UMLS::Interface->new();
2958 my $st = "bpoc";
2959 my $double = $umls->getStIC($st);
2960 print "The IC of $st is $double\n";
2961
2962 =cut
2963 0 ▶sub getStIC {
Subroutine getStIC: not called CC=1 SCAR=6.9
Pod documented
2964 0 my $self = shift;
2965 0 my $st = shift;
2966
2967 0 my $ic = $stfinder->_getStIC($st);
2968  
2969 0 return $ic;
2970 }
2971  
2972 =head3 getStProbability
2973  
2974 description:
2975  
2976 returns the probability of a given semantic type
2977  
2978 input:
2979  
2980 $st <- string containing a semantic type
2981  
2982 output:
2983  
2984 $double <- double containing its probabilit
2985  
2986 example:
2987  
2988 use UMLS::Interface;
2989 my $umls = UMLS::Interface->new();
2990 my $st = "bpoc";
2991 my $double = $umls->getStProbability($st);
2992 print "The Probability of $st is $double\n";
2993  
2994 =cut
2995 0 ▶sub getStProbability {
Subroutine getStProbability: not called CC=1 SCAR=6.9
Pod documented
2996 0 my $self = shift;
2997 0 my $st = shift;
2998
2999 0 my $prob = $stfinder->_getStProbability($st);
3000  
3001 0 return $prob;
3002 }
3003  
3004 =head3 getStN
3005  
3006 description:
3007  
3008 returns the total number of semantic types (N)
3009  
3010 input:
3011
3012 output:
3013  
3014 $int <- double containing frequency
3015  
3016 example:
3017  
3018 use UMLS::Interface;
3019 my $umls = UMLS::Interface->new();
3020 my $int = $umls->getStN();
3021  
3022 =cut
3023 0 ▶sub getStN {
Subroutine getStN: not called CC=1 SCAR=6.9
Pod documented
3024 0 my $self = shift;
3025
3026 0 my $n = $stfinder->_getStN();
3027  
3028 0 return $n;
3029 }
3030  
3031 =head3 setStSmoothing
3032  
3033 description:
3034  
3035 function to set the smoothing parameter
3036  
3037 input:
3038  
3039 None
3040
3041 output:
3042  
3043 None
3044
3045 example:
3046  
3047 use UMLS::Interface;
3048 my $umls = UMLS::Interface->new();
3049 $umls->setStSmoothing();
3050  
3051 =cut
3052 sub setStSmoothing
3053 0 ▶{
Subroutine setStSmoothing: not called CC=1 SCAR=6.9
Pod documented
3054 0 my $self = shift;
3055
3056 0 $stfinder->_setStSmoothing();
3057
3058 }
3059  
3060 58 1;
3061  
3062 __END__
« blib/script/getExtendedDef.pl ↑ Summary blib/script/findAncestors.pl »