asancpt / caffsim

R package for simulation of caffeine concentration <doi:10.12793/tcp.2017.25.3.141>. https://asancpt.github.io/caffsim
https://www.tcpharm.org/Synapse/Data/PDFData/1179TCP/tcp-25-141.pdf
GNU General Public License v3.0
9 stars 1 forks source link

Errors installing caffsim #1

Open nholford opened 7 years ago

nholford commented 7 years ago

Spelling error https://github.com/asancpt/caffsim install.pacakges("devtools") Ran the command with correct spelling Then tried: devtools::install_github("asancpt/caffsim") This failed as follows. Any suggestions on how to complete the installation?

shanmdphd commented 7 years ago

Hi, Dr. Holford. Thanks for reporting a bug. Let me figure out what went wrong.

Sungpil

shanmdphd commented 7 years ago

This is possibly related to the issue of ggplot2. You can probably try this.

install.packages("lazyeval")
install.packages("forcats")

Please let me know if this helps.

Sungpil

nholford commented 7 years ago

Sungpil,

Thanks for your quick and helpful reply.

Your suggestion was successful for installing the required packages.

I was then able to install caffsim and run it.

The Shiny app gave this warning.

     2: shiny::runApp      1: caffsim::caffShiny Warning: Error in caffDataset: could not find function "caffDataset" Stack trace (innermost first):

The Shiny web page reported this:

  Descriptive Statistics of PK parameters

could not find function "caffDataset"

  Individual PK parameters

could not find function "caffDataset"

Some inconsistency in the messages -- the first says it is a warning but then describes it as an error. Is this expected?

Thanks for making this simulator available. Medical use of caffeine is most common in neonates. Have you thought about making it appropriate for this age group?

Best wishes,

Nick

On 29-Sep-17 13:46, Sungpil Han wrote:

This is possibly related the issue of ggplot2 https://github.com/tidyverse/ggplot2/issues/1910. You can probably try this.

install.packages("lazyeval") install.packages("forcats")

Please let me know if this helps.

Sungpil

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/asancpt/caffsim/issues/1#issuecomment-333001167, or mute the thread https://github.com/notifications/unsubscribe-auth/AZHNQGuAdo0MO7vi6O4YTHozJVoDrOwIks5snD4AgaJpZM4PoBsz.

-- Nick Holford, Professor Clinical Pharmacology Dept Pharmacology & Clinical Pharmacology, Bldg 503 Room 302A University of Auckland,85 Park Rd,Private Bag 92019,Auckland,New Zealand office:+64(9)923-6730 mobile:NZ+64(21)46 23 53 FR+33(6)62 32 46 72 email: n.holford@auckland.ac.nz http://holford.fmhs.auckland.ac.nz/ http://orcid.org/0000-0002-4031-2514 Read the question, answer the question, attempt all questions

shanmdphd commented 7 years ago

Thanks for reporting an error again. This is quite preliminary yet and to me, it's the first pharmacometrics R package I've ever made so there must be a lot of bugs and unexpected things. So your feedback is invaluable.

  1. I'll try to solve the caffShiny() issue. Instead, you can try the web app first.
  2. I had little idea about medical use of caffeine in neonates. This is a new perspective I can work on. Probably your paper will be a good point to start with.

I've not expected that somebody will submit issues regarding this R package through GitHub and especially I've never expected that the issuer is you. :-)

Best regards, Sungpil

nholford commented 7 years ago

Sungpil,

Thanks for reminding of the caffeine paper we wrote a long time ago.

Brian and I have done a lot more work since then on maturation of clearance in neonates. I am not aware of any more recent data on caffeine maturation but perhaps Brian is (CCed). The allometric size scaled clearances are typically about 10% of adult values in premature neonates and 30% of adult values in full term neonates. The estimates for caffeine look much lower than that.

We have some plans to get more data on caffeine PK in neonates next year. In the meantime it would be easy to modify your shiny app based on weight to estimate a maturation age specific clearance from neonates to adults. Where do you calculate clearance in your app? Which file?

Best wishes,

Nick

On 29-Sep-17 14:20, Sungpil Han wrote:

Thanks for reporting an error again. This is quite preliminary yet and to me, it's the first pharmacometrics R package I've ever made so there must be a lot of bugs and unexpected things. So your feedback is invaluable.

  1. I'll try to solve the |caffShiny()| issue. Instead, you can try the web app https://asan.shinyapps.io/caff.
  2. I had little idea about medical use of caffeine in neonates. This is a new perspective I can work on. Probably your paper https://www.ncbi.nlm.nih.gov/pubmed/10389569 will be a good point to start with.

I've not expected that somebody will submit issues regarding this R package through GitHub and especially I've never expected that the issuer is you. :-)

Best regards, Sungpil

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/asancpt/caffsim/issues/1#issuecomment-333005519, or mute the thread https://github.com/notifications/unsubscribe-auth/AZHNQMCelnbMWY4NcO2Y7A0H21qr_j7_ks5snEXfgaJpZM4PoBsz.

-- Nick Holford, Professor Clinical Pharmacology Dept Pharmacology & Clinical Pharmacology, Bldg 503 Room 302A University of Auckland,85 Park Rd,Private Bag 92019,Auckland,New Zealand office:+64(9)923-6730 mobile:NZ+64(21)46 23 53 FR+33(6)62 32 46 72 email: n.holford@auckland.ac.nz http://holford.fmhs.auckland.ac.nz/ http://orcid.org/0000-0002-4031-2514 Read the question, answer the question, attempt all questions

shanmdphd commented 7 years ago

Nick,

Thanks for sharing your follow-up story.

A caffPkparam() function in the file R/caffPkparam.R contains how we calculate the clearance according to this paper.

caffPkparam <- function(Weight, Dose, N = 20){
  mgcv::rmvn(N, CaffMu, CaffSigma) %>% 
    as_tibble() %>% 
    select(eta1 = 1, eta2 = 2, eta3 = 3) %>% 
    mutate(CL = 0.09792 * Weight * exp(eta1), # L/hr
           V  = 0.7219 * Weight * exp(eta2), 
           # TVV =THETA[2] * (1 + ABST*THETA[7]) [1] 0.7218775
           Ka = 4.268 * exp(eta3), # /hr
           Ke = CL / V,
           Tmax = (log(Ka) - log(Ke)) / (Ka - Ke),
           Cmax = Dose / V * Ka / (Ka - Ke) * (exp(-Ke * Tmax) - exp(-Ka * Tmax)), 
           AUC  = Dose / CL, # mg/h/L
           Half_life = 0.693 / Ke) %>% 
    mutate(subjid = row_number()) %>% 
    select(subjid, Tmax, Cmax, AUC, Half_life, CL, V, Ka, Ke)
}

An information regarding CaffMu and CaffSigma is in data-raw/use_data.R.

CaffSigma <- matrix(c(0.1599, 6.095e-2, 9.650e-2, 
                      6.095e-2, 4.746e-2, 1.359e-2, 
                      9.650e-2, 1.359e-2, 1.004), nrow = 3)
CaffMu <- c(0,0,0)

Hope this helps and it would be definitely interesting (and meaningful) if the similar approach can be applied to the caffeine PK in neonates.

Regards, Sungpil

nholford commented 7 years ago

Sungpil,

Thanks for showing me how caffsim calculates clearance. It is based on the Bae (2015) paper which uses a linear relationship of clearance with weight. It seems the original studies were done in healthy adults and extrapolated to adolescents whose weights I cannot check because the web page is unhelpful - see below.

The Bae (2015) PK analysis cannot be expected to distinguish between a biologically implausible linear model and a theory based allometric model (Anderson BJ, Holford NH. Mechanism-based concepts of size and maturity in pharmacokinetics. Annu Rev Pharmacol Toxicol. 2008;48:303-32.). The linear model should not be used for extrapolation from adults to younger ages.

If you would like me to help you build a more biological and evidence based model let me know. Do you have access to the original PK data?

Best wishes,

Nick

On 29-Sep-17 19:01, Sungpil Han wrote:

Nick,

Thanks for sharing your follow-up story.

A |caffPkparam()| function in the file |R/caffPkparam.R| contains how we calculate the clearance according to this paper https://link.springer.com/article/10.1007%2Fs00431-015-2581-x.

caffPkparam <- function(Weight,Dose,N = 20){ mgcv::rmvn(N,CaffMu,CaffSigma) %>% as_tibble() %>% select(eta1 = 1,eta2 = 2,eta3 = 3) %>% mutate(CL = 0.09792 Weight exp(eta1),# L/hr V = 0.7219 Weight exp(eta2),

TVV =THETA[2] (1 + ABSTTHETA[7]) [1] 0.7218775

        Ka  =  4.268  *  exp(eta3),# /hr
        Ke  =  CL  /  V,
        Tmax  =  (log(Ka)-  log(Ke))/  (Ka  -  Ke),
        Cmax  =  Dose  /  V  *  Ka  /  (Ka  -  Ke)*  (exp(-Ke  *  Tmax)-  exp(-Ka  *  Tmax)),
        AUC   =  Dose  /  CL,# mg/h/L
        Half_life  =  0.693  /  Ke) %>%
 mutate(subjid  =  row_number()) %>%
 select(subjid,Tmax,Cmax,AUC,Half_life,CL,V,Ka,Ke)

}

An information regarding |CaffMu| and |CaffSigma| is in |data-raw/use_data.R|.

CaffSigma <- matrix(c(0.1599,6.095e-2,9.650e-2, 6.095e-2,4.746e-2,1.359e-2, 9.650e-2,1.359e-2,1.004),nrow = 3) CaffMu <- c(0,0,0)

Hope this helps and it would be definitely interesting (and meaningful) if the similar approach can be applied to the caffeine PK in neonates.

Regards, Sungpil

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/asancpt/caffsim/issues/1#issuecomment-333038471, or mute the thread https://github.com/notifications/unsubscribe-auth/AZHNQBugHXOc5APs6CZsk4bmUEH4WRY2ks5snIe8gaJpZM4PoBsz.

-- Nick Holford, Professor Clinical Pharmacology Dept Pharmacology & Clinical Pharmacology, Bldg 503 Room 302A University of Auckland,85 Park Rd,Private Bag 92019,Auckland,New Zealand office:+64(9)923-6730 mobile:NZ+64(21)46 23 53 FR+33(6)62 32 46 72 email: n.holford@auckland.ac.nz http://holford.fmhs.auckland.ac.nz/ http://orcid.org/0000-0002-4031-2514 Read the question, answer the question, attempt all questions