-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUMLSQueryExamples.pl
90 lines (71 loc) · 2.64 KB
/
UMLSQueryExamples.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use strict;
use UMLSQuery;
my $U = new UMLSQuery;
$U->init( u => 'username',
p => 'password',
h => 'host',
dbname => 'dbname',
port => 3306);
print "\n",'$U->getCUI(Malignant tumour of prostate, RCD)',"\n";
@_ = $U->getCUI('Malignant tumour of prostate', 'RCD');
print " @_";
print "\n",'$U->getAUI(Malignant tumour of prostate, RCD)',"\n";
@_ = $U->getAUI('Malignant tumour of prostate', 'RCD');
print " @_";
print "\n",'$U->getSTR(A0812060)',"\n";
@_ = $U->getSTR('A0812060');
print " @_";
print "\n",'$U->getSAB(prostate)',"\n";
@_ = $U->getSAB('prostate');
print " @_";
print "\n",'$U->mapToId(intraductal carcinoma of prostate, idtype=>cui, sab=>SNOMEDCT)',"\n";
my $Ref = $U->mapToId('intraductal carcinoma of prostate', idtype=>'cui', sab=>'SNOMEDCT');
foreach $_ (sort keys %{$Ref}){
print " ",$_,"\t","@{$$Ref{$_}}","\n";
}
#print "-----------------\n";
#my $Ref = $U->mapToId('Carcinoma of prostate',idtype=>'aui');
#foreach $_ (keys %{$Ref}){
# print " ",$_,"\t","@{$$Ref{$_}}","\n";
#}
print "\n",'$U->getParents(C0600139,rela=>isa)',"\n";
my $Ref = $U->getParents('C0600139',rela=>'isa');
print scalar (keys %{$Ref})," paths to the root\n";
foreach $_ (keys %{$Ref}){
print " ",$_,"\t",$$Ref{$_},"\n";
my @parents = split(/\./, $_);
print scalar @parents,"\n";
foreach my $p (@parents){
my ($CUI) = $U->getCUI($p);
my ($STR) = $U->getSTR($CUI);
print $p," - ", $CUI," - ", $STR,"\n";
}
}
print "\n",'$U->getCommonParent(C0600139, C0007124)',"\n";
my ($cp, $dist) = $U->getCommonParent('C0600139','C0007124');
print " ",$cp,"\t",$dist,"\n";
print "\n",'$U->getChildren(C0376358,rela=>isa)',"\n";
my $Ref = $U->getChildren('C0376358',rela=>'isa');
foreach $_ (keys %{$Ref}){
print " ",$_,"\t",$$Ref{$_},"\n";
}
#print "\n",'$U->getChildren(A0740298)',"\n";
#my $Ref = $U->getChildren('A0740298');
#foreach $_ (keys %{$Ref}){
# print " ",$_,"\t",$$Ref{$_},"\n";
#}
print "\n",'$U->getCommonChild(C0376358,C0346554)',"\n";
my ($cp, $dist) = $U->getCommonChild('C0376358','C0346554');
print " ",$cp,"\t",$dist,"\n";
#print "\n",'$U->getCommonChild(A3261244,A3339540)',"\n";
#my ($cp, $dist) = $U->getCommonChild('A3261244','A3339540');
#print $cp,"\t",$dist,"\n";
print "\n",'$U->getDistBF(C0600139,C0007124)',"\n";
my $dist = $U->getDistBF('C0600139','C0007124');
print " ","distance b/w C0600139 and C0007124\t",$dist," links\n";
print "\n",'$U->getAvailableSAB(SNOMED)',"\n";
my $Ref = $U->getAvailableSAB('SNOMED');
foreach $_ (keys %{$Ref}){
print " ",$_,"\t",$$Ref{$_},"\n";
}
$U->finish();