#error checking
my $function = "_getCUICooccurrences_DB";
if(!defined $self || !ref $self) {
$errorhandler->_error($pkg, $function, "", 2);
}
#get hashes of co-occurring CUIs
my %cooccurrences1 = ();
my %cooccurrences2 = ();
#query DB to get cuis, where concept 1 is the leading cui
my $firstCui = shift @{$cuis1Ref};
my $query = "SELECT * FROM N_11 WHERE (N_11.cui_1 = '$firstCui' ";
foreach my $cui (@{$cuis1Ref}) {
$query .= "OR N_11.cui_1 = '$cui' ";
}
$query .= ") AND N_11.n_11 > 0;";
my $sth = $assocDB_G->prepare($query);
$sth->execute();
my @rows = @{$sth->fetchall_arrayref()};
unshift @{$cuis1Ref}, $firstCui;
#turn CUIs into a hash of cui1's cooccurrences
foreach my $rowRef (@rows) {
print STDERR join(' ', @{$rowRef})."\n";
}
#TODO - this is done, it works ... it gets back the whole relevant table. Now fill up as needed.
my @cuis;
#query DB to get cuis, where concept 2 is the trailing cui
$firstCui = shift @{$cuis2Ref};
$query = "SELECT N_11.cui_1 FROM N_11 WHERE (N_11.cui_2 = '$firstCui' ";
foreach my $cui (@{$cuis2Ref}) {
$query .= "OR N_11.cui_2 = '$cui' ";
}
$query .= ") AND N_11.n_11 > 0;";
@cuis = @{$assocDB_G->selectcol_arrayref($query)};
unshift @{$cuis2Ref}, $firstCui;
#turn CUIs into a hash of cui2's co-occurrences
foreach my $cui (@cuis) {
$cooccurrences2{$cui} = 1;
}
#add additional cuis if order doesn't matter
if($noOrder_G) {
#get cuis, where concept 1 is the trailing cui
$firstCui = shift @{$cuis1Ref};
my $query = "SELECT N_11.cui_1 FROM N_11 WHERE (N_11.cui_2 = '$firstCui' ";
foreach my $cui (@{$cuis1Ref}) {
$query .= "OR N_11.cui_2 = '$cui' ";
}
$query .= ") AND N_11.n_11 > 0;";
@cuis = @{$assocDB_G->selectcol_arrayref($query)};
unshift @{$cuis1Ref}, $firstCui;
#add cuis to the hash of cui1's co-occurrences
foreach my $cui (@cuis) {
$cooccurrences1{$cui} = 1;
}
#get cuis, where concept 2 is the leading cui
$firstCui = shift @{$cuis2Ref};
$query = "SELECT N_11.cui_2 FROM N_11 WHERE (N_11.cui_1 = '$firstCui' ";
foreach my $cui (@{$cuis2Ref}) {
$query .= "OR N_11.cui_1 = '$cui' ";
}
$query .= ") AND N_11.n_11 > 0;";
@cuis = @{$assocDB_G->selectcol_arrayref($query)};
unshift @{$cuis2Ref}, $firstCui;
#add cuis to the hash of cui2's co-occurrences
foreach my $cui (@cuis) {
$cooccurrences2{$cui} = 1;
}
}
#return the cui co-occurrences
return (\%cooccurrences1, \%cooccurrences2);
}
NAME
UMLS::Association::StatFinder - provides the statistical association information of the concept pairs in the UMLS
DESCRIPTION For more information please see the UMLS::Association.pm documentation.
SYNOPSIS
use UMLS::Association::StatFinder; use UMLS::Association::ErrorHandler;
%params = ();
$statfinder = UMLS::Association::StatFinder->new(\%params); die "Unable to create UMLS::Association::StatFinder object.\n" if(!$statfinder);
my $cui1 = C0018563; my $cui2 = C0446516;
# calculate measure assocation my $measure = "ll"; my $score = $statfinder->calculateStatistic($cui1, $cui2, $measure);
INSTALL
To install the module, run the following magic commands:
perl Makefile.PL
make
make test
make install
This will install the module in the standard location. You will, most
probably, require root privileges to install in standard system
directories. To install in a non-standard directory, specify a prefix
during the 'perl Makefile.PL' stage as:
perl Makefile.PL PREFIX=/home/bridget
It is possible to modify other parameters during installation. The
details of these can be found in the ExtUtils::MakeMaker
documentation. However, it is highly recommended not messing around
with other parameters, unless you know what you're doing.
=head1 SEE ALSO
<http://tech.groups.yahoo.com/group/umls-similarity/>
=head1 AUTHOR
Bridget T McInnes <bmcinnes@vcu.edu>
Andriy Y. Mulyar <andriy.mulyar@gmail.com>
Alexander D. McQuilkin <alexmcq99@yahoo.com>
Alex McQuilken <alexmcq99@yahoo.com>
Sam Henry <henryst@vcu.edu>
=head1 COPYRIGHT
Copyright (c) 2015
Bridget T. McInnes, Virginia Commonwealth University
btmcinnes at vcu.edu
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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 1240:
Unknown directive: =comment