This repository has been archived by the owner on Jul 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
test.pl
executable file
·206 lines (158 loc) · 4.5 KB
/
test.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/usr/local/bin/perl
# Copyright SRA International
#
# Distributed under the OSI-approved BSD 3-Clause License.
# See http://ncip.github.com/pathway-interaction-database/LICENSE.txt for details.
##
## More options to consider:
## - save the input config file and allow retrieval
## - allow uploading a config file
## - limit to atoms of a given data source (maybe also with NOT)
## - allow retrieval by template
## - allow retrieval by degree (on incoming and/or outgoing edge) of
## separation (but don't follow pruned mols)
##
BEGIN {
my @path_elems = split("/", $0);
pop @path_elems;
push @INC, join("/", @path_elems);
}
use strict;
use Blocks;
use PWAppConfig;
use PWApp;
use Pathway;
use PathwayXML;
use PathParams;
use PWLabel;
use FileHandle;
use ServerSupport;
use URI::Escape;
######################################################################
sub InitializeDatabase {
InitializeLV();
InitializeComplex2Component();
InitializeAtom2Atom();
}
######################################################################
sub GetPwImage {
my ($base, $id) = @_;
return GetPwImage_1 ($base, $id);
}
######################################################################
sub MakeCommandFile {
my ($base, $graphic_type, $parm_string) = @_;
$parm_string = uri_unescape($parm_string);
return MakeCommandFile_1 ($base, $graphic_type, $parm_string);
}
######################################################################
sub PrPath {
my ($base, $graphic_type, $parm_string) = @_;
$parm_string = uri_unescape($parm_string);
return PrPath_1 ($base, $graphic_type, $parm_string);
}
######################################################################
sub MoleculePage {
my ($base, $molid) = @_;
return MoleculePage_1($base, $molid);
}
######################################################################
sub MoleculeInstance {
my ($base, $inst) = @_;
return MoleculeInstance_1($base, $inst);
}
######################################################################
sub PathwayPage {
my ($base, $pathid) = @_;
return PathwayPage_1($base, $pathid);
}
######################################################################
sub ListAllPathways {
my ($base) = @_;
return ListAllPathways_1($base);
}
######################################################################
sub MoleculeHeader {
my ($base, $moleculeName, $source_id, $format) = @_;
return MoleculeHeader_1($base, $moleculeName, $source_id, $format);
}
######################################################################
sub PathwayHeader {
my ($base, $pid, $format) = @_;
return PathwayHeader_1($base, $pid, $format);
}
######################################################################
sub SearchPathwayKeywords {
my ($base, $word, $format) = @_;
return SearchPathwayKeywords_1($base, $word, $format);
}
######################################################################
sub Comment {
my ($base, $name, $email, $organization, $atomid, $molname, $molid,
$pathname, $pathid, $comment) = @_;
return Comment_1($base, $name, $email, $organization,
$atomid, $molname, $molid, $pathname, $pathid, $comment);
}
######################################################################
sub AtomPage {
my ($base, $atomid) = @_;
return AtomPage_1($base, $atomid);
}
######################################################################
######################################################################
#
# main
#
SetProgramName($0);
SetSafe(
"ResetServer",
"PrPath",
"GetPwImage",
"MoleculePage",
"MoleculeInstance",
"PathwayPage",
"ListAllPathways",
"AtomPage",
"MakeCommandFile",
"SearchPathwayKeywords",
"PathwayHeader",
"MoleculeHeader",
"Comment"
);
SetForkable(
"PrPath",
"GetPwImage",
"MoleculePage",
"MoleculeInstance",
"PathwayPage",
"ListAllPathways",
"AtomPage",
"MakeCommandFile",
"SearchPathwayKeywords",
"PathwayHeader",
"MoleculeHeader"
### "Comment" ##!!! do not make this forkable
);
print "Content-type: text/plain\n\n";
InitializeDatabase();
print PrPath("", "text", join("\n",
"db_inst cgprod",
"db_user web",
"db_pass readonly",
"db_schema pid",
"print xml",
"molecule zak",
"include complex_uses",
"include family_uses",
"source_id 5"
));
exit();
StartServer(PW_SERVER_PORT, "PWAppServer");
#print PrPath_1("","text", join("\n",
#"db_user\tweb",
#"db_inst\tlpgprod",
#"db_pass\treadonly",
#"db_schema\tcgap2",
#"print\tdot",
#"mol_id\t20035") . "\n");
exit();