Creating models using SBML
The SBML integration into MEmilio works via the sbml_to_memilio executable.
Building it requires the installation of libsbml. Then the general build command
will produce the executable at build/bin/sbml_to_memilio.
Building the converter
To build the executable, the following steps are necessary:
Install
libsbml. The latest releases are available on GitHub, advice can be found in the documentation. The compilation was tested with version 5.20.2. It might work with other versions, but then it has to be updated in the CMakeLists.txt.Create the CMake files. At the time of writing, the libsbml package installed with default settings could not be found by CMake. Therefore, you have to hint CMake to the location of the
sbml-config.cmake, e.g., by adding the flag-Dsbml_DIR=<path to folder containing sbml-config.cmake>during the configuration step. Be sure to also have setMEMILIO_ENABLE_SBML=ON(this isOFFby default).Build the MEmilio project with the general build command (see the documentation for details).
The files generated by
sbml_to_memiliowill only be nicely formatted, if clang-format is installed. It will work also without it, but installing it is recommended.
For more information on the build process, please refer to Getting started.
Usage
Call the executable on a given SBML file as
./build/bin/sbml_to_memilio <sbml-file>
Attention
You have to call the executable from either cpp or cpp/build or cpp/build/bin. Otherwise it will not find
the sbml_model_generation folder.
If clang-format is not installed, it will end with an error, but produce the necessary files nevertheless.
It will produce
a folder with the same name as the SBML file in the
cpp/sbml_model_generation-directory.an implementation-file called
ex_<sbml-file-name>.cppthat contains the generated code for the model.the necessary additions to the
CMakeLists.txtfile in thecpp/sbml_model_generation-directory.
Now, using the general build command with target all or ex_<sbml-file-name> will build an executable for the new model.
For more information on building memilio, we refer to Getting started.
Changing parameters
As some parameters (mainly the duration of simulation) are not part of the SBML file, they are set to generic values in
the generated example file cpp/sbml_model_generation/ex_<sbml-file-name>.cpp. They can also be changed there.
Limitations
Be careful about your naming, as some names like, e.g., Inf are ambiguous.
Not every feature implemented in SBML is also supported by MEmilio. The following features are the most important not supported features:
Events not triggered by time
Usage of multiple SBML-compartments
Rules (unless they are RateRules)
The
^operator for exponentiation in functions. This will produce errors during compilation of the generated code, but can then be changed manually.
As in an SBML file all species have to be given separately, it is unfortunately also not possible to automatically use the Population in MEmilio to stratify the population into different compartments.
In general: Please check your models after the conversion to ensure that everything is working as expected.
BioModels Database
The BioModels Database contains many models written in SBML, also quite a few models for epidemiological contexts. If you created your own SBML file for your model, don’t forget to upload it there ;) .