-
Notifications
You must be signed in to change notification settings - Fork 41
/
install.m
58 lines (52 loc) · 2.2 KB
/
install.m
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
function install
%Installs whole-cell model
%
% Author: Jonathan Karr, [email protected]
% Affilitation: Covert Lab, Department of Bioengineering, Stanford University
% Last updated: 2/2/2012
% check MATLAB version
if verLessThan('matlab', '7.9')
throw(MException('install:newerMatlabVersionRequired', 'The whole-cell model software requires MATLAB R2009b (7.9) or newer'));
end
%% set warnings and path
setWarnings()
setPath();
%% configure stored simulation results path
outputPath = input(strrep(sprintf('Enter an absolute file path where simulated data will be stored [%s%soutput%srunSimulation]: ', pwd, filesep, filesep), '\','\\'), 's');
if ~isdir(outputPath)
mkdir(outputPath);
end
if isempty(outputPath)
outputPath = sprintf('%s%soutput%srunSimulation', pwd, filesep, filesep);
else
outputPath = absolutepath(outputPath);
end
%% set server configuration
reply = ' ';
while ~(isequal(upper(reply), 'Y') || isequal(upper(reply), 'N') || isempty(reply))
reply = input('Would you like to setup your server configuration? Y/N [N]: ', 's');
end
if isequal(upper(reply), 'N') || isempty(reply)
return;
end
%prompt user
hostName = input('Enter knowledge base server hostname: ', 's');
schema = input('Enter knowledge base schema: ', 's');
userName = input('Enter knowledge base username: ', 's');
password = input('Enter knowledge base password: ', 's');
%edit knowledge base configuration
fid = fopen('getConfig.m', 'w');
fprintf(fid, 'function config = getConfig()\n');
fprintf(fid, '%%GETCONFIG Returns configuration values.\n');
fprintf(fid, '%%\n');
fprintf(fid, '%% Author: Jonathan Karr, [email protected]\n');
fprintf(fid, '%% Affilitation: Covert Lab, Department of Bioengineering, Stanford University\n');
fprintf(fid, '%% Last updated: 9/21/2010\n');
fprintf(fid, '\n');
fprintf(fid, '%% knowledgebase\n');
fprintf(fid, 'config.hostName = ''%s'';\n', strrep(hostName, '''', ''''''));
fprintf(fid, 'config.schema = ''%s'';\n', strrep(schema, '''', ''''''));
fprintf(fid, 'config.userName = ''%s'';\n', strrep(userName, '''', ''''''));
fprintf(fid, 'config.password = ''%s'';\n', strrep(password, '''', ''''''));
fprintf(fid, 'config.outputPath = ''%s'';\n', strrep(outputPath, '''', ''''''));
fclose(fid);