script/ws-test.pl untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 22 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 66 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2  
3  
4 #---------------------------PERLDOC STARTS HERE------------------------------------------------------------------
5  
6 =head1 NAME
7  
8 ws-test
9  
10 =cut
11  
12 #---------------------------------------------------------------------------------------------------------------------
13  
14 =head1 SYNOPSIS
15  
16 =head2 Basic Usuage
17  
18 =pod
19  
20 perl ws-test.pl --config configfilename --login loginfile --testfile test_file
21  
22 --config : Instead of providing sources, relations and directions on command line, they can be
23 specified using a configuration file, which can be provided with this option.
24 It takes complete path and name of the file. The config file is expected in following format:
25  
26 =cut
27  
28 =pod
29  
30 =over
31  
32 =item SAB :: include SNOMEDCT,MSH
33  
34 =item REL :: include PAR,RB
35  
36 =item DIR :: include U,H
37  
38 =item RELA :: include RB-has_part
39
40 =back
41  
42 =cut
43  
44 =pod
45  
46 --login : User can specify login credentials through the file, which should be of form:
47  
48 =over
49  
50 =item username :: xyz
51  
52 =item password :: pqr
53
54 =back
55  
56  
57 --testfile : User can specify the list of test CUIs stored in the test_file throught this option.
58 The program would call getAllowablePath.pl for all the CUI pairs sequentially.
59  
60  
61 Follwing is a sample output
62  
63 =over
64  
65 =item Enter username to connect to UMLSKS:mchoudhari
66  
67 =item Enter password:
68  
69 =item An output file output.txt would be generated.
70  
71 =back
72  
73  
74 =head1 DESCRIPTION
75  
76 This program is used for testing a large data set. It accepts the test file as command line argument and sequentially
77 calls getAllowablePath.pl for each test CUI pair.
78  
79 =cut
80  
81 #---------------------------------------------------------------------------------------------------------------------------
82  
83 #------------------------------PERLDOC ENDS HERE------------------------------------------------------------------------------
84  
85  
86  
87 use Getopt::Long;
88 use strict;
89  
90  
91 my $test_file ;
92 my $c_file;
93 my $l_file;
94 my $patterns_file;
95  
96 GetOptions( 'testfile=s' => \$test_file, 'config=s' => \$c_file, 'login=s' => \$l_file, 'pattern=s' => \$patterns_file);
97  
98 if($test_file eq "" || $l_file eq "" || $c_file eq "" || $patterns_file eq "")
99 {
100 print "\n Please specify options --testfile, --login , --config and --pattern for testing\n";
101 exit;
102 }
103  
104  
105 if($test_file ne "" && $c_file ne "" && $l_file ne "" && $patterns_file ne ""){
106
107 open(MYDATA, $test_file) or die("Error: cannot open file 'data.txt'\n");
108
109
110 # This is creating the file for writing output
111 open(OUTPUT,">","output.txt") or die("Error: cannot open file 'output.txt'\n");
112 close OUTPUT;
113
114 #open(TIME,">","time.txt") or die("Error: cannot open file 'time.txt'\n");
115 #close TIME;
116
117 #open(OUT,">","inter_output.txt") or die("Error: cannot open file 'inter_output.txt'\n");
118 #close OUT;
119
120 my $line;
121
122 my $lnum = 1;
123 while( $line = <MYDATA> ){
124 chomp($line);
125
126 $line =~ /\s*(.*)\s*<>\s*(.*?)$/;
127 my $query1 = $1;
128 my $query2 = $2;
129 $query1 =~ s/\s*//g;
130 $query2 =~ s/\s*//g;
131
132 # Call getAllowable.pl for each CUI pair in the test file.
133 system("/usr/bin/perl ws-getAllowablePath.pl --input1 $query1 --input2 $query2 --login $l_file --config $c_file --patterns $patterns_file");
134
135
136
137 }
138
139 }
140  
141  
142  
143  
144 #-------------------------------PERLDOC STARTS HERE-------------------------------------------------------------
145  
146  
147 =head1 SEE ALSO
148  
149 ValidateTerm.pm GetUserData.pm Query.pm ConnectUMLS.pm
150  
151 =cut
152  
153  
154 =head1 AUTHORS
155  
156 Mugdha Choudhari University of Minnesota Duluth
157 E<lt>chou0130 at d.umn.eduE<gt>
158  
159 Ted Pedersen, University of Minnesota Duluth
160 E<lt>tpederse at d.umn.eduE<gt>
161  
162  
163  
164  
165 =head1 COPYRIGHT
166  
167 Copyright (C) 2011, Mugdha Choudhari, Ted Pedersen
168  
169 This program is free software; you can redistribute it and/or modify
170 it under the terms of the GNU General Public License as published by
171 the Free Software Foundation; either version 2 of the License, or (at
172 your option) any later version.
173  
174 This program is distributed in the hope that it will be useful, but
175 WITHOUT ANY WARRANTY; without even the implied warranty of
176 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
177 General Public License for more details.
178  
179 You should have received a copy of the GNU General Public License
180 along with this program; if not, write to
181 The Free Software Foundation, Inc.,
182 59 Temple Place - Suite 330,
183 Boston, MA 02111-1307, USA.
184  
185 =cut
186  
187 #---------------------------------PERLDOC ENDS HERE---------------------------------------------------------------
188  
189  
190