WebService-UMLSKS-Similarity
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
bin/ws-getAllowablePath.pl view on Meta::CPAN
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.
=item 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.
=item package ValidateTerm
sub ValidateTerm::validateTerm to accepts an input and validates it
for as valid or invalid CUI or a term.
=item package GetUserData
sub GetUserData::getUserDetails to get username and password from the user.
=item 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.
=item 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.
=back
=cut
#---------------------------------------------------------------------------------------------------------------------------
#------------------------------PERLDOC ENDS HERE------------------------------------------------------------------------------
###############################################################################
########## CODE STARTS HERE #################################################
#use lib "/home/mugdha/UMLS-HSO/UMLS-HSO/WebService-UMLSKS-Similarity/lib";
use strict;
use warnings;
use SOAP::Lite;
use Term::ReadKey;
use WebService::UMLSKS::GetUserData;
use WebService::UMLSKS::ValidateTerm;
use WebService::UMLSKS::Query;
use WebService::UMLSKS::ConnectUMLS;
use WebService::UMLSKS::Similarity;
use WebService::UMLSKS::GetCUIs;
use WebService::UMLSKS::FormGraph;
use Log::Message::Simple qw[msg error debug];
#use get_all_associatedCUIs;
use Getopt::Long;
#use SOAP::Lite +trace => 'debug';
no warnings qw/redefine/;
#Program that returns the shortest path between two concepts using UMLS database.
# Author : Mugdha
# Reference: Program provided by Olivier B., NLM.
my $verbose = '';
my $log_file = '';
my $patterns_file = '';
my $sources = '';
my $relations = '';
my $directions = '';
my $similarity;
my $config_file = '';
my $login_file = '';
my $test_file = '';
my $input1 = '';
my $input2 = '';
my $chd_threshold = '';
my $sib_threshold = '';
GetOptions( 'verbose:i' => \$verbose , 'sources=s' => \$sources , 'rels=s' =>\$relations, 'dirs=s' =>\$directions,
'config=s' =>\$config_file, 'log=s' => \$log_file, 'login=s' => \$login_file ,'patterns=s' => \$patterns_file,
'testfile=s' => \$test_file, 'input1=s' => \$input1, 'input2=s'=>\$input2,'chd_threshold=s' => \$chd_threshold, 'sib_threshold=s'=>\$sib_threshold);
# Reference for use of Log package
# http://perldoc.perl.org/Log/Message/Simple.html#msg(%22message-string%22-%5b%2cVERBOSE%5d)
if($log_file ne '' && $verbose eq 1){
open (LOG , '>>', $log_file);
$Log::Message::Simple::MSG_FH = \*LOG;
$Log::Message::Simple::ERROR_FH = \*LOG;
$Log::Message::Simple::DEBUG_FH = \*LOG;
# Following code to print time and date in readable form is taken from following source
#http://perl.about.com/od/perltutorials/a/perllocaltime_2.htm
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
my $year = 1900 + $yearOffset;
my $theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year";
# Code from source ends here
debug("\n*********************************\n Log written on :
$theTime\n************************************", $verbose);
}
if($log_file ne '' && $verbose eq '')
{
print "\nPlease set verbose option to true to see the log\n";
exit;
}
if(defined $config_file && $config_file ne "")
{
$similarity = WebService::UMLSKS::Similarity->new({"config" => $config_file});
# print "\n creating object of similarity with config file";
msg("\n creating object of similarity with config file", $verbose);
}
else
{
if($sources eq "" && $relations eq "" && $directions eq "")
{
# use default things
msg("\n creating default object of similarity", $verbose);
$similarity = WebService::UMLSKS::Similarity->new();
}
else{
if( $sources ne "" && $relations ne "" && $directions ne "")
{
# user specified sources through command line
my @source_list = split ("," , $sources);
my @relation_list = split ("," , $relations);
my @direction_list = split ("," , $directions);
$similarity = WebService::UMLSKS::Similarity->new({"sources" => \@source_list,
"rels" => \@relation_list,
"dirs" => \@direction_list } );
msg("\n creating object of similarity with sources, rels and dirs", $verbose);
#$ConfigurationParameters{"SAB"} = \@sources_list;
}
else{
if($relations ne "" && $directions ne "")
{
# user specified rels through command line
my @relation_list = split ("," , $relations);
my @direction_list = split ("," , $directions);
$similarity = WebService::UMLSKS::Similarity->new({ "rels" => \@relation_list,
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.763 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )