R Under development (unstable) (2024-08-23 r87049 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # R CMD BATCH --no-timing --no-restore --no-save montecarlo_tests.R montecarlo_tests.Rout > > # Get rid of anything in the workspace: > rm(list=ls()) > > library(httk) > > # Reduce the number of samples used by Monte Carlo to decrease runtime for > # CRAN checks (never use predictions with only ten draws): > NSAMP <- 10 > > # > # > # Test that the underlying PK models give the same answers: > calc_analytic_css(chem.cas="15972-60-8") Plasma concentration returned in uM units. [1] 0.1784 Warning messages: 1: 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. 2: 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. 3: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 4: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human in vivo measured Rblood2plasma used. 5: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. > calc_analytic_css(chem.cas="15972-60-8",model="1compartment") Human volume of distribution returned in units of L/kg BW. Plasma concentration returned in uM units. [1] 0.2091 Warning messages: 1: 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. 2: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 3: In available_rblood2plasma(chem.cas = chem.cas, chem.name = chem.name, : Human in vivo measured Rblood2plasma used. > calc_analytic_css(chem.cas="15972-60-8",model="pbtk") Plasma concentration returned in uM units. [1] 0.1784 Warning messages: 1: 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. 2: 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. 3: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 4: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human in vivo measured Rblood2plasma used. 5: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. > calc_analytic_css(chem.cas="15972-60-8",model="3compartment") Plasma concentration returned in uM units. [1] 0.1784 Warning messages: 1: 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. 2: 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. 3: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 4: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human in vivo measured Rblood2plasma used. 5: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. > > > > # > # > # Now test Monte Carlo for a variety of chemicals: > # Clint and Fup are distributions, clint is zero: > set.seed(1234) > uM <- calc_mc_css(chem.cas="50594-66-6",samples=NSAMP,output.units="uM") Human plasma concentration returned in uM units for 0.95 quantile. Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Clint is provided as a distribution. 4: 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 > set.seed(1234) > mgpL <- calc_mc_css(chem.cas="50594-66-6",samples=NSAMP,output.units="mg/L") Human plasma concentration returned in mg/L units for 0.95 quantile. Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Clint is provided as a distribution. 4: 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 > # Test unit conversions, molecular weight of Acifluorfen is 361.66: > signif(mgpL/uM*1000,3) 95% 362 > # Human.Clint.pvalue > 0.05, no measured Rblood2plasma > set.seed(1234) > calc_mc_css(chem.cas="116-06-3",samples=NSAMP) Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 2.955 Warning messages: 1: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 2: 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 > # Human.Funbound.plasma is below LOD (0.005), can't do PBPK, can't predict > # Rblood2plasma > set.seed(1234) > calc_mc_css(chem.cas="101-05-3",samples=NSAMP) Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 8.286 Warning messages: 1: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound below limit of detection. 2: In (function (chem.cas = NULL, chem.name = NULL, dtxsid = NULL, : Fraction unbound = 0, changed to 0.005. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 4: 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 > # well-behaved chemical with a measured Rblood2plasma: > set.seed(1234) > calc_mc_css(chem.cas="15972-60-8",samples=NSAMP) Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 0.1509 Warning messages: 1: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 2: 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 > # Chemical where median fup is 0 but upper 95th percentile is non-zero: > set.seed(1234) > calc_mc_css(dtxsid="DTXSID5041726",samples=NSAMP) Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 1237 Warning messages: 1: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 2: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 3: 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 > > # > # > # Now test that MC works across different models: > set.seed(1234) > calc_mc_css(chem.cas="15972-60-8",model="3compartment",samples=NSAMP) Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 0.1509 Warning messages: 1: 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. 2: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human in vivo measured Rblood2plasma used. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 4: 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 > set.seed(1234) > calc_mc_css(chem.cas="15972-60-8",model="1compartment",samples=NSAMP) Human volume of distribution returned in units of L/kg BW. Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 0.1768 Warning messages: 1: 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. 2: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 3: In available_rblood2plasma(chem.cas = chem.cas, chem.name = chem.name, : Human in vivo measured Rblood2plasma used. 4: 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 > set.seed(1234) > calc_mc_css(chem.cas="15972-60-8",model="pbtk",samples=NSAMP) Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 0.1509 Warning messages: 1: 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. 2: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human in vivo measured Rblood2plasma used. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 4: 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 > > # Should be the same as the mean result: > calc_analytic_css(chem.cas="90-43-7",model="pbtk",output.units="mg/L") Plasma concentration returned in mg/L units. [1] 8.339 Warning messages: 1: 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. 2: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 3: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 4: In calc_rblood2plasma(chem.cas = chem.cas, species = species, adjusted.Funbound.plasma = adjusted.Funbound.plasma, : Rblood2plasma has been recalculated. 5: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human Rblood2plasma calculated with calc_rblood2plasma. 6: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. > > set.seed(1234) > # HTTK Monte Carlo using basic Monte Carlo sampler: > calc_mc_css(chem.cas="90-43-7", + model="pbtk", + samples=NSAMP, + httkpop=FALSE, + invitrouv=FALSE, + vary.params=list(Pow=0.3)) Human plasma concentration returned in mg/L units for 0.95 quantile. 95% 6.77 Warning messages: 1: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 2: In calc_rblood2plasma(chem.cas = chem.cas, species = species, adjusted.Funbound.plasma = adjusted.Funbound.plasma, : Rblood2plasma has been recalculated. 3: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human Rblood2plasma calculated with calc_rblood2plasma. 4: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 5: 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 > > > #set.seed(1234) > # well-behaved chemical with a measured Rblood2plasma: > # lapply(calc_mc_tk(chem.cas="80-05-7",samples=NSAMP),function(x) x[-2,]) > > # make sure the oral equivalent function works: > set.seed(1234) > calc_mc_oral_equiv(chem.name="bisphenol a",conc=10,samples=NSAMP) Human plasma concentration returned in uM units for 0.95 quantile. uM concentration converted to mgpkgpday dose for 0.95 quantile. 95% 4.018 Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 4: 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 > set.seed(1234) > # Do the calculation manually to make sure units are correct: > signif(10/calc_mc_css(chem.name="bisphenol a",samples=NSAMP,output.units="uM"),4) Human plasma concentration returned in uM units for 0.95 quantile. 95% 4.018 Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 4: 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 > > # do test of passing data.table of parameters > set.seed(1234) > parameter.dt <- create_mc_samples(chem.cas="335104-84-2", + model="pbtk", + samples=NSAMP) Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: 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. 3: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 4: 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. 5: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 6: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 7: In calc_rblood2plasma(chem.cas = chem.cas, species = species, adjusted.Funbound.plasma = adjusted.Funbound.plasma, : Rblood2plasma has been recalculated. 8: In available_rblood2plasma(chem.cas = chem.cas, species = species, : Human Rblood2plasma calculated with calc_rblood2plasma. 9: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. > calc_mc_oral_equiv(conc=100, + parameters=parameter.dt, + model="pbtk") Human plasma concentration returned in uM units for 0.95 quantile. uM concentration converted to mgpkgpday dose for 0.95 quantile. 95% 4.744 Warning message: 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 > > # do test of passing single set of parameters > params <- parameterize_steadystate(chem.cas="80-05-7") Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: 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. 3: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 4: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 5: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. > css3 <- calc_analytic_css( + parameters=params, + output.units = "uM", + model = "3compartmentss", + species = "Human") Plasma concentration returned in uM units. > set.seed(1234) > css4 <- calc_mc_css( + parameters=params, + output.units = "uM", + model = "3compartmentss", + species = "Human", + httkpop=FALSE, + invitrouv=FALSE, + return.samples=TRUE) Human plasma concentration returned in uM units. Warning message: 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 > set.seed(1234) > css5 <- calc_mc_css( + parameters=params, + output.units = "uM", + model = "3compartmentss", + species = "Human", + httkpop=TRUE, + invitrouv=TRUE, + return.samples=TRUE) Human plasma concentration returned in uM units. Warning message: 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 > > # If we turn off all the montecarlo the samples should all be the same and > # give us the same result as calc_analytic_css: > set.seed(1234) > css1 <- calc_mc_css( + chem.cas = "80-05-7", + output.units = "uM", + model = "3compartmentss", + species = "Human", + httkpop=FALSE, + invitrouv=FALSE, + return.samples=TRUE) Human plasma concentration returned in uM units. Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 3: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. 4: 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 > set.seed(1234) > css2 <- calc_analytic_css( + chem.cas = "80-05-7", + output.units = "uM", + model = "3compartmentss", + species = "Human") Plasma concentration returned in uM units. Warning messages: 1: In get_clint(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Clint is provided as a distribution. 2: 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. 3: In get_fup(dtxsid = dtxsid, chem.name = chem.name, chem.cas = chem.cas, : Fraction unbound is provided as a distribution. 4: In apply_fup_adjustment(fup.point, fup.correction = fup.adjustment, : Fup adjusted for in vivo lipid partitioning (Pearce, 2017), see calc_fup_correction. 5: In get_caco2(chem.cas = chem.cas, chem.name = chem.name, dtxsid = dtxsid, : Default value of 1.6 used for Caco2 permeability. > # These values should be the same: > all(css1/css2==1) [1] TRUE > css2/css3==1 [1] TRUE > # Because we can't recalculate Rblood2plasma for 3compartmentss this is not > # quite the same but should be close: > unique(css4)/css2 [1] 0.9301338 > > quit("no") > proc.time() user system elapsed 32.89 0.60 33.43