1) Introduction to HTTK"

Please send questions to breen.miyuki@epa.gov

Set vignette options

R package knitr generates html and PDF documents from this RMarkdown file, Each bit of code that follows is known as a "chunk". We start by telling knitr how we want our chunks to look.

knitr::opts_chunk$set(echo = TRUE, fig.width=5, fig.height=4)


R package httk provides pre-made, chemical independent ("generic") models and chemical-specific data for chemical toxicokinetics ("TK") and in vitro-in vivo extrapolation ("IVIVE") in bioinformatics, as described by Pearce et al. (2017). Chemical-specific in vitro data have been obtained from relatively high-throughput experiments. Both physiologically-based ("PBTK") and empirical (for example, one compartment) "TK" models can be parameterized with the data provided for thousands of chemicals, multiple exposure routes, and various species. The models consist of systems of ordinary differential equations which are solved using compiled (C-based) code for speed. A Monte Carlo sampler is included, which allows for simulating human biological variability (Ring et al., 2017) and propagating parameter uncertainty (Wambaugh et al., 2019). Calibrated methods are included for predicting tissue:plasma partition coefficients and volume of distribution (Pearce et al., 2017). These functions and data provide a set of tools for IVIVE of high-throughput screening data (for example, Tox21, ToxCast) to real-world exposures via reverse dosimetry (also known as "RTK") (Wetmore et al., 2015).


Chemicals can be identified using name, CAS, or DTXSID (that is, a substance identifier for the Distributed Structure- Searchable Toxicity (DSSTox) database. Available chemical- specific information includes logP, MW, pKa, intrinsic clearance, partitioning. Calculations can be performed to derive chemical properties, TK parameters, or IVIVE values. Functions are also available to perform forward dosimetry using the various models. As functions are typed at the RStudio command line, available arguments are displayed, with additional help available through the "?" operator. Vignettes for the various available packages in httk are provided to give an overview of their respective capabilities. The aim of httk is to provide a readily accessible platform for working with HTTK models.

This material is from Breen et al. (2021) "High-throughput PBTK models for in vitro to in vivo extrapolation"

Getting Started

For an introduction to R, see Irizarry (2022) "Introduction to Data Science": http://rafalab.dfci.harvard.edu/dsbook/getting-started.html

For an introduction to toxicokinetics, with examples in "httk", see Ring (2021) in the "TAME Toolkit": https://uncsrp.github.io/Data-Analysis-Training-Modules/toxicokinetic-modeling.html


Installing R package "httk"


“Write Privileges” On Your Personal Computer.

 Depending on the account you are using and where you want to install the package on that computer, you may need “permission” from your local file system to install the package. See this help here:


and here:


Delete all objects from memory:

It is a bad idea to let variables and other information from previous R sessions float around, so we first remove everything in the R memory.


Load the HTTK data, models, and functions


# Check what version you are using 

Control run speed

Portions of this vignette use Monte Carlo sampling to simulate variability and propagate uncertainty. The more samples that are used, the more stable the results are (that is, the less likely they are to change if a different random sequence is used). However, the more samples that are used, the longer it takes to run. So, to speed up how fast these examples run, we specify here that we only want to use 25 samples, even though the actual httk default is 1000. Increase this number to get more stable (and accurate) results:

NSAMP <- 25

Suppressing Messages

Note that since in vitro-in vivo extrapolation (IVIVE) is built upon many, many assumptions, httk* attempts to give many warning messages by default. These messages do not usually mean something is wrong, but are rather intended to make the user aware of the assumptions involved. However, they quickly grow annoying and can be turned off with the "suppress.messages=TRUE" argument. Proceed with caution...

css <- calc_analytic_css(chem.name = "Bisphenol A",
                  suppress.messages = FALSE)

css <- calc_analytic_css(chem.name = "Bisphenol A",
                  suppress.messages = TRUE)


head(get_cheminfo(suppress.messages = TRUE))

Remove the head() function to get the full table

get_cheminfo(suppress.messages = TRUE)

Note that we use the R built-in function head() to show only the first five rows

head(get_cheminfo(info = "all", median.only=TRUE,suppress.messages = TRUE))
"80-05-7" %in% get_cheminfo(suppress.messages = TRUE)
subset(get_cheminfo(info = "all",suppress.messages = TRUE), 
       Compound %in% c("A","B","C"))
                   chem.cas = "34256-82-1",
                   species = "human",
                   samples = NSAMP,
                   suppress.messages = TRUE)
                   chem.cas = "99-71-8", 
                   species = "human",
                   samples = NSAMP,
                   suppress.messages = TRUE)
calc_tkstats(chem.cas = "34256-82-1",
             species = "rat",
             suppress.messages = TRUE)
calc_tkstats(chem.cas = "962-58-3", 
             species = "rat",
             suppress.messages = TRUE)

Note that we use the R built-in function head() to show only the first five rows

head(solve_pbtk(chem.name = "bisphenol a", 
                plots = TRUE,
                days = 1,
                suppress.messages = TRUE))
my_data <- subset(get_cheminfo(info = "all",suppress.messages = TRUE), 
                  Compound %in% c("A","B","C"))
write.csv(my_data, file = "my_data.csv")

Mean and Median Fraction Unbound in Plasma

Create a data.frame with all the Fup values, we ask for model="schmitt" since that model only needs fup, we ask for "median.only" because we don't care about uncertainty intervals here:

fup.tab <- get_cheminfo(info="all",
                        suppress.messages = TRUE)

Calculate the median, making sure to convert to numeric values:


Calculate the mean:


Count how many non-NA values we have (should be the same as the number of rows in the table but just in case we ask for non NA values:


User Notes


help(package = httk)
vignette(package = "httk")

Try the httk package in your browser

Any scripts or data that you put into this service are public.

httk documentation built on June 22, 2024, 6:48 p.m.