This is a simple implementation of PBPK modeling in python.
Project description
pbpk-lite
pbpk-lite is a lightweight Python package for basic physiologically based pharmacokinetic (PBPK) modeling.
It provides a simple programmatic interface for defining substance properties, patient physiology, elimination kinetics, and solving the resulting ODE system.
The implementation is intended to be used with a consistent unit system based on mass units for doses and amounts, milliliters (mL) for volumes, and minutes for time. When using the model, doses, volumes, flows, and clearances should all be expressed in compatible units within that framework.
Features
- Substance partition coefficient calculation using logP and fraction unbound
- Patient blood flows and tissue volumes derived from body weight
- Linear liver and kidney elimination pathways
- ODE solution via
scipy.integrate.solve_ivp - Plotting helpers for whole-model, venous-blood, and selected-compartment concentration profiles
- Support for different administration routes, including intravenous, intra-arterial, and inhalation dosing
Installation
Install from PyPI:
pip install pbpk-lite
Quick Start
from pbpk_lite import model
m = model()
m.set_substance(log_p=6.97, fu=0.0022448)
m.set_patient(bw=70)
m.set_elimination(cl_l=748.6643482986731, cl_k=0)
# example dose: 0.053 mg/kg for a 70 kg patient, converted to ng
# dose = 0.053 * 70 * 1e3 * 1e3
dose = 0.053
doses = [dose]
times = [0, 480]
t, c = m.simulate(doses, times, route_of_administration='iv')
m.graph_whole('concentrations.png')
m.graph_venous('venous.png', limit_of_detection=0.15)
m.graph_compartments(['liver', 'kidney'], 'selected.png')
Route of Administration
The simulate() method accepts a route_of_administration argument to control where each dose is introduced into the model.
Supported values are:
iv: intravenous dosing into the venous blood compartment (default)ia: intra-arterial dosing into the arterial blood compartmentinh: inhalation dosing into the lung compartment
Example:
m.simulate([dose], [0, 24*60], route_of_administration='inh')
Dosing Schedule
The simulate() method expects:
doses: array-like of administered dosestimes: array-like of dosing times plus a final endpoint
Important: times must have exactly one more element than doses.
Each dose at index i is administered at times[i], and the final value in times is the last observation or endpoint. Times are interpreted in hours, so dosing schedules and simulation endpoints should be provided in hours.
Example with one dose:
# one dose at time 0, observation at 480 minutes
doses = [dose]
times = [0, 480]
Example with two doses:
# two identical doses spaced 480 minutes apart, with a final observation at 960 minutes
doses = [dose, dose]
times = [0, 480, 960]
API Summary
pbpk_lite.model
set_substance(log_p, fu)
Set the substance physicochemical properties.
log_p: log octanol-water partition coefficientfu: fraction unbound in blood
set_patient(bw)
Set patient physiological parameters using body weight in kilograms.
set_elimination(cl_l=0, cl_k=0)
Set linear clearance from liver and kidney compartments.
simulate(doses, times, route_of_administration='iv')
Simulate the PBPK model and return time points t and compartment concentrations c.
route_of_administration: administration route used for each dose ('iv','ia', or'inh')
graph_whole(name)
Save a multi-panel plot of concentrations across all compartments.
graph_venous(name, limit_of_detection=None)
Save a plot of venous blood concentrations, optionally marking a detection limit.
graph_compartments(compartments, name)
Save a plot of selected compartments by name or index.
License
pbpk-lite is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pbpk_lite-1.1.4.tar.gz.
File metadata
- Download URL: pbpk_lite-1.1.4.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73eb0b68adc26a087d587b3fca7965f2a0a1dd20d459bc54ef859179f6279be8
|
|
| MD5 |
4e4443545536490bd8bfd913e6654390
|
|
| BLAKE2b-256 |
c837be69ce2e643815295a9367a374c5dc43953b4aa9c5551b3dd2add2060d99
|
File details
Details for the file pbpk_lite-1.1.4-py3-none-any.whl.
File metadata
- Download URL: pbpk_lite-1.1.4-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31c3c526aa2cc47c655dd0b6ee8fa6d0be0a3ca5cad0147caec197361971a066
|
|
| MD5 |
651bbb0d0801b9fe9aaac08a25213222
|
|
| BLAKE2b-256 |
b51f0d3b8318951e838d501f0c3563b2455f8d5e703fbb24739b6ebfd0c5f676
|