WebService-UMLSKS-Similarity

 view release on metacpan or  search on metacpan

lib/WebService/UMLSKS/FormGraph.pm  view on Meta::CPAN

    use WebService::UMLSKS::GetUserData;   
    
    # Creating object of class GetUserData 
	my $g = WebService::UMLSKS::GetUserData->new;
    
    $t1 = valid input CUI1;
    $t2 = valid input CUI2;
    $service = $g->getUserDetails($verbose);
    @sources,@relations,@directions,@attributes = read from configuration;
    $allowable_pattern_regex = read from pattern file;
    $test_flag = 1 for testing else 0;
   
    my $return_val = 
    form_graph-> form_graph($t1,$t2,$service, $verbose, \@sources, \@relations,\@directions
			,\@attributes,$allowable_pattern_regex,$test_flag);

=head1 DESCRIPTION

This module forms a graph of concepts connected to input concepts. It accepts the list of
parents, children and siblings from GetNeighbors module. This module calls
GetAllowablePaths module and finds the shortest allowable path between the input
CUIs or concepts. It then calculates the semantic relatedness between the concepts 
using the shortest allowable path information.

=head1 SUBROUTINES

The subroutines are as follows:

=cut

###############################################################################
##########  CODE STARTS HERE  #################################################

# This module has package  FormGraph

# Author  : Mugdha Choudhari

# Description : this module makes a graph stored in form of hash of hash and
# calculates the semantic relatedness value between the input concepts.

#use lib "/home/mugdha/UMLS-HSO/UMLS-HSO/WebService-UMLSKS-Similarity/lib";
use warnings;
use SOAP::Lite;
use strict;
no warnings qw/redefine/;    #http://www.perlmonks.org/?node_id=582220


#use WebService::UMLSKS::GetAllowablePaths; changed name of getallowablepathsold
use WebService::UMLSKS::GetAllowablePaths;
use WebService::UMLSKS::GetNeighbors;
use WebService::UMLSKS::Query;
use WebService::UMLSKS::ConnectUMLS;
use WebService::UMLSKS::Similarity;
#use Proc::ProcessTable;
#use Graph::Directed;


package WebService::UMLSKS::FormGraph;


use Log::Message::Simple qw[msg error debug];

my %node_cost = ();
my %Graph     = ();
my $counter = 0;
my $const_C = 20;
my $const_k = 1 / 4;
my $absent = 0;

my %MetaCUIs = (
	'C0332280' => 'Linkage concept',
	'C1274012' => 'Ambiguous concept',
	'C1274014' => 'Outdated concept',
	'C1276325' => 'Reason not stated concept',
	'C1274013' => 'Duplicate concept',
	'C1264758' => 'Inactive concept',
	'C1274015' => 'Erroneous concept',
	'C1274021' => 'Moved elsewhere',
	'C2733115' => 'Limited status concept',
	'C1299995' => 'Namespace concept',
	'C1285556' => 'Navigational concept',
	'C1298232' => 'Special concept',
);

my @sources   = ();
my @relations = ();
my @directions = ();
my @attributes = ();

my $source;
my $destination;
my $tflag;
my $verbose = 0;
	

# This sub creates a new object of FormGraph

=head2 new

This sub creates a new object of FormGraph.

=cut

sub new {
	my $class = shift;
	my $self  = {};
	bless( $self, $class );
	return $self;
}



=head2 form_graph

This sub gets neighbors for the input concepts and forms graph. It also
calculates the semantic relatedness between the concepts.

=cut

sub form_graph

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.402 second using v1.00-cache-2.02-grep-82fe00e-cpan-dad7e4baca0 )