-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateSimFun.m
More file actions
44 lines (34 loc) · 1.36 KB
/
generateSimFun.m
File metadata and controls
44 lines (34 loc) · 1.36 KB
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
function MATfilename = generateSimFun(MATfilename)
arguments
MATfilename (1,1) string = "simFunction_Dose.mat"
end
% if only a file name without folder name is provided, make sure the MAT
% file is saved in the same directory as generateSimFun.m
if ~contains(MATfilename,filesep)
fullpath = mfilename('fullpath');
folder = fileparts(fullpath);
MATfilename = fullfile(folder,MATfilename);
end
% Load the SimBiology project into the workspace
s = sbioloadproject("TMDD.sbproj",'m1');
modelObj = s.m1;
doseObj = modelObj.getdose('Daily Dose');
basevariantObj = modelObj.getvariant('Estimated values');
% Use hours for dose timing and convert any day-based interval to hours
oldTimeUnit = doseObj.TimeUnits;
doseObj.TimeUnits = 'hour';
doseObj.Interval = sbiounitcalculator(oldTimeUnit, ...
doseObj.TimeUnits, doseObj.Interval);
% Increase the number of repeat doses for long simulations
doseObj.RepeatCount = 200;
% Save dose table for simulation
doseTable = doseObj.getTable();
% Create a simulation function
simFun = modelObj.createSimFunction({'kel','kon','kdeg'}, ...
{'Drug','Receptor','Complex','RO'}, doseObj.TargetName, basevariantObj);
% Compile the simulation function for faster execution
simFun.accelerate();
dependenciesSimFun = simFun.DependentFiles';
% Create MAT file
save(MATfilename,"simFun","doseTable","dependenciesSimFun");
end