SBML creator

sbmlutils provides helpers for the creation of SBML models from scratch.

Create model

The easist way to create a new model is by using a dictionary of information for the model creation.

[1]:
from pathlib import Path
from sbmlutils.io import read_sbml, write_sbml, validate_sbml

from sbmlutils.factory import *
from sbmlutils.metadata import *

import tempfile
[2]:
model = Model(
    "example_model",
    name="Example model",
    units=Units,
    model_units = ModelUnits(
        time=Units.second,
        substance=Units.mole,
        extent=Units.mole,
        volume=Units.litre,
    ),
    compartments = [Compartment(sid="C", value=1.0)],
    species = [
        Species(
            sid="S1",
            initialConcentration=10.0,
            compartment="C",
            hasOnlySubstanceUnits=False,
        ),
        Species(
            sid="S2",
            initialConcentration=0.0,
            compartment="C",
            hasOnlySubstanceUnits=False,
        )
    ],
    parameters = [Parameter(sid="k1", value=1.0)],
    reactions = [
        Reaction(sid="R1", equation="S1 -> S2", formula=("k1 * S1", None))
    ],
)

# create the model as L3V1
with tempfile.TemporaryDirectory() as tmp_path:
    results = create_model(
        model=model,
        filepath=Path(tmp_path) / f"{model.sid}.xml",
        validation_options=ValidationOptions(units_consistency=False),
        sbml_level=3,
        sbml_version=1,
    )
    # show level and version and print SBML
    doc = read_sbml(source=results.sbml_path, validate=False)
    sbml = write_sbml(doc)
    print(sbml)
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'example_model'                                                      factory.py:3526
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Species(S2)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S2)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmpyxd33q0b/example_model.xml
valid                    : TRUE
check time (s)           : 0.002
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" level="3" version="1" comp:required="true">
  <notes>
    <body xmlns="http://www.w3.org/1999/xhtml">
      <p>Created with <a href="https://github.com/matthiaskoenig/sbmlutils">https://github.com/matthiaskoenig/sbmlutils</a>.
<a href="https://doi.org/10.5281/zenodo.5525390">
        <img src="https://zenodo.org/badge/DOI/10.5281/zenodo.5525390.svg" alt="DOI"/></a></p>
      </body>
    </notes>
  <model id="example_model" name="Example model" substanceUnits="mole" timeUnits="second" volumeUnits="litre" extentUnits="mole">
    <listOfCompartments>
      <compartment id="C" spatialDimensions="3" size="1" constant="true"/>
    </listOfCompartments>
    <listOfSpecies>
      <species id="S1" compartment="C" initialConcentration="10" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
      <species id="S2" compartment="C" initialConcentration="0" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
    </listOfSpecies>
    <listOfParameters>
      <parameter id="k1" value="1" constant="true"/>
    </listOfParameters>
    <listOfReactions>
      <reaction id="R1" reversible="false" fast="false">
        <listOfReactants>
          <speciesReference species="S1" stoichiometry="1" constant="true"/>
        </listOfReactants>
        <listOfProducts>
          <speciesReference species="S2" stoichiometry="1" constant="true"/>
        </listOfProducts>
        <kineticLaw>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <times/>
              <ci> k1 </ci>
              <ci> S1 </ci>
            </apply>
          </math>
        </kineticLaw>
      </reaction>
    </listOfReactions>
  </model>
</sbml>

Units

It is highly recommended to annotate all units in the model. This allows automatic unit validation and unit conversions with the model.

Units are defined by subclassing the Units class. This provides the default SBML units and allows for code completion with units. Units are defined as attributes on the Units subclass.

[3]:
class U(Units):
    """UnitDefinitions."""

    mmole = UnitDefinition("mmole", "mmole")
    mmole_per_min = UnitDefinition("mmole_per_min", "mmole/min")

SBML Levels and Versions

Models can be generated in all SBML levels and versions via the create_model function.

[4]:
from sbmlutils.io import read_sbml, write_sbml, validate_sbml

from sbmlutils.factory import *
from sbmlutils.metadata import *

import tempfile
[5]:
# model definition
md: ModelDict = {
    "sid": "level_version",
    "units": U,
    "model_units": ModelUnits(
        time=U.second,
        substance=U.mole,
        extent=U.mole,
        volume=U.liter,
    ),
    "compartments": [Compartment(sid="C", value=1.0)],
    "species": [
        Species(
            sid="S1",
            initialConcentration=10.0,
            compartment="C",
            hasOnlySubstanceUnits=False,
            boundaryCondition=True,
        )
    ],
    "parameters": [Parameter(sid="k1", value=1.0)],
    "reactions": [
        Reaction(sid="R1", equation="S1 ->", formula=("k1 * S1", None))
    ],
}

supported_level_version = [
    (1, 1), (1, 2),
    (2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
    (3, 1), (3, 2),
]

with tempfile.TemporaryDirectory() as tmp_path:

    for level, version in supported_level_version:
        # inject information
        md["sid"] = f"L{level}V{version}"
        results = create_model(
            model=Model(**md),
            filepath=Path(tmp_path) / f"{model.sid}.xml",
            validation_options=ValidationOptions(units_consistency=False),
            sbml_level=level,
            sbml_version=version,
        )
        doc = read_sbml(source=results.sbml_path, validate=False)
        print(f"L{doc.getLevel()}V{doc.getVersion()}")
        if level == 3 and version == 1:
            sbml = write_sbml(doc)
            print("-" * 80)
            print(sbml)

─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L1V1'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L1V1', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
ERROR    ENone: General SBML conformance (core, L2, code)                                         validation.py:188
         [Error] Annotation objects on the SBML container element are not permitted in SBML Level                  
         1                                                                                                         
         The <sbml> container element cannot contain <notes> or <annotations> in an SBML Level 1                   
         document.                                                                                                 
                                                                                                                   
ERROR    `read_sbml` error '/tmp/tmp8gk6q08t/example_model.xml': SBMLDocumentErrors encountered while    sbml.py:66
         reading the SBML file.                                                                                    
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : FALSE
validation error(s)      : 1
validation warnings(s)   : 0
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
ERROR    E0: General SBML conformance (core, L2, code)                                            validation.py:188
         [Error] Annotation objects on the SBML container element are not permitted in SBML Level                  
         1                                                                                                         
         The <sbml> container element cannot contain <notes> or <annotations> in an SBML Level 1                   
         document.                                                                                                 
                                                                                                                   
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
ERROR    ENone: General SBML conformance (core, L2, code)                                         validation.py:188
         [Error] Annotation objects on the SBML container element are not permitted in SBML Level                  
         1                                                                                                         
         The <sbml> container element cannot contain <notes> or <annotations> in an SBML Level 1                   
         document.                                                                                                 
                                                                                                                   
ERROR    `read_sbml` error '/tmp/tmp8gk6q08t/example_model.xml': SBMLDocumentErrors encountered while    sbml.py:66
         reading the SBML file.                                                                                    
L1V1
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L1V2'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L1V2', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
ERROR    ENone: General SBML conformance (core, L2, code)                                         validation.py:188
         [Error] Annotation objects on the SBML container element are not permitted in SBML Level                  
         1                                                                                                         
         The <sbml> container element cannot contain <notes> or <annotations> in an SBML Level 1                   
         document.                                                                                                 
                                                                                                                   
ERROR    `read_sbml` error '/tmp/tmp8gk6q08t/example_model.xml': SBMLDocumentErrors encountered while    sbml.py:66
         reading the SBML file.                                                                                    
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : FALSE
validation error(s)      : 1
validation warnings(s)   : 0
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
ERROR    E0: General SBML conformance (core, L2, code)                                            validation.py:188
         [Error] Annotation objects on the SBML container element are not permitted in SBML Level                  
         1                                                                                                         
         The <sbml> container element cannot contain <notes> or <annotations> in an SBML Level 1                   
         document.                                                                                                 
                                                                                                                   
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
ERROR    ENone: General SBML conformance (core, L2, code)                                         validation.py:188
         [Error] Annotation objects on the SBML container element are not permitted in SBML Level                  
         1                                                                                                         
         The <sbml> container element cannot contain <notes> or <annotations> in an SBML Level 1                   
         document.                                                                                                 
                                                                                                                   
ERROR    `read_sbml` error '/tmp/tmp8gk6q08t/example_model.xml': SBMLDocumentErrors encountered while    sbml.py:66
         reading the SBML file.                                                                                    
L1V2
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L2V1'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L2V1', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : TRUE
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
L2V1
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L2V2'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L2V2', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : TRUE
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
L2V2
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L2V3'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L2V3', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : TRUE
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
L2V3
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L2V4'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L2V4', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : TRUE
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
L2V4
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L2V5'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L2V5', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : TRUE
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
L2V5
─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L3V1'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L3V1', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : TRUE
check time (s)           : 0.001
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
L3V1
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" level="3" version="1" comp:required="true">
  <notes>
    <body xmlns="http://www.w3.org/1999/xhtml">
      <p>Created with <a href="https://github.com/matthiaskoenig/sbmlutils">https://github.com/matthiaskoenig/sbmlutils</a>.
<a href="https://doi.org/10.5281/zenodo.5525390">
        <img src="https://zenodo.org/badge/DOI/10.5281/zenodo.5525390.svg" alt="DOI"/></a></p>
      </body>
    </notes>
  <model id="L3V1" substanceUnits="mole" timeUnits="second" volumeUnits="litre" extentUnits="mole">
    <listOfUnitDefinitions>
      <unitDefinition id="mmole" name="mmole">
        <listOfUnits>
          <unit kind="mole" exponent="1" scale="0" multiplier="0.001"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="mmole_per_min" name="mmole/min">
        <listOfUnits>
          <unit kind="mole" exponent="1" scale="0" multiplier="0.001"/>
          <unit kind="second" exponent="-1" scale="0" multiplier="60"/>
        </listOfUnits>
      </unitDefinition>
    </listOfUnitDefinitions>
    <listOfCompartments>
      <compartment id="C" spatialDimensions="3" size="1" constant="true"/>
    </listOfCompartments>
    <listOfSpecies>
      <species id="S1" compartment="C" initialConcentration="10" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="true" constant="false"/>
    </listOfSpecies>
    <listOfParameters>
      <parameter id="k1" value="1" constant="true"/>
    </listOfParameters>
    <listOfReactions>
      <reaction id="R1" reversible="false" fast="false">
        <listOfReactants>
          <speciesReference species="S1" stoichiometry="1" constant="true"/>
        </listOfReactants>
        <kineticLaw>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <apply>
              <times/>
              <ci> k1 </ci>
              <ci> S1 </ci>
            </apply>
          </math>
        </kineticLaw>
      </reaction>
    </listOfReactions>
  </model>
</sbml>

─────────────────────────────────────────────────── Create SBML ───────────────────────────────────────────────────
INFO     Create SBML for model 'L3V2'                                                               factory.py:3526
WARNING  'name' should be set on 'Model(sid='L3V2', packages=[<Package.COMP_V1: 'comp-v1'>],         factory.py:441
         model_units=<sbmlutils.factory.ModelUnits object at 0x7fe940324cd0>, units=<class                         
         '__main__.U'>, compartments=[C = 1.0 [None]], species=[<sbmlutils.factory.Species object at               
         0x7fe940324dc0>], parameters=[k1 = 1.0 [None]], reactions=[<sbmlutils.factory.Reaction                    
         object at 0x7fe940324f40>], _FrozenClass__isfrozen=True)'                                                 
INFO     'length' should be set in 'model_units'.                                                    factory.py:266
INFO     'area' should be set in 'model_units'.                                                      factory.py:266
WARNING  'name' should be set on 'Parameter(k1)'                                                     factory.py:441
WARNING  'sboTerm' should be set on 'Parameter(k1)'                                                  factory.py:466
WARNING  'name' should be set on 'Compartment(C)'                                                    factory.py:441
WARNING  'sboTerm' should be set on 'Compartment(C)'                                                 factory.py:466
WARNING  'name' should be set on 'Species(S1)'                                                       factory.py:441
WARNING  'sboTerm' should be set on 'Species(S1)'                                                    factory.py:466
WARNING  'name' should be set on 'Reaction(R1)'                                                      factory.py:441
WARNING  'sboTerm' should be set on 'Reaction(R1)'                                                   factory.py:466
────────────────────────────────────────────────── Validate SBML ──────────────────────────────────────────────────
file:///tmp/tmp8gk6q08t/example_model.xml
valid                    : TRUE
check time (s)           : 0.002
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
L3V2
[ ]: