View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Ted Pedersen > WebService-UMLSKS-Similarity > ws-getAllowablePath


Annotate this POD


New  1
Open  0
View/Report Bugs




This program authenticates user by asking for valid username and password to connect to UMLSKS. Once the user is authenticated program takes two terms from the user and finds the shortest path (semantic distance) and the semantic relatedness(hso) between those two concepts using the heirarchical structure of the UMLSKS Metathesaurus database. The program queries SNOMED-CT database with the CUIs user enters and displays the shortest path along with the concepts through which the two inputs are connected.


Basic Usage

perl --verbose 1 -sources SNOMEDCT,MSH --rels PAR --dirs U --config configfilename --login loginfile --log logfile --patterns patternsfile --testfile test_file

--verbose: Sets verbose flag to true if value is set to 1, and thus displays all the authentication information for the user.

--sources : UMLS sources can be specified by providing list of sources seperated by comma. These sources will be used to query and retrieve the information.

--rels : UMLS relations can be specified by providing list of relations seperated by comma. These relations will be used to query and retrieve the information.

--dirs : Directions for UMLS relations can be specified by providing list of directions seperated by comma. Different directions are U - Up , D - Down and H - Horizontal. These directions will be used to find the allowable path. The sequence of these directions should be same as the sequence of relations provided by the --rels option.

--config : Instead of providing sources, relations and directions on command line, they can be specified using a configuration file, which can be provided with this option. It takes complete path and name of the file. The config file is expected in following format:

REL :: include PAR,RB
DIR :: include U,H
RELA :: include RB-has_part

--login : User can specify login credentials through the file, which should be of form:

username :: xyz
password :: pqr

--log : User can spacify the logfile name in which the log will be recorded. --verbose option must be set on to have log generated.

--patterns : User can specify the set of allowable patterns that should be used while calculating an allowable path. This options accepts a regex inside a file specified by patternsfile.

The regex may be of form :


U : upward arrow

D: downward arrow

H: Horizontal arrow

Each regex is seperated from another using | (or). Each regex represents one allowed pattern from the set.

Right now, the vector length of any size is allowed in the allowed direction,

For example,

\bU+\b : means a path which consists of one or more than one upward arrows is allowed.

--testfile : User can specify the list of test CUIs stored in the test_file throught this option. The program would generate output for all the CUI pairs sequentially.

Follwing is a sample output

Enter username to connect to UMLSKS:mchoudhari
Enter password:
Enter first query CUI:C0013378
Enter second query CUI:C0011167
First input is a CUI: C0013378
Second input is a CUI: C0011167
Final shortest path :Dysgeusia (C0013378) (U)->Taste Perception (C0039336) (U)->Special sensory functions (C0730359) (U)->Esthesia (C0036658) (U)->Nervous System Physiological Phenomena (C0027767) (U)->Function (C0542341) (D)->Digestion (C0012238) (D)->Oral cavity AND/OR esophageal function (C1268925) (D)->Deglutition (C0011167)
Final path cost : 80
Changes in Direction : 1
Semantic relatedness(hso) : 9
Enter first query CUI:stop


This program uses following packages:

package GetNeighbors

sub GetNeighbors::read_object which reads hash reference object passed to this sub and fetches the required Neighbors' information.

sub GetNeighbors::format_object calls appropriate functions like format_homogenous_hash, format_scalar, format_homogenous_array depending on the object reference it is called with. format_homogenous_hash,format_scalar and format_homogenous_array are subroutines which read the objects they are called with and fetch the desired information.

package ConnectUMLS

sub ConnectUMLS::get_pt to get the proxy ticket using a web service.

sub ConnectUMLS::connect_umls to connect to UMLS by sending username and password and getting back a proxy ticket.

package ValidateTerm

sub ValidateTerm::validateTerm to accepts an input and validates it for as valid or invalid CUI or a term.

package GetUserData

sub GetUserData::getUserDetails to get username and password from the user.

package Query

sub Query::runQuery which takes method name, service and other parameters as argument and calls the web service. It also displays the information received from the web service and other error messages.

package FormGraph

sub FormGraph::form_graph forms graph using standard BFS algorithm and creates a graph using the concepts and their neighbor concepts. It finds shortest path between two input concepts and displays the path.



Mugdha Choudhari University of Minnesota Duluth <chou0130 at>

Ted Pedersen, University of Minnesota Duluth <tpederse at>


Copyright (C) 2011, Mugdha Choudhari, Ted Pedersen

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to The Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

syntax highlighting: