Data2Dynamics / d2d

a modeling environment tailored to parameter estimation in dynamical systems
https://github.com/Data2Dynamics/d2d
57 stars 29 forks source link

SBML import not working for models with constant=False compartments #109

Closed matthiaskoenig closed 4 years ago

matthiaskoenig commented 6 years ago

SBML models with non-constant compartments cannot be imported in d2d. This is a problem with the SBML importer and SBML support in D2D.

This was originally reported in https://github.com/Data2Dynamics/d2d/issues/76

An example model is attached: limax_pkpd_39.xml.zip

Trying to load the model with

arImportSBML('limax_pkpd_39.xml)

Results in the following message:

Specified tEnd
Level 3 packages detected. Information WILL be lost.
Error using arImportSBML (line 128)
non-constant compartments are not yet supported in D2D!

Best Matthias

matthiaskoenig commented 6 years ago

@hhass I will write an SBML->def converter which should solve the issue for me. One question I have is how I can define calculated values from my states which I want to use in the ODEs? Is this possible, or do I have to write out everything in the ODES?

E.g. if I have the states x0, x1 and parameters p0, p1 and some assignment rules like y0 = p1*p2*x1

Where do I define the assignment y0 in the def file ? So I can write the ODEs as

dx0/dt = y0 - p1*x0
dx1/dt = p1

Or do I have to insert all intermediate assignments directly in the ODEs?, i.e.

dx0/dt = p1*p2*x1 - p1*x0
dx1/dt = p1
JoepVanlier commented 6 years ago

You could use the preprocessor, but have to be aware that it's a literal replacement and it is not aware of any math that may be going on.

define Y0 (p1*p2*x1)

Always use extra brackets to be on the safe side.

JoepVanlier commented 6 years ago

Can also use derived variables. They get substituted into the rate equations.