Learn R Programming

invitroTKstats

Welcome to the GitHub repository for the invitroTKstats package

The invitroTKstats R package contains functions to run a standardized data pipeline for processing high-throughput toxicokinetic (HTTK) mass-spectrometry data obtained from a variety of in vitro assays. The pipeline includes standardization for data documentation, statistical analyses predicting toxicokinetic parameters characterizing absorption, distribution, metabolism, and elimination of chemicals by the body.

The assays covered by the pipeline include intrinsic clearance after hepatocyte incubation ($Cl_{int}$); two variants of plasma protein binding experiments ($f_{up}$) – namely Rapid Equilibrium Dialysis (RED) and Ultracentrifugation (UC), CACO-2 membrane permeability, and blood to plasma concentration ratio. Analysis methods include a frequentist point estimation and, in some cases, Bayesian estimations for the distribution of likely parameter values. Data used to derive the estimates are based on mass spectrometry ratios of analyte peak areas to internal standard (ISTD) peak areas.

If you are interested in contributing or want to report a bug, please submit an issue or start a discussion.

Additional background information on dosimetry and use of these estimates may be found here.

Dependencies

  • Users will need the freely available R statistical computing language.
  • Users will need the freely available “Just Another Gibbs Sampler” (JAGS).
    • JAGS is a software used for conducting Bayesian hierarchical modeling using Markov Chain Monte Carlo (MCMC) simulation.
    • This software can be downloaded via https://sourceforge.net/projects/mcmc-jags/files/ and installed using the prompts.
    • Users should note that this installation will likely be found in a system location (e.g. “Program Files”) - thus users should ensure to identify the installation location, which is necessary when utilizing the software within R.
  • Users will need to have the following R packages installed in addition to invitroTKstats:
    • ggplot2
    • parallel
    • runjags
    • stats4
  • Users will likely want a development environment like RStudio.

Installation

  • Installing the current version of the package from GitHub, run the following command in the R console:
devtools::install_github("https://github.com/USEPA/invitroTKstats")
  • Installing a local clone of the GitHub repo:

    1. Go to the GitHub repo for invitroTKstats.
    2. Choose the “Code” button and copy the repo URL.
    3. In your local command line terminal, navigate to the directory location you wish to store your local copy of the repo.
    4. In your terminal type git clone https://github.com/USEPA/invitroTKstats.
    5. After cloning completes then open an R session.
    6. In the R console use the following commands:
devtools::install_local(
  "<file_path_to_invitroTKstats_repo>/invitroTKstats"
)
  • Installing a tarball version of the package:

    1. Save the tarball file “invitroTKstats_X.Y.Z.tar.gz” to a local directory location.
    2. Install the package via the RStudio provided ‘Install Packages’ menu under the ‘Tools’ tab, or using the command line terminal with the following:
R CMD INSTALL <file_path_to_invitroTKstats_tarball>/invitroTKstats_X.Y.Z.tar.gz

NOTE: “X.Y.Z” in the tarball filename indicates the version number associated with the version of the package you wish to install.

Loading the Package

To load the invitroTKstats R package into your local R session via the R console:

library(invitroTKstats)

Check the package version installed and in use:

packageVersion(invitroTKstats)

Unprocessed Data

A subset of raw experimental data files are provided as part of the R package for demonstration purposes in the “Data Guide Creation and Level-0 Data Compilation” vignette. These data files were originally published as part of Kreutz et al. (2023). Details about these files can be found in the README file under the “inst/extdata/Kreutz-Clint” sub-directory, as well as a separate data processing GitHub repository invitrotkstats_dataproc under “working/KreutzPFAS”.

Contributors

  • Caroline Ring (Lead Package Developer & Maintainer)
  • Barbara A. Wetmore (Raw Data Generation & Subject Matter Expert)
  • Sarah E. Davidson-Fritz (Conceptualization & Software Development)
  • John Wambaugh (Package Creator, Conceptualization, Data Processing, & Subject Matter Expert)
  • Lindsay Knupp (Software Development)
  • Nicolas Chantel (Initial Bayesian Model Development for $f_{up}$ RED assay)
  • Zhihui Zhao (Software Development)
  • Anna Kreutz (Raw Data Generation & Subject Matter Expert)

Disclaimer

The United States Environmental Protection Agency (EPA) GitHub project code is provided on an “as is” basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.

Copy Link

Version

Install

install.packages('invitroTKstats')

Monthly Downloads

254

Version

0.0.14

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Caroline Ring

Last Published

January 26th, 2026

Functions in invitroTKstats (0.0.14)

calc_fup_red_point

Calculate Point Estimates of Fraction Unbound in Plasma (Fup) with Rapid Equilibrium Dialysis (RED) Data (Level-3)
calc_fup_uc

Calculate Fraction Unbound in Plasma (Fup) from Ultracentrifugation (UC) Data with Bayesian Modeling (Level-4)
check_catalog

Function to Check Level 0 Data Catalog
calc_fup_uc_point

Calculate Point Estimates of Fraction Unbound in Plasma (Fup) with Ultracentrifugation (UC) Data (Level-3)
clint_L0

Clint Level-0 Example Data set
clint_L2

Clint Level-2 Example Data set
clint_L2_heldout

Clint Level-2 Heldout Example Data set
calc_caco2_point

Calculate a Point Estimate of Apparent Membrane Permeability (Papp) from Caco-2 data (Level-3)
create_catalog

Function to create a catalog of level 0 files to be merged.
create_chem_table

Creates a Standardized Data Table of Chemical Identities
format_fup_red

Creates a Standardized Data Frame with Rapid Equilibrium Dialysis (RED) Plasma Protein Binding (PPB) Data (Level-1)
format_clint

Creates a Standardized Data Frame with Hepatocyte Clearance Data (Level-1)
clint_L1

Clint Level-1 Example Data set
calc_clint

Calculate Intrinsic Hepatic Clearance (Clint) with Bayesian Modeling (Level-4)
.check_std_colnames_in_data

Check the standard column names are in the data.
clint_L4

Clint Level-4 Example Data set
.check_num_cols

Check the numeric columns are correctly of numeric class.
clint_L3

Clint Level-3 Example Data set
clint_PREJAGS

Clint Level-4 PREJAGS arguments
clint_cheminfo

Clint Chemical Information Example Data set
fup_uc_L1

Fup UC Level-1 Example Data set
fup_uc_L2

Fup UC Level-2 Example Data set
fup_uc_L2_heldout

Fup UC Level-2 Heldout Example Data set
extract_level1_fup_uc

Extract level 1 ultracentrifugation redgrave1975separationinvitroTKstats data from wide level 0 file
fup_red_L2

Fup RED Level-2 Example Data set
format_caco2

Creates a Standardized Data Frame with Caco-2 Data (Level-1)
fup_red_cheminfo

Fup RED Chemical Information Example Data set
fup_uc_L0

Fup UC Level-0 Example Data set
fup_red_L1

Fup RED Level-1 Example Data set
merge_level0

Merge Multiple Level-0 files into a Single Table for Processing
fup_uc_L3

Fup UC Level-3 Example Data set
plot_clint

Plot Mass Spectrometry Responses from Measurements of Intrinsic Hepatic Clearance
fup_uc_cheminfo

Fup UC Chemical Information Example Data set
calc_fup_red

Calculate Fraction Unbound in Plasma (Fup) from Rapid Equilibrium Dialysis (RED) Data with Bayesian Modeling (Level-4)
calc_clint_point

Calculate a Point Estimate of Intrinsic Hepatic Clearance (Clint) (Level-3)
create_method_table

Creates a Standardized Data Table for Chemical Analysis Methods
.check_all_miss_cols

Check if all the data is missing for specified columns.
.check_no_miss_cols

Check there is no missing data for specified columns.
.check_char_cols

Check the character columns are correctly of character class.
fup_red_L4

Fup RED Level-4 Example Data set
scientific_10

Formatting function for X-axis in log10-scale
std.catcols

Standard Data Catalog (Data Guide) Columns
format_fup_uc

Creates a Standardized Data Frame with Ultracentrifugation (UC) Plasma Protein Binding (PPB) Data (Level-1)
fup_red_L0

Fup RED Level-0 Example Data set
fup_red_L2_heldout

Fup RED Level-2 Heldout Example Data set
initfunction_clint

Set Initial Values for Intrinsic Hepatic Clearance (Clint) Bayesian Model
fup_red_PREJAGS

Fup RED Level-4 PREJAGS arguments
initfunction_fup_red

Set Initial Values for Fup RED Bayesian Model
initfunction_fup_uc

Set Initial Values for Fup UC Bayesian Model
sample_verification

Add Sample Verification Column (Level-2)
runjagsdata.to.list

Convert a runjags-class object to a list
fup_uc_PREJAGS

Fup UC Level-4 PREJAGS arguments
summarize_table

Creates a Summary Table of Mass-Spectrometry (MS) Data
fup_uc_L4

Fup UC Level-4 Example Data set
fup_red_L3

Fup RED Level-3 Example Data set
plot_fup_uc

Plot Mass Spectrometry Responses for Fraction Unbound in Plasma Data from Ultracentrifugation (UC)
round_output

Round Numeric Data (Any Level and Assay)
build_mydata_fup_red

Build Data Object for Fup RED Bayesian Model
caco2_L3

Caco-2 Level-3 Example Data set
build_mydata_clint

Build Data Object for Intrinsic Hepatic Clearance (Clint) Bayesian Model
Heaviside

Heaviside
build_mydata_fup_uc

Build Data Object for Fup UC Bayesian Model
caco2_L0

Caco-2 Level-0 Example Data set
caco2_cheminfo

Caco-2 Chemical Information Example Data set
caco2_L2

Caco-2 Level-2 Example Data set
caco2_L1

Caco-2 Level-1 Example Data set
L1.common.col

Common Columns in Level-1