Skip to content

pkpdsim: PBPK/PD models in SBML using python

GitHub Actions CI/CD Status Documentation Version Python Versions MIT License

pkpdsim is a library for physiologically based pharmacokinetic and pharmacodynamic (PBPK/PD) models in SBML: a standard physiology at its centre, the substances, chemistry, routes and observers of a model on top of it, and the simulation experiments, fits, scans, uncertainty and credibility of sbmlsim on top of those. The source code is available from https://github.com/matthiaskoenig/pkpdsim.

A model package writes one definition of what is specific to its substances: the substances with their mechanism flags, the chemistry of its organs, its choices and its PD components. The library adds the body and writes the SBML with the factory of sbmlutils, a comp model with one submodel per organ and the flat model which is simulated. The PBPK library links every component of the three layers below, and its tutorial builds such a model step by step.

The anatomical figure of the glimepiride-like model of the tutorial, generated from its definition: the male and the female build with the organs sized by their volumes, the substances of every organ, the submodels of the liver and the kidney, the routes and the blood sample. Hover an organ, a label, a substance or an icon for its details; Figures describes all figures of a model.

Background

The models of pkdb_models describe the pharmacokinetics and pharmacodynamics of a substance in the whole body, against the studies curated in PK-DB. They were written one by one, each with its own body, liver, kidney and intestine model in python with the factory of sbmlutils; they are being rebuilt from this library, and each lives in a repository of its own, which imports nothing but itself and released packages (see Migration and Release of a model repository).

The physiology

Every model is built on one physiology, scaled to the individual of a study and changed by its condition.

  • Physiology - the organs with their volumes, blood flows and blood (ICRP 89), the topology of the circulation, and everything which follows from the covariates BW, HEIGHT and AGE; species builds the same definition on the rat, the mouse or the pig.
  • Virtual populations - how an individual is drawn (sex, age, body weight, height, organ function) and how a population is simulated.
  • Impairment - liver cirrhosis, chronic kidney disease and heart failure as parameter vectors on the physiology, by the clinical classes the studies report.
  • Pregnancy, circadian rhythms and adipose tissue - the physiology over the gestational age with the fetoplacental unit, the clock time in a model, and the fat of an individual with its depots.
  • Standard organ - the four compartments every organ is built from, and the variants within its boundary: the zonated liver, the nephron kidney, the intestines.
  • Zonated liver and machine perfusion - the sinusoid of n zones with flow and diffusion, and the circuit of an ex vivo perfusion with one mounted organ.

The building blocks

On top of the physiology a model puts what is specific to its substances, and the library writes the SBML for it.

  • Substances and chemistry - the mechanism flags of a substance (binding, erythrocytes, distribution, excretion, inhibition, induction) and the processes of an organ with the proteins which carry them.
  • Intestine and routes - how a dose is applied, the lumen segments with their dissolution and absorption, the mucosa, the bile and the enterohepatic circulation.
  • Observers - what a model is read at: the arm vein, the hepatic vein, the free and the blood concentrations, the excretion rates and the observers of a definition.
  • Annotation, templates and annotations and figures - the SBO, PBPKO, UBERON, NCIT, UniProt and ChEBI terms of every created element, the creators and the terms of use of a model, and the figures generated from its definition: the anatomical figure, the schematic, the publication figure, the bodies of individuals and the pictograms of the impaired organs.
  • Parameter database - the numbers the libraries are built from, each with the publication it is taken from; initial values put a substance into every tissue at the start.

The analysis

The models are simulated, fitted and assessed with sbmlsim; these pages are its capabilities in the PBPK context.

  • Experiments and their metadata - a published study as code (its data, its dosing protocol as simulations, its fit mappings) with the shared vocabulary which describes it and the filters which select the mappings of a fit by it.
  • Scans and sensitivity analyses - the designs which run a model over many parameter values, and the sensitivity of its PK observables.
  • Uncertainty of the fitted parameters - adopted fits whose values the factory takes, their confidence intervals as distrib uncertainties of the SBML parameters, and the run of the experiments over draws of the fitted parameters with bands (run_simulation <package> --uncertainty).
  • Context of use and credibility - what a model is credible for, which evidence supports each use and when the use is accepted.
  • Models and their commands - the model object of a package, the commands which work with every model, the tests of a model as functions and the verification of a change (pkpdsim-verify).
  • Study data, timecourses in parts, licenses and the release of a model repository - the studies of PK-DB a model keeps in its own folder, a model simulated directly with roadrunner in parts, the license texts of a COMBINE archive and the complete release of the repository of a model.

Quickstart

A definition of what is specific to the substance, and the library writes the whole-body model: the organs with their volumes and blood flows, the oral route, the kidney which clears the drug and the observers it is read at. The numbers are illustrative.

from pathlib import Path
from tempfile import mkdtemp

from sbmlsim.model.model_roadrunner import load_roadrunner

from pkpdsim.pbpk import Binding, Excretion, Kp, PBPKDefinition, Route, Substance, build

# what is specific to the substance: an oral drug which the kidney clears
definition = PBPKDefinition(
    sid="drg_body",
    substances=[
        Substance(
            "drg",
            name="drug",
            mr=450.0,
            binding=Binding(fu=0.1, protein="albumin"),
            distribution=Kp(1.5, ftissue=5.0),
            excretion=Excretion(urine=True),
        )
    ],
    routes=[Route.oral("drg")],
)

# the library adds the physiology, the organs, the routes and the observers
model = build(definition, Path(mkdtemp()))

r = load_roadrunner(model.flat_path)
r.timeCourseSelections = ["time", "Carm_drg"]
r["PODOSE_drg"] = 10.0  # mg
s = r.simulate(0, 24 * 60, 1441)  # min

carm = 1000 * s["Carm_drg"]  # µM
print(f"BW {r['BW']:.0f} kg, Vli {r['Vli']:.2f} l, Qh {r['Qh']:.2f} l/min")
print(f"Cmax {carm.max():.3f} µM, C(24 h) {carm[-1]:.3f} µM")
BW 73 kg, Vli 2.33 l, Qh 1.79 l/min
Cmax 0.445 µM, C(24 h) 0.169 µM

Continue with Installation and the tutorial, which builds such a model step by step and adds what this example leaves out: the hepatic chemistry with its metabolites, the individual of a study, the impairment of an organ and the figures of the model.

How to cite

DOI

If you use pkpdsim please cite the archived software on Zenodo:

König, M. (2026). pkpdsim: building blocks of physiologically based pharmacokinetic and pharmacodynamic models in SBML (Version 0.41.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.24557395

License

Funding

Matthias König is supported by the German Research Foundation (DFG) within the Research Unit Programme FOR 5151 "QuaLiPerF (Quantifying Liver Perfusion-Function Relationship in Complex Resection - A Systems Medicine Approach)" by grant number 436883643 and by grant number 465194077 (Priority Programme SPP 2311, Subproject SimLivA).

Matthias König was supported by the Federal Ministry of Education and Research (BMBF, Germany) within the research network Systems Medicine of the Liver (LiSyM, grant number 031L0054).