-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.php
executable file
·321 lines (266 loc) · 12.8 KB
/
install.php
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php
/*
This script installs both the whole-cell knowledge base and model,
including configuring the whole-cell model code to run on a Linux
cluster using the MATLAB MCR.
Detailed notes on the third-party software packages required to run
the whole-cell knowledge base and model are listed below.
Please contact the authors at for help installing and/or using this
software. See wholecell.stanford.edu for contact information.
Whole Cell Instructions
===================================================
A. Knowledgebase
1. Install MySQL, Apache, PHP
- http://www.mysql.com/downloads/
- http://www.apache.org/dyn/closer.cgi
- http://www.php.net/downloads.php
2. Install php packages
- DOMDocument
3. Add apache alias for web-based whole cell knowledge base viewer/editor. Add these lines your apache configuration file
Alias /WholeCell <repos>
<Directory <repos>
Options none
AllowOverride All
Order allow,deny
Allow from all
</Directory>
4. Run this script to install MySQL schema, knowledge base content, create new MySQL users, and setup configuration files. Follow on screen instructions.
>> php install.php
5. To view/edit knowledge base, visit http://<hostname>/WholeCell/knowledgebase
B. Model
1. Install MATLAB
- http://www.mathworks.com/products/matlab/
2. Install toolbooxes
- bioinformatics
- curve fitting
- image processing
- optimization
- signal processing
- statistics
3. To run model
>> cd <repos>/simulation/; matlab -r "runSimulation();"
4. To synchronize model with knowledge base
>> cd <repos>/simulation/; matlab -r "generateTestFixtures();"
C. Cluster, analysis, animation
1. Install MATLAB Component Runtime (MCR)
2. Install Perl with packages
- XML::DOM
- XML::RegExp
- LWP
- LWP::UserAgent
- LWP::UserAgent::Determined
- Date::Format
- MIME::Lite
- HTML::Template
- Mysql
- DBI::DBD
3. Install graphics/video software:
- latex
- inkscape
- GraphicsMagick
- ffmpeg
- meconder
- pdftk
4. Install Torque/Maui
5. Add apache alias to enable web-based simulation submission and tracking (see A.3)
6. Run this script to configure your cluster. See simulation/config.php and simulation/library.pl for further information.
7. To run and view simulations, visit http://<hostname>/WholeCell/simulation
8. To compile animations
>> cd <repos>/simulation/; runAnimation.pl <simulation group ID>
Author: Jonathan Karr, jkarr@stanford.edu
Affiliation: Covert Lab, Department of Bioengineering, Stanford University
Last Updated: 11/25/2011
*/
if (is_dir('knowledgebase') && !is_dir('knowledgebase/tmp'))
mkdir('knowledgebase/tmp');
// gather configuration
echo "MySQL host name: ";
$hostName = rtrim(fgets(STDIN));
echo "MySQL schema name (eg. wholecell): ";
$schema = rtrim(fgets(STDIN));
echo "MySQL user name (eg. wholecell): ";
$dbNewUserName = rtrim(fgets(STDIN));
echo "MySQL password: ";
$dbNewPassword = rtrim(fgets(STDIN));
echo "Do you need to create this schema? [Y/N]: ";
$createSchema = rtrim(fgets(STDIN));
if ($createSchema == 'y' || $createSchema == 'Y') {
echo "MySQL root user name: ";
$dbUserName = rtrim(fgets(STDIN));
echo "MySQL root password: ";
$dbPassword = rtrim(fgets(STDIN));
}
echo "Desired knowledge base user name (eg. jkarr): ";
$kbUserName = rtrim(fgets(STDIN));
echo "Desired knowledge base password: ";
$kbPassword = rtrim(fgets(STDIN));
echo "Desired knowledge first name: ";
$kbFirstName = rtrim(fgets(STDIN));
echo "Desired knowledge middle name: ";
$kbMiddleName = rtrim(fgets(STDIN));
echo "Desired knowledge last name: ";
$kbLastName = rtrim(fgets(STDIN));
echo "Desired knowledge affiliation: ";
$kbAffiliation = rtrim(fgets(STDIN));
echo "Desired knowledge email: ";
$kbEmail = rtrim(fgets(STDIN));
echo "Desired file absolute path to store simulation results: ";
$resultsFilePath = rtrim(fgets(STDIN));
echo "Would you like to setup a cluster? [Y/N]: ";
$setupCluster = rtrim(fgets(STDIN));
if ($setupCluster == 'y' || $setupCluster == 'Y') {
echo "Enter system user name: ";
$linuxUserName = rtrim(fgets(STDIN));
echo "Enter front-end hostname: ";
$simulationHostName = rtrim(fgets(STDIN));
echo "Enter simulation code path: ";
$simulationPath = rtrim(fgets(STDIN));
echo "Enter node MCR path: ";
$mcrPath = rtrim(fgets(STDIN));
echo "Enter node tmp directory path: ";
$tmpDirectoryPath = rtrim(fgets(STDIN));
echo "Enter user database host name: ";
$userDBHostName = rtrim(fgets(STDIN));
echo "Enter user database schema: ";
$userDBSchema = rtrim(fgets(STDIN));
echo "Enter user database user name: ";
$userDBUserName = rtrim(fgets(STDIN));
echo "Enter user database password: ";
$userDBPassword = rtrim(fgets(STDIN));
echo "Enter whole-cell base URL: ";
$baseURL = rtrim(fgets(STDIN));
echo "Enter simulation results URL: ";
$simulationResultsURL = rtrim(fgets(STDIN));
echo "Enter websvn URL: ";
$webSVNURL = rtrim(fgets(STDIN));
echo "Enter ganglia job URL: ";
$gangliaJobURL = rtrim(fgets(STDIN));
echo "Enter ganglia queue URL: ";
$gangliaQueueURL = rtrim(fgets(STDIN));
echo "Enter checkjob URL: ";
$checkJobURL = rtrim(fgets(STDIN));
}
//Create new mysql database and new mysql user with priviledges on new database
if (is_dir('knowledgebase') && $createSchema=='y' || $createSchema=='Y'){
echo "Creating MySQL database and new user.\n";
file_put_contents("knowledgebase/tmp/tmp.sql", "
CREATE DATABASE `$schema`;
CREATE USER '$dbNewUserName'@'%' IDENTIFIED BY '$dbNewPassword';
GRANT ALL PRIVILEGES
ON `$schema`.*
TO '$dbNewUserName'@'%'
WITH GRANT OPTION
MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0
MAX_USER_CONNECTIONS 0;");
$result = system("mysql \"--host=$hostName\" \"--user=$dbUserName\" \"--password=$dbPassword\" mysql < knowledgebase/tmp/tmp.sql");
if ($result === false)
echo "Error creating MySQL databse and adding new user.\n";
}
//Edit hostname, username, password, and schema in <repos>/knowledgebase/configuration.php, <repos>/simulation/config.m
echo "Editing configuration files.\n";
if (is_dir('knowledgebase')){
$result = file_put_contents('knowledgebase/configuration.php',
"<?php
\$configuration = array(
'hostName' => '$hostName',
'userName' => '$dbNewUserName',
'password' => '$dbNewPassword',
'schema' => '$schema',
'enableLogin' => 1,
'enableExport' => 1,
);
?>
");
if ($result === false)
echo "Error editing configuration file.\n";
}
if (is_dir('simulation')){
$result = file_put_contents('simulation/config.m',
"function dbConnectionParameters = config()
%CONFIG Returns configuration values.
dbConnectionParameters.hostName = '$hostName';
dbConnectionParameters.schema = '$schema';
dbConnectionParameters.userName = '$dbNewUserName';
dbConnectionParameters.password = '$dbNewPassword';
");
if ($result === false)
echo "Error editing configuration file.\n";
$str = file_get_contents('simulation/src/+edu/+stanford/+covert/+cell/+sim/+util/SimulationDiskUtil.m');
$str = str_replace("% value = '/absolute_path/to/output/directory';", $resultsFilePath, $str);
$result = file_put_contents('simulation/src/+edu/+stanford/+covert/+cell/+sim/+util/SimulationDiskUtil.m', $str);
if ($result === false)
echo "Error editing configuration file.\n";
$str = file_get_contents('simulation/config.php');
$str = preg_replace('/\$baseDir = \'.*?\';/', '$baseDir = \''.$resultsFilePath.'\';', $str);
$str = preg_replace('/\$baseURL = \'.*?\';/', '$baseURL = \''.$baseURL.'/simulation\';', $str);
$str = preg_replace('/\$simulationResultsURL = \'.*?\';/', '$simulationResultsURL = \''.$simulationResultsURL.'\';', $str);
$str = preg_replace('/\$webSVNURL = \'.*?\';/', '$webSVNURL = \''.$webSVNURL.'\';', $str);
$str = preg_replace('/\$gangliaJobURL = \'.*?\';/', '$gangliaJobURL = \''.$gangliaJobURL.'\';', $str);
$str = preg_replace('/\$gangliaQueueURL = \'.*?\';/', '$gangliaQueueURL = \''.$gangliaQueueURL.'\';', $str);
$str = preg_replace('/\$checkJobURL = \'.*?\';/', '$checkJobURL = \''.$checkJobURL.'\';', $str);
$str = preg_replace('/\$dbConfig\[\'hostName\'\] = \'.*?\';/', '$dbConfig[\'hostName\'] = \''.$userDBHostName.'\';', $str);
$str = preg_replace('/\$dbConfig\[\'userName\'\] = \'.*?\';/', '$dbConfig[\'userName\'] = \''.$userDBUserName.'\';', $str);
$str = preg_replace('/\$dbConfig\[\'password\'\] = \'.*?\';/', '$dbConfig[\'password\'] = \''.$userDBPassword.'\';', $str);
$str = preg_replace('/\$dbConfig\[\'schema\'\] = \'.*?\';/', '$dbConfig[\'schema\'] = \''.$userDBSchema.'\';', $str);
$result = file_put_contents('simulation/config.php', $str);
if ($result === false)
echo "Error editing configuration file.\n";
$str = file_get_contents('simulation/library.pl');
$str = preg_replace('/\'hostName\' => \'.*?\',/', "'hostName' => '$hostName',", $str);
$str = preg_replace('/\'URL\' => \'.*?\',/', "'URL' => '".str_replace("http://", "", $baseURL)."',", $str);
$str = preg_replace('/\'schema\' => \'.*?\',/', "'schema' => '$schema',", $str);
$str = preg_replace('/\'dbUserName\' => \'.*?\',/', "'dbUserName' => '$dbNewUserName',", $str);
$str = preg_replace('/\'dbPassword\' => \'.*?\',/', "'dbPassword' => '$dbNewPassword',", $str);
$str = preg_replace('/\'email\' => \'.*?\',/', "'email' => '$kbEmail',", $str);
$str = preg_replace('/\'simulationHostName\' => \'.*?\',/', "'simulationHostName' => '$simulationHostName',", $str);
$str = preg_replace('/\'simulationPath\' => \'.*?\',/', "'simulationPath' => '$simulationPath',", $str);
$str = preg_replace('/\'execUserName\' => \'.*?\',/', "'execUserName' => '$linuxUserName',", $str);
$str = preg_replace('/\'fileUserName\' => \'.*?\',/', "'fileUserName' => '$linuxUserName',", $str);
$str = preg_replace('/\'mcrPath\' => \'.*?\',/', "'mcrPath' => '$mcrPath',", $str);
$str = preg_replace('/\'nodeTmpDir\' => \'.*?\',/', "'nodeTmpDir' => '$tmpDirectoryPath',", $str);
$str = preg_replace('/\'webSVNURL\' => \'.*?\',/', "'webSVNURL' => '$webSVNURL',", $str);
$str = preg_replace('/\'gangliaJobURL\' => \'.*?\',/', "'gangliaJobURL' => '$gangliaJobURL',", $str);
$str = preg_replace('/\'gangliaQueueURL\' => \'.*?\',/', "'gangliaQueueURL' => '$gangliaQueueURL',", $str);
$str = preg_replace('/\'checkJobURL\' => \'.*?\',/', "'checkJobURL' => '$checkJobURL',", $str);
$result = file_put_contents('simulation/library.pl', $str);
if ($result === false)
echo "Error editing configuration file.\n";
}
if (is_dir('knowledgebase')){
//Load database schema based on BioWarehouse v4.1 (http://biowarehouse.ai.sri.com/releases/previous-releases/4.1/)
echo "Loading schema\n";
$result = system("mysql \"--host=$hostName\" \"--user=$dbNewUserName\" \"--password=$dbNewPassword\" \"$schema\" < knowledgebase/lib/biowarehouse/warehouse-mysql-create.sql");
if ($result === false)
echo "Error creating MySQL databse and adding new user.\n";
$result = system("mysql \"--host=$hostName\" \"--user=$dbNewUserName\" \"--password=$dbNewPassword\" \"$schema\" < knowledgebase/lib/biowarehouse/warehouse-mysql-index.sql");
if ($result === false)
echo "Error creating MySQL databse and adding new user.\n";
echo "Loading stored procedures\n";
$result = system("mysql \"--host=$hostName\" \"--user=$dbNewUserName\" \"--password=$dbNewPassword\" \"$schema\" < knowledgebase/src/procedures.sql");
if ($result === false)
echo "Error creating MySQL databse and adding new user.\n";
echo "Editing schema\n";
file_put_contents("knowledgebase/tmp/tmp.sql", "CALL update_schema();");
$result = system("mysql \"--host=$hostName\" \"--user=$dbNewUserName\" \"--password=$dbNewPassword\" \"$schema\" < knowledgebase/tmp/tmp.sql");
if ($result === false)
echo "Error creating MySQL databse and adding new user.\n";
//Create knowledge base user
echo "Creating knowledge base user.\n";
file_put_contents("knowledgebase/tmp/tmp.sql", "CALL set_user('$kbUserName', '$kbPassword', '$kbFirstName', '$kbMiddleName', '$kbLastName', '$kbAffiliation', '$kbEmail');");
$result = system("mysql \"--host=$hostName\" \"--user=$dbNewUserName\" \"--password=$dbNewPassword\" \"$schema\" < knowledgebase/tmp/tmp.sql");
if ($result === false)
echo "Error creating MySQL databse and adding new user.\n";
//Load knowledge base content
echo "Loading knowledge base content.\n";
$result = system("cd knowledgebase; php uploadKnowledgeBase.php \"$kbUserName\" \"$kbPassword\" false false");
if ($result === false)
echo "Error creating MySQL databse and adding new user.\n";
}
// Print success message(s)
if (is_dir('knowledgebase'))
echo "Knowledge successfully installed.\n";
if (is_dir('simulation'))
echo "Model successfully installed.\n";
?>