Css from CCD - Comptox Chemicals Dashboard

Toxicokinetic (httk) predictions for chemicals can be found in the Comptox Chemicals Dashboard - under ADME-IVIVE. An example is provided with DEET.The url for CCD is:https://comptox.epa.gov/dashboard/.

CompTox Chemicals Dashboard
CompTox Chemicals Dashboard

Chemical of interest: DEET

DEET
DEET

Selecting ADME

ADME/IVIVE selection
ADME/IVIVE selection
Csteady-state
Csteady-state

The steady-state concentrations can be used to calculate plasma blood concentration using forward dosimetry. As an example, we will consider a 1 ppm spill of DEET in drinking water.

Clearance and Css are related: Css and Clearance

Css = Rate of exposure (1 mg/kg/day)/ Clearance (L/kg/day)

Css = 1/Clearance , or Clearance = 1/Css

Application of Css with DEET
Application of Css with DEET

Reading data from httk

The httk dataset called chem.invivo.PK.data contains time course data for oral exposure in rats published in Wambaugh et al.(2018).

Wambaugh, J. F., Hughes, M. F., Ring, C. L., MacMillan, D. K., Ford, J., Fennell, T. R., ... & Thomas, R. S. (2018). Evaluating in vitro-in vivo extrapolation of toxicokinetics. Toxicological Sciences163(1), 152-169.

We will look at the R code needed in the next code chunk.

library(httk)
rm(list=ls())
head(chem.invivo.PK.data)
##      Compound        CAS Reference Species Species.Weight Species.Weight.Units
## 1 Carbendazim 10605-21-7  Jia 2003     rat          0.185                   kg
## 2 Carbendazim 10605-21-7  Jia 2003     rat          0.185                   kg
## 3 Carbendazim 10605-21-7  Jia 2003     rat          0.185                   kg
## 4 Carbendazim 10605-21-7  Jia 2003     rat          0.185                   kg
## 5 Carbendazim 10605-21-7  Jia 2003     rat          0.185                   kg
## 6 Carbendazim 10605-21-7  Jia 2003     rat          0.185                   kg
##   Dose Dose.Units.and.Type Time Time.Units                Media Media.Units
## 1 1000            mg/kg po 0.25          h Plasma concentration       ug/mL
## 2 1000            mg/kg po 0.50          h Plasma concentration       ug/mL
## 3 1000            mg/kg po 1.00          h Plasma concentration       ug/mL
## 4 1000            mg/kg po 2.00          h Plasma concentration       ug/mL
## 5 1000            mg/kg po 4.00          h Plasma concentration       ug/mL
## 6 1000            mg/kg po 8.00          h Plasma concentration       ug/mL
##      Value Units Route          Source        LOQ Subject info
## 1 10.04130 mg/kg    po TNO Lit. Review 0.02225196    <NA> <NA>
## 2 11.62170 mg/kg    po TNO Lit. Review 0.02225196    <NA> <NA>
## 3 14.69500 mg/kg    po TNO Lit. Review 0.02225196    <NA> <NA>
## 4 20.22630 mg/kg    po TNO Lit. Review 0.02225196    <NA> <NA>
## 5 14.13310 mg/kg    po TNO Lit. Review 0.02225196    <NA> <NA>
## 6  4.58575 mg/kg    po TNO Lit. Review 0.02225196    <NA> <NA>
#To save the dataframe in the environment, give it a name
chem.invivo.PK.data <- chem.invivo.PK.data
#Let's select carbendazim as a chemical of interest
which(chem.invivo.PK.data$Compound == "Carbendazim")
## [1] 1 2 3 4 5 6 7
#Rows 1-7 have carbendazim data
carben<-chem.invivo.PK.data[1:7,]
time_carb<-carben$Time
conc_carb<-carben$Value

Selecting a particular chemical

Valproate (valproic acidVPAsodium valproate, and valproate semisodium forms) are medications primarily used to treat epilepsy and bipolar disorder and prevent migraine headaches. They are useful for the prevention of seizures in those with absence seizures, partial seizures, and generalized seizures. They can be given intravenously or by mouth, and the tablet forms exist in both long- and short-acting formulations. https://comptox.epa.gov/dashboard/chemical/details/DTXSID6023733

As before, apply the which function to identify the rows that have this chemical.

rm(list=ls())
#To save the dataframe in the environment, give it a name
chem.invivo.PK.data <- chem.invivo.PK.data

#Lists all the experiments containing valproic acid
#Spelling is important as R is case sensitive
which(chem.invivo.PK.data$Compound =="Valproic acid")
##  [1] 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
## [20] 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
## [39] 430 431 432 433 434 435 436
#If you View the rows listed by which containing Valproic acid as a chemical. The list contains both oral and iv exposures.
valp_all<-chem.invivo.PK.data[392:436,]  #The comma tells R to list all columns

#The first oral experiment uses 200 mg/kg and is listed from rows 392 to 397
valp<-chem.invivo.PK.data[392:397,] 
#To select the time column from the oral gavage experiment
first_oral_val<-valp$Time   # in hours
# Divide by 24 to convert to days
first_oral_val_days<-valp$Time/24
#To select the concentration - use the column titled Value
first_oral_val_conc<-valp$Value

An iv exposure is used as a first step to determine clearance. Lets use subset to select an iv exposure of 10 mg/kg for valproic acid. The subset statement uses a logical & to make sure both conditions are met.

Note: There are multiple ways to achieve this data selection in R. If you want to use the additional package dyplr, there is an example in the Appendix.

rm(list=ls())
#To save the dataframe in the environment, give it a name
chem.invivo.PK.data <- chem.invivo.PK.data
#Select the iv experiment with 10 mg/kg dose.
firstexp<-subset(chem.invivo.PK.data,chem.invivo.PK.data$Compound =="Valproic acid" & chem.invivo.PK.data$Dose ==10)

Now that we have our experimental data, what input parameters do we need to match the data with httk simulations?

There are several inputs that come to mind:

All this information can be found in the experimental data set you have selected to simulate.

#To obtain the CAS number and name
#View firstexp to verify that chemical name, cas or DTXSID are listed. You do not need all of them, one identifier is sufficient. 

chem<-firstexp$Compound
# The object chem has multipe names listed repeatedly and httk will need only one name. To obtain a unique name use:
cas<-unique(firstexp$CAS)

#You may prefer the chemical name
chem.name<-unique(firstexp$Compound)

#The DTXSID number is not included in the chem.invivo.PK.data set, but can be obtained by using the             get_chem__id function.

#To obtain the dose for this experiment
dose<-unique(firstexp$Dose)

#To find duration use max function
dur <- max(firstexp$Time)
#Convert to days divide by 24
days=dur/24

We are going to start with the pbtk model having separate venous and arterial compartments, liver and kidney clearance. Both iv and oral routes are supported. This model takes into account physiological inputs to the liver and accounts for mass balance using a rest of body compartment.

pbtk - general model
pbtk - general model

Regardless of the type of PBTK model used, we need to define all model parameters using the parameterize function. This function will calculate all physiological and chemical specific parameters. This latest version also includes oral absorption calculations derived from Caco2 assays.

To find the parameterize function for the pbtk model, go to the console and start typing the first letters for param. You should see a box with options for which model you are using. It is important to note that different pbtk models have a corresponding parameterize function.

PBTK for iv example
PBTK for iv example

The yellow box is part of the help function and lists all the inputs used by the parameterize function. It is not necessary to use all the inputs listed. For our examples, we will need to specify the chemical and the species being rats. I like to store the parameters using a variable name of my choice, like p.

p<-parameterize_pbtk(chem.name=chem.name,species=“Rat”)

p<-parameterize_pbtk(chem.cas=cas,species="Rat")
## 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 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, :
## Rat in vivo measured Rblood2plasma used.
## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
## dtxsid, : Clint is provided as a distribution.

You can list the values stored in p

#To list all of the parameters, click on the down arrow next to p on the environment window.

#For a specific parameter, use the $ sign
p$Funbound.plasma
## [1] 0.3656

The final step in setting up for the simulations is using the solve function. Like before, each pbtk model has an associated solve function. We need to use the solve_pbtk(). As before, you may want to select the solve function from the console.

solve function for iv example
solve function for iv example

We had selected chemical cas, name, initial dose, and duration of the iv experiment for valproic acid on the r chunk labelled name. ({r name, eval=TRUE}. We are going to use those parameters as input for our simulation. I am also going to name an output variable to store the simulation results. As a reminder,

out<-solve_pbtk(chem.cas = cas,days=days,iv.dose=TRUE,dose=dose,input.units="mg/kg",output.units = "mg/L")
## 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, : Clint is provided as a distribution.
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.74.
## The model outputs are provided in the following units:
##  mg: Aven, Atubules, Ametabolized
##  mg/l: Cgut, Cliver, Cven, Clung, Cart, Crest, Ckidney, Cplasma
##  mg/l*days: AUC
#Out is stored as a matrix not a dataframe.
#Reminder, we need to use rows and columns notation
head(out)
##            time   Aven   Cgut Cliver   Cven  Clung  Cart Crest Ckidney Cplasma
## [1,] 0.00000000 700.00  0.000   0.00 261.30  0.000  0.00 0.000    0.00  353.10
## [2,] 0.00100000  98.74 34.110  52.74  36.86 10.660 56.16 5.228   98.35   49.81
## [3,] 0.01041667  55.73 10.440  38.44  20.80  5.944 20.84 8.714   29.90   28.11
## [4,] 0.02083333  53.86 10.060  36.55  20.10  5.745 20.12 8.510   28.85   27.17
## [5,] 0.03125000  52.35  9.782  35.52  19.54  5.583 19.56 8.272   28.04   26.41
## [6,] 0.04166667  50.88  9.507  34.52  18.99  5.427 19.01 8.040   27.25   25.67
##      Atubules Ametabolized    AUC
## [1,]    0.000       0.0000 0.0000
## [2,]    3.833       0.4734 0.1263
## [3,]   15.720       9.8920 0.4209
## [4,]   26.730      17.8400 0.7083
## [5,]   37.410      25.5400 0.9873
## [6,]   47.790      33.0100 1.2580
#Simulated results for time is in the first column, and Cplasma is in the 10th column.

Let’s compare the experimental data and simulation results. The experimental data is stored in firstexp. Since it is a dataframe, we can list the columns using the $ operator.

time_exp<-firstexp$Time   #hours
#Convert to days to be in same units as httk results
time_exp_days<-time_exp/24
conc_plasma_exp<-firstexp$Value
#Now let's do the same for the simulation results
time_sim<-out[,1]
conc_sim<-out[,10]
#We normally plot the experimental data using dots and the simulation are represented by lines
plot(time_exp_days,conc_plasma_exp,xlab="Time in days",ylab="Cplasma in mg/L", main="First iv simulation with data")

#To add simulation lines we use the lines command
#The peak for the simulation is higher than the data, so we are going to use the max function to find the highest value, then set the ylimit to the max value.
lim<-max(out[,10])
plot(time_exp_days,conc_plasma_exp,xlab="Time in days",ylab="Cplasma in mg/L",ylim=c(0,lim),main="First iv simulation with data") + lines(time_sim,conc_sim,col="blue")

## integer(0)

The solve_pbtk model has a separate iv blood compartment and accounts for iv modeling. If you were to use a simpler model like the 3_comp model, the blood compartment is much larger (located in the rest of the body) , and will results in a much lower peak value.

p2<-parameterize_3comp(chem.cas=cas,species = "Rat")
## 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 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, :
## Rat in vivo measured Rblood2plasma used.
## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
## dtxsid, : Clint is provided as a distribution.
out2<-solve_3comp(chem.cas = cas,days=days,iv.dose=TRUE,dose=dose,input.units="mg/kg",output.units = "mg/L")
## 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, : Clint is provided as a distribution.
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.74.
## The model outputs are provided in the following units:
##  mg: Asyscomp, Atubules, Ametabolized
##  mg/l: Cliver, Csyscomp
##  mg/l*days: AUC
#plot simulations and results
#Time is in the first column, cplasma is in 8th column
time_sim2<-out2[,1]
conc_sim2<-out2[,8]
#Experimental data is the same
plot(time_exp_days,conc_plasma_exp,xlab="Time in days",ylab="Cplasma in mg/L", main="First iv simulation with data")+ lines(time_sim2,conc_sim2,col="blue")

## integer(0)

So why the difference between 3comp and pbtk? If you follow the 3 comp diagram, stomach and liver blood flows are inputs to the liver. The liver is the only organ to have arterial and venous blood coming together as an input. As a result, the liver has a lower oxygen concentration gradient than other organs. The 3 comp model was built to describe oral absorption and liver clearance. Next, let’s try a compound given orally.

Oral 3 comp model
Oral 3 comp model

Imidacloprid is a systemic insecticide belonging to a class of chemicals called the neonicotinoids which act on the central nervous system of insects. The chemical works by interfering with the transmission of stimuli in the insect nervous system. Specifically, it causes a blockage of the nicotinergic neuronal pathway. https://comptox.epa.gov/dashboard/chemical/details/DTXSID5032442

chem.invivo.PK.data <- chem.invivo.PK.data
#The only difference when setting an oral exposure, is to make sure iv.dose=FALSE. It is the default value, but it is shown here to make a point.
which(chem.invivo.PK.data == "Imidacloprid")
##  [1] 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385
## [16] 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400
## [31] 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415
## [46] 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430
## [61] 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445
## [76] 2446 2447 2448 2449 2450 2451 2452 2453 2454
#Rows for 5 mg/kg oral dose are 2371 to 2390
imida<-chem.invivo.PK.data[2371:2390,]
#All other steps are as before
time_imida_exp<-imida$Time/24  #Convert to days
conc_imida_exp<-imida$Value
cas<-unique(imida$CAS)
dose<-unique(imida$Dose)
days <- max(imida$Time)/24
p_imida<-parameterize_3comp(chem.cas=cas,species="Rat")
## 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 calc_ma(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid,
## : Membrane affintity (MA) predicted with method of Yun and Edginton (2013), see
## calc_ma.
## 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 substituted.
## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
## dtxsid, : Clint is provided as a distribution.
out_imida<-solve_3comp(chem.cas = cas,days=days,iv.dose=FALSE,dose=dose,input.units="mg/kg",output.units = "mg/L")
## 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 calc_ma(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid,
## : Membrane affintity (MA) predicted with method of Yun and Edginton (2013), see
## calc_ma.
## 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, : Clint is provided as a distribution.
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.866.
## The model outputs are provided in the following units:
##  mg: Aintestine, Atubules, Ametabolized
##  mg/l: Cliver, Csyscomp
##  mg/l*days: AUC
#Plotting
time_imida_sim<-out_imida[,1]
conc_imida_sim<-out_imida[,8]
lim<-max(conc_imida_sim)
plot(time_imida_exp,conc_imida_exp,xlab="Time in days",ylab="Cplasma mg/L",ylim=c(0,lim), main="First oral exposure") + lines(time_imida_sim,conc_imida_sim,col="blue")

## integer(0)

However, the oral absorption can be overpredicted. Overprediction can be considered to be health protective. For comparison, we will use chlorpyrifos as an example.

In organic chemistry, chlorpyrifos (CPS), also known as chlorpyrifos ethyl, is an organophosphate pesticide that has been used on crops, animals, and buildings, and in other settings, to kill several pests, including insects and worms. It acts on the nervous systems of insects by inhibiting the acetylcholinesterase enzyme. https://comptox.epa.gov/dashboard/chemical/details/DTXSID4020458

chem.invivo.PK.data <- chem.invivo.PK.data
which(chem.invivo.PK.data$Compound =="Chlorpyrifos")
##  [1] 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
## [20] 363
#The 100 mg/kg oral dose chlorpyrifos experiment starts in row 358 and ends in row 363
#Save experiment as a dataframe
chlor<-chem.invivo.PK.data[358:363,]
#All other steps are as before
time_chlor_exp<-chlor$Time/24  #Convert to days
conc_chlor_exp<-chlor$Value
cas<-unique(chlor$CAS)
dose<-unique(chlor$Dose)
days <- max(chlor$Time)/24
p_chlor<-parameterize_3comp(chem.cas=cas,species="Rat")
## 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 calc_ma(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid,
## : Membrane affintity (MA) predicted with method of Yun and Edginton (2013), see
## calc_ma.
## 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 substituted.
## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
## dtxsid, : Default value of 1.6 used for Caco2 permeability.
out_chlor<-solve_3comp(chem.cas = cas,days=days,iv.dose=FALSE,dose=dose,input.units="mg/kg",output.units = "mg/L")
## 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 calc_ma(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid,
## : Membrane affintity (MA) predicted with method of Yun and Edginton (2013), see
## calc_ma.
## 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.
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.733.
## The model outputs are provided in the following units:
##  mg: Aintestine, Atubules, Ametabolized
##  mg/l: Cliver, Csyscomp
##  mg/l*days: AUC
#Plotting
plot(time_chlor_exp,conc_chlor_exp,xlab="Time in days",ylab="Cplasma mg/L", main="First oral exposure")

time_chlor_sim<-out_chlor[,1]
conc_chlor_sim<-out_chlor[,8]
lim<-max(conc_chlor_sim)
plot(time_chlor_exp,conc_chlor_exp,xlab="Time in days",ylab="Cplasma mg/L",ylim=c(0,lim), main="First oral exposure") + lines(time_chlor_sim,conc_chlor_sim,col="blue")

## integer(0)

We can change the gut absorption to a lower value to see if it helps with fits.

p_chlor$Fabsgut
## [1] 0.02716
p_chlor$Fabsgut<-0.008
#Since you have changed the parameter list, make sure you input this modified parameter list into solve.
out_chlor<-solve_3comp(chem.cas=cas,
                      parameters=p_chlor,
                      days=days,
                      iv.dose=FALSE,
                      dose=dose,
                      input.units="mg/kg",
                      output.units = "mg/L")
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.733.
## The model outputs are provided in the following units:
##  mg: Aintestine, Atubules, Ametabolized
##  mg/l: Cliver, Csyscomp
##  mg/l*days: AUC
time_chlor_sim<-out_chlor[,1]
conc_chlor_sim<-out_chlor[,8]
lim<-max(conc_chlor_sim)
plot(time_chlor_exp,conc_chlor_exp,xlab="Time in days",ylab="Cplasma mg/L",ylim=c(0,lim), main="First oral exposure") + lines(time_chlor_sim,conc_chlor_sim,col="blue")

## integer(0)

Some record keeping suggestions. We can paste the chemical name and dose into the graph title. You could assign a simulation number as well.

sim<-"chem_000001"   #Use ""
#Chemical is same as above
chem.invivo.PK.data <- chem.invivo.PK.data
which(chem.invivo.PK.data$Compound =="Chlorpyrifos")
##  [1] 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
## [20] 363
#The 100 mg/kg oral dose chlorpyrifos experiment starts in row 358 and ends in row 363
#Save experiment as a dataframe
chlor<-chem.invivo.PK.data[358:363,]
#All other steps are as before
time_chlor_exp<-chlor$Time/24  #Convert to days
conc_chlor_exp<-chlor$Value
cas<-unique(chlor$CAS)
dose<-unique(chlor$Dose)
days <- max(chlor$Time)/24
p_chlor<-parameterize_3comp(chem.cas=cas,species="Rat")
## 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 calc_ma(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid,
## : Membrane affintity (MA) predicted with method of Yun and Edginton (2013), see
## calc_ma.
## 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 substituted.
## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
## dtxsid, : Default value of 1.6 used for Caco2 permeability.
p_chlor$Fabsgut<-0.008
#Have changed Fabsgut from 0.02716 to 0.008
out_chlor<-solve_3comp(chem.cas = cas,parameters=p_chlor,days=days,iv.dose=FALSE,dose=dose,input.units="mg/kg",output.units = "mg/L")
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.733.
## The model outputs are provided in the following units:
##  mg: Aintestine, Atubules, Ametabolized
##  mg/l: Cliver, Csyscomp
##  mg/l*days: AUC
#Plotting
time_chlor_sim<-out_chlor[,1]
conc_chlor_sim<-out_chlor[,8]
lim<-max(conc_chlor_sim)
#The paste0 command can be used to add text to the title
#main=paste0(chem.name," ",dose,"mg/kg"))
plot(time_chlor_exp,conc_chlor_exp,xlab="Time in days",ylab="Cplasma mg/L",ylim=c(0,lim), main=paste0(sim," ",cas," ", dose,"mg/kg")) + lines(time_chlor_sim,conc_chlor_sim,col="blue")
## integer(0)
#mtext command with side=3 puts text on the top quadrant
mtext("Changed Fabsgut from 0.02716 to 0.008",side=3)

To save the plot:

Copy the plot command into the console and return. You plot will appear on the Plots window. Once your plot is in the window, click on Export, then click on Save as Image, and select the name and file directory you want. By default it will save the image in your working directory, where you have been working.

Capture image
Capture image
Save file
Save file

Appendix

For R users that are familiar with the dyplr package and matrix notation.

library(dplyr);library(httk)
## Warning: package 'dplyr' was built under R version 4.1.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
rm(list=ls())
#An alternate to select the data for a given experiment
#Lists all the experiments containing valproic acid
#which(chem.invivo.PK.data$Compound =="Valproic acid")

#Subsets the data frame to only include experiments with valproic acid
valp_acid<-chem.invivo.PK.data%>% filter(Compound == "Valproic acid")

# To select the first experiment using dose = 10 mg/kg
firstexp <- valp_acid %>% filter(Dose == 10)

#To find duration use max function
dur <- max(firstexp$Time)

#To obtain the CAS number use
cas<-unique(valp_acid$CAS)
chem.name<-unique(valp_acid$Compound)

#To obtain the dose for this experiment
dose<-unique(firstexp$Dose)

#Use parameterize function to set parameters before calling solve.
p<-parameterize_3comp(chem.cas=cas,species="Rat")
## 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 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, :
## Rat in vivo measured Rblood2plasma used.
## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
## dtxsid, : Clint is provided as a distribution.
#Calculate duration in days
days=dur/24

#USe solve function for 3 compartments to obtain simulations
out<-solve_3comp(chem.cas = cas,days=days,iv.dose=TRUE,dose=dose,input.units="mg/kg",output.units = "mg/L")
## 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, : Clint is provided as a distribution.
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.74.
## The model outputs are provided in the following units:
##  mg: Asyscomp, Atubules, Ametabolized
##  mg/l: Cliver, Csyscomp
##  mg/l*days: AUC
#Data collected as time and Cplasma points
time_cplasma <- out[,c(1,8)]

#Plot simulations
#plot(time_cplasma, type="l") 

#Experimental time and concentration points
time_conc_points <- firstexp[,c("Time","Value")]

#convert time from hours to days
time_conc_points$Time <- time_conc_points$Time / 24

#Plot simulations with experimental points
plot(time_conc_points,xlab="Time in days",ylab="Cplasma in mg/L",ylim=c(0,max(time_conc_points$Value)), main=paste0(chem.name," ",dose,"mg/kg")) + lines(time_cplasma,col="green")

## integer(0)
#Use pbtk model
p2<-parameterize_pbtk(chem.cas=cas,species="Rat")
## 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 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, :
## Rat in vivo measured Rblood2plasma used.
## Warning in get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid =
## dtxsid, : Clint is provided as a distribution.
out2<-solve_pbtk(chem.cas = cas,days=days,iv.dose=TRUE,dose=dose,input.units="mg/kg",output.units = "mg/L")
## 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, : Clint is provided as a distribution.
## None of the monitored components undergo unit conversions  (i.e. conversion factor of 1).
## 
## AUC is area under the plasma concentration curve in uM*days units with Rblood2plasma = 0.74.
## The model outputs are provided in the following units:
##  mg: Aven, Atubules, Ametabolized
##  mg/l: Cgut, Cliver, Cven, Clung, Cart, Crest, Ckidney, Cplasma
##  mg/l*days: AUC
time_cplasma2 <- out2[,c(1,10)]
#Plot simulations with experimental points
plot(time_conc_points,xlab="Time in days",ylim=c(0,max(time_cplasma2[,2])),ylab="Cplasma in mg/L",main=paste0(chem.name," ",dose,"mg/kg")) + lines(time_cplasma2,col="blue")+ lines(time_cplasma, col="green")

## integer(0)