Convert SimBiology model to script format.

조회 수: 7 (최근 30일)
Ciaran
Ciaran 2015년 1월 13일
답변: Rick Paxson 2015년 1월 13일
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

채택된 답변

Rick Paxson
Rick Paxson 2015년 1월 13일
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개)

커뮤니티

더 많은 답변 보기:  SimBiology Community

카테고리

Help CenterFile Exchange에서 Scan Parameter Ranges에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by