Title: | Inference and Prediction of ToxicoKinetic (TK) Models |
---|---|
Description: | The MOSAICbioacc application is a turnkey package providing bioaccumulation factors (BCF/BMF/BSAF) from a toxicokinetic (TK) model fitted to accumulation-depuration data. It is designed to fulfil the requirements of regulators when examining applications for market authorization of active substances. See Ratier et al. (2021) <doi:10.1101/2021.09.08.459421>. |
Authors: | Virgile Baudrot [aut, cre], Sandrine Charles [aut], Ophélia Gestin [ctb], Miléna Kaag [aut], Christelle Lopes [ctb], Gauthier Multari [ctb], Alain Pavé [ctb], Aude Ratier [aut], Aurélie Siberchicot [ctb] |
Maintainer: | Virgile Baudrot <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1-2 |
Built: | 2024-11-25 04:58:17 UTC |
Source: | https://github.com/lbbe-software/rbioacc |
A DESCRIPTION OF THE PACKAGE
Stan Development Team (NA). RStan: the R interface to Stan. R package version NA. https://mc-stan.org
A simple implementation of to pivot_longer of tidyr
.fonte(df, names_to, values_to)
.fonte(df, names_to, values_to)
df |
A data frame to pivot. |
names_to |
A string specifying the name of the column to create from
the data stored in the column names of |
values_to |
A string specifying the name of the column to create from the data stored in cell values. |
The data frame with a "lengthens" shape: more rows, less columns
data.frame
Return column matching "expw", "exps", "expf", "exppw" of a data.frame
.index_col_exposure(data_frame)
.index_col_exposure(data_frame)
data_frame |
a dataframe |
A vector of numeric
data.frame
where X is metaboliteReturn column matching "concX" of a data.frame
where X is metabolite
.index_col_metabolite(data_frame)
.index_col_metabolite(data_frame)
data_frame |
a dataframe |
A vector of numeric
x
and y are equal after remove Inf
Check if two vectors x
and y are equal after remove Inf
.is_equal_rmInf(x, y)
.is_equal_rmInf(x, y)
x |
A vector |
y |
A vector |
A logical value
Biaccumulation metrics
bioacc_metric(fit, ...) ## S3 method for class 'fitTK' bioacc_metric(fit, type = "k", route = "all", ...)
bioacc_metric(fit, ...) ## S3 method for class 'fitTK' bioacc_metric(fit, type = "k", route = "all", ...)
fit |
An |
... |
Further arguments to be passed to generic methods |
type |
A string with the type of metric: |
route |
Provide exposure route: |
a data frame
Data on Chironomus with several exposure routes.
data(Chiro_Creuzot)
data(Chiro_Creuzot)
A dataframe with 24 observations on the following four variables:
time
A vector of class numeric
with the time points in
days.
expw
A vector of class numeric
with the exposure
in water.
expw
A vector of class numeric
with the exposure
in pore water.
replicate
A vector of class integer
for replicate
identification.
conc
A vector of class numeric
with concentration
in organism.
concm1
A vector of class numeric
with metabolite
concentration in organism.
concm2
A vector of class numeric
with metabolite
concentration in organism.
Data on Chironomus exposed to benzoapyrene
data(Chironomus_benzoapyrene)
data(Chironomus_benzoapyrene)
Correlations between parameters: colored matrix
corrMatrix(fit)
corrMatrix(fit)
fit |
An object of class |
A heatmap of class ggplot
.
Correlations between parameters: pairs plot
corrPlot(fit, plots = c("all", "deterministic", "stochastic"))
corrPlot(fit, plots = c("all", "deterministic", "stochastic"))
fit |
An object of class |
plots |
A string selecting the parameters. Defaults is |
A pairsplot of class ggmatrix
containing planes of parameter pairs (lower triangle), marginal posterior distribution of each parameter (diagonal) and Pearson correlation coefficients (upper triangle)
This is the generic ppc
S3 method for plots of the predicted
values along with 95\
versus the observed values for fitTK
objects.
df_ppc(fit, ...) ## S3 method for class 'fitTK' df_ppc(fit, ...) ppc(fit, ...) ## S3 method for class 'fitTK' ppc(fit, ...)
df_ppc(fit, ...) ## S3 method for class 'fitTK' df_ppc(fit, ...) ppc(fit, ...) ## S3 method for class 'fitTK' ppc(fit, ...)
fit |
And object returned by fitTK |
... |
Additional arguments |
The black points show the observed number of survivors (pooled
replicates, on -axis) against the corresponding predicted
number (
-axis). Predictions come along with 95\
intervals, which are depicted in green when they contain the
observed value and in red otherwise. Samples with equal observed
value are shifted on the
-axis. For that reason, the
bisecting line (y = x), is represented by steps when observed
values are low. That way we ensure green intervals do intersect the
bisecting line.
A data frame with median and 95\
a plot of class ggplot
Data frame of Posterior over Prior
Data frame of Posterior over Prior
df_PriorPost(fit, ...) ## S3 method for class 'fitTK' df_PriorPost(fit, select = "all", ...)
df_PriorPost(fit, ...) ## S3 method for class 'fitTK' df_PriorPost(fit, select = "all", ...)
fit |
An object of class |
... |
Additional arguments |
select |
A string selecting the parameters. Defaults is |
An object of class data.frame
Equations of the mathematical model used for the fit
equations(fit, object)
equations(fit, object)
fit |
An object of class |
object |
The data.frame used as the base as the fit object |
A vector of strings each containing an equation
Retrieve exposure routes names from object
exposure_names(object)
exposure_names(object)
object |
a data frame. |
A vector of string
Data on Sialis lutaria exposure time series
data(Exposure_Sialis_lutaria)
data(Exposure_Sialis_lutaria)
Posterior predictive check
Bayesian inference of TK model with Stan
Bayesian inference of TK model with variable exposure profile (BETA version)
fitTK(stanTKdata, ...) ## S3 method for class 'stanTKdataCST' fitTK(stanTKdata, ...) ## S3 method for class 'stanTKdataVAR' fitTK(stanTKdata, ...)
fitTK(stanTKdata, ...) ## S3 method for class 'stanTKdataCST' fitTK(stanTKdata, ...) ## S3 method for class 'stanTKdataVAR' fitTK(stanTKdata, ...)
stanTKdata |
List of Data require for computing |
... |
Arguments passed to |
An object of class fitTK
containing two object: stanTKdata
the data set used for inference and stanfit
returned by rstan::sampling
Data on Gammarus exposed to azoxistrobine
data(Gammarus_azoxistrobine_1d_Rosch2017)
data(Gammarus_azoxistrobine_1d_Rosch2017)
Data on Sialis lutaria internal time series
data(Internal_Sialis_lutaria)
data(Internal_Sialis_lutaria)
Gammarus fossarum
exposed to Hg spiked water.
Three exposure concentrations were tested in triplicates. The duration of the
accumulation phase is 4 days for 0.0000708021 and 0.000283208
exposure concentrations, and 7 days for 0.000141604
exposure concentration.Male Gammarus fossarum
exposed to Hg spiked water.
Three exposure concentrations were tested in triplicates. The duration of the
accumulation phase is 4 days for 0.0000708021 and 0.000283208
exposure concentrations, and 7 days for 0.000141604
exposure concentration.
data(Male_Gammarus_Merged)
data(Male_Gammarus_Merged)
A dataframe with 72 observations on the following four variables:
time
A vector of class numeric
with the time points in
days.
expw
A vector of class numeric
with Hg
exposure in water in .
replicate
A vector of class integer
for replicate
identification.
conc
A vector of class numeric
with Hg concentration
in organism in .
Ciccia, T. (2019). Accumulation et devenir du mercure chez l'espèce sentinelle Gammarus fossarum : de l'expérimentation au développement d'un modèle toxicocinétique multi-compartiments. Rapport de stage de Master 2, INRAE.
Gammarus pulex
exposed to seanine spiked water. A single exposure
concentration was tested. The duration of the accumulation phase is 1.417
days. Three metabolites were quantified. The growth of organism was included.Male Gammarus pulex
exposed to seanine spiked water. A single exposure
concentration was tested. The duration of the accumulation phase is 1.417
days. Three metabolites were quantified. The growth of organism was included.
data(Male_Gammarus_seanine_growth)
data(Male_Gammarus_seanine_growth)
A dataframe with 22 observations on the following four variables:
time
A vector of class numeric
with the time points in
days.
expw
A vector of class numeric
with seanine
exposure in water in .
replicate
A vector of class integer
for replicate
identification.
conc
A vector of class numeric
with concentration
in organism.
concm1
A vector of class numeric
with metabolite
concentration in organism.
concm2
A vector of class numeric
with metabolite
concentration in organism.
concm3
A vector of class numeric
with metabolite
concentration in organism.
growth
A vector of class numeric
with growth of the
organism.
Ashauer, R. et al. (2012). Significance of xenobiotic metabolism for bioaccumulation kinetics of organic chemicals in Gammarus pulex. Environmental Science Technology, 46: 3498-3508.
Male Gammarus fossarum exposed to Hg spiked water. A single exposure concentration was tested. The duration of the accumulation phase is 4 days.
data(Male_Gammarus_Single)
data(Male_Gammarus_Single)
A dataframe with 23 observations on the following four variables:
time
A vector of class numeric
with the time points in
days.
expw
A vector of class numeric
with Hg
exposure in water in .
replicate
A vector of class integer
for replicate
identification.
conc
A vector of class numeric
with Hg concentration
in organism in .
Ciccia, T. (2019). Accumulation et devenir du mercure chez l'espèce sentinelle Gammarus fossarum : de l'expérimentation au développement d'un modèle toxicocinétique multi-compartiments. Rapport de stage de Master 2, INRAE.
Traces of MCMC iterations
mcmcTraces(fit, plots = "all")
mcmcTraces(fit, plots = "all")
fit |
An object of class |
plots |
A string selecting the parameters. Defaults is |
A traceplot of class ggplot
.
Create a list giving data and parameters to use in the model inference.
modelData(object, ...) ## S3 method for class 'data.frame' modelData(object, time_accumulation, elimination_rate = NA, ...)
modelData(object, ...) ## S3 method for class 'data.frame' modelData(object, time_accumulation, elimination_rate = NA, ...)
object |
An object of class |
... |
Further arguments to be passed to generic methods |
time_accumulation |
A scalar givin accumulation time |
elimination_rate |
A scalar for the elimination rate. Default is |
A list
with data and parameters require for model inference.
Create a list giving data and parameters to use in the model inference.
modelData_ode( df_exposure, df_internal, y0 = 1, t0 = -0.001, unifMax = 10, time_accumulation = NULL, minK = -5, maxK = 5, ... ) modelData_ode( df_exposure, df_internal, y0 = 1, t0 = -0.001, unifMax = 10, time_accumulation = NULL, minK = -5, maxK = 5, ... )
modelData_ode( df_exposure, df_internal, y0 = 1, t0 = -0.001, unifMax = 10, time_accumulation = NULL, minK = -5, maxK = 5, ... ) modelData_ode( df_exposure, df_internal, y0 = 1, t0 = -0.001, unifMax = 10, time_accumulation = NULL, minK = -5, maxK = 5, ... )
df_exposure |
Dataframe of exposure with 2 column ( |
df_internal |
Dataframe of internal concentration with 2 column ( |
y0 |
Initial concentration |
t0 |
initial time point |
unifMax |
Hyperparameter value |
time_accumulation |
Time of accumulation |
minK |
Hyperparameter value |
maxK |
Hyperparameter value |
... |
Additional arguments |
A list
with data and parameters require for model inference.
Data on Oncorhynchus exposition
data(Oncorhynchus_two)
data(Oncorhynchus_two)
Plot exposure profile
plot_exposure(object)
plot_exposure(object)
object |
a data frame with exposure column |
a plot of class ggplot
Plot Posterior over Prior
Plot Posterior over Prior
plot_PriorPost(x, ...) ## S3 method for class 'fitTK' plot_PriorPost(x, select = "all", ...) ## S3 method for class 'df_PP' plot_PriorPost(x, select = "all", ...)
plot_PriorPost(x, ...) ## S3 method for class 'fitTK' plot_PriorPost(x, select = "all", ...) ## S3 method for class 'df_PP' plot_PriorPost(x, select = "all", ...)
x |
A data.frame of class |
... |
addition arguments |
select |
A string selecting the parameters. Defaults is |
A plot of class ggplot
.
A plot of class ggplot
.
bioaccMetric
Plot function for object of class bioaccMetric
## S3 method for class 'bioaccMetric' plot(x, ...)
## S3 method for class 'bioaccMetric' plot(x, ...)
x |
a data frame |
... |
Additional arguments |
A plot of class ggplot
fitTK
objectsThis is the generic plot
S3 method for the
fitTK
. It plots the fit obtained for each
variable in the original dataset.
## S3 method for class 'fitTK' plot(x, time_interp = NULL, ...)
## S3 method for class 'fitTK' plot(x, time_interp = NULL, ...)
x |
And object returned by fitTK |
time_interp |
A vector with additional time point to interpolate. Time point of the original data set are conserved. |
... |
Additional arguments |
a plot of class ggplot
predictTK
objectsThis is the generic plot
S3 method for the
predictTK
.
## S3 method for class 'predictTK' plot(x, ...) ## S3 method for class 'predictTKstan' plot(x, add_data = FALSE, ...)
## S3 method for class 'predictTK' plot(x, ...) ## S3 method for class 'predictTKstan' plot(x, add_data = FALSE, ...)
x |
An object of class |
... |
Additional arguments |
add_data |
logical TRUE or FALSE to add the orignal data of the fit object
|
A plot of class ggplot
fitTK
objectUse when parameter are manually given by the user.
## S3 method for class 'fitTK' predict(object, data, mcmc_size = NULL, fixed_init = TRUE, ...) predict_stan( object, data, mcmc_size = NULL, fixed_init = TRUE, time_interp = NULL, iter = 1000, ... ) predict_manual( param, data, time_accumulation = NULL, C0 = 0, G0 = NA, gmax = NA )
## S3 method for class 'fitTK' predict(object, data, mcmc_size = NULL, fixed_init = TRUE, ...) predict_stan( object, data, mcmc_size = NULL, fixed_init = TRUE, time_interp = NULL, iter = 1000, ... ) predict_manual( param, data, time_accumulation = NULL, C0 = 0, G0 = NA, gmax = NA )
object |
An object of |
data |
A data set with one column |
mcmc_size |
Size of mcmc chain if needed to be reduced |
fixed_init |
If |
... |
Additional arguments |
time_interp |
A vector with additional time point to interpolate. Time point of the original data set are conserved. |
iter |
Number of time steps |
param |
A dataframe with name of parameters |
time_accumulation |
the time of accumulation. |
C0 |
Gives the initial conditions of internal concentration. |
G0 |
initial condition of G0 (require if |
gmax |
gmax (require if |
An object of class predictTK
An object of class predictTK
Potential Scale Reduction Factors (PSRF) of the parameters
psrf(fit)
psrf(fit)
fit |
An object of class |
An object of class data.frame
with two columns: PSRF and parameter
a data frame with Potential Scale Reduction Factors
Quantiles of parameters
quantile_table(fit, probs = c(0.025, 0.5, 0.975))
quantile_table(fit, probs = c(0.025, 0.5, 0.975))
fit |
An object of class |
probs |
Scalar or Vector of quantiles. Default is 0.025, 0.5 and 0.975 giving median and 95% credible interval |
A data frame with quantiles
Replace element of a vector
replace_(x, from, to)
replace_(x, from, to)
x |
a vector |
from |
a vector of elements to replace |
to |
a vector with replacing elements |
a vector
replace_(1:10,c(2,4,5,8), c(0,0,0,0)) replace_(c(1,2,2,3,2),c(3,2), c(4,5))
replace_(1:10,c(2,4,5,8), c(0,0,0,0)) replace_(c(1,2,2,3,2),c(3,2), c(4,5))
Return the time at 95% depuration of the parent component
t95(fit)
t95(fit)
fit |
An object of class |
a numeric object
Compute WAIC using the waic()
method of the loo package.
waic(fit)
waic(fit)
fit |
An object of class |
A numeric containing the WAIC