Inference and Prediction of Generic Physiologically-Based Kinetic Models

Fit and simulate any kind of physiologically-based kinetic ('PBK') models whatever the number of compartments. Moreover, it allows to account for any link between pairs of compartments, as well as any link of each of the compartments with the external medium. Such generic PBK models have today applications in pharmacology (PBPK models) to describe drug effects, in toxicology and ecotoxicology (PBTK models) to describe chemical substance effects. In case of exposure to a parent compound (drug or chemical) the 'rPBK' package allows to consider metabolites, whatever their number and their phase (I, II, ...). Last but not least, package 'rPBK' can also be used for dynamic flux balance analysis (dFBA) to deal with metabolic networks. See also Charles et al. (2022) .


rPBK

An R package for the inference of physiologically-based toxicokinetics model

Dev R

Package skeleton

library("rstantools")
rstan_create_package(path = 'rPBK')

See further information here rstantools

Dev info

Use this to add a new dependency

usethis::use_package("ggplot2")
usethis::use_package("testthat")

Additional dependencies used in the Vignette

usethis::use_package("loo", "Suggests")

Use this to add a data to be used in the package

usethis::use_data(dataCompartment4)
usethis::use_data(dataMaleGammarusSingle)

Use this to add a test function. ADD A TEST FILE TO EVERY NEW R FILE!

usethis::use_test("data.R")
usethis::use_test("dataPBK.R")
usethis::use_test("fitPBK.R")
usethis::use_test("plotFIT.R")
usethis::use_test("plotPPC.R")
usethis::use_test("predictPBK.R")

Add vignette

usethis::use_vignette("Examples")

remove files from building

usethis::use_build_ignore("[.]so", escape = FALSE)
usethis::use_build_ignore("[.]o", escape = FALSE)

Rstudio

Before 'Documentation' and 'Clear and Rebuild' and within 'Configure Build Tools...' untick 'use devtools package function if available'. Keep 'Generate Configuration with Roxygen'

little hack

  • to load all internal function of a package during dev: devtools::load_all()

A lighter package build

To make the package lighter, we have to remove the vignettes: see file .Rbuildignore

Error to recompile during package dev

Sometimes, there is an Error to recompile during development after change of .stan files. A solution is to remove the rPBK folder in R repository of the win-library (see the path written in the error message).

An other solution is to build the package from the terminal using R CMD -preclean INSTALL rPBK from parent directory of rPBK.

Dev tools

Dev In Docker

Roxygen for the documentation

example(source) # defines the sourceDir() function
try(roxygen2::roxygenize(load_code = sourceDir), silent = TRUE)
roxygen2::roxygenize()

Build

pkgbuild::compile_dll() # to preform a fake R CMD install
roxygen2::roxygenize() # to update the documentation
devtools::install() 

Test and Check the package

devtools::test() 
devtools::check() 

then to build the package:

 devtools::build() 

If the archive produce (rPBK_X.Y.Z.tar.gz) is in the workspace of the container (outside RPBK), then move the archive:

mv rPBK_X.Y.Z.tar.gz rPBK

Check as CRAN

R CMD check --as-cran

or from command line, but not working very well to be send to CRAN:

R CMD INSTALL --preclean --no-configure --build .
R CMD INSTALL --preclean --build .

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rPBK")

0.2.5 by Virgile Baudrot, a year ago


https://gitlab.in2p3.fr/mosaic-software/rPBK/


Report a bug at https://gitlab.in2p3.fr/mosaic-software/rPBK/-/issues


Browse source code at https://github.com/cran/rPBK


Authors: Virgile Baudrot [aut, cre] , Sandrine Charles [aut] , Christelle Lopes [aut] , Ophélia Gestin [ctb] , Dominique Lamonica [ctb] , Aurélie Siberchicot [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports ggplot2, methods, Rcpp, rstan, rstantools

Suggests knitr, loo, rmarkdown, testthat

Linking to BH, Rcpp, RcppEigen, RcppParallel, rstan, StanHeaders

System requirements: GNU make


See at CRAN