2021 - Online - In the cloud

PAGE 2021: Methodology - New Modelling Approaches
Rikard Nordgren

Pharmpy and assemblerr - Two novel tools to simplify the model building process in NONMEM

Rikard Nordgren (1), Sebastian Ueckert (1), Stella Belin (1), Gunnar Yngman (1), Simon Carter (1), Simon Buatois (2), João A. Abrantes (2), Andrew C. Hooker (1), Mats O. Karlsson (1)

(1) Department of Pharmacy, Uppsala University, Sweden(2) Roche Pharma Research and Early Development, Roche Innovation Center Basel, Basel, Switzerland

The development of pharmacometric nonlinear mixed effect models is a complex, multi-step
process. Generally, it begins with an informed starting model, which is subsequently improved in a stepwise manner. Throughout the process, a modeler needs to master knowledge in multiple domains, including pharmacology and statistics. The technical component, i.e. how to implement and manipulate models, is an additional burden. In this work, we present two novel packages to decrease the technical hurdles in the model building process; assemblerr for the generation of models from pre-defined components, and Pharmpy for manipulating models and processing of results. Both software are designed as standalone tools but are especially powerful when used together.
assemblerr: assemblerr is an open-source R package [1] to construct pharmacometric models by
combining pre-defined model building blocks. It is intended to simplify the specification of
pharmacometric models and provides a mechanism to generate them in an automatic way. With assemblerr, models are specified using R code and then converted to a NONMEM [2] control stream.
assemblerr supports building blocks with different levels of abstraction, both high-level pharmacokinetic (PK) building blocks such as an absorption transit compartment, and low-level building blocks such as flows between compartments. This way, modelers can generate PK models with a few lines of R code but are also able to go beyond the pre-defined set of components.
Models generated with assemblerr are automatically optimized, using special ADVANs, if possible, and providing mu-referencing for parameters, if desired.
Pharmpy: Pharmpy is an open-source software package for pharmacometric modeling. It has
functionality ranging from reading and manipulating model files and datasets, to executing
workflows and collecting and presenting results. Through a plugin mechanism it is possible to
support different model languages and tools for estimation and simulation. Currently, NM-TRAN control streams and execution using NONMEM is supported.
The package can do advanced model manipulation of PK models, including changing the absorption rate, absorption delay, elimination rate and distribution. For general models, Pharmpy can add covariate effects, set variability on parameters, manipulate the covariance structure of random effects, fix parameters, update initial estimates and change the error model.
Pharmpy is intended to be useful to tool developers, pharmacometric researchers and modelers, and has different API layers to cater for the different needs of the groups. Modelers and developers can use Pharmpy in Python, and R via the pharmr package or the command line interface.
The main design principles of Pharmpy are: modularity, so that parts of the tools can be reused independently, and tool agnosticism, so that multiple model languages and tools for estimation and simulation of models can be used. At the core of Pharmpy lies its abstraction for nonlinear mixed effects models. Models are internally separated into components. The parameters, random variables, differential equations and model statements have their own classes with APIs allowing for low level manipulation. Pharmpy uses the main packages from the Python scientific stack with sympy [3] for symbolic manipulation, and pandas [4], numpy [5] and scipy [6] for numeric calculation.
In summary, with assemblerr, the user can build pharmacometric models from scratch in R environment, and with Pharmpy and pharmr the user can further extend and manipulate the models in a process that can be automated.
Assembler, Pharmpy and pharmr are freely available at
Contribution to all software packages is welcome!
Acknowledgment
This work was supported by F. Hoffmann-La Roche Ltd., Basel, Switzerland.


References:
[1] R Core Team (2020). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
[2] Bauer RJ. NONMEM Tutorial Part I: Description of Commands and Options, With Simple
Examples of Population Analysis. CPT: Pharmacometrics & Systems Pharmacology.
2019;8(8):525–37.
[3] Meurer A, Smith CP, Paprocki M, Certík O, Kirpichev SB, Rocklin M, Kumar A, Ivanov S,
Moore JK, Singh S, Rathnayake T, Vig S, Granger BE, Muller RP, Bonazzi F, Gupta H, Vats S,
Johansson F, Pedregosa F, Curry MJ, Terrel AR, Roucka Š, Saboo A, Fernando I, Kulal S, Cimrman R, Scopatz A. (2017) SymPy: symbolic computing in Python. PeerJ Computer Science
3:e103 https://doi.org/10.7717/peerj-cs.103
[4] Jeff Reback, Wes McKinney, jbrockmendel, Joris Van den Bossche, Tom Augspurger, Phillip
Cloud, ... Mortada Mehyar. (2020, March 18). pandas-dev/pandas: Pandas 1.0.3 (Version v1.0.3). Zenodo. http://doi.org/10.5281/zenodo.3715232
[5] Harris, C.R., Millman, K.J., van der Walt, S.J. et al. Array programming with NumPy
. Nature 585, 357–362 (2020). DOI: 0.1038/s41586-020-2649-2 . (Publisher link).
[6] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David
Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J.
Nelson, Eric Jones, Robert Kern, Eric Larson, CJ Carey, Ilhan Polat, Yu Feng, Eric W. Moore, Jake
VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E.A. Quintero, Charles R Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, and SciPy 1.0 Contributors. (2020) SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17(3), 261-272.


Reference: PAGE 29 (2021) Abstr 9656 [www.page-meeting.org/?abstract=9656]
Poster: Methodology - New Modelling Approaches
Click to open PDF poster/presentation (click to open)
Top