MATLAB Answers

0

How to run the model in SBML file?

Asked by Deepa Maheshvare on 25 Apr 2019
Latest activity Commented on by Jeremy Huard on 25 Apr 2019
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')

  0 Comments

Sign in to comment.

Tags

Products

Communities

More Answers in the  SimBiology Community

1 Answer

Answer by Jeremy Huard on 25 Apr 2019
 Accepted 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

  4 Comments

Show 1 older comment
As suggested in the documentation, sbioparamestim will be removed in a future release. Please use sbiofit instead.
That being said, I recommend you to use the SimBiology App. There, you will see what needs to be defined to run the parameter estimation ('Add task' -> 'Fit data').
Please follow Steps 1 & 3 described here: (step 2 is the addition of a model but you already have one): Parameter estimation
You will be able to set parameter bounds, choose error models and choose one of several optimization methods in the fit task. fmincon will be in that list. But other methods accept also parameter bounds. The list is available here: Supported Methods for Parameter Estimation
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?
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.