2022 - Ljubljana - Slovenia

PAGE 2022: Methodology - Other topics
Nicolas Luyckx

Campsis: A generic, easy-to-use and intuitive PK/PD simulation platform based on R packages RxODE and mrgsolve

Nicolas Luyckx, Andreas Lindauer, Erno Van Schaick, Emilie Hénin, Stéphanie Blaizot, Pierre-Alexandre Noguine, Christian Laveille

Calvagone, France

Introduction: Campsis (www.campsis.org) is an open source PK/PD simulation suite running R, freely available on CRAN [1] and GitHub [2], designed to facilitate the simulation of population PK/PD models, and by extension, the simulation of clinical endpoints. The suite comprises two R packages campsismod and campsis. While the former package is dedicated to the manipulation of the pharmacometric model, the latter is responsible for running the simulation with RxODE [3] or mrgsolve [4] at the user’s choice, for given model, dataset and simulation settings.

Objectives:

  • Create an Application Programming Interface (API) to work with pharmacometric models. This API allows the pharmacometrician to read/write a model from/to files, to manipulate it further in R and to export it to either RxODE or mrgsolve.
  • Create an API to work with pharmacometric datasets. While traditional datasets in pharmacometrics are often stored in the form of tabular data, the dataset format proposed in Campsis is more elaborated and implemented as a structured object. This object encapsulates the whole dataset by defining a series of independent layers: such as treatment arms, dosing information, observations, occasions, inter-occasion variability (IOV), covariates, interruption events, etc. This approach offers great flexibility and easy handling of the data. Once the dataset is assembled, it can be exported to RxODE, mrgsolve or even NONMEM [5] through the API.
  • Build an abstraction layer on top of RxODE and mrgsolve, and consequently reduce the burden of setting-up a simulation. A simulation, in its shorter form, only comprises a Campsis model and a Campsis dataset. The simulation output, in its simplest form, is a data frame with all observations over time. More advanced simulation settings include, among others: scenarios, study replication, interruption events, seed management and output post-processing.

Methods:

To achieve the objectives, the S4 object system provided in R was intensively used. This object system is relatively close to other object-oriented programming languages (like Java, C++/C#, Python) and allows in particular to define classes, inheritance and generic functions, which are the building blocks to design complex software.

An example of a class is the class ‘protocol’. The Campsis dataset may contain as many treatment arms as needed by the trial. Each arm is assigned a distinct protocol which contains two fields:

  • Treatment: an object encapsulating the dosing information, which comprises a list of treatment entries, each entry being either a bolus or an infusion.
  • Observations: an object encapsulating the observations.

For instance, infusing 10 mg QD to a 10-subject arm for 3 days at a rate of 3 mg/hour and observing every 6 hours is coded as follows:

arm <- Arm(subjects=10) %>%

  add(Infusion(time=0, amount=10, rate=3, ii=24, addl=2)) %>%

  add(Observations(times=seq(0, 3*24, by=6)))

The above script creates a treatment arm which can be modified further, e.g., by adding covariates, occasions, IOV, and can be added to the Campsis dataset, which may include additional arms. This dataset, together with the Campsis model, can be simulated using the user’s preferred engine. The process of exporting the model and the dataset to RxODE or mrgsolve is made invisible to the user.

Results:

The two packages campsismod and campsis were initially created on GitHub early 2021 and developed for about 1 year. They were released on CRAN for the first time in February 2022.

These packages come with extensive and reproducible documentation [2] to facilitate self-learning.

Both packages are extensively tested and currently show code coverage of respectively 86% [6] and 90% [7], meaning much of the source code is executed during test runs. Most simulation tests are executed twice, with RxODE and mrgsolve, and are compared to reference results, ensuring both engines provide identical results.

Conclusion:

Campsis provides a useful abstraction layer over the underlying processes of writing a model, assembling a dataset and running a simulation with RxODE or mrgsolve, and therefore offers the pharmacometric community an interesting platform for running model-based simulations.

In addition, as the suite runs R, the simulation scripts can be integrated into an R workflow (R script, Rmarkdown, Shiny application, etc.).

The Campsis suite, being open source, is designed to be further extended and to benefit from community-driven contribution. Any input is welcome.



References:
[1] https://cran.r-project.org/web/packages/campsis/index.html
[2] https://calvagone.github.io/
[3] https://github.com/nlmixrdevelopment/RxODE
[4] https://github.com/metrumresearchgroup/mrgsolve
[5] https://www.iconplc.com/innovation/nonmem/
[6] https://app.codecov.io/gh/Calvagone/campsismod
[7] https://app.codecov.io/gh/Calvagone/campsis


Reference: PAGE 30 (2022) Abstr 9991 [www.page-meeting.org/?abstract=9991]
Poster: Methodology - Other topics
Click to open PDF poster/presentation (click to open)
Top