# 1) Introduction to HTTK

#### Miyuki Breen, Anna Kreutz, and John Wambaugh

#### June 15, 2021

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)

## Description

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

## Introduction

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

### Dependencies

- Users will need the freely available R statistical computing language: https://www.r-project.org/
- Users will likely want a development environment like RStudio: https://posit.co/download/rstudio-desktop/
- If you get the message “Error in library(X) : there is no package called ‘X’” then you will need to install that package: From the R command prompt: install.packages(“X”) Or, if using RStudio, look for ‘Install Packages’ under the ‘Tools’ tab.
- Note that R does not recognize fancy versions of quotation marks that curve toward each other. If you are cutting and pasting from software like Word or Outlook you may need to replace the quotation marks that curve toward each other with ones typed by the keyboard.

### Installing R package “httk”

    install.packages("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:

    <https://stackoverflow.com/questions/42807247/installing-package-cannot-open-file-permission-denied>

    and here:

    <https://support.microsoft.com/en-us/topic/general-problem-installing-any-r-package-0bf1f9ba-ead2-6335-46ec-190f6af75e44>

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

    rm(list=ls())

### Load the HTTK data, models, and functions

    library(httk)

    # Check what version you are using
    packageVersion("httk")

    ## [1] '2.6.1'

### 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 5 samples, even though the actual httk default is 1000. Increase this number to get more stable (and accurate) results:

    NSAMP <- 5

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

    ## Warning in get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas =
    ## chem.cas, : Clint is provided as a distribution.

    ## Warning in apply_clint_adjustment(Clint.point, Fu_hep = Fu_hep,
    ## suppress.messages = suppress.messages): Clint adjusted for in vitro
    ## partitioning (Kilford, 2008), see calc_hep_fu.

    ## Warning in get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas,
    ## : Fraction unbound is provided as a distribution.

    ## Warning in apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, :
    ## Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see
    ## calc_fup_correction.

    ## Warning in available_rblood2plasma(chem.cas = chem.cas, species = species, :
    ## Human in vivo measured Rblood2plasma used.

    ## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
    ## dtxsid, : Default value of 1.6 used for Caco2 permeability.

    ## Plasma concentration returned in uM units.

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

## Examples

- List all CAS numbers for all chemicals with sufficient data to run httk Note that we use the R built-in function head() to show only the first five rows

    head(get_cheminfo(suppress.messages = TRUE))

    ## [1] "2971-36-0"  "94-75-7"    "94-82-6"    "90-43-7"    "1007-28-9"
    ## [6] "71751-41-2"

Remove the head() function to get the full table

    get_cheminfo(suppress.messages = TRUE)

- List all information (If median.only=FALSE you will get medians, lower 95th, and upper 95th for Fup, plus p-value for Clint, separated by commans, when those statistics are available. Older data only have means for Clint and Fup.):

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

    ##                                                Compound        CAS
    ## 1 2,2-bis(4-hydroxyphenyl)-1,1,1-trichloroethane (hpte)  2971-36-0
    ## 2                                                 2,4-d    94-75-7
    ## 3                                                2,4-db    94-82-6
    ## 4                                        2-phenylphenol    90-43-7
    ## 5                                6-desisopropylatrazine  1007-28-9
    ## 6                                             Abamectin 71751-41-2
    ##          DTXSID  logP    MW pKa_Accept      pKa_Donor Human.Clint
    ## 1 DTXSID8022325 4.622 317.6                 9.63,10.2      136.50
    ## 2 DTXSID0020442 2.809 221.0                      2.81        0.00
    ## 3 DTXSID7024035 3.528 249.1                      3.58        0.00
    ## 4 DTXSID2021151 3.091 170.2                      9.69        0.00
    ## 5 DTXSID0037495 1.150 173.6       3.41                       0.00
    ## 6 DTXSID8023892 4.480 819.0            12.5,13.2,13.8        5.24
    ##   Human.Clint.pValue Human.Funbound.plasma Human.Rblood2plasma
    ## 1          0.0000357              0.005000                  NA
    ## 2          0.1488000              0.040010                2.11
    ## 3          0.1038000              0.006623                  NA
    ## 4          0.1635000              0.041050                  NA
    ## 5          0.5387000              0.458800                  NA
    ## 6          0.0009170              0.066870                  NA

- Is a chemical with a specified CAS number available?

    "80-05-7" %in% get_cheminfo(suppress.messages = TRUE)

    ## [1] TRUE

- All data on chemicals A, B, C (You need to specify the names instead of “A”,“B”,“C”…)

    subset(get_cheminfo(info = "all",suppress.messages = TRUE),
           Compound %in% c("A","B","C"))

    ##  [1] Compound              CAS                   DTXSID
    ##  [4] logP                  MW                    pKa_Accept
    ##  [7] pKa_Donor             Human.Clint           Human.Clint.pValue
    ## [10] Human.Funbound.plasma Human.Rblood2plasma
    ## <0 rows> (or 0-length row.names)

- Administrated equivalent dose (mg/kg BW/day) to produce 0.1 uM plasma concentration, 0.95 quantile, for a specified CAS number and species

    calc_mc_oral_equiv(0.1,
                       chem.cas = "34256-82-1",
                       species = "human",
                       samples = NSAMP,
                       suppress.messages = TRUE)

    ## Warning in (function (chem.name = NULL, chem.cas = NULL, dtxsid = NULL, :
    ## calc_analytic_css deprecated argument daily.dose replaced with new argument
    ## dose, value given assigned to dose

    ##     95%
    ## 0.04411

    calc_mc_oral_equiv(0.1,
                       chem.cas = "99-71-8",
                       species = "human",
                       samples = NSAMP,
                       suppress.messages = TRUE)

    ## Warning in (function (chem.name = NULL, chem.cas = NULL, dtxsid = NULL, :
    ## calc_analytic_css deprecated argument daily.dose replaced with new argument
    ## dose, value given assigned to dose

    ##  95%
    ## 0.01

- Calculate the mean, AUC, and peak concentrations for a simulated study (28-day daily dose, by default) for a specified CAS number and species

    calc_tkstats(chem.cas = "34256-82-1",
                 species = "rat",
                 suppress.messages = TRUE)

    ## $AUC
    ## [1] 2.158
    ##
    ## $peak
    ## [1] 0.5815
    ##
    ## $mean
    ## [1] 0.07707

    calc_tkstats(chem.cas = "962-58-3",
                 species = "rat",
                 suppress.messages = TRUE)

    ## $AUC
    ## [1] 0.1327
    ##
    ## $peak
    ## [1] 0.02837
    ##
    ## $mean
    ## [1] 0.004739

- Using the PBTK solver for a specified chem name

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

    ##        time Agutlumen    Cgut    Cliver     Cven  Clung    Cart    Crest
    ## [1,] 0.0000     197.5  0.0000  0.000000 0.000000 0.0000 0.00000 0.000000
    ## [2,] 0.0001     197.3  0.1582  0.000479 0.000001 0.0000 0.00000 0.000000
    ## [3,] 0.0104     180.0 10.1400  3.061000 0.036370 0.2969 0.03128 0.007969
    ## [4,] 0.0208     164.1 13.6300  7.594000 0.102400 0.8854 0.09674 0.056180
    ## [5,] 0.0312     149.6 14.7700 11.110000 0.161900 1.4240 0.15730 0.149500
    ## [6,] 0.0416     136.3 14.9900 13.380000 0.206900 1.8340 0.20350 0.275400
    ##      Ckidney  Cplasma Atubules Ametabolized      AUC
    ## [1,]  0.0000 0.000000 0.000000       0.0000 0.000000
    ## [2,]  0.0000 0.000001 0.000000       0.0000 0.000000
    ## [3,]  0.3828 0.045750 0.000581       0.1353 0.000170
    ## [4,]  1.7520 0.128900 0.004210       0.7581 0.001073
    ## [5,]  3.2890 0.203700 0.011540       1.8560 0.002817
    ## [6,]  4.5500 0.260300 0.021930       3.2870 0.005245

- Create data set, my_data, for all data on chemicals A, B, C, in R

    my_data <- subset(get_cheminfo(info = "all",suppress.messages = TRUE),
                      Compound %in% c("A","B","C"))

- Export data set, my_data, from R to csv file called my_data.csv in the current working directory

    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:

    library(httk)
    fup.tab <- get_cheminfo(info="all",
                            median.only=TRUE,
                            model="schmitt",
                            suppress.messages = TRUE)

    ## Warning in get_cheminfo(info = "all", median.only = TRUE, model = "schmitt", :
    ## NAs introduced by coercion

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

    median(as.numeric(fup.tab$Human.Funbound.plasma),na.rm=TRUE)

    ## [1] 0.13

Calculate the mean:

    mean(as.numeric(fup.tab$Human.Funbound.plasma),na.rm=TRUE)

    ## [1] 0.2957295

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:

    sum(!is.na(fup.tab$Human.Funbound.plasma))

    ## [1] 1726

#### User Notes

- When using the CAS number as a unique chemical identifier with ‘httk’ functions it is best to type these numbers directly (i.e. by hand) into the console, script, Rmarkdown, etc. to avoid unnecessary error messages. Webpages, word documents, and other sources of these CAS numbers may use a different character encoding that does not match those used in the ‘httk’ data sources.

## Help

- Getting help with R Package httk

    help(httk)

- You can go straight to the index:

    help(package = httk)

- List all vignettes for httk

    vignette(package = "httk")

- Displays the vignette for a specified vignette

    vignette("1_IntroToHTTK")