Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing endpoint #754

Merged
merged 5 commits into from
Aug 6, 2024
Merged

Missing endpoint #754

merged 5 commits into from
Aug 6, 2024

Conversation

mattfidler
Copy link
Member

@mattfidler mattfidler commented Aug 6, 2024

In the example below I'm trying to extract the endpoint from the rxode2 object. I believe the model should have one endpoint and it should be tumorVol. However it's not being found/discovered. Instead it just gives me character(0).

library(rxode2)
library(nlmixr2)

oncology_sdm_lobo_2002 <- function() {
  description <- "Signal transduction model for delayed concentration effects on cancer cell growth"
  reference <- "Lobo ED, Balthasar JP. Pharmacodynamic modeling of chemotherapeutic effects: Application of a transit compartment model to characterize methotrexate effects in vitro. AAPS J. 2002;4(4):212-222. doi:10.1208/ps040442"
  depends<-"Cc"
  units<-list(time="hr")
  # Values for lkng, ltau, lec50, and kmax are for methotrexate from Lobo 2002,
  # Table 2.  propErr and addErr are added as reasonable values though not from
  # Lobo 2002 where no value is apparent in the paper.
  ini({
    lkng <- log(0.02) ; label("Cell net growth rate (growth minus death) (1/hr)")
    ltau <- log(34.1) ; label("Mean transit time of each transit compartment (hr)")
    lec50 <- log(0.1) ; label("Drug concentration reducing the cell growth by 50% (ug/mL)")
    kmax <- 0.29 ; label("Maximum drug-related reduction in cell growth (1/hr)")

    tumorVolpropSd <- c(0, 0.3) ; label("Proportional residual error (fraction)")
    tumorVoladdSd <- c(0, 50, 1000) ; label("Additive residual error (tumor volume units)")
  })
  model({
    # Cc is the drug concentration
    kng <- exp(lkng)
    tau <- exp(ltau)
    ec50 <- exp(lec50)

    drugEffectTumorVol <- kmax*Cc/(ec50 + Cc)

    tumorVol(0) <- tumorVol0
    d/dt(tumorVol) <- kng*tumorVol - transit4*tumorVol
    d/dt(transit1) <- (drugEffectTumorVol - transit1)/tau
    d/dt(transit2) <- (transit1 - transit2)/tau
    d/dt(transit3) <- (transit2 - transit3)/tau
    d/dt(transit4) <- (transit3 - transit4)/tau
    tumorVol ~ prop(tumorVolpropSd) + add(tumorVoladdSd)
  })
}

rx_obj = rxode2::rxode2(oncology_sdm_lobo_2002)

rx_obj$params$output$endpoint
sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] nlmixr2_2.1.2     nlmixr2data_2.0.9 rxode2_2.1.3     

loaded via a namespace (and not attached):
 [1] utf8_1.2.4          generics_0.1.3      lattice_0.22-6     
 [4] digest_0.6.36       magrittr_2.0.3      grid_4.4.0         
 [7] rxode2random_2.1.1  fastmap_1.2.0       lotri_0.4.3        
[10] backports_1.5.0     nlmixr2est_2.2.2    fansi_1.0.6        
[13] scales_1.3.0        lazyeval_0.2.2      RApiSerialize_0.1.3
[16] cli_3.6.3           crayon_1.5.3        rlang_1.1.4        
[19] symengine_0.2.6     munsell_0.5.1       cachem_1.1.0       
[22] rxode2et_2.0.13     qs_0.26.3           tools_4.4.0        
[25] rxode2parse_2.0.19  nlmixr2plot_2.0.9   lbfgsb3c_2024-3.4  
[28] memoise_2.0.1       checkmate_2.3.1     dplyr_1.1.4        
[31] colorspace_2.1-0    ggplot2_3.5.1       n1qn1_6.0.1-11     
[34] vctrs_0.6.5         R6_2.5.1            lifecycle_1.0.4    
[37] stringfish_0.16.0   PreciseSums_0.6     pkgconfig_2.0.3    
[40] RcppParallel_5.1.7  rex_1.2.1           pillar_1.9.0       
[43] gtable_0.3.5        data.table_1.15.4   glue_1.7.0         
[46] Rcpp_1.0.12         xfun_0.45           tibble_3.2.1       
[49] tidyselect_1.2.1    sys_3.4.2           knitr_1.47         
[52] dparser_1.3.1-11    nlme_3.1-164        compiler_4.4.0 

@mattfidler
Copy link
Member

@john-harrold as far as I know you are the only one who uses this interface (and I don't think it has been released publicly yet).

With that being said there is an unfortunate collision between this property and the low level $params which has a totally different meaning.

This is moving to props with this change.

@mattfidler
Copy link
Member

I'm unsure why changing the issue to a pull request changes the author.

Anyway, this should fix the issue. Once there is a successful check I will merge.

@mattfidler mattfidler merged commit 356e55e into main Aug 6, 2024
6 of 7 checks passed
@mattfidler mattfidler deleted the 754-missing-endpoint branch August 6, 2024 18:28
@john-harrold
Copy link
Author

I'm pretty sure I'm using the one on CRAN so I think it's live, but I'm probably the only one who really knows its there. And I'm also probably one of the few people dong this kind of thing. I wrapped most of this in a function because I thought it might change. So I will only have update in a few places :).

@mattfidler
Copy link
Member

That is good 😄 thank you for your understanding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants