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

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

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

    ## 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.62 317.6       None              8.33      136.50
    ## 2 DTXSID0020442 2.81 221.0       None              2.42        0.00
    ## 3 DTXSID7024035 3.53 249.1       None              3.11        0.00
    ## 4 DTXSID2021151 3.09 170.2       None              9.35        0.00
    ## 5 DTXSID0037495 1.15 173.6       3.43              None        0.00
    ## 6 DTXSID8023892 4.48 819.0       None 12.47,13.17,13.80        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)

    ##     95%
    ## 0.08137

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

    ##      95%
    ## 0.003683

- 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.854
    ##
    ## $peak
    ## [1] 0.8253
    ##
    ## $mean
    ## [1] 0.1019

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

    ## $AUC
    ## [1] 0.9334
    ##
    ## $peak
    ## [1] 0.5086
    ##
    ## $mean
    ## [1] 0.03334

- 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.00000    306.60  0.00  0.0000 0.000000 0.000000 0.0000000 0.000e+00
    ## [2,] 0.00100    291.00 13.48  0.4107 0.002545 0.008112 0.0003948 6.010e-06
    ## [3,] 0.01042    177.80 72.13 23.8100 0.285900 2.350000 0.2492000 6.599e-02
    ## [4,] 0.02083    103.10 73.21 49.2100 0.679500 5.920000 0.6513000 4.141e-01
    ## [5,] 0.03125     59.77 59.40 59.1300 0.897100 7.958000 0.8853000 9.794e-01
    ## [6,] 0.04167     34.66 45.49 57.9700 0.954400 8.534000 0.9538000 1.605e+00
    ##        Ckidney  Cplasma  Atubules Ametabolized       AUC
    ## [1,] 0.000e+00 0.000000 0.000e+00     0.000000 0.000e+00
    ## [2,] 4.552e-04 0.003201 4.300e-07     0.001555 9.040e-07
    ## [3,] 3.135e+00 0.359700 4.826e-03     1.106000 1.392e-03
    ## [4,] 1.237e+01 0.854800 3.117e-02     5.495000 7.854e-03
    ## [5,] 1.964e+01 1.129000 7.620e-02    11.940000 1.839e-02
    ## [6,] 2.277e+01 1.201000 1.296e-01    18.820000 3.066e-02

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

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] 1618

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