Package 'rbioacc'

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

Help Index


The 'rbioacc' package.

Description

A DESCRIPTION OF THE PACKAGE

References

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

Description

A simple implementation of to pivot_longer of tidyr

Usage

.fonte(df, names_to, values_to)

Arguments

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 df.

values_to

A string specifying the name of the column to create from the data stored in cell values.

Value

The data frame with a "lengthens" shape: more rows, less columns


Return column matching "expw", "exps", "expf", "exppw" of a data.frame

Description

Return column matching "expw", "exps", "expf", "exppw" of a data.frame

Usage

.index_col_exposure(data_frame)

Arguments

data_frame

a dataframe

Value

A vector of numeric


Return column matching "concX" of a data.frame where X is metabolite

Description

Return column matching "concX" of a data.frame where X is metabolite

Usage

.index_col_metabolite(data_frame)

Arguments

data_frame

a dataframe

Value

A vector of numeric


Check if two vectors x and y are equal after remove Inf

Description

Check if two vectors x and y are equal after remove Inf

Usage

.is_equal_rmInf(x, y)

Arguments

x

A vector

y

A vector

Value

A logical value


Biaccumulation metrics

Description

Biaccumulation metrics

Usage

bioacc_metric(fit, ...)

## S3 method for class 'fitTK'
bioacc_metric(fit, type = "k", route = "all", ...)

Arguments

fit

An stanFit object

...

Further arguments to be passed to generic methods

type

A string with the type of metric: k for the kinetics BioConcentration Factor, ss for the steady state BioConcentration Factor.

route

Provide exposure route: all

Value

a data frame


Data on Chironomus with several exposure routes.

Description

Data on Chironomus with several exposure routes.

Usage

data(Chiro_Creuzot)

Format

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

Description

Data on Chironomus exposed to benzoapyrene

Usage

data(Chironomus_benzoapyrene)

Correlations between parameters: colored matrix

Description

Correlations between parameters: colored matrix

Usage

corrMatrix(fit)

Arguments

fit

An object of class fitTK

Value

A heatmap of class ggplot.


Correlations between parameters: pairs plot

Description

Correlations between parameters: pairs plot

Usage

corrPlot(fit, plots = c("all", "deterministic", "stochastic"))

Arguments

fit

An object of class fitTK

plots

A string selecting the parameters. Defaults is "all" and select all parameters. Deterministc parameters can be selected by setting "deterministic" and stochastic parameter with "stochastic"

Value

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)


PPC data.frame

Description

This is the generic ppc S3 method for plots of the predicted values along with 95\ versus the observed values for fitTK objects.

Usage

df_ppc(fit, ...)

## S3 method for class 'fitTK'
df_ppc(fit, ...)

ppc(fit, ...)

## S3 method for class 'fitTK'
ppc(fit, ...)

Arguments

fit

And object returned by fitTK

...

Additional arguments

Details

The black points show the observed number of survivors (pooled replicates, on XX-axis) against the corresponding predicted number (YY-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 XX-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.

Value

A data frame with median and 95\

a plot of class ggplot


Data frame of Posterior over Prior

Description

Data frame of Posterior over Prior

Data frame of Posterior over Prior

Usage

df_PriorPost(fit, ...)

## S3 method for class 'fitTK'
df_PriorPost(fit, select = "all", ...)

Arguments

fit

An object of class fitTK returned by the function fitTK().

...

Additional arguments

select

A string selecting the parameters. Defaults is "all" and select all parameters.Deterministc parameters can be selected by setting "deterministic" and stochastic parameter with "stochastic"

Value

An object of class data.frame


Equations of the mathematical model used for the fit

Description

Equations of the mathematical model used for the fit

Usage

equations(fit, object)

Arguments

fit

An object of class fitTK

object

The data.frame used as the base as the fit object

Value

A vector of strings each containing an equation


Retrieve exposure routes names from object

Description

Retrieve exposure routes names from object

Usage

exposure_names(object)

Arguments

object

a data frame.

Value

A vector of string


Data on Sialis lutaria exposure time series

Description

Data on Sialis lutaria exposure time series

Usage

data(Exposure_Sialis_lutaria)

Posterior predictive check

Description

Posterior predictive check

Bayesian inference of TK model with Stan

Bayesian inference of TK model with variable exposure profile (BETA version)

Usage

fitTK(stanTKdata, ...)

## S3 method for class 'stanTKdataCST'
fitTK(stanTKdata, ...)

## S3 method for class 'stanTKdataVAR'
fitTK(stanTKdata, ...)

Arguments

stanTKdata

List of Data require for computing

...

Arguments passed to rstan::sampling (e.g. iter, chains).

Value

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

Description

Data on Gammarus exposed to azoxistrobine

Usage

data(Gammarus_azoxistrobine_1d_Rosch2017)

Data on Sialis lutaria internal time series

Description

Data on Sialis lutaria internal time series

Usage

data(Internal_Sialis_lutaria)

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 μg.mL1\mu g.m L^{-1} exposure concentrations, and 7 days for 0.000141604 μg.mL1\mu g.m L^{-1} exposure concentration.

Description

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 μg.mL1\mu g.m L^{-1} exposure concentrations, and 7 days for 0.000141604 μg.mL1\mu g.m L^{-1} exposure concentration.

Usage

data(Male_Gammarus_Merged)

Format

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 μg.mL1\mu g.m L^{-1}.

replicate

A vector of class integer for replicate identification.

conc

A vector of class numeric with Hg concentration in organism in μg.mL1\mu g.m L^{-1}.

References

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.


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.

Description

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.

Usage

data(Male_Gammarus_seanine_growth)

Format

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 μg.mL1\mu g.m L^{-1}.

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.

References

Ashauer, R. et al. (2012). Significance of xenobiotic metabolism for bioaccumulation kinetics of organic chemicals in Gammarus pulex. Environmental Science Technology, 46: 3498-3508.


Bio-accumulation data set for Gammarus fossarum exposed to Hg spiked water.

Description

Male Gammarus fossarum exposed to Hg spiked water. A single exposure concentration was tested. The duration of the accumulation phase is 4 days.

Usage

data(Male_Gammarus_Single)

Format

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 μg.mL1\mu g.m L^{-1}.

replicate

A vector of class integer for replicate identification.

conc

A vector of class numeric with Hg concentration in organism in μg.mL1\mu g.m L^{-1}.

References

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

Description

Traces of MCMC iterations

Usage

mcmcTraces(fit, plots = "all")

Arguments

fit

An object of class fitTK

plots

A string selecting the parameters. Defaults is "all" and select all parameters. Deterministc parameters can be selected by setting "deterministic" and stochastic parameter with "stochastic"

Value

A traceplot of class ggplot.


Create a list giving data and parameters to use in the model inference.

Description

Create a list giving data and parameters to use in the model inference.

Usage

modelData(object, ...)

## S3 method for class 'data.frame'
modelData(object, time_accumulation, elimination_rate = NA, ...)

Arguments

object

An object of class data.frame

...

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 NA. To remove elimination rate, set elimination_rate = 0.

Value

A list with data and parameters require for model inference.


Create a list giving data and parameters to use in the model inference.

Description

Create a list giving data and parameters to use in the model inference.

Usage

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,
  ...
)

Arguments

df_exposure

Dataframe of exposure with 2 column (time and value)

df_internal

Dataframe of internal concentration with 2 column (time and value)

y0

Initial concentration

t0

initial time point

unifMax

Hyperparameter value

time_accumulation

Time of accumulation

minK

Hyperparameter value

maxK

Hyperparameter value

...

Additional arguments

Value

A list with data and parameters require for model inference.


Data on Oncorhynchus exposition

Description

Data on Oncorhynchus exposition

Usage

data(Oncorhynchus_two)

Plot exposure profile

Description

Plot exposure profile

Usage

plot_exposure(object)

Arguments

object

a data frame with exposure column

Value

a plot of class ggplot


Plot Posterior over Prior

Description

Plot Posterior over Prior

Plot Posterior over Prior

Usage

plot_PriorPost(x, ...)

## S3 method for class 'fitTK'
plot_PriorPost(x, select = "all", ...)

## S3 method for class 'df_PP'
plot_PriorPost(x, select = "all", ...)

Arguments

x

A data.frame of class df_PP returned by the function df_PriorPost().

...

addition arguments

select

A string selecting the parameters. Defaults is "all" and select all parameters. Deterministic parameters can be selected by setting "deterministic" and stochastic parameter with "stochastic".

Value

A plot of class ggplot.

A plot of class ggplot.


Plot function for object of class bioaccMetric

Description

Plot function for object of class bioaccMetric

Usage

## S3 method for class 'bioaccMetric'
plot(x, ...)

Arguments

x

a data frame

...

Additional arguments

Value

A plot of class ggplot


Plotting method for fitTK objects

Description

This is the generic plot S3 method for the fitTK. It plots the fit obtained for each variable in the original dataset.

Usage

## S3 method for class 'fitTK'
plot(x, time_interp = NULL, ...)

Arguments

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

Value

a plot of class ggplot


Plotting method for predictTK objects

Description

This is the generic plot S3 method for the predictTK.

Usage

## S3 method for class 'predictTK'
plot(x, ...)

## S3 method for class 'predictTKstan'
plot(x, add_data = FALSE, ...)

Arguments

x

An object of class predictTK returned by predict

...

Additional arguments

add_data

logical TRUE or FALSE to add the orignal data of the fit object x

Value

A plot of class ggplot


Prediction function using fitTK object

Description

Use when parameter are manually given by the user.

Usage

## 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
)

Arguments

object

An object of stanfit

data

A data set with one column time and 1 to 4 exposure

mcmc_size

Size of mcmc chain if needed to be reduced

fixed_init

If TRUE fix the initial conditions of internal concentration. columns with name in expw, exps, expf and exppw

...

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 kee, keg, ku1, ku2, ..., km1, km2, ... and kem1, kem2, ..., sigmaConc, sigmaCmet (if metabolites) and sigmaGrowth (if growth). The parameter kee is mandatory.

time_accumulation

the time of accumulation.

C0

Gives the initial conditions of internal concentration.

G0

initial condition of G0 (require if keg is provided)

gmax

gmax (require if keg is provided) columns with name in expw, exps, expf and exppw

Value

An object of class predictTK

An object of class predictTK


Potential Scale Reduction Factors (PSRF) of the parameters

Description

Potential Scale Reduction Factors (PSRF) of the parameters

Usage

psrf(fit)

Arguments

fit

An object of class fitTK

Value

An object of class data.frame with two columns: PSRF and parameter

a data frame with Potential Scale Reduction Factors


Quantiles of parameters

Description

Quantiles of parameters

Usage

quantile_table(fit, probs = c(0.025, 0.5, 0.975))

Arguments

fit

An object of class fitTK

probs

Scalar or Vector of quantiles. Default is 0.025, 0.5 and 0.975 giving median and 95% credible interval

Value

A data frame with quantiles


Replace element of a vector

Description

Replace element of a vector

Usage

replace_(x, from, to)

Arguments

x

a vector

from

a vector of elements to replace

to

a vector with replacing elements

Value

a vector

Examples

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

Description

Return the time at 95% depuration of the parent component

Usage

t95(fit)

Arguments

fit

An object of class fitTK

Value

a numeric object


Widely Applicable Information Criterion (WAIC)

Description

Compute WAIC using the waic() method of the loo package.

Usage

waic(fit)

Arguments

fit

An object of class fitTK

Value

A numeric containing the WAIC