pharmsol

Crates.iopharmsol
lib.rspharmsol
version
sourcesrc
created_at2024-05-13 13:54:02.207793+00
updated_at2025-02-23 12:56:57.463939+00
descriptionRust library for solving analytic and ode-defined pharmacometric models.
homepage
repository
max_upload_size
id1238479
Cargo.toml error:TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Markus Hovd (mhovd)

documentation

https://lapkb.github.io/pharmsol/

README

pharmsol

Build Documentation crates.io

Simulate PK/PD profiles using ODE and analytical models.

Example

ODE based model.

    use pharmsol::*;

    // Subject data can be generated using the builder pattern
    let subject = Subject::builder("id1")
        .bolus(0.0, 100.0, 0)
        .repeat(2, 0.5)
        .observation(0.5, 0.1, 0)
        .observation(1.0, 0.4, 0)
        .observation(2.0, 1.0, 0)
        .observation(2.5, 1.1, 0)
        .covariate("wt", 0.0, 80.0)
        .covariate("wt", 1.0, 83.0)
        .covariate("age", 0.0, 25.0)
        .build();

    let ode = equation::ODE::new(
        |x, p, t, dx, _rateiv, cov| {
            // The following are helper functions to fetch parameters and covariates
            fetch_cov!(cov, t, _wt, _age);
            fetch_params!(p, ka, ke, _tlag, _v);

            // The ODEs are defined here
            dx[0] = -ka * x[0];
            dx[1] = ka * x[0] - ke * x[1];
        },
        |p| {
            fetch_params!(p, _ka, _ke, tlag, _v);
            lag! {0=>tlag}
        },
        |_p| fa! {},
        |_p, _t, _cov, _x| {},
        |x, p, _t, _cov, y| {
            fetch_params!(p, _ka, _ke, _tlag, v);
            // This equation specifies the output, e.g. the measured concentrations
            y[0] = x[1] / v;
        },
        (2, 1),
    );

    let op = ode.estimate_predictions(&subject, &vec![0.3, 0.5, 0.1, 70.0]);
    // println!("{op:#?}");
    let _ = op.run();

Analytic based model.

use pharmsol::*;
let analytical = equation::Analytical::new(
    one_compartment_with_absorption,
    |_p, _cov| {},
    |p| {
        fetch_params!(p, _ka, _ke, tlag, _v);
        lag! {0=>tlag}
    },
    |_p| fa! {},
    |_p, _t, _cov, _x| {},
    |x, p, _t, _cov, y| {
        fetch_params!(p, _ka, _ke, _tlag, v);
        y[0] = x[1] / v;
    },
    (2, 1),
);
let op = analytical.simulate_subject(&subject, &vec![0.3, 0.5, 0.1, 70.0]);
println!("{op:#?}");

Supported analytical models

We are working to support all the standard analytical models.

  • One-compartment with IV infusion
  • One-compartment with IV infusion and oral absorption
  • Two-compartment with IV infusion
  • Two-compartment with IV infusion and oral absorption
  • Three-compartmental models

Links

Documentation Benchmarks

Commit count: 0

cargo fmt