The Systems Biology Markup Language (SBML) is a computer-readable format designed for representing models of biological systems. It is an XML-based standard that encodes computational models in systems biology, a field focused on understanding the interactions and behaviors of biological components within a system.
Key Features and Benefits
Standardization: SBML provides a standardized format for encoding biological models, ensuring consistency and interoperability across different software tools.
Model Exchange: Facilitates the exchange of models between different research groups and software applications, allowing researchers to utilize the best tools available for various aspects of their work.
Collaboration and Reproducibility: Enhances collaboration by enabling researchers to share models easily. It also ensures that models can be stored, archived, and reused, promoting reproducibility in scientific research.
Components of SBML
SBML models describe biochemical entities (such as species), the reactions between these entities, and the mathematical rules that govern the system. It can represent a wide range of biological processes, including metabolism, cell signaling, and gene regulation.
Development and Support
The development of SBML is coordinated by the SBML Project, a community-driven effort that includes researchers, software developers, and other stakeholders in systems biology. The project provides libraries, software tools, and educational resources for working with SBML.
Working with SBML
To work with SBML models, additional packages such as sbmlutils and libroadrunner are required. These packages facilitate the manipulation and simulation of SBML models. You can install them via pip:
pip install sbmlutils pip install libroadrunner
By using these tools, researchers can effectively create, modify, and analyze SBML models, enhancing their understanding of complex biological systems and improving the quality of their computational studies.
Encode SBML model
In a first step we encode our simple model with sbmlutils as SBML.
Absorption Elimination Model
from sbmlutils.factory import*from sbmlutils.metadata import*from pathlib import Pathimport warningswarnings.filterwarnings("ignore")m = Model( sid="absorption_first_order", name="Absorption model with first order kinetics",)m.compartments = [ Compartment("body", 1.0, name="Body", sboTerm=SBO.SIMPLE_CHEMICAL)]m.parameters = [ Parameter("Dose_A", 10.0, name="Dose of A"), Parameter("ka", 1.0, name="Absorption rate"), Parameter("ke", 1.0, name="Elimination rate"),]m.species = [ Species("A_tablet", initialAmount=0.0, hasOnlySubstanceUnits=True, compartment="body", name="A (tablet)", sboTerm=SBO.SIMPLE_CHEMICAL), Species("A_central", initialAmount=0.0, hasOnlySubstanceUnits=True, compartment="body", name="A (body)", sboTerm=SBO.SIMPLE_CHEMICAL), Species("A_urine", initialAmount=0.0, hasOnlySubstanceUnits=True, compartment="body", name="A (urine)", sboTerm=SBO.SIMPLE_CHEMICAL),]m.assignments = [ InitialAssignment("A_tablet", "Dose_A")]m.reactions = [ Reaction("ABSORPTION", name="absorption A", equation="A_tablet -> A_central", formula ="ka * A_tablet" ), Reaction("ELIMINATION", name="elimination A", equation="A_central -> A_urine", formula ="ke * A_central" )]# save the model (uncomment the following lines to create the model)# results = create_model(# model=m,# filepath=Path("absorption_first_order.xml"),# validation_options=ValidationOptions(units_consistency=False)# )
---------------------------------------------------------------------------ImportError Traceback (most recent call last)
CellIn[1], line 1----> 1fromsbmlutils.factoryimport *
2fromsbmlutils.metadataimport *
3frompathlibimport Path
File ~/git/dhpe-pkpd/.venv/lib/python3.12/site-packages/sbmlutils/factory.py:45 43importnumpyasnp 44importxmltodict# type: ignore---> 45fromnumpyimport NaN
46frompintimport UndefinedUnitError, UnitRegistry
47frompydanticimport BaseModel, ConfigDict
ImportError: cannot import name 'NaN' from 'numpy' (/home/mkoenig/git/dhpe-pkpd/.venv/lib/python3.12/site-packages/numpy/__init__.py)
Exercise: Explore the model with https://sbml4humans.de. Upload the model to the website and navigate the objects.
Exercise: Visualize the model with cytoscape and cy3sbml. I.e. download Cytoscape, install the app cy3sbml and load the model to explore the model.
Simulate SBML model
In a second step we load the model and perform a simple simulation and visualization.
from matplotlib import pyplot as pltf, ax = plt.subplots(nrows=1, ncols=1)f.suptitle("Simulation with SBML")for name in ["A_tablet", "A_central", "A_urine"]: ax.plot(df.time, df[f"[{name}]"], lw=2, label=name)ax.set_ylabel("concentration")ax.set_xlabel("time [hr]")ax.legend()plt.show()