How to run the model in SBML file?

15 views (last 30 days)
Hi All,
I have a differential equation model(kinetic model) in sbml file. I want to run this model using ode15s solver.
How someone explain me how this can be done?
I have imported the file using
modelObj = sbmlimport('File.xml')

Accepted Answer

Jeremy Huard
Jeremy Huard on 25 Apr 2019
Dear Deepa,
there is two ways to simulate a model saved in a sbml file:
1. using the SimBiology App
You can open the SimBiology App from the App tab in MATLAB. Then in the 'Add Model' menu, select 'Load a model from a file' and choose your sbml file. One your model is loaded, select 'Simulate model' in the 'Add task' menu. ode15s is the default solver but you can select other in the 'Simulation settings'.
I recommend you to have a look at those short videos for a tutorial:
2. programmatically using SimBiology commands
Here is a code snippet to do this:
% Load model
modelObj = sbmlimport('File.xml');
% Define simulation settings
cs = getconfigset(modelObj);
cs.SolverType = 'ode15s'; % this is the default
cs.StopTime = 24; % to simulate 24 time units as specified by your model
% Simulate
[t, x, names] = sbiosimulate(modelObj);
plot(t, x)
xlabel('Time')
ylabel('States')
title('States vs Time')
legend(names)
I suggest you have a look at the documentation for an overview of the simulation settings:
However, here are some general remarks:
  • I recommend you to define all units in your model and turn on the unit conversion feature. This way you will be able to specify the simulation time in any unit you want (hour, day, minute,...). Otherwise, you will need to make sure that everything is consistent.
  • If your model is large and you wish to work on the command line, I recommend you to call sbiosimulate with a single output that will be a simData object. Then, you can select the state(s) you wish to plot:
sd = sbiosimulate(modelObj);
[t, x1] = selectbyname(sd, 'speciesNameToPlot');
plot(t, x1)
xlabel('Time')
ylabel('speciesNameToPlot')
  • There is a lot of great information in the doc that will help you get started. Starting by using the SimBiology App might be the easiest way. This page will explain you all the concepts: SimBiology App.
Best,
Jérémy
  4 Comments
Deepa Maheshvare
Deepa Maheshvare on 25 Apr 2019
Hi,
Thank you very much for the links and suggestions.Since my model is large, I prefer using the command line for now.I'll definetly have a look at the app too.
I've been going though the sbiofit options documented here,
fitResults = sbiofit(sm,grpData,responseMap,estiminfo)
In the contents that go into estiminfo(the following example is illustrated in the documentation),
paramsToEstimate = {'log(Central)','log(Cl_Central)'};
estimatedParams = estimatedInfo(paramsToEstimate,'InitialValue',[1 1],'Bounds',[1 5;0.5 2]);
Likewise, I'd like to choose the parameters from my model contained in the xml file.
I would like to know how parameters can be selected. Should I use libsbml to parse the parameters?
Jeremy Huard
Jeremy Huard on 25 Apr 2019
There is no disadvantage of using the App with large models over the command line.
Also, your model is now a SimBiology model. So, there is no need to use the sbml file anymore.
The App presents the huge advantage of displaying all model components, including the parameters. Also, the Fit task provides you a user interface to choose the parameters to estimate.
I strongly recommend you to have a look at it. And if you wish later on to do this on the command line, you can generate the MATLAB code associated with this fit task from the user interface:
Capture.PNG
On the command line, you can access the list parameters with:
modelObj.Parameters

Sign in to comment.

More Answers (0)

Communities

More Answers in the  SimBiology Community

Categories

Find more on Scan Parameter Ranges in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!