MATLAB: How to run the model in SBML file

SimBiology

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')

Best Answer

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