Convert SimBiology model to script format.
6 views (last 30 days)
Show older comments
Is there any way to import a SMBL using SimBiology (either code or GUI) then automatically produce the code for that model in script form. My aim here is to be able to import an SBML that I made using CellDesigner and simulate multiple times with randomly generated initial values (something that seems hard to do with the GUI alone).
Thanks
0 Comments
Accepted Answer
Rick Paxson
on 13 Jan 2015
There are a couple of ways of doing this from the MATLAB command line. Neither one produces a script from the model though.
Let me describe one of them and see if it satisfies your needs. Note that is assumes you are using R2014a or newer. If that is not the case let me know and I will describe the other way.
Say you have a SBML file with a model that has a number of parameters and you want to simulate the model using uniformly distributed random parameter values in the range [0 10] for two of those parameters. I will use a model that we ship with SimBiology called oscillator.xml (it is SBML) for demonstration purposes.
model = sbmlimport('oscillator');
func = createSimFunction(model, {'Reaction1.k1', 'Reaction3.k3'}, 'pA', []);
parameter_values = 10 * rand(10, 2);
stopTime = 100;
results = func(parameter_values, stopTime);
sbioplot(results)
Note that this model has a number of parameters (42) and a number of species (23) but in the call to createSimFunction you can specify a subset of this parameters that will be accessible from the generated function. Likewise the resulting function (func) will only return values for the species specified by name in the second argument to createSimFunction; in this case 'pA'.
When calling func, every row of the parameter_values matrix is used during one simulation. Calling func with a matrix returns simulation results for each of those rows. There are options that allow running these simulations in parallel (either using multiple cores, or a cluster) if you have the parallel computing toolbox.
Lastly I will mention that there are ways of doing this from the GUI (there is a Task for scanning with some options). But if you want more control over the parameters used this example might be more adequate.
0 Comments
More Answers (0)
Communities
More Answers in the SimBiology Community
See Also
Categories
Find more on Scan Parameter Ranges in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!