├── .Rbuildignore ├── .gitignore ├── readme_images ├── vignette_01.PNG ├── vignette_02.PNG ├── vignette_03.PNG ├── vignette_04.PNG ├── vignette_05.PNG ├── vignette_06.PNG ├── vignette_07.PNG ├── vignette_08.PNG ├── vignette_09.PNG ├── vignette_10.PNG ├── vignette_11.PNG └── vignette_12.PNG ├── NAMESPACE ├── R ├── nonmem2mrgsolve-package.R ├── utils-pipe.R ├── writemrgsolve.R ├── misc_helpers.R ├── nonmem2mrgsolve.R ├── load_nonmem.R └── get_blocks.R ├── nonmem2mrgsolve.Rproj ├── man ├── pipe.Rd ├── load_ctl.Rd ├── writemrgsolve.Rd ├── nonmem2mrgsolve-package.Rd ├── load_ext.Rd └── nonmem2mrgsolve.Rd ├── vignette └── models │ ├── drugx-oral-1cmt-101 │ ├── run_nonmem2mrgsolve_drugx.R │ ├── mrgsolve_code_drugx-oral.R │ ├── mod1.ctl │ ├── mod1.ext │ └── mod1.lst │ ├── evolocumab-tmdd-qss-pkpd-101 │ ├── run_nonmem2mrgsolve_evolocumab.R │ ├── mrgsolve_code_evolocumab-tmdd.R │ ├── mrgsolve_code_evolocumab-tmdd_user-modified.R │ ├── mod1.ctl │ └── mod1.ext │ └── mavoglurant-pbpk-101 │ ├── run_nonmem2mrgsolve_mavoglurant.R │ ├── mrgsolve_code_mavoglurant-pbpk.R │ ├── mrgsolve_code_mavoglurant-pbpk_user-modified.R │ ├── mod1.ctl │ └── mod1.ext ├── DESCRIPTION ├── .github └── workflows │ └── r.yml ├── README.Rmd ├── README.md └── LICENSE /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | -------------------------------------------------------------------------------- /readme_images/vignette_01.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_01.PNG -------------------------------------------------------------------------------- /readme_images/vignette_02.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_02.PNG -------------------------------------------------------------------------------- /readme_images/vignette_03.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_03.PNG -------------------------------------------------------------------------------- /readme_images/vignette_04.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_04.PNG -------------------------------------------------------------------------------- /readme_images/vignette_05.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_05.PNG -------------------------------------------------------------------------------- /readme_images/vignette_06.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_06.PNG -------------------------------------------------------------------------------- /readme_images/vignette_07.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_07.PNG -------------------------------------------------------------------------------- /readme_images/vignette_08.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_08.PNG -------------------------------------------------------------------------------- /readme_images/vignette_09.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_09.PNG -------------------------------------------------------------------------------- /readme_images/vignette_10.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_10.PNG -------------------------------------------------------------------------------- /readme_images/vignette_11.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_11.PNG -------------------------------------------------------------------------------- /readme_images/vignette_12.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy00000000000/nonmem2mrgsolve/HEAD/readme_images/vignette_12.PNG -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export("%>%") 4 | export(load_ctl) 5 | export(load_ext) 6 | export(nonmem2mrgsolve) 7 | export(writemrgsolve) 8 | importFrom(magrittr,"%>%") 9 | -------------------------------------------------------------------------------- /R/nonmem2mrgsolve-package.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | #' @aliases nonmem2mrgsolve-package 3 | "_PACKAGE" 4 | 5 | # The following block is used by usethis to automatically manage 6 | # roxygen namespace tags. Modify with care! 7 | ## usethis namespace: start 8 | ## usethis namespace: end 9 | NULL 10 | -------------------------------------------------------------------------------- /R/utils-pipe.R: -------------------------------------------------------------------------------- 1 | #' Pipe operator 2 | #' 3 | #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 4 | #' 5 | #' @name %>% 6 | #' @rdname pipe 7 | #' @keywords internal 8 | #' @export 9 | #' @importFrom magrittr %>% 10 | #' @usage lhs \%>\% rhs 11 | #' @param lhs A value or the magrittr placeholder. 12 | #' @param rhs A function call using the magrittr semantics. 13 | #' @return The result of calling `rhs(lhs)`. 14 | NULL 15 | -------------------------------------------------------------------------------- /nonmem2mrgsolve.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils-pipe.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \arguments{ 10 | \item{lhs}{A value or the magrittr placeholder.} 11 | 12 | \item{rhs}{A function call using the magrittr semantics.} 13 | } 14 | \value{ 15 | The result of calling `rhs(lhs)`. 16 | } 17 | \description{ 18 | See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /vignette/models/drugx-oral-1cmt-101/run_nonmem2mrgsolve_drugx.R: -------------------------------------------------------------------------------- 1 | ## Start #### 2 | 3 | # devtools::install_github("Andy00000000000/nonmem2mrgsolve") 4 | # setwd("...") 5 | 6 | library("nonmem2mrgsolve") 7 | 8 | nonmem2mrgsolve( 9 | "mod1.ctl", # filename 10 | "./vignette/models/drugx-oral-1cmt-101/", # dir 11 | out.filename = "mrgsolve_code_drugx-oral", 12 | sigdig = 3 13 | ) 14 | 15 | source("./vignette/models/drugx-oral-1cmt-101/mrgsolve_code_drugx-oral.R") 16 | mrgsolve::mcode("Test_Unmodified_Translation",code) 17 | 18 | # Shortcomings of the current translation which requires the user's attention: 19 | # 20 | # None, this model translates exactly as needed 21 | 22 | ## End #### 23 | -------------------------------------------------------------------------------- /man/load_ctl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/load_nonmem.R 3 | \name{load_ctl} 4 | \alias{load_ctl} 5 | \title{Load NONMEM ctl (or mod) file into R} 6 | \usage{ 7 | load_ctl(filename = NULL, dir = "") 8 | } 9 | \arguments{ 10 | \item{filename}{String of the NONMEM model name without the .ctl (or .mod) extension} 11 | 12 | \item{dir}{String of the directory path to the NONMEM run files} 13 | } 14 | \value{ 15 | R dataframe of the NONMEM ctl (or mod) file 16 | } 17 | \description{ 18 | Loads the NONMEM ctl (or mod) file into R for translation to mrgsolve format. 19 | } 20 | \examples{ 21 | # load_ctl(filename = "nonmem-model", dir = "path/to/directory/") 22 | 23 | } 24 | -------------------------------------------------------------------------------- /man/writemrgsolve.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/writemrgsolve.R 3 | \name{writemrgsolve} 4 | \alias{writemrgsolve} 5 | \title{Write the mrgsolve code to an R file} 6 | \usage{ 7 | writemrgsolve(mrg_code = NULL, filename = "mrgsolve_code0", dir = NULL) 8 | } 9 | \arguments{ 10 | \item{mrg_code}{Dataframe of the NONMEM model translated into mrgsolve code} 11 | 12 | \item{filename}{String of the name for the mrgsolve output file without the .R extension} 13 | 14 | \item{dir}{String of the directory path to the NONMEM run files} 15 | } 16 | \value{ 17 | R file of the mrgsolve code 18 | } 19 | \description{ 20 | Writes the mrgsolve code, translated from the input NONMEM run, to an R file. 21 | } 22 | \examples{ 23 | # writemrgsolve() 24 | 25 | } 26 | -------------------------------------------------------------------------------- /man/nonmem2mrgsolve-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nonmem2mrgsolve-package.R 3 | \docType{package} 4 | \name{nonmem2mrgsolve-package} 5 | \alias{nonmem2mrgsolve-package} 6 | \alias{_PACKAGE} 7 | \title{nonmem2mrgsolve: Automated NONMEM to mrgsolve Translation} 8 | \description{ 9 | This package is intended to streamline the modeling and simulation process for PK and PK-PD applications by translating NONMEM models to mrgsolve syntax. It currently does not encompass all NONMEM use cases, and as such modifications to the output mrgsolve code may be neccessary. There is no guarantee to the accuracy of the translation. It remains the responsibility of the user to perform validation of the resulting mrgsolve code. 10 | } 11 | \keyword{internal} 12 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: nonmem2mrgsolve 2 | Type: Package 3 | Title: Automated NONMEM to mrgsolve Translation 4 | Version: 1.2.0 5 | Author: Andrew Santulli 6 | Maintainer: Andrew Santulli 7 | Description: This package is intended to streamline the modeling and simulation process for PK and PK-PD applications by translating NONMEM models to mrgsolve syntax. It currently does not encompass all NONMEM use cases, and as such modifications to the output mrgsolve code may be neccessary. There is no guarantee to the accuracy of the translation. It remains the responsibility of the user to perform validation of the resulting mrgsolve code. 8 | License: GPL (>=2) 9 | Encoding: UTF-8 10 | LazyData: true 11 | Depends: 12 | R (>= 4.1.0) 13 | Imports: 14 | dplyr (>= 1.0.7), 15 | stringr (>= 1.4.0), 16 | stringi (>= 1.6.2), 17 | zoo (>= 1.8-9), 18 | magrittr 19 | Exports: 20 | load_ctl, 21 | load_ext, 22 | nonmem2mrgsolve, 23 | writemrgsolve 24 | RoxygenNote: 7.1.1 25 | -------------------------------------------------------------------------------- /man/load_ext.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/load_nonmem.R 3 | \name{load_ext} 4 | \alias{load_ext} 5 | \title{Load NONMEM ext file into R} 6 | \usage{ 7 | load_ext(filename = NULL, dir = "", sigdig = -1, use.cnv = F) 8 | } 9 | \arguments{ 10 | \item{filename}{String of the NONMEM model name without the .ext extension} 11 | 12 | \item{dir}{String of the directory path to the NONMEM run files} 13 | 14 | \item{sigdig}{Numeric of the number of significant digits to round non-fixed thetas and etas to; -1 for no rounding} 15 | 16 | \item{use.cnv}{Logical for whether to use the NONMEM cnv file for final parameter estimates instead of the ext file (\code{T} or \code{F})} 17 | } 18 | \value{ 19 | R list of the NONMEM final OFV, parameter estimates, and IIV magnitudes 20 | } 21 | \description{ 22 | Loads the NONMEM ext file into R for capture of the final estimates. 23 | } 24 | \examples{ 25 | load_ext(filename = "nonmem-model", dir = "path/to/directory/") 26 | 27 | } 28 | -------------------------------------------------------------------------------- /vignette/models/evolocumab-tmdd-qss-pkpd-101/run_nonmem2mrgsolve_evolocumab.R: -------------------------------------------------------------------------------- 1 | ## Start #### 2 | 3 | # devtools::install_github("Andy00000000000/nonmem2mrgsolve") 4 | # setwd("...") 5 | 6 | library("nonmem2mrgsolve") 7 | 8 | nonmem2mrgsolve( 9 | "mod1.ctl", # filename 10 | "./vignette/models/evolocumab-tmdd-qss-pkpd-101/", # dir 11 | out.filename = "mrgsolve_code_evolocumab-tmdd" 12 | ) 13 | 14 | source("./vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd.R") 15 | mrgsolve::mcode("Test_Unmodified_Translation",code) 16 | 17 | source("./vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd_user-modified.R") 18 | mrgsolve::mcode("Test_Modified_Translation",code) 19 | 20 | # Shortcomings of the current translation which requires the user's attention: 21 | # 22 | # Line 69: This line needs to be manually changed by the user 23 | # 1) Rename "TIME" to "SOLVERTIME" (since nonmem2mrgsolve does not currently translate reserved time-related variables) 24 | 25 | ## End #### 26 | -------------------------------------------------------------------------------- /vignette/models/mavoglurant-pbpk-101/run_nonmem2mrgsolve_mavoglurant.R: -------------------------------------------------------------------------------- 1 | ## Start #### 2 | 3 | # devtools::install_github("Andy00000000000/nonmem2mrgsolve") 4 | # setwd("...") 5 | 6 | library("nonmem2mrgsolve") 7 | 8 | nonmem2mrgsolve( 9 | "mod1.ctl", # filename 10 | "./vignette/models/mavoglurant-pbpk-101/", # dir 11 | out.filename = "mrgsolve_code_mavoglurant-pbpk", 12 | sigdig = 2 13 | ) 14 | 15 | source("./vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk.R") 16 | mrgsolve::mcode("Test_Unmodified_Translation",code) 17 | 18 | source("./vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk_user-modified.R") 19 | mrgsolve::mcode("Test_Modified_Translation",code) 20 | 21 | # Shortcomings of the current translation which requires the user's attention: 22 | # 23 | # Line 42: This line needs to be manually changed by the user 24 | # 1) Rename "RATE" to a non-reserved term such as "INRATE" 25 | # 2) Add "INRATE" to $PARAM 26 | # 3) Pass "INRATE" into the mrgsolve simulation using either param(INRATE = ...) or data_set() 27 | 28 | ## End #### 29 | -------------------------------------------------------------------------------- /R/writemrgsolve.R: -------------------------------------------------------------------------------- 1 | ## FUNCTION WRITE MRGSOLVE #### 2 | 3 | #' Write the mrgsolve code to an R file 4 | #' 5 | #' Writes the mrgsolve code, translated from the input NONMEM run, to an R file. 6 | #' 7 | #' @param mrg_code Dataframe of the NONMEM model translated into mrgsolve code 8 | #' @param filename String of the name for the mrgsolve output file without the .R extension 9 | #' @param dir String of the directory path to the NONMEM run files 10 | #' 11 | #' @return R file of the mrgsolve code 12 | #' 13 | #' @examples 14 | #' # writemrgsolve() 15 | #' 16 | #' @export 17 | writemrgsolve <- function(mrg_code = NULL, filename = "mrgsolve_code0", dir = NULL){ 18 | 19 | tdir <- ifelse(is.na(dir) | is.null(dir), "", paste0(dir,"/")) 20 | nme_pth <- paste0(tdir,filename,".R") 21 | 22 | file <- file(nme_pth) 23 | 24 | cat("code <- ' ",file=nme_pth,sep="\n\n") 25 | 26 | for(i in 1:nrow(mrg_code)){ 27 | cat(mrg_code[i,"V1"],file=nme_pth,sep = "\n",append=TRUE) 28 | } 29 | 30 | cat("'",file=nme_pth,append = T) 31 | 32 | close(file) 33 | 34 | print("Mrgsolve Code was Saved to an R File") 35 | } 36 | 37 | ## END #### 38 | -------------------------------------------------------------------------------- /.github/workflows/r.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | # 6 | # See https://github.com/r-lib/actions/tree/master/examples#readme for 7 | # additional example workflows available for the R community. 8 | 9 | name: R 10 | 11 | on: 12 | push: 13 | branches: [ main ] 14 | pull_request: 15 | branches: [ main ] 16 | 17 | jobs: 18 | build: 19 | runs-on: macos-latest 20 | strategy: 21 | matrix: 22 | r-version: ['4.1.1'] 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | - name: Set up R ${{ matrix.r-version }} 27 | uses: r-lib/actions/setup-r@f57f1301a053485946083d7a45022b278929a78a 28 | with: 29 | r-version: ${{ matrix.r-version }} 30 | - name: Install dependencies 31 | run: | 32 | install.packages(c("remotes", "rcmdcheck")) 33 | remotes::install_deps(dependencies = TRUE) 34 | shell: Rscript {0} 35 | - name: Check 36 | run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") 37 | shell: Rscript {0} 38 | -------------------------------------------------------------------------------- /R/misc_helpers.R: -------------------------------------------------------------------------------- 1 | ## Miscellaneous Helper Functions #### 2 | 3 | ## FUNCTION BLANK ROW #### 4 | 5 | blank_df <- function(){ 6 | return(data.frame(V1 = "")) 7 | } 8 | 9 | ## FUNCTION MATCH PARENTHESES #### 10 | 11 | par_match <- function(data = NULL, colnme = "V1", openChar = "\\(", closedChar = "\\)"){ 12 | 13 | unlist(lapply(1:length(data[,colnme]), function(i){ # locate chr index of open and closed parentheses 14 | 15 | open <- stringr::str_locate_all(data[i,colnme], openChar)[[1]][,1] # start and end are identical since ( is 1 chr 16 | closed <- stringr::str_locate_all(data[i,colnme], closedChar)[[1]][,1] 17 | 18 | all <- data.frame(ALL = c(open,closed), OPEN = c(rep(1,length(open)), rep(0, length(closed))))%>% # combine open and closed parentheses and order 19 | dplyr::arrange(ALL) 20 | 21 | count <- 1 22 | iter <- 2 23 | 24 | while(iter <= length(all$ALL) & count != 0){ # find closing parenthesis of first open, since first open should always be if statement 25 | if(all[iter,"OPEN"] == 1){ 26 | count <- count+1 27 | }else{ 28 | count <- count-1 29 | } 30 | if(count == 0){ 31 | match_close <- all[iter,"ALL"] 32 | } 33 | iter <- iter+1 34 | } 35 | 36 | return(match_close) 37 | })) 38 | } 39 | 40 | ## END #### 41 | -------------------------------------------------------------------------------- /vignette/models/drugx-oral-1cmt-101/mrgsolve_code_drugx-oral.R: -------------------------------------------------------------------------------- 1 | code <- ' 2 | $PROB ev_no-delay_first-order_one-compartment_linear 3 | 4 | $PARAM 5 | 6 | WTKG=NA_real_ 7 | 8 | $THETA 9 | 10 | 0.782 17.3 85.8 1.85 1.58 11 | 12 | $CMT 13 | 14 | DEPOT 15 | CENTRAL 16 | 17 | $MAIN 18 | 19 | /* NOTE: There is no guarantee to the accuracy of the NONMEM to mrgsolve translator. It remains the responsibility of the user to validate the resulting mrgsolve code. */ 20 | 21 | /* NOTE: The nonmem2mrgsolve package remains in active development, please report bugs and feature requests to improve future versions. */ 22 | /* NOTE: If you find nonmem2mrgsolve helpful, please consider giving it a star at github.com/Andy00000000000/nonmem2mrgsolve. */ 23 | 24 | /* NOTE: The translator does not currently convert T or TIME to SOLVERTIME. */ 25 | /* NOTE: The translator does not currently convert MTIME() to self.mtime(). */ 26 | 27 | double TVKA = THETA1; 28 | double KA = TVKA; 29 | double TVCL = THETA2*pow((WTKG/71.0),THETA4); 30 | double CL = TVCL*exp(ETA(1)); 31 | double TVV = THETA3*pow((WTKG/71.0),THETA5); 32 | double V = TVV*exp(ETA(2)); 33 | double S2 = V; 34 | 35 | $ODE 36 | 37 | dxdt_DEPOT=-KA*DEPOT; 38 | dxdt_CENTRAL=KA*DEPOT - (CL/V)*CENTRAL; 39 | 40 | $OMEGA @block 41 | 42 | 0.0105 43 | 0 0.00765 44 | 45 | $CAPTURE 46 | 47 | KA 48 | CL 49 | V 50 | WTKG 51 | 52 | ' -------------------------------------------------------------------------------- /vignette/models/drugx-oral-1cmt-101/mod1.ctl: -------------------------------------------------------------------------------- 1 | $PROB ev_no-delay_first-order_one-compartment_linear 2 | 3 | $INPUT ID TIME EVID AMT DV RACEN WTKG Race=DROP 4 | 5 | $DATA "../../data/F1003-Asian-PK-Study.csv" IGNORE=@ 6 | 7 | $SUBROUTINES ADVAN13 TRANS1 TOL=9 SUBROUTINES=D 8 | 9 | $MODEL 10 | COMP=(DEPOT,DEFDOSE) 11 | COMP=(CENTRAL,DEFOBS) 12 | 13 | $PK 14 | 15 | TVKA = THETA(1) 16 | KA = TVKA 17 | 18 | TVCL = THETA(2)*(WTKG/71.0)**THETA(4) 19 | CL = TVCL*EXP(ETA(1)) 20 | 21 | TVV = THETA(3)*(WTKG/71.0)**THETA(5) 22 | V = TVV*EXP(ETA(2)) 23 | S2 = V 24 | 25 | $DES 26 | 27 | DADT(1) = -KA*A(1) 28 | DADT(2) = KA*A(1) - (CL/V)*A(2) 29 | 30 | $ERROR 31 | 32 | IPRED = F 33 | IRES = DV-IPRED 34 | W = SQRT(IPRED**2*SIGMA(1,1)) 35 | IWRES = IRES/W 36 | Y = F + F*EPS(1) 37 | 38 | $THETA 39 | (0, 0.783) ; KA ; 1/hr ; Absorption Rate Constant 40 | (0, 17.3) ; CL ; L/hr ; Clearance 41 | (0, 84.0) ; V ; L ; Volume of Distribution 42 | (1.83) ; WTonCL 43 | (1) ; WTonV 44 | 45 | $OMEGA BLOCK(2) 46 | 0.0103 ; CL 47 | 0.00 0.111 ; V 48 | 49 | $SIGMA 50 | 0.0206 ; Proportional 51 | 52 | $ESTIMATION METHOD=1 INTER NOABORT MAXEVAL=9999 PRINT=5 NSIG=3 SIGL=9 NOTHETABOUNDTEST 53 | NOOMEGABOUNDTEST NOSIGMABOUNDTEST 54 | 55 | $COVARIANCE PRINT=E UNCONDITIONAL 56 | 57 | $TABLE ID TIME DV MDV EVID IPRED CWRES IWRES ONEHEADER NOPRINT FILE=sdtab1 58 | $TABLE ID KA CL V ETAS(1:LAST) ONEHEADER NOPRINT FILE=patab1 ; model parameters 59 | $TABLE ID RACEN ONEHEADER NOPRINT FILE=catab1 ; categorical covariates 60 | $TABLE ID WTKG ONEHEADER NOPRINT FILE=cotab1 ; continuous covariates -------------------------------------------------------------------------------- /man/nonmem2mrgsolve.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nonmem2mrgsolve.R 3 | \name{nonmem2mrgsolve} 4 | \alias{nonmem2mrgsolve} 5 | \title{Automated NONMEM to mrgsolve Translation} 6 | \usage{ 7 | nonmem2mrgsolve( 8 | filename = NULL, 9 | dir = NULL, 10 | sigdig = NULL, 11 | write = T, 12 | return.orig = F, 13 | out.filename = NULL, 14 | use.cnv = F 15 | ) 16 | } 17 | \arguments{ 18 | \item{filename}{String of the NONMEM model name with or without the .ctl (or .mod) extension} 19 | 20 | \item{dir}{String of the directory path to the NONMEM files (if not already given in the filename input; or if the working directory was not already set)} 21 | 22 | \item{sigdig}{Numeric of the number of significant digits to round non-fixed thetas and etas to; default NULL for no rounding} 23 | 24 | \item{write}{Logical for whether to write the mrgsolve code to an R file (\code{T} or \code{F})} 25 | 26 | \item{return.orig}{Logical for whether to output the original NONMEM ctl and ext files (\code{T} or \code{F})} 27 | 28 | \item{out.filename}{String of the name for the mrgsolve output file without the .R extension} 29 | 30 | \item{use.cnv}{Logical for whether to use the NONMEM cnv file for final parameter estimates instead of the ext file (\code{T} or \code{F})} 31 | } 32 | \value{ 33 | R dataframe of the mrgsolve code 34 | } 35 | \description{ 36 | Translates a NONMEM model into mrgsolve syntax using the NONMEM ctl and ext (or cnv) files. 37 | } 38 | \examples{ 39 | # setwd("path/to/directory") 40 | # nonmem2mrgsolve::nonmem2mrgsolve(filename = "nonmem-model.ctl") 41 | 42 | } 43 | -------------------------------------------------------------------------------- /vignette/models/drugx-oral-1cmt-101/mod1.ext: -------------------------------------------------------------------------------- 1 | TABLE NO. 1: First Order Conditional Estimation with Interaction: Goal Function=MINIMUM VALUE OF OBJECTIVE FUNCTION: Problem=1 Subproblem=0 Superproblem1=0 Iteration1=0 Superproblem2=0 Iteration2=0 2 | ITERATION THETA1 THETA2 THETA3 THETA4 THETA5 SIGMA(1,1) OMEGA(1,1) OMEGA(2,1) OMEGA(2,2) OBJ 3 | 0 7.83000E-01 1.73000E+01 8.40000E+01 1.83000E+00 1.00000E+00 2.06000E-02 1.03000E-02 0.00000E+00 1.11000E-01 -6481.6169580283204 4 | 5 8.24248E-01 1.73750E+01 8.96435E+01 1.94188E+00 2.10747E+00 2.06426E-02 1.04061E-02 0.00000E+00 1.60329E-02 -6548.9249358333400 5 | 10 7.92543E-01 1.73453E+01 8.52719E+01 1.90968E+00 1.56732E+00 2.04539E-02 8.74251E-03 0.00000E+00 6.86312E-03 -6639.5236031714330 6 | 15 7.82387E-01 1.73376E+01 8.58244E+01 1.85049E+00 1.58069E+00 2.05904E-02 1.04557E-02 0.00000E+00 7.65757E-03 -6645.4469074892349 7 | 20 7.82421E-01 1.73383E+01 8.58298E+01 1.85120E+00 1.58107E+00 2.05894E-02 1.04605E-02 0.00000E+00 7.64910E-03 -6645.4473027426147 8 | -1000000000 7.82421E-01 1.73383E+01 8.58298E+01 1.85120E+00 1.58107E+00 2.05894E-02 1.04605E-02 0.00000E+00 7.64910E-03 -6645.4473027426147 9 | -1000000001 9.55997E-03 1.93321E-01 9.54265E-01 5.61044E-02 5.84250E-02 7.76336E-04 1.36722E-03 1.00000E+10 1.31867E-03 0.0000000000000000 10 | -1000000002 4.51179E-01 5.49913E-01 7.17197E-01 7.69389E-01 1.03896E+00 1.11635E+00 1.58770E+00 1.76931E+00 0.00000E+00 0.0000000000000000 11 | -1000000003 3.92154E+00 4.51179E-01 1.76931E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.0000000000000000 12 | -1000000004 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.43490E-01 1.02277E-01 0.00000E+00 8.74592E-02 0.0000000000000000 13 | -1000000005 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 2.70519E-03 6.68392E-03 1.00000E+10 7.53879E-03 0.0000000000000000 14 | -1000000006 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E+00 0.00000E+00 0.0000000000000000 15 | -1000000007 0.00000E+00 3.70000E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.0000000000000000 16 | -1000000008 3.86702E-02 4.70410E-03 -5.81470E-04 5.38516E-02 3.02526E-02 -7.78857E-01 -3.12890E-01 0.00000E+00 -6.59977E-01 0.0000000000000000 17 | -------------------------------------------------------------------------------- /vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd.R: -------------------------------------------------------------------------------- 1 | code <- ' 2 | $PROB Simultaneous PKPD of the human anti-PCSK9 mAb evolocumab 3 | 4 | $PARAM 5 | 6 | HEALTHY=NA_real_ 7 | 8 | $THETA 9 | 10 | 0.227505 2.71313 0.276166 2.11422 5.88232 0.265911 0.0528221 0.58245 0.72 0.304556 113.171 1 1.40841 11 | 12 | $CMT 13 | 14 | DEPOT 15 | TDA 16 | TLC 17 | CLDL 18 | 19 | $MAIN 20 | 21 | /* NOTE: There is no guarantee to the accuracy of the NONMEM to mrgsolve translator. It remains the responsibility of the user to validate the resulting mrgsolve code. */ 22 | 23 | /* NOTE: The nonmem2mrgsolve package remains in active development, please report bugs and feature requests to improve future versions. */ 24 | /* NOTE: If you find nonmem2mrgsolve helpful, please consider giving it a star at github.com/Andy00000000000/nonmem2mrgsolve. */ 25 | 26 | /* NOTE: The translator does not currently convert T or TIME to SOLVERTIME. */ 27 | /* NOTE: The translator does not currently convert MTIME() to self.mtime(). */ 28 | 29 | /* CALLFL=-2; */ 30 | double TVKA = THETA1; 31 | double KA = TVKA*exp(ETA(1)); 32 | double TVV = THETA2; 33 | double V = TVV*exp(ETA(2)); 34 | double TVCL = THETA3; 35 | double CL = TVCL*exp(ETA(3)); 36 | double TVKDEG = THETA4; 37 | double KDEG = TVKDEG*exp(ETA(4)); 38 | double TVPCSK9_0 = THETA5*pow(THETA8,(HEALTHY)); 39 | double PCSK9_0 = TVPCSK9_0*exp(ETA(5)); 40 | double TVKSS = THETA6; 41 | double KSS = TVKSS*exp(ETA(6)); 42 | double TVKINT = THETA7; 43 | double KINT = TVKINT*exp(ETA(7)); 44 | double KEL = CL/V; 45 | double KSYN = KDEG*PCSK9_0; 46 | F_DEPOT=THETA9; 47 | TLC_0=PCSK9_0; 48 | double TVKOUT = THETA10; 49 | double KOUT = TVKOUT*exp(ETA(8)); 50 | double TVLDLC_0 = THETA11; 51 | double LDLC_0 = TVLDLC_0*exp(ETA(9)); 52 | double TVIMAX = THETA12; 53 | double IMAX = TVIMAX*exp(ETA(10)); 54 | double TVIC50 = THETA13; 55 | double IC50 = TVIC50*exp(ETA(11)); 56 | double INH0 = (IMAX*PCSK9_0)/(IC50+PCSK9_0); 57 | double KIN = KOUT*(1.0-INH0)*LDLC_0; 58 | CLDL_0=LDLC_0; 59 | 60 | $ODE 61 | 62 | double TDC=TDA/V; 63 | double FDC=0.5*((TDC-TLC-KSS) + sqrt(pow((TDC-TLC-KSS),2.0 )+ 4.0*KSS*TDC)); 64 | double FLC=TLC - (TDC - FDC); 65 | dxdt_DEPOT=-KA*DEPOT; 66 | dxdt_TDA=KA*DEPOT - KEL*FDC*V - (KINT*TLC*FDC*V)/(KSS+FDC); 67 | dxdt_TLC=KSYN - KDEG*TLC - ((KINT-KDEG)*FDC*TLC)/(KSS+FDC); 68 | double INH=(IMAX*PCSK9_0)/(IC50+PCSK9_0); 69 | if(TIME>0){ 70 | INH=(IMAX*FLC)/(IC50+FLC); 71 | } 72 | dxdt_CLDL=KIN - KOUT*(1.0-INH)*CLDL; 73 | 74 | $OMEGA @block 75 | 76 | 0.0709136 77 | 0 0.0402987 78 | 0 0 0.11236 79 | 0 0 0 0 80 | 0 0 0 0 0.041995 81 | 0 0 0 0 0 0.0869048 82 | 0 0 0 0 0 0 0 83 | 0 0 0 0 0 0 0 0 84 | 0 0 0 0 0 0 0 0 0.0375891 85 | 0 0 0 0 0 0 0 0 0 0 86 | 0 0 0 0 0 0 0 0 0 0 0.127478 87 | 88 | $CAPTURE 89 | 90 | KA 91 | V 92 | CL 93 | KDEG 94 | PCSK9_0 95 | KSS 96 | KINT 97 | KOUT 98 | LDLC_0 99 | IMAX 100 | IC50 101 | HEALTHY 102 | 103 | ' -------------------------------------------------------------------------------- /vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd_user-modified.R: -------------------------------------------------------------------------------- 1 | code <- ' 2 | $PROB Simultaneous PKPD of the human anti-PCSK9 mAb evolocumab 3 | 4 | $PARAM 5 | 6 | HEALTHY=NA_real_ 7 | 8 | $THETA 9 | 10 | 0.227505 2.71313 0.276166 2.11422 5.88232 0.265911 0.0528221 0.58245 0.72 0.304556 113.171 1 1.40841 11 | 12 | $CMT 13 | 14 | DEPOT 15 | TDA 16 | TLC 17 | CLDL 18 | 19 | $MAIN 20 | 21 | /* NOTE: There is no guarantee to the accuracy of the NONMEM to mrgsolve translator. It remains the responsibility of the user to validate the resulting mrgsolve code. */ 22 | 23 | /* NOTE: The nonmem2mrgsolve package remains in active development, please report bugs and feature requests to improve future versions. */ 24 | /* NOTE: If you find nonmem2mrgsolve helpful, please consider giving it a star at github.com/Andy00000000000/nonmem2mrgsolve. */ 25 | 26 | /* NOTE: The translator does not currently convert T or TIME to SOLVERTIME. */ 27 | /* NOTE: The translator does not currently convert MTIME() to self.mtime(). */ 28 | 29 | /* CALLFL=-2; */ 30 | double TVKA = THETA1; 31 | double KA = TVKA*exp(ETA(1)); 32 | double TVV = THETA2; 33 | double V = TVV*exp(ETA(2)); 34 | double TVCL = THETA3; 35 | double CL = TVCL*exp(ETA(3)); 36 | double TVKDEG = THETA4; 37 | double KDEG = TVKDEG*exp(ETA(4)); 38 | double TVPCSK9_0 = THETA5*pow(THETA8,(HEALTHY)); 39 | double PCSK9_0 = TVPCSK9_0*exp(ETA(5)); 40 | double TVKSS = THETA6; 41 | double KSS = TVKSS*exp(ETA(6)); 42 | double TVKINT = THETA7; 43 | double KINT = TVKINT*exp(ETA(7)); 44 | double KEL = CL/V; 45 | double KSYN = KDEG*PCSK9_0; 46 | F_DEPOT=THETA9; 47 | TLC_0=PCSK9_0; 48 | double TVKOUT = THETA10; 49 | double KOUT = TVKOUT*exp(ETA(8)); 50 | double TVLDLC_0 = THETA11; 51 | double LDLC_0 = TVLDLC_0*exp(ETA(9)); 52 | double TVIMAX = THETA12; 53 | double IMAX = TVIMAX*exp(ETA(10)); 54 | double TVIC50 = THETA13; 55 | double IC50 = TVIC50*exp(ETA(11)); 56 | double INH0 = (IMAX*PCSK9_0)/(IC50+PCSK9_0); 57 | double KIN = KOUT*(1.0-INH0)*LDLC_0; 58 | CLDL_0=LDLC_0; 59 | 60 | $ODE 61 | 62 | double TDC=TDA/V; 63 | double FDC=0.5*((TDC-TLC-KSS) + sqrt(pow((TDC-TLC-KSS),2.0 )+ 4.0*KSS*TDC)); 64 | double FLC=TLC - (TDC - FDC); 65 | dxdt_DEPOT=-KA*DEPOT; 66 | dxdt_TDA=KA*DEPOT - KEL*FDC*V - (KINT*TLC*FDC*V)/(KSS+FDC); 67 | dxdt_TLC=KSYN - KDEG*TLC - ((KINT-KDEG)*FDC*TLC)/(KSS+FDC); 68 | double INH=(IMAX*PCSK9_0)/(IC50+PCSK9_0); 69 | if(SOLVERTIME>0){ 70 | INH=(IMAX*FLC)/(IC50+FLC); 71 | } 72 | dxdt_CLDL=KIN - KOUT*(1.0-INH)*CLDL; 73 | 74 | $OMEGA @block 75 | 76 | 0.0709136 77 | 0 0.0402987 78 | 0 0 0.11236 79 | 0 0 0 0 80 | 0 0 0 0 0.041995 81 | 0 0 0 0 0 0.0869048 82 | 0 0 0 0 0 0 0 83 | 0 0 0 0 0 0 0 0 84 | 0 0 0 0 0 0 0 0 0.0375891 85 | 0 0 0 0 0 0 0 0 0 0 86 | 0 0 0 0 0 0 0 0 0 0 0.127478 87 | 88 | $CAPTURE 89 | 90 | KA 91 | V 92 | CL 93 | KDEG 94 | PCSK9_0 95 | KSS 96 | KINT 97 | KOUT 98 | LDLC_0 99 | IMAX 100 | IC50 101 | HEALTHY 102 | 103 | ' 104 | -------------------------------------------------------------------------------- /R/nonmem2mrgsolve.R: -------------------------------------------------------------------------------- 1 | ## FUNCTION MASTER #### 2 | 3 | #' Automated NONMEM to mrgsolve Translation 4 | #' 5 | #' Translates a NONMEM model into mrgsolve syntax using the NONMEM ctl (or mod) and ext (or cnv) files. 6 | #' 7 | #' @param filename String of the NONMEM model name with or without the .ctl (or .mod) extension 8 | #' @param dir String of the directory path to the NONMEM files (if not already given in the filename input; or if the working directory was not already set) 9 | #' @param sigdig Numeric of the number of significant digits to round non-fixed thetas and etas to; default NULL for no rounding 10 | #' @param write Logical for whether to write the mrgsolve code to an R file (\code{T} or \code{F}) 11 | #' @param return.orig Logical for whether to output the original NONMEM ctl (or mod) and ext (or cnv) files (\code{T} or \code{F}) 12 | #' @param out.filename String of the name for the mrgsolve output file without the .R extension 13 | #' @param use.cnv Logical for whether to use the NONMEM cnv file for final parameter estimates instead of the ext file (\code{T} or \code{F}) 14 | #' 15 | #' @return R dataframe of the mrgsolve code 16 | #' 17 | #' @examples 18 | #' # setwd("path/to/directory") 19 | #' # nonmem2mrgsolve::nonmem2mrgsolve(filename = "nonmem-model.ctl") 20 | #' 21 | #' @export 22 | nonmem2mrgsolve <- function(filename = NULL, dir = NULL, sigdig = NULL, write = T, return.orig = F, out.filename = NULL, use.cnv = F){ 23 | 24 | keep_block <- c("PROB", "PROBL", "PROBLEM", "INPUT", "MODEL", "PK", "DES", "TABLE") 25 | 26 | in.filename <- gsub("\\.ctl","",filename) 27 | in.filename <- gsub("\\.mod","",in.filename) 28 | 29 | tsigdig <- ifelse(!is.null(sigdig), sigdig, -1) 30 | tdir <- ifelse(!is.null(dir), paste0(dir,"/"), "") 31 | tusecnv <- ifelse(use.cnv == T, T, F) 32 | 33 | ctl0 <- load_ctl(in.filename, tdir) 34 | 35 | btemp <- load_ext(in.filename, tdir, sigdig = tsigdig, use.cnv = tusecnv) 36 | 37 | ext0 <- btemp$ext0 38 | ext <- btemp$ext 39 | 40 | if(!is.null(ctl0) && !is.null(ext)){ 41 | ctl <- ctl0 %>% 42 | dplyr::filter(BLOCK %in% keep_block) # filter to useful blocks 43 | 44 | btemp <- get_block_input(ctl,ext) 45 | params <- btemp$params 46 | mrg_code <- btemp$mrg_code 47 | 48 | btemp <- get_block_model(ctl, mrg_code) 49 | mrg_code <- btemp$mrg_code 50 | cmts <- btemp$cmts 51 | 52 | btemp <- get_block_pk(ctl, mrg_code, cmts) 53 | mrg_code <- btemp$mrg_code 54 | params2 <- btemp$params2 55 | 56 | mrg_code <- get_block_omega(ext0 = ext, mrg_code = mrg_code) 57 | 58 | all_params <- sort(c(params$V1,params2)) 59 | mrg_code <- get_block_table(ctl, mrg_code, all_params, cmts$V1) 60 | 61 | print("NONMEM to Mrgsolve Translation Completed") 62 | 63 | if(write == T){ 64 | 65 | print("Mrgsolve Code is Writing to an R File") 66 | 67 | outfile <- paste0("mrgsolve-code-V0_",in.filename) 68 | 69 | if(!is.null(out.filename)){ 70 | if(!is.na(out.filename) & out.filename != "" & out.filename != " "){ 71 | outfile <- out.filename 72 | } 73 | } 74 | 75 | writemrgsolve(mrg_code, outfile, dir = dir) 76 | } 77 | 78 | if(return.orig == T){ 79 | 80 | return(list(mrg_code=mrg_code,ctl0=ctl0,ext0=ext0,ext=ext)) 81 | 82 | }else{ 83 | 84 | return(mrg_code) 85 | } 86 | } 87 | } 88 | 89 | ## END #### 90 | -------------------------------------------------------------------------------- /vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk.R: -------------------------------------------------------------------------------- 1 | code <- ' 2 | $PROB Mavoglurant PBPK (Wendling et al., 2016. DOI: 10.1208/s12248-015-9840-7) presented as an nlmixr2 example (https://nlmixr2.org/articles/mavoglurant.html) 3 | 4 | $PARAM 5 | 6 | WTKG=NA_real_ 7 | 8 | $THETA 9 | 10 | 7.2 2 0.45 2.3 -0.19 -10 11 | 12 | $CMT 13 | 14 | LU 15 | HT 16 | BR 17 | MU 18 | AD 19 | SK 20 | SP 21 | PA 22 | LI 23 | ST 24 | GU 25 | BO 26 | KI 27 | AB 28 | VB 29 | RB 30 | 31 | $MAIN 32 | 33 | /* NOTE: There is no guarantee to the accuracy of the NONMEM to mrgsolve translator. It remains the responsibility of the user to validate the resulting mrgsolve code. */ 34 | 35 | /* NOTE: The nonmem2mrgsolve package remains in active development, please report bugs and feature requests to improve future versions. */ 36 | /* NOTE: If you find nonmem2mrgsolve helpful, please consider giving it a star at github.com/Andy00000000000/nonmem2mrgsolve. */ 37 | 38 | /* NOTE: The translator does not currently convert T or TIME to SOLVERTIME. */ 39 | /* NOTE: The translator does not currently convert MTIME() to self.mtime(). */ 40 | 41 | /* CALLFL=-2; */ 42 | R_VB=RATE; 43 | double lCLint = THETA1; 44 | double MU_1 = lCLint; 45 | double CLint = exp(MU_1+ETA(1)); 46 | double KbBR = exp(THETA2); 47 | double KbMU = exp(THETA3); 48 | double KbAD = exp(THETA4); 49 | double KbBO = exp(THETA5); 50 | double KbRB = exp(THETA6); 51 | double CO = (187.00*pow(WTKG,0.81))*60.0/1000.0; 52 | double QHT = 4.0 *CO/100.0; 53 | double QBR = 12.0*CO/100.0; 54 | double QMU = 17.0*CO/100.0; 55 | double QAD = 5.0 *CO/100.0; 56 | double QSK = 5.0 *CO/100.0; 57 | double QSP = 3.0 *CO/100.0; 58 | double QPA = 1.0 *CO/100.0; 59 | double QLI = 25.5*CO/100.0; 60 | double QST = 1.0 *CO/100.0; 61 | double QGU = 14.0*CO/100.0; 62 | double QHA = QLI - (QSP + QPA + QST + QGU); 63 | double QBO = 5.0 *CO/100.0; 64 | double QKI = 19.0*CO/100.0; 65 | double QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI); 66 | double QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + QRB; 67 | double VLU = (0.76 *WTKG/100.0)/1.051; 68 | double VHT = (0.47 *WTKG/100.0)/1.030; 69 | double VBR = (2.00 *WTKG/100.0)/1.036; 70 | double VMU = (40.00*WTKG/100.0)/1.041; 71 | double VAD = (21.42*WTKG/100.0)/0.916; 72 | double VSK = (3.71 *WTKG/100.0)/1.116; 73 | double VSP = (0.26 *WTKG/100.0)/1.054; 74 | double VPA = (0.14 *WTKG/100.0)/1.045; 75 | double VLI = (2.57 *WTKG/100.0)/1.040; 76 | double VST = (0.21 *WTKG/100.0)/1.050; 77 | double VGU = (1.44 *WTKG/100.0)/1.043; 78 | double VBO = (14.29*WTKG/100.0)/1.990; 79 | double VKI = (0.44 *WTKG/100.0)/1.050; 80 | double VAB = (2.81 *WTKG/100.0)/1.040; 81 | double VVB = (5.62 *WTKG/100.0)/1.040; 82 | double VRB = (3.86 *WTKG/100.0)/1.040; 83 | double BP = 0.61; 84 | double fup = 0.028; 85 | double fub = fup/BP; 86 | double KbLU = exp(0.8334); 87 | double KbHT = exp(1.1205); 88 | double KbSK = exp(-.5238); 89 | double KbSP = exp(0.3224); 90 | double KbPA = exp(0.3224); 91 | double KbLI = exp(1.7604); 92 | double KbST = exp(0.3224); 93 | double KbGU = exp(1.2026); 94 | double KbKI = exp(1.3171); 95 | double S15 = VVB*BP/1000.0; 96 | 97 | $ODE 98 | 99 | dxdt_LU=QLU*(VB/VVB - LU/KbLU/VLU); 100 | dxdt_HT=QHT*(AB/VAB - HT/KbHT/VHT); 101 | dxdt_BR=QBR*(AB/VAB - BR/KbBR/VBR); 102 | dxdt_MU=QMU*(AB/VAB - MU/KbMU/VMU); 103 | dxdt_AD=QAD*(AB/VAB - AD/KbAD/VAD); 104 | dxdt_SK=QSK*(AB/VAB - SK/KbSK/VSK); 105 | dxdt_SP=QSP*(AB/VAB - SP/KbSP/VSP); 106 | dxdt_PA=QPA*(AB/VAB - PA/KbPA/VPA); 107 | dxdt_LI=QHA*AB/VAB + QSP*SP/KbSP/VSP + QPA*PA/KbPA/VPA + QST*ST/KbST/VST + QGU*GU/KbGU/VGU - CLint*fub*LI/KbLI/VLI - QLI*LI/KbLI/VLI; 108 | dxdt_ST=QST*(AB/VAB - ST/KbST/VST); 109 | dxdt_GU=QGU*(AB/VAB - GU/KbGU/VGU); 110 | dxdt_BO=QBO*(AB/VAB - BO/KbBO/VBO); 111 | dxdt_KI=QKI*(AB/VAB - KI/KbKI/VKI); 112 | dxdt_AB=QLU*(LU/KbLU/VLU - AB/VAB); 113 | dxdt_VB=QHT*HT/KbHT/VHT + QBR*BR/KbBR/VBR + QMU*MU/KbMU/VMU + QAD*AD/KbAD/VAD + QSK*SK/KbSK/VSK + QLI*LI/KbLI/VLI + QBO*BO/KbBO/VBO + QKI*KI/KbKI/VKI + QRB*RB/KbRB/VRB - QLU*VB/VVB; 114 | dxdt_RB=QRB*(AB/VAB - RB/KbRB/VRB); 115 | double C15=VB/S15; 116 | 117 | $OMEGA @block 118 | 119 | 0.083 120 | 121 | $CAPTURE 122 | 123 | C15 124 | WTKG 125 | CLint 126 | 127 | ' -------------------------------------------------------------------------------- /vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk_user-modified.R: -------------------------------------------------------------------------------- 1 | code <- ' 2 | $PROB Mavoglurant PBPK (Wendling et al., 2016. DOI: 10.1208/s12248-015-9840-7) presented as an nlmixr2 example (https://nlmixr2.org/articles/mavoglurant.html) 3 | 4 | $PARAM 5 | 6 | WTKG=NA_real_ 7 | INRATE=NA_real_ 8 | 9 | $THETA 10 | 11 | 7.2 2 0.45 2.3 -0.19 -10 12 | 13 | $CMT 14 | 15 | LU 16 | HT 17 | BR 18 | MU 19 | AD 20 | SK 21 | SP 22 | PA 23 | LI 24 | ST 25 | GU 26 | BO 27 | KI 28 | AB 29 | VB 30 | RB 31 | 32 | $MAIN 33 | 34 | /* NOTE: There is no guarantee to the accuracy of the NONMEM to mrgsolve translator. It remains the responsibility of the user to validate the resulting mrgsolve code. */ 35 | 36 | /* NOTE: The nonmem2mrgsolve package remains in active development, please report bugs and feature requests to improve future versions. */ 37 | /* NOTE: If you find nonmem2mrgsolve helpful, please consider giving it a star at github.com/Andy00000000000/nonmem2mrgsolve. */ 38 | 39 | /* NOTE: The translator does not currently convert T or TIME to SOLVERTIME. */ 40 | /* NOTE: The translator does not currently convert MTIME() to self.mtime(). */ 41 | 42 | /* CALLFL=-2; */ 43 | R_VB=INRATE; 44 | double lCLint = THETA1; 45 | double MU_1 = lCLint; 46 | double CLint = exp(MU_1+ETA(1)); 47 | double KbBR = exp(THETA2); 48 | double KbMU = exp(THETA3); 49 | double KbAD = exp(THETA4); 50 | double KbBO = exp(THETA5); 51 | double KbRB = exp(THETA6); 52 | double CO = (187.00*pow(WTKG,0.81))*60.0/1000.0; 53 | double QHT = 4.0 *CO/100.0; 54 | double QBR = 12.0*CO/100.0; 55 | double QMU = 17.0*CO/100.0; 56 | double QAD = 5.0 *CO/100.0; 57 | double QSK = 5.0 *CO/100.0; 58 | double QSP = 3.0 *CO/100.0; 59 | double QPA = 1.0 *CO/100.0; 60 | double QLI = 25.5*CO/100.0; 61 | double QST = 1.0 *CO/100.0; 62 | double QGU = 14.0*CO/100.0; 63 | double QHA = QLI - (QSP + QPA + QST + QGU); 64 | double QBO = 5.0 *CO/100.0; 65 | double QKI = 19.0*CO/100.0; 66 | double QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI); 67 | double QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + QRB; 68 | double VLU = (0.76 *WTKG/100.0)/1.051; 69 | double VHT = (0.47 *WTKG/100.0)/1.030; 70 | double VBR = (2.00 *WTKG/100.0)/1.036; 71 | double VMU = (40.00*WTKG/100.0)/1.041; 72 | double VAD = (21.42*WTKG/100.0)/0.916; 73 | double VSK = (3.71 *WTKG/100.0)/1.116; 74 | double VSP = (0.26 *WTKG/100.0)/1.054; 75 | double VPA = (0.14 *WTKG/100.0)/1.045; 76 | double VLI = (2.57 *WTKG/100.0)/1.040; 77 | double VST = (0.21 *WTKG/100.0)/1.050; 78 | double VGU = (1.44 *WTKG/100.0)/1.043; 79 | double VBO = (14.29*WTKG/100.0)/1.990; 80 | double VKI = (0.44 *WTKG/100.0)/1.050; 81 | double VAB = (2.81 *WTKG/100.0)/1.040; 82 | double VVB = (5.62 *WTKG/100.0)/1.040; 83 | double VRB = (3.86 *WTKG/100.0)/1.040; 84 | double BP = 0.61; 85 | double fup = 0.028; 86 | double fub = fup/BP; 87 | double KbLU = exp(0.8334); 88 | double KbHT = exp(1.1205); 89 | double KbSK = exp(-.5238); 90 | double KbSP = exp(0.3224); 91 | double KbPA = exp(0.3224); 92 | double KbLI = exp(1.7604); 93 | double KbST = exp(0.3224); 94 | double KbGU = exp(1.2026); 95 | double KbKI = exp(1.3171); 96 | double S15 = VVB*BP/1000.0; 97 | 98 | $ODE 99 | 100 | dxdt_LU=QLU*(VB/VVB - LU/KbLU/VLU); 101 | dxdt_HT=QHT*(AB/VAB - HT/KbHT/VHT); 102 | dxdt_BR=QBR*(AB/VAB - BR/KbBR/VBR); 103 | dxdt_MU=QMU*(AB/VAB - MU/KbMU/VMU); 104 | dxdt_AD=QAD*(AB/VAB - AD/KbAD/VAD); 105 | dxdt_SK=QSK*(AB/VAB - SK/KbSK/VSK); 106 | dxdt_SP=QSP*(AB/VAB - SP/KbSP/VSP); 107 | dxdt_PA=QPA*(AB/VAB - PA/KbPA/VPA); 108 | dxdt_LI=QHA*AB/VAB + QSP*SP/KbSP/VSP + QPA*PA/KbPA/VPA + QST*ST/KbST/VST + QGU*GU/KbGU/VGU - CLint*fub*LI/KbLI/VLI - QLI*LI/KbLI/VLI; 109 | dxdt_ST=QST*(AB/VAB - ST/KbST/VST); 110 | dxdt_GU=QGU*(AB/VAB - GU/KbGU/VGU); 111 | dxdt_BO=QBO*(AB/VAB - BO/KbBO/VBO); 112 | dxdt_KI=QKI*(AB/VAB - KI/KbKI/VKI); 113 | dxdt_AB=QLU*(LU/KbLU/VLU - AB/VAB); 114 | dxdt_VB=QHT*HT/KbHT/VHT + QBR*BR/KbBR/VBR + QMU*MU/KbMU/VMU + QAD*AD/KbAD/VAD + QSK*SK/KbSK/VSK + QLI*LI/KbLI/VLI + QBO*BO/KbBO/VBO + QKI*KI/KbKI/VKI + QRB*RB/KbRB/VRB - QLU*VB/VVB; 115 | dxdt_RB=QRB*(AB/VAB - RB/KbRB/VRB); 116 | double C15=VB/S15; 117 | 118 | $OMEGA @block 119 | 120 | 0.083 121 | 122 | $CAPTURE 123 | 124 | C15 125 | WTKG 126 | CLint 127 | 128 | ' 129 | -------------------------------------------------------------------------------- /vignette/models/mavoglurant-pbpk-101/mod1.ctl: -------------------------------------------------------------------------------- 1 | $PROB Mavoglurant PBPK (Wendling et al., 2016. DOI: 10.1208/s12248-015-9840-7) presented as an nlmixr2 example (https://nlmixr2.org/articles/mavoglurant.html) 2 | 3 | $INPUT ID CMT EVID EVI2 MDV DV LNDV AMT TIME DOSE OCC RATE AGE SEX RACE WTKG HTM BLQ 4 | 5 | $DATA ../../data/Mavoglurant_A2121_nmpk_edited.csv 6 | IGNORE=I 7 | IGNORE=(OCC.GT.1) ; Match data subsets of nlmixr2 vignette 8 | IGNORE=(ID.GE.812) ; Match data subsets of nlmixr2 vignette 9 | IGNORE=(BLQ.EQ.1) ; Match data subsets of nlmixr2 vignette 10 | 11 | $SUBROUTINES ADVAN13 TRANS1 TOL=6 SUBROUTINES=D 12 | 13 | $MODEL 14 | COMP=(LU) ; 01 15 | COMP=(HT) ; 02 16 | COMP=(BR) ; 03 17 | COMP=(MU) ; 04 18 | COMP=(AD) ; 05 19 | COMP=(SK) ; 06 20 | COMP=(SP) ; 07 21 | COMP=(PA) ; 08 22 | COMP=(LI) ; 09 23 | COMP=(ST) ; 10 24 | COMP=(GU) ; 11 25 | COMP=(BO) ; 12 26 | COMP=(KI) ; 13 27 | COMP=(AB) ; 14 28 | COMP=(VB,DEFDOSE,DEFOBS) ; 15 29 | COMP=(RB) ; 16 30 | 31 | $PK 32 | ;--- Initial 33 | 34 | CALLFL=-2 35 | R15=RATE 36 | 37 | ;--- Estimated Parameters 38 | 39 | lCLint = THETA(1) 40 | MU_1 = lCLint 41 | CLint = EXP(MU_1+ETA(1)) 42 | 43 | KbBR = EXP(THETA(2)) 44 | KbMU = EXP(THETA(3)) 45 | KbAD = EXP(THETA(4)) 46 | KbBO = EXP(THETA(5)) 47 | KbRB = EXP(THETA(6)) 48 | 49 | ;--- Fixed Physiological Parameters 50 | 51 | CO = (187.00*WTKG**0.81)*60.0/1000.0 ; Cardiac output (L/h) from White et al (1968) as presented by nlmixr2 vignette 52 | QHT = 4.0 *CO/100.0 53 | QBR = 12.0*CO/100.0 54 | QMU = 17.0*CO/100.0 55 | QAD = 5.0 *CO/100.0 56 | QSK = 5.0 *CO/100.0 57 | QSP = 3.0 *CO/100.0 58 | QPA = 1.0 *CO/100.0 59 | QLI = 25.5*CO/100.0 60 | QST = 1.0 *CO/100.0 61 | QGU = 14.0*CO/100.0 62 | QHA = QLI - (QSP + QPA + QST + QGU) ; Hepatic artery blood flow 63 | QBO = 5.0 *CO/100.0 64 | QKI = 19.0*CO/100.0 65 | QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI) 66 | QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + QRB 67 | 68 | VLU = (0.76 *WTKG/100.0)/1.051 69 | VHT = (0.47 *WTKG/100.0)/1.030 70 | VBR = (2.00 *WTKG/100.0)/1.036 71 | VMU = (40.00*WTKG/100.0)/1.041 72 | VAD = (21.42*WTKG/100.0)/0.916 73 | VSK = (3.71 *WTKG/100.0)/1.116 74 | VSP = (0.26 *WTKG/100.0)/1.054 75 | VPA = (0.14 *WTKG/100.0)/1.045 76 | VLI = (2.57 *WTKG/100.0)/1.040 77 | VST = (0.21 *WTKG/100.0)/1.050 78 | VGU = (1.44 *WTKG/100.0)/1.043 79 | VBO = (14.29*WTKG/100.0)/1.990 80 | VKI = (0.44 *WTKG/100.0)/1.050 81 | VAB = (2.81 *WTKG/100.0)/1.040 82 | VVB = (5.62 *WTKG/100.0)/1.040 83 | VRB = (3.86 *WTKG/100.0)/1.040 84 | 85 | ;--- Fixed Drug-specific Parameters 86 | 87 | BP = 0.61 ; Blood:plasma partition coefficient 88 | fup = 0.028 ; Fraction unbound in plasma 89 | fub = fup/BP ; Fraction unbound in blood 90 | 91 | KbLU = exp(0.8334) 92 | KbHT = exp(1.1205) 93 | KbSK = exp(-.5238) 94 | KbSP = exp(0.3224) 95 | KbPA = exp(0.3224) 96 | KbLI = exp(1.7604) 97 | KbST = exp(0.3224) 98 | KbGU = exp(1.2026) 99 | KbKI = exp(1.3171) 100 | 101 | ;--- Finalize 102 | 103 | S15 = VVB*BP/1000.0 104 | 105 | $DES 106 | 107 | DADT(1) = QLU*(A(15)/VVB - A(1)/KbLU/VLU) 108 | DADT(2) = QHT*(A(14)/VAB - A(2)/KbHT/VHT) 109 | DADT(3) = QBR*(A(14)/VAB - A(3)/KbBR/VBR) 110 | DADT(4) = QMU*(A(14)/VAB - A(4)/KbMU/VMU) 111 | DADT(5) = QAD*(A(14)/VAB - A(5)/KbAD/VAD) 112 | DADT(6) = QSK*(A(14)/VAB - A(6)/KbSK/VSK) 113 | DADT(7) = QSP*(A(14)/VAB - A(7)/KbSP/VSP) 114 | DADT(8) = QPA*(A(14)/VAB - A(8)/KbPA/VPA) 115 | DADT(9) = QHA*A(14)/VAB + QSP*A(7)/KbSP/VSP + QPA*A(8)/KbPA/VPA + QST*A(10)/KbST/VST + QGU*A(11)/KbGU/VGU - CLint*fub*A(9)/KbLI/VLI - QLI*A(9)/KbLI/VLI 116 | DADT(10) = QST*(A(14)/VAB - A(10)/KbST/VST) 117 | DADT(11) = QGU*(A(14)/VAB - A(11)/KbGU/VGU) 118 | DADT(12) = QBO*(A(14)/VAB - A(12)/KbBO/VBO) 119 | DADT(13) = QKI*(A(14)/VAB - A(13)/KbKI/VKI) 120 | DADT(14) = QLU*(A(1)/KbLU/VLU - A(14)/VAB) 121 | DADT(15) = QHT*A(2)/KbHT/VHT + QBR*A(3)/KbBR/VBR + QMU*A(4)/KbMU/VMU + QAD*A(5)/KbAD/VAD + QSK*A(6)/KbSK/VSK + QLI*A(9)/KbLI/VLI + QBO*A(12)/KbBO/VBO + QKI*A(13)/KbKI/VKI + QRB*A(16)/KbRB/VRB - QLU*A(15)/VVB 122 | DADT(16) = QRB*(A(14)/VAB - A(16)/KbRB/VRB) 123 | 124 | C15 = A(15)/S15 125 | 126 | $THETA 127 | (7.6) ; lCLint 128 | (1.1) ; lKbBR 129 | (0.3) ; lKbMU 130 | (2.0) ; lKbAD 131 | (0.03) ; lKbBO 132 | (0.3) ; lKbRB 133 | 134 | $OMEGA 135 | (0, 4.00) ; IIV on CLint 136 | 137 | $SIGMA 138 | 10.0 ; proportional residual variability 139 | 1.00 ; additive residual variability 140 | 141 | $ERROR 142 | 143 | IPRED = A(15)/S15 144 | IRES=DV-IPRED 145 | W=SQRT(IPRED**2*SIGMA(1,1)+SIGMA(2,2)) 146 | IWRES=IRES/W 147 | F_FLAG = 0 148 | Y = IPRED + IPRED*EPS(1) + EPS(2) 149 | 150 | ; $EST METHOD=IMP INTERACTION NOABORT PRINT=5 NOABORT AUTO=1 RANMETHOD=S2P CTYPE=3 NITER=5000 151 | 152 | $EST METHOD=CONDITIONAL INTERACTION MAXEVAL=9999 PRINT=1 NOABORT NOTBT NOOBT NOSBT NSIG=2 SIGL=6 153 | 154 | $COV UNCONDITIONAL 155 | 156 | $TABLE ID EVID CMT DOSE C15 WTKG CLint 157 | ETAS(1:LAST) NPDE CWRES IWRES IPRED NOPRINT ONEHEADER FILE=mod1.tbl 158 | -------------------------------------------------------------------------------- /vignette/models/evolocumab-tmdd-qss-pkpd-101/mod1.ctl: -------------------------------------------------------------------------------- 1 | $PROB Simultaneous PKPD of the human anti-PCSK9 mAb evolocumab 2 | 3 | $ABBR PROTECT 4 | 5 | $INPUT ID TIME DV AMT ADDL II CMT MDV EVID DOSEMG HEALTHY 6 | 7 | $DATA "../../data/NM_data_evoPKPD.csv" IGNORE=@ 8 | 9 | $SUBROUTINES ADVAN13 TRANS1 TOL=6 10 | 11 | $MODEL 12 | COMP = (DEPOT, DEFDOSE) ; evolocumab SC depot 13 | COMP = (TDA) ; total evolocumab amount in central 14 | COMP = (TLC, NODOSE) ; total ligand (PCSK9) concentration in central 15 | COMP = (CLDL, NODOSE) ; LDL cholesterol concentration 16 | 17 | $PK 18 | 19 | CALLFL=-2 20 | 21 | ;;;;; TMDD PK ;;;;; 22 | 23 | TVKA = THETA(1) 24 | KA = TVKA*EXP(ETA(1)) 25 | 26 | TVV = THETA(2) 27 | V = TVV*EXP(ETA(2)) 28 | 29 | TVCL = THETA(3) 30 | CL = TVCL*EXP(ETA(3)) 31 | 32 | TVKDEG = THETA(4) 33 | KDEG = TVKDEG*EXP(ETA(4)) 34 | 35 | TVPCSK9_0 = THETA(5)*THETA(8)**(HEALTHY) 36 | PCSK9_0 = TVPCSK9_0*EXP(ETA(5)) 37 | 38 | TVKSS = THETA(6) 39 | KSS = TVKSS*EXP(ETA(6)) 40 | 41 | TVKINT = THETA(7) 42 | KINT = TVKINT*EXP(ETA(7)) 43 | 44 | KEL = CL/V 45 | 46 | KSYN = KDEG*PCSK9_0 ; zero-order PCSK9 production rate (nM/day) 47 | 48 | F1 = THETA(9) 49 | 50 | A_0(3) = PCSK9_0 ; change initial condition from default of zero 51 | 52 | ;;;;; PD ;;;;; 53 | 54 | TVKOUT = THETA(10) 55 | KOUT = TVKOUT*EXP(ETA(8)) 56 | 57 | TVLDLC_0 = THETA(11) 58 | LDLC_0 = TVLDLC_0*EXP(ETA(9)) 59 | 60 | TVIMAX = THETA(12) 61 | IMAX = TVIMAX*EXP(ETA(10)) 62 | 63 | TVIC50 = THETA(13) 64 | IC50 = TVIC50*EXP(ETA(11)) 65 | 66 | INH0 = (IMAX*PCSK9_0)/(IC50+PCSK9_0) 67 | 68 | KIN = KOUT*(1.0-INH0)*LDLC_0 ; zero-order LDL-C production rate (mg/dL/day) 69 | 70 | A_0(4) = LDLC_0 ; change initial condition from default of zero 71 | 72 | $DES 73 | 74 | ;;;;; TMDD PK ;;;;; 75 | 76 | TDC = A(2)/V ; total evolocumab concentration (nM) 77 | FDC = 0.5*((TDC-A(3)-KSS) + SQRT((TDC-A(3)-KSS)**2.0 + 4.0*KSS*TDC)) ; free evolocumab concentration (nM) 78 | FLC = A(3) - (TDC - FDC) ; free PCSK9 concentration (nM) 79 | 80 | DADT(1) = -KA*A(1) ; evolocumab SC depot (nmol) 81 | DADT(2) = KA*A(1) - KEL*FDC*V - (KINT*A(3)*FDC*V)/(KSS+FDC) ; total evolocumab amount in central (nmol) 82 | DADT(3) = KSYN - KDEG*A(3) - ((KINT-KDEG)*FDC*A(3))/(KSS+FDC) ; total PCSK9 concentration in central (nM) 83 | 84 | ;;;;; PD ;;;;; 85 | 86 | INH = (IMAX*PCSK9_0)/(IC50+PCSK9_0) 87 | IF (TIME.GT.0) INH = (IMAX*FLC)/(IC50+FLC) 88 | 89 | DADT(4) = KIN - KOUT*(1.0-INH)*A(4) ; LDL-C concentration (mg/dL) 90 | 91 | $ERROR 92 | 93 | TDC2 = A(2)/V ; total evolocumab concentration (nM) 94 | FDC2 = 0.5*((TDC2-A(3)-KSS) + SQRT((TDC2-A(3)-KSS)**2.0 + 4.0*KSS*TDC2)) ; free evolocumab concentration (nM) 95 | FLC2 = A(3) - (TDC2 - FDC2) ; free PCSK9 concentration (nM) 96 | 97 | DRUG=0 98 | IF(CMT.EQ.2)DRUG=1 99 | 100 | LIG=0 101 | IF(CMT.EQ.3)LIG=1 102 | 103 | LDL=0 104 | IF(CMT.EQ.4)LDL=1 105 | 106 | IF(CMT.EQ.2)THEN 107 | IPRED = FDC2*144/1000 ; convert nM to mcg/mL, approximate MW of evolocumab is 144 kDa 108 | IRES = DV-IPRED 109 | W = SQRT(IPRED**2*SIGMA(1,1)+SIGMA(2,2)) 110 | IWRES = IRES/W 111 | ENDIF 112 | 113 | IF(CMT.EQ.3)THEN 114 | IPRED = FLC2 115 | IRES = DV-IPRED 116 | W = SQRT(IPRED**2*SIGMA(3,3)+SIGMA(4,4)) 117 | IWRES = IRES/W 118 | ENDIF 119 | 120 | IF(CMT.EQ.4)THEN 121 | IPRED = F 122 | IRES = DV-IPRED 123 | W = SQRT(IPRED**2*SIGMA(5,5)+SIGMA(6,6)) 124 | IWRES = IRES/W 125 | ENDIF 126 | 127 | Y1 = IPRED + IPRED*EPS(1) + EPS(2) 128 | Y2 = IPRED + IPRED*EPS(3) + EPS(4) 129 | Y3 = IPRED + IPRED*EPS(5) + EPS(6) 130 | 131 | Y = Y1*DRUG + Y2*LIG + Y3*LDL 132 | 133 | $THETA 134 | 0.2; KA; 1/day ; first-order evolocumab absorption rate constant 135 | 3; V; L ; evolocumab volume of distribution 136 | 0.3; CL; L/day ; evolocumab clearance 137 | 2; KDEG; 1/day ; first-order PCSK9 degradation rate constant 138 | 5; PCSK9_0; nM ; initial PCSK9 concentration 139 | 0.3; KSS; nM ; steady-state constant 140 | 0.05; KINT; 1/day ; first-order evolocumab-PCSK9 complex elimination rate constant 141 | 0.6; PCSK9_0_HEALTHY; none ; fold change in initial PCSK9 conc. for healthy vs. statin-treated 142 | 0.72 FIXED; F1; none ; evolocumab SC bioavailability 143 | 0.3; KOUT; 1/day ; first-order elimination rate constant for LDL-C 144 | 100; LDLC_0; mg/dL ; baseline LDL-C concentration 145 | 1 FIXED; IMAX; none ; maximal inhibition 146 | 1; IC50; nM ; serum unbound PCSK9 concentration associated with half-maximal inhibition 147 | 148 | $OMEGA BLOCK(1) 149 | 0.1; KA 150 | 151 | $OMEGA BLOCK(1) 152 | 0.03; V 153 | 154 | $OMEGA BLOCK(1) 155 | 0.1; CL 156 | 157 | $OMEGA BLOCK(1) 158 | 0 FIXED; KDEG 159 | 160 | $OMEGA BLOCK(1) 161 | 0.03; PCSK9_0 162 | 163 | $OMEGA BLOCK(1) 164 | 0.1; KSS 165 | 166 | $OMEGA BLOCK(1) 167 | 0 FIXED; KINT 168 | 169 | $OMEGA BLOCK(1) 170 | 0 FIXED; KOUT 171 | 172 | $OMEGA BLOCK(1) 173 | 0.04; LDLC_0 174 | 175 | $OMEGA BLOCK(1) 176 | 0 FIXED; IMAX 177 | 178 | $OMEGA BLOCK(1) 179 | 0.1; IC50 180 | 181 | $SIGMA 182 | 0.01 ; Evolocumab_Prop 183 | 0 FIXED ; Evolocumab_Add 184 | 0.01 ; PCSK9_Prop 185 | 0 FIXED ; PCSK9_Add 186 | 0.01 ; LDLC_Prop 187 | 20 ; LDLC_Add 188 | 189 | $ESTIMATION METHOD=1 INTER NOHABORT MAXEVAL=9999 PRINT=5 NSIG=1 SIGL=3 190 | 191 | $COVARIANCE PRINT=E MATRIX=S UNCONDITIONAL 192 | 193 | ;*...............80 Character limit............................................* 194 | $TABLE ID TIME DV CMT MDV EVID IPRED CWRES IWRES ONEHEADER NOPRINT FILE=sdtab1 195 | $TABLE ID KA V CL KDEG PCSK9_0 KSS KINT KOUT LDLC_0 IMAX IC50 ONEHEADER 196 | NOPRINT FILE=patab1 ; model parameters 197 | $TABLE ID DOSEMG HEALTHY ONEHEADER NOPRINT FILE=catab1 ; categorical covariates 198 | $TABLE ID ONEHEADER NOPRINT FILE=cotab1 ; continuous covariates -------------------------------------------------------------------------------- /R/load_nonmem.R: -------------------------------------------------------------------------------- 1 | ## Loading Nonmem Files #### 2 | 3 | ## FUNCTION LOAD CTL #### 4 | 5 | #' Load NONMEM ctl (or mod) file into R 6 | #' 7 | #' Loads the NONMEM ctl (or mod) file into R for translation to mrgsolve format. 8 | #' 9 | #' @param filename String of the NONMEM model name without the .ctl (or .mod) extension 10 | #' @param dir String of the directory path to the NONMEM run files 11 | #' 12 | #' @return R dataframe of the NONMEM ctl (or mod) file 13 | #' 14 | #' @examples 15 | #' # load_ctl(filename = "nonmem-model", dir = "path/to/directory/") 16 | #' 17 | #' @export 18 | load_ctl <- function(filename = NULL, dir = ""){ 19 | 20 | ctl <- try(suppressWarnings(read.delim2(paste0(dir,filename,".ctl"), header = F)),silent=T) 21 | 22 | if(class(ctl)=="try-error"){ 23 | ctl <- try(suppressWarnings(read.delim2(paste0(dir,filename,".mod"), header = F)),silent=T) 24 | } 25 | 26 | if(class(ctl)=="try-error"){ 27 | err_msg <- ctl[1] 28 | ctl <- NULL 29 | } 30 | 31 | if(!is.null(ctl)){ 32 | ctl <- ctl %>% 33 | dplyr::mutate(V1 = trimws(V1, which = "both"))%>% # remove leading and trailing white space 34 | dplyr::filter(substr(V1,1,1) != ";", V1 != "")%>% # remove white space or comment rows 35 | dplyr::mutate(V1 = gsub(";.*","",V1))%>% # remove anything after comment 36 | dplyr::mutate(FLG_BLOCK = ifelse(startsWith(V1, "$"), 1, 0))%>% # flag beginning of each block 37 | dplyr::mutate(BLOCK = suppressWarnings(ifelse(FLG_BLOCK == 1, trimws(substr(V1,2,6), which = "both"), NA)))%>% # get block name 38 | dplyr::mutate(BLOCK = zoo::na.locf(BLOCK, na.rm = F, fromLast = F)) # pull block name down until next block starts 39 | 40 | print("NONMEM Control Stream Successfully Loaded") 41 | }else{ 42 | print("NONMEM Control Stream Failed to Load") 43 | print(err_msg) 44 | } 45 | 46 | return(ctl) 47 | } 48 | 49 | ## FUNCTION LOAD EXT #### 50 | 51 | #' Load NONMEM ext file into R 52 | #' 53 | #' Loads the NONMEM ext file into R for capture of the final estimates. 54 | #' 55 | #' @param filename String of the NONMEM model name without the .ext extension 56 | #' @param dir String of the directory path to the NONMEM run files 57 | #' @param sigdig Numeric of the number of significant digits to round non-fixed thetas and etas to; -1 for no rounding 58 | #' @param use.cnv Logical for whether to use the NONMEM cnv file for final parameter estimates instead of the ext file (\code{T} or \code{F}) 59 | #' 60 | #' @return R list of the NONMEM final OFV, parameter estimates, and IIV magnitudes 61 | #' 62 | #' @examples 63 | #' load_ext(filename = "nonmem-model", dir = "path/to/directory/") 64 | #' 65 | #' @export 66 | load_ext <- function(filename = NULL, dir = "", sigdig = -1, use.cnv = F){ 67 | 68 | ext00 <- try(suppressWarnings(read.table(paste0(dir,filename,".ext"),sep='',header=T,fill=T,na.strings=".", skip=1)),silent=T) 69 | 70 | if(class(ext00) != "try-error"){ 71 | if(class(ext00$ITERATION) != "numeric"){ 72 | for(i in 1:ncol(ext00)){ 73 | ext00[,i] <- as.numeric(ext00[,i]) 74 | } 75 | rm(i) 76 | } 77 | } 78 | 79 | if(use.cnv == T){ 80 | 81 | ext0 <- try(suppressWarnings(read.table(paste0(dir,filename,".cnv"),sep='',header=T,fill=T,na.strings =".",skip=1)),silent=T) 82 | 83 | if(class(ext0) != "try-error"){ 84 | ext0 <- ext0 %>% 85 | dplyr::filter(ITERATION == -2000000000) 86 | }else{ 87 | ext0 <- NULL 88 | } 89 | }else{ 90 | 91 | if(class(ext00) != "try-error"){ 92 | ext0 <- ext00 %>% 93 | dplyr::filter(ITERATION == -1000000000) %>% # NONMEM User Guide VIII for definition (final estimates) 94 | dplyr::filter(dplyr::row_number() == max(dplyr::row_number())) 95 | }else{ 96 | ext0 <- NULL 97 | } 98 | } 99 | 100 | if(!is.null(ext0)){ 101 | 102 | print("NONMEM Final Estimates Successfully Loaded") 103 | 104 | tmpfixed <- ext00 %>% 105 | dplyr::filter(ITERATION == -1000000006) %>% # NONMEM User Guide VIII for definition (fixed parameters) 106 | dplyr::filter(dplyr::row_number() == max(dplyr::row_number())) 107 | 108 | if(sigdig > 0){ 109 | omnofix <- tmpfixed[1,dplyr::starts_with("OMEGA", vars = colnames(tmpfixed))] 110 | 111 | if(class(omnofix)=="numeric"){ # 3/17/2024 fix load when only 1 IIV 112 | omnofix <- data.frame("OMEGA.1.1." = omnofix) 113 | } 114 | 115 | omnofix <- colnames(omnofix[which(omnofix[1,] != 1)]) 116 | 117 | if(length(omnofix)>0){ # 3/17/2024 fix load when all IIV fixed 118 | tmpomnofix <- lapply(1:length(omnofix), function(i){ 119 | nofixtmpa <- strsplit(trimws(omnofix[[i]]),"\\.") 120 | return(data.frame(R = as.numeric(nofixtmpa[[1]][2]), C = as.numeric(nofixtmpa[[1]][3]))) 121 | }) 122 | omnofix <- dplyr::bind_rows(tmpomnofix) 123 | }else{ 124 | omnofix <- NULL 125 | } 126 | }else{ 127 | omnofix <- NULL 128 | } 129 | 130 | ext <- list(NITER = NA, OFV = NA, THETA = NA, OMEGA = NA) 131 | 132 | ext$NITER <- max(ext00$ITERATION) 133 | ext$OFV <- ext0[1,which(substr(colnames(ext0),nchar(colnames(ext0))-2,nchar(ext0)) == "OBJ")] 134 | ext$THETA <- ext0[1,dplyr::starts_with("THETA",vars = colnames(ext0))] 135 | 136 | tmpom0 <- ext0[1,dplyr::starts_with("OMEGA",vars = colnames(ext0))] 137 | if(class(tmpom0)=="numeric"){ # 3/17/2024 fix load when only 1 IIV 138 | tmpom0 <- data.frame("OMEGA.1.1." = tmpom0) 139 | } 140 | 141 | tmpn <- strsplit(trimws(colnames(tmpom0)[ncol(tmpom0)]), "\\.") 142 | tmpn <- as.numeric(tmpn[[1]][length(tmpn[[1]])]) 143 | 144 | tmpom2 <- matrix(data = 0, ncol = tmpn, nrow = tmpn) 145 | colnames(tmpom2) <- paste0("OMEGA",1:tmpn) 146 | rownames(tmpom2) <- paste0("OMEGA",1:tmpn) 147 | 148 | tmpom <- tmpom0[1, which(tmpom0 != 0)] 149 | if(class(tmpom)=="numeric"){ # 3/17/2024 fix load when only 1 IIV 150 | tmpom_val <- tmpom 151 | tmpom <- data.frame() 152 | tmpom[1,colnames(tmpom0)[which(tmpom0!=0)]] = tmpom_val 153 | } 154 | 155 | if(length(tmpom)>0){ # 3/17/2024 fix error all IIV fixed to zero 156 | for(i in 1:length(tmpom)){ 157 | 158 | tmp <- strsplit(trimws(colnames(tmpom)[i]),"\\.")[[1]] 159 | tmpr <- as.numeric(tmp[2]) 160 | tmpc <- as.numeric(tmp[3]) 161 | 162 | if(sigdig > 0 & !is.null(omnofix)){ # 3/17/2024 fix load when all iiv fixed 163 | 164 | omvalround <- tmpom[1,i] 165 | 166 | tmpa <- which(omnofix$R == tmpr) 167 | 168 | if(length(tmpa)>0){ 169 | 170 | tmpa <- omnofix[tmpa,] 171 | tmpa <- which(tmpa$C == tmpc) 172 | 173 | if(length(tmpa)>0){ 174 | 175 | omvalround <- signif(tmpom[1,i], sigdig) 176 | } 177 | } 178 | 179 | tmpom2[tmpr,tmpc] <- omvalround 180 | tmpom2[tmpc,tmpr] <- omvalround 181 | 182 | }else{ 183 | 184 | tmpom2[tmpr,tmpc] <- tmpom[1,i] 185 | tmpom2[tmpc,tmpr] <- tmpom[1,i] 186 | } 187 | } 188 | } 189 | 190 | ext$OMEGA <- tmpom2 191 | 192 | if(sigdig > 0){ 193 | 194 | thnofix <- which(tmpfixed[1,dplyr::starts_with("THETA",vars = colnames(tmpfixed))] != 1) 195 | 196 | if(length(thnofix)>0){ 197 | ext[["THETA"]][thnofix] <- signif(ext[["THETA"]][thnofix],sigdig) 198 | } 199 | } 200 | }else{ 201 | ext <- NULL 202 | print("NONMEM Final Estimates Failed to Load") 203 | } 204 | 205 | return(list(ext=ext,ext0=ext0)) 206 | } 207 | 208 | ## END #### 209 | -------------------------------------------------------------------------------- /vignette/models/mavoglurant-pbpk-101/mod1.ext: -------------------------------------------------------------------------------- 1 | TABLE NO. 1: First Order Conditional Estimation with Interaction: Goal Function=MINIMUM VALUE OF OBJECTIVE FUNCTION: Problem=1 Subproblem=0 Superproblem1=0 Iteration1=0 Superproblem2=0 Iteration2=0 2 | ITERATION THETA1 THETA2 THETA3 THETA4 THETA5 THETA6 SIGMA(1,1) SIGMA(2,1) SIGMA(2,2) OMEGA(1,1) OBJ 3 | 0 7.60000E+00 1.10000E+00 3.00000E-01 2.00000E+00 3.00000E-02 3.00000E-01 1.00000E+01 0.00000E+00 1.00000E+00 4.00000E+00 2653.2644430763830 4 | 1 7.89013E+00 1.10137E+00 3.01495E-01 2.30000E+00 3.00018E-02 3.00142E-01 9.98149E+00 0.00000E+00 1.00020E+00 3.99980E+00 2612.8117676464426 5 | 2 9.29882E+00 1.10891E+00 3.12021E-01 2.71431E+00 3.00151E-02 3.00935E-01 9.89852E+00 0.00000E+00 1.00056E+00 3.99823E+00 2610.6891245724055 6 | 3 9.99623E+00 1.11852E+00 3.26023E-01 2.64757E+00 3.00302E-02 3.01858E-01 9.82702E+00 0.00000E+00 1.00077E+00 3.99544E+00 2605.4042398419460 7 | 4 1.07531E+01 2.50465E+00 2.28216E+00 3.08980E+00 3.18054E-02 4.24569E-01 4.26380E+00 0.00000E+00 1.03328E+00 3.79118E+00 2449.9931245790508 8 | 5 1.07085E+01 2.88034E+00 2.32960E+00 3.10294E+00 3.20140E-02 4.43977E-01 3.98901E+00 0.00000E+00 1.03511E+00 3.77340E+00 2443.6624431420360 9 | 6 6.24820E+00 2.68308E+00 2.06195E+00 3.03630E+00 3.87756E-02 1.33154E+00 4.61359E-01 0.00000E+00 1.07419E+00 3.19667E+00 2251.0708960113002 10 | 7 5.16848E+00 2.61468E+00 1.97166E+00 3.01421E+00 3.89949E-02 1.15108E+00 2.81458E-01 0.00000E+00 1.07876E+00 2.97293E+00 2235.6318466860494 11 | 8 5.00628E+00 2.56818E+00 1.91237E+00 2.92750E+00 3.77349E-02 9.73981E-01 2.31417E-01 0.00000E+00 1.14378E+00 5.31227E+00 2230.0874857133399 12 | 9 3.67333E+00 1.87315E+00 1.04844E+00 2.36365E+00 -3.97876E-02 -1.14797E-01 1.12235E-01 0.00000E+00 1.57050E+01 2.95081E+01 2126.0836744033586 13 | 10 3.18873E+00 1.63318E+00 7.43131E-01 2.19035E+00 -9.79242E-02 -4.59189E-01 8.59558E-02 0.00000E+00 1.68340E+01 5.45015E+01 2103.0693180302328 14 | 11 2.79299E+00 1.42094E+00 5.64535E-01 2.20768E+00 3.43954E-01 -1.23265E+00 8.40926E-02 0.00000E+00 1.29816E+00 7.22370E+01 2090.6356567484536 15 | 12 2.56849E+00 1.55348E+00 5.12727E-01 2.34111E+00 1.53614E-02 -1.63254E+00 8.99406E-02 0.00000E+00 7.27995E-01 4.81787E+01 2077.9996500222251 16 | 13 2.19402E+00 1.63404E+00 4.78171E-01 2.35062E+00 -7.68071E-02 -2.02460E+00 8.73986E-02 0.00000E+00 5.84006E-01 4.02711E+01 2076.8272909493135 17 | 14 1.90144E+00 1.71144E+00 4.66011E-01 2.34519E+00 -1.74601E-01 -2.33307E+00 8.69276E-02 0.00000E+00 4.98768E-01 3.71769E+01 2076.6890024621471 18 | 15 1.90144E+00 1.71144E+00 4.66011E-01 2.34519E+00 -1.74601E-01 -2.33307E+00 8.69276E-02 0.00000E+00 4.98768E-01 3.71769E+01 2076.6890024621471 19 | 16 1.67166E+00 1.83982E+00 4.76686E-01 2.34859E+00 -2.11057E-01 -2.66352E+00 8.97223E-02 0.00000E+00 4.23895E-01 3.12381E+01 2075.5779670319403 20 | 17 6.68662E+00 2.03963E+00 5.19792E-01 2.31587E+00 -1.45267E-01 -3.76568E+00 8.74787E-02 0.00000E+00 3.96380E-01 3.07459E+01 2056.0535616458214 21 | 18 5.37270E+00 2.05013E+00 5.12593E-01 2.31138E+00 -1.52637E-01 -4.23874E+00 8.72086E-02 0.00000E+00 3.87315E-01 2.64261E+01 2055.2391901967908 22 | 19 4.66287E+00 2.01283E+00 4.96408E-01 2.31699E+00 -1.72502E-01 -4.41215E+00 8.74075E-02 0.00000E+00 3.85361E-01 2.35630E+01 2055.1517311728439 23 | 20 4.66287E+00 2.01283E+00 4.96408E-01 2.31699E+00 -1.72502E-01 -4.41215E+00 8.74075E-02 0.00000E+00 3.85361E-01 2.35630E+01 2055.1517311728439 24 | 21 4.47750E+00 2.02372E+00 4.96013E-01 2.31591E+00 -1.68251E-01 -4.47845E+00 8.71359E-02 0.00000E+00 3.82826E-01 2.17802E+01 2054.9745219033916 25 | 22 4.15993E+00 2.00215E+00 4.75654E-01 2.31688E+00 -1.72533E-01 -4.76637E+00 8.72142E-02 0.00000E+00 3.73513E-01 1.55120E+01 2053.0308694271475 26 | 23 5.15526E+00 2.00887E+00 4.08130E-01 2.31607E+00 -1.96340E-01 -6.37528E+00 8.45768E-02 0.00000E+00 3.28062E-01 2.28615E+00 2039.8660920503937 27 | 24 7.19656E+00 2.00854E+00 3.27511E-01 2.31709E+00 -2.28363E-01 -8.14078E+00 8.20936E-02 0.00000E+00 2.85462E-01 2.64558E-01 1974.9391433990561 28 | 25 7.04435E+00 2.03307E+00 3.74566E-01 2.29590E+00 -2.06079E-01 -8.03655E+00 8.66785E-02 0.00000E+00 2.98045E-01 2.94709E-01 1974.5444862388053 29 | 26 7.24171E+00 2.07334E+00 4.32217E-01 2.26396E+00 -1.76277E-01 -8.29979E+00 9.35533E-02 0.00000E+00 3.09373E-01 1.98773E-01 1970.0428535705735 30 | 27 7.14920E+00 2.06052E+00 4.89068E-01 2.35380E+00 -1.39656E-01 -8.44777E+00 8.37990E-02 0.00000E+00 3.56596E-01 1.54212E-01 1967.2574730390793 31 | 28 7.13728E+00 1.88636E+00 4.93083E-01 2.31983E+00 -1.87158E-01 -8.74898E+00 8.39644E-02 0.00000E+00 3.33434E-01 9.87576E-02 1964.4019324527226 32 | 29 7.15787E+00 1.98443E+00 4.54449E-01 2.32284E+00 -1.95231E-01 -8.90260E+00 8.87764E-02 0.00000E+00 3.22188E-01 7.97237E-02 1963.7772739376223 33 | 30 7.14485E+00 1.99059E+00 4.52406E-01 2.31644E+00 -1.96066E-01 -8.88831E+00 8.78743E-02 0.00000E+00 3.13133E-01 8.14532E-02 1963.7317217607010 34 | 31 7.14521E+00 1.99649E+00 4.51296E-01 2.30993E+00 -1.94667E-01 -8.88019E+00 8.65211E-02 0.00000E+00 3.00459E-01 8.27458E-02 1963.6787758263199 35 | 32 7.16067E+00 2.00054E+00 4.52002E-01 2.31015E+00 -1.85604E-01 -8.98750E+00 8.65005E-02 0.00000E+00 2.68010E-01 8.32930E-02 1963.6271921483342 36 | 33 7.16030E+00 2.00052E+00 4.52003E-01 2.31014E+00 -1.85919E-01 -9.02268E+00 8.65018E-02 0.00000E+00 2.68132E-01 8.32924E-02 1963.6271463019898 37 | 34 7.16030E+00 2.00052E+00 4.52003E-01 2.31014E+00 -1.85919E-01 -9.02268E+00 8.65018E-02 0.00000E+00 2.68132E-01 8.32924E-02 1963.6271463019898 38 | 35 7.16011E+00 2.00051E+00 4.52002E-01 2.31013E+00 -1.86123E-01 -9.03959E+00 8.65024E-02 0.00000E+00 2.68195E-01 8.32919E-02 1963.6271438357737 39 | 36 7.15952E+00 2.00043E+00 4.51933E-01 2.31038E+00 -1.86576E-01 -9.07856E+00 8.65030E-02 0.00000E+00 2.70895E-01 8.33020E-02 1963.6270294603462 40 | 37 7.16059E+00 2.00032E+00 4.52833E-01 2.31071E+00 -1.86624E-01 -1.00029E+01 8.68449E-02 0.00000E+00 2.73824E-01 8.32052E-02 1963.6240820290291 41 | 38 7.16049E+00 2.00030E+00 4.52950E-01 2.31074E+00 -1.86674E-01 -1.01745E+01 8.68874E-02 0.00000E+00 2.74203E-01 8.31927E-02 1963.6238498152991 42 | 39 7.16049E+00 2.00030E+00 4.52950E-01 2.31074E+00 -1.86674E-01 -1.01745E+01 8.68874E-02 0.00000E+00 2.74203E-01 8.31927E-02 1963.6238498152991 43 | 40 7.16049E+00 2.00030E+00 4.52950E-01 2.31074E+00 -1.86674E-01 -1.01745E+01 8.68874E-02 0.00000E+00 2.74203E-01 8.31927E-02 1963.6238498152991 44 | -1000000000 7.16049E+00 2.00030E+00 4.52950E-01 2.31074E+00 -1.86674E-01 -1.01745E+01 8.68874E-02 0.00000E+00 2.74203E-01 8.31927E-02 1963.6238498152991 45 | -1000000001 7.41825E-02 2.17470E-01 2.21092E-01 1.62808E-01 1.55338E-01 3.44156E+01 1.46300E-02 1.00000E+10 9.15875E-01 2.29954E-02 0.0000000000000000 46 | -1000000004 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 2.94767E-01 0.00000E+00 5.23644E-01 2.88431E-01 0.0000000000000000 47 | -1000000005 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 2.48163E-02 1.00000E+10 8.74522E-01 3.98628E-02 0.0000000000000000 48 | -1000000006 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E+00 0.00000E+00 0.00000E+00 0.0000000000000000 49 | -1000000007 0.00000E+00 3.70000E+01 3.80000E+01 4.90000E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.0000000000000000 50 | -1000000008 1.09841E-01 -4.11955E-03 1.37611E-01 1.12246E-01 -4.44219E-03 -2.68801E-04 3.26364E-01 0.00000E+00 -3.21276E-03 -3.83805E-03 0.0000000000000000 51 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "nonmem2mrgsolve" 3 | output: github_document 4 | --- 5 | 6 | ```{r setup, include=FALSE} 7 | knitr::opts_chunk$set(warning=FALSE, message=FALSE, eval=FALSE) # echo = FALSE 8 | ``` 9 | 10 | ## Purpose 11 | 12 | Provide an R package that automates NONMEM to mrgsolve translation to reduce human errors and improve efficiency. 13 | 14 | ## Introduction 15 | 16 | Pharmacometricians often utilize multiple software, with NONMEM (ICON plc, Dublin, Ireland) widely regarded as the current gold standard for population pharmacokinetic (PK) and pharmacokinetic-pharmacodynamic (PK-PD) modeling. While NONMEM has the ability to simulate, it is often more convenient and practical to perform simulations using free open-source software such as R which can also perform post-processing of the output. A popular pharmacometrics-orientated R package for solving ODE systems is mrgsolve. Although mrgsolve has built-in functionality to streamline translation, to the best of our knowledge a previously-developed and publicly-available R package for fully automated NONMEM to mrgsolve translation does not exist. 17 | 18 | ## Installation 19 | 20 | If not already installed, install R. Then within R run the following command: 21 | ```{r} 22 | devtools::install_github("Andy00000000000/nonmem2mrgsolve") 23 | ``` 24 | 25 | ## Getting Started 26 | 27 | As an orientation, assume that a theoretical NONMEM run has finished estimating and has explicitly-defined ODEs. The ctl and ext files are both named pbpk-101 and are located at C:/Documents/NONMEM/Project. 28 | 29 | Load R and run: 30 | ```{r} 31 | setwd("C:/Documents/NONMEM/Project") # set the working directory to where the NONMEM files are located 32 | library(nonmem2mrgsolve) # load the nonmem2mrgsolve package 33 | nonmem2mrgsolve("pbpk-101") # run the nonmem2mrgsolve function with default settings 34 | ``` 35 | 36 | The resulting mrgsolve code will be wrote to mrgsolve-code-V0_pbpk-101.R within the C:/Documents/NONMEM/Project folder. The user should then validate the translation, for which there is an intuitive and established framework [(Here)](https://mrgsolve.org/blog/posts/2023-update-validation.html). 37 | 38 | ## Usage Statement 39 | 40 | ```{r} 41 | nonmem2mrgsolve::nonmem2mrgsolve( 42 | filename = "nonmem-model.ctl", # String of the NONMEM model name with or without the .ctl (or .mod) extension 43 | dir = "./folder", # String of the directory path to the NONMEM files (if not already given in the file name input or the working directory already set) 44 | sigdig = NULL, # Numeric of the number of significant digits to round non-fixed thetas and etas to; default NULL for no rounding 45 | write = T, # [T or F] for whether to write the resulting mrgsolve code to an R file 46 | return.orig = F, # [T or F] for whether to return the original NONMEM ctl and ext (or cnv) files to the R environment 47 | out.filename = NULL, # String of the name for the mrgsolve output file without the .R extension; NULL for default naming 48 | use.cnv = F # [T or F] for whether to use the NONMEM cnv file for parameter estimates instead of the ext file 49 | ) 50 | ``` 51 | 52 | ## Getting Help 53 | 54 | Please feel free to report problems using the [Issue Tracker](https://github.com/Andy00000000000/nonmem2mrgsolve/issues) or to reach out for help on the [Discussion Board](https://github.com/Andy00000000000/nonmem2mrgsolve/discussions). 55 | 56 | ## Our Team 57 | 58 | [Enhanced Pharmacodynamics, LLC (ePD)](https://www.epd-llc.com/) is a contract research organization that assists clients with the design and implementation of model-informed drug development strategies in a broad range of therapeutic areas. The executive management team is led by [Dr. Donald E. Mager](https://www.linkedin.com/in/don-mager-2652615/) and [Dr. Scott A. Van Wart](https://www.linkedin.com/in/scott-van-wart-2b6002a/). 59 | 60 | [Finch Studio](https://finchstudio.io/) is an integrated modeling environment for pharmacometricians, clinical pharmacologists, and other team members to visualize, develop, and organize PK/PD models and data. It includes a modern NONMEM code editor and workbench, interactive data tables and visualizations, and a PK/PD model library. The development team is led by [Dr. Mohamed Ismail](https://www.linkedin.com/in/mohamed-ismail-bb54a367/). 61 | 62 | nonmem2mrgsolve was developed at ePD by [Andrew Santulli](https://www.linkedin.com/in/andrew-santulli-219034156/). 63 | 64 | ## Vignette 65 | 66 | Three case study models are provided within the vignette folder. The following section will use these examples to provide a brief tutorial on how to implement nonmem2mrgsolve into the model development and simulation workflow. To get started, download nonmem2mrgsolve and copy the vignette folder to a convenient file location. 67 | 68 | ### Example 1: A 1-compartment model with first-order absorption 69 | 70 | Within the vignette >> models directory, you should find three folders: 71 | 72 | ![](./readme_images/vignette_01.PNG){width=40%} 73 | 74 | This first example is drugx-oral-1cmt-101, in which you will find the NONMEM control stream (.ctl) and output files (.ext and .lst). The nonmem2mrgsolve package does not require the .lst file, it is provided solely for user reference. The nonmem2mrgsolve-translated mrgsolve code, along with the mrgsolve code following any necessary user modifications, are provided as well for reference, but could be deleted at this step and recreated during the vignette. The run_nonmem2mrgsolve_drugx.R file contains all the code presented for this example of the vignette. 75 | 76 | ![](./readme_images/vignette_02.PNG){width=40%} 77 | 78 | 79 | Now that the directory structure is clear, start R, load the nonmem2mrgsolve package, and set the working directory to immediately before entering the vignette folder: 80 | ```{r} 81 | library("nonmem2mrgsolve") 82 | setwd("Your file path to vignette folder here") 83 | ``` 84 | 85 | Translating the NONMEM model into mrgsolve code is accomplished using a single function call: 86 | ```{r} 87 | nonmem2mrgsolve( 88 | "mod1.ctl", # the NONMEM run name 89 | "./vignette/models/drugx-oral-1cmt-101/", # path to mod1.ctl and mod1.ext, from the working directory (which was set earlier) 90 | out.filename = "mrgsolve_code_drugx-oral", # name for the mrgsolve code .R output file 91 | sigdig = 3 # number of significant digits to report thetas and omegas to within the mrgsolve code (optional) 92 | ) 93 | ``` 94 | During the translation, the final parameter estimates (thetas and omegas) are obtained from the NONMEM .ext file, while the parameter and differential equations are pulled from the NONMEM .ctl file. There are several optional inputs to the nonmem2mrgsolve function, as detailed in the usage statement. 95 | 96 | When the translation is finished, the mrgsolve code will print to the R console and will also be written to a .R file: 97 | 98 | ![](./readme_images/vignette_03.PNG){width=100%} 99 | ![](./readme_images/vignette_04.PNG){width=40%} 100 | 101 | 102 | Now is a good time to check whether the nonmem2mrgsolve-translated mrgsolve code requires any user modifications in order to compile: 103 | ```{r} 104 | source("./vignettes/models/drugx-oral-1cmt-101/mrgsolve_code_drugx-oral.R") 105 | mrgsolve::mcode("Test_Unmodified_Translation",code) 106 | ``` 107 | 108 | In this example manual user changes to the mrgsolve code are not needed, since the model successfully compiled: 109 | 110 | ![](./readme_images/vignette_05.PNG){width=50%} 111 | 112 | 113 | If certain model complexities are present, the nonmem2mrgsolve-translated mrgsolve code may fail to compile into an mrgsolve model object. The compilation failure will provide informative error messages for locating the line of code that needs attention. The compilation failure will also prevent the user from running simulations without first addressing problems in the code. 114 | 115 | As a final step before conducting simulations, the user should validate the mrgsolve model. There is an intuitive and established framework [(Here)](https://mrgsolve.org/blog/posts/2023-update-validation.html). Model validation remains the responsibility of the user and should always be performed, regardless of the robustness of the translation software or the experience of the user. 116 | 117 | ### Example 2: A QSS Target-Mediated Drug Disposition (TMDD) Model and Indirect Response PK-PD Model 118 | 119 | This example is located within the evolocumab-tmdd-qss-pkpd-101 folder of the vignette >> models directory. Since the steps for translating the NONMEM model into mrgsolve code are equivalent to those presented in Example 1, the tutorial for this case study will start at compiling the nonmem2mrgsolve-translated mrgsolve code into an mrgsolve model object. The complete code for running the earlier steps as well is included within the run_nonmem2mrgsolve_evolocumab.R file. 120 | 121 | Attempting to compile the nonmem2mrgsolve-translated mrgsolve code results in a fatal error: 122 | ```{r} 123 | source("./vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd.R") 124 | mrgsolve::mcode("Test_Unmodified_Translation",code) 125 | ``` 126 | ![](./readme_images/vignette_06.PNG){width=100%} 127 | 128 | 129 | From the error message it is clear that the issue occurred when the NONMEM dataset column "TIME" was being used in the differential equation code block ($DES). Mrgsolve syntax requires this to be labeled as "SOLVERTIME". 130 | 131 | The user can manually make this single change while leaving the rest of the nonmem2mrgsolve code unmodified: 132 | 133 | ![](./readme_images/vignette_07.PNG){width=100%} 134 | 135 | 136 | Compiling the corrected mrgsolve code is successful: 137 | ```{r} 138 | source("./vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd_user-modified.R") 139 | mrgsolve::mcode("Test_Modified_Translation",code) 140 | ``` 141 | 142 | ![](./readme_images/vignette_08.PNG){width=50%} 143 | 144 | ### Example 3: A Whole-body Physiologically-based Pharmacokinetic (PBPK) Model 145 | 146 | This example is located within the mavoglurant-pbpk-101 folder of the vignette >> models directory. Since the steps for translating the NONMEM model into mrgsolve code are equivalent to those presented in Example 1, the tutorial for this case study will start at compiling the nonmem2mrgsolve-translated mrgsolve code into an mrgsolve model object. The complete code for running the earlier steps as well is included within the run_nonmem2mrgsolve_mavoglurant.R file. 147 | 148 | Attempting to compile the nonmem2mrgsolve-translated mrgsolve code results in a fatal error: 149 | ```{r} 150 | source("./vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk.R") 151 | mrgsolve::mcode("Test_Unmodified_Translation",code) 152 | ``` 153 | 154 | ![](./readme_images/vignette_09.PNG){width=80%} 155 | 156 | 157 | From the error message it is clear that the issue occurred because "RATE" was not declared in the parameter block ($PARAM). Additionally, this should be renamed since "RATE" is a reserved term. 158 | 159 | The user can manually make these two changes while leaving the rest of the nonmem2mrgsolve code unmodified: 160 | 161 | ![](./readme_images/vignette_10.PNG){width=100%} 162 | ![](./readme_images/vignette_11.PNG){width=100%} 163 | 164 | 165 | Compiling the corrected mrgsolve code is successful: 166 | ```{r} 167 | source("./vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk_user-modified.R") 168 | mrgsolve::mcode("Test_Modified_Translation",code) 169 | ``` 170 | 171 | ![](./readme_images/vignette_12.PNG){width=50%} 172 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | nonmem2mrgsolve 2 | ================ 3 | 4 | ## Purpose 5 | 6 | Provide an R package that automates NONMEM to mrgsolve translation to 7 | reduce human errors and improve efficiency. 8 | 9 | ## Introduction 10 | 11 | Pharmacometricians often utilize multiple software, with NONMEM (ICON 12 | plc, Dublin, Ireland) widely regarded as the current gold standard for 13 | population pharmacokinetic (PK) and pharmacokinetic-pharmacodynamic 14 | (PK-PD) modeling. While NONMEM has the ability to simulate, it is often 15 | more convenient and practical to perform simulations using free 16 | open-source software such as R which can also perform post-processing of 17 | the output. A popular pharmacometrics-orientated R package for solving 18 | ODE systems is mrgsolve. Although mrgsolve has built-in functionality to 19 | streamline translation, to the best of our knowledge a 20 | previously-developed and publicly-available R package for fully 21 | automated NONMEM to mrgsolve translation does not exist. 22 | 23 | ## Installation 24 | 25 | If not already installed, install R. Then within R run the following 26 | command: 27 | 28 | ``` r 29 | devtools::install_github("Andy00000000000/nonmem2mrgsolve") 30 | ``` 31 | 32 | ## Getting Started 33 | 34 | As an orientation, assume that a theoretical NONMEM run has finished 35 | estimating and has explicitly-defined ODEs. The ctl and ext files are 36 | both named pbpk-101 and are located at C:/Documents/NONMEM/Project. 37 | 38 | Load R and run: 39 | 40 | ``` r 41 | setwd("C:/Documents/NONMEM/Project") # set the working directory to where the NONMEM files are located 42 | library(nonmem2mrgsolve) # load the nonmem2mrgsolve package 43 | nonmem2mrgsolve("pbpk-101") # run the nonmem2mrgsolve function with default settings 44 | ``` 45 | 46 | The resulting mrgsolve code will be wrote to 47 | mrgsolve-code-V0\_pbpk-101.R within the C:/Documents/NONMEM/Project 48 | folder. The user should then validate the translation, for which there 49 | is an intuitive and established framework 50 | [(Here)](https://mrgsolve.org/blog/posts/2023-update-validation.html). 51 | 52 | ## Usage Statement 53 | 54 | ``` r 55 | nonmem2mrgsolve::nonmem2mrgsolve( 56 | filename = "nonmem-model.ctl", # String of the NONMEM model name with or without the .ctl (or .mod) extension 57 | dir = "./folder", # String of the directory path to the NONMEM files (if not already given in the file name input or the working directory already set) 58 | sigdig = NULL, # Numeric of the number of significant digits to round non-fixed thetas and etas to; default NULL for no rounding 59 | write = T, # [T or F] for whether to write the resulting mrgsolve code to an R file 60 | return.orig = F, # [T or F] for whether to return the original NONMEM ctl and ext (or cnv) files to the R environment 61 | out.filename = NULL, # String of the name for the mrgsolve output file without the .R extension; NULL for default naming 62 | use.cnv = F # [T or F] for whether to use the NONMEM cnv file for parameter estimates instead of the ext file 63 | ) 64 | ``` 65 | 66 | ## Getting Help 67 | 68 | Please feel free to report problems using the [Issue 69 | Tracker](https://github.com/Andy00000000000/nonmem2mrgsolve/issues) or 70 | to reach out for help on the [Discussion 71 | Board](https://github.com/Andy00000000000/nonmem2mrgsolve/discussions). 72 | 73 | ## Our Team 74 | 75 | [Enhanced Pharmacodynamics, LLC (ePD)](https://www.epd-llc.com/) is a 76 | contract research organization that assists clients with the design and 77 | implementation of model-informed drug development strategies in a broad 78 | range of therapeutic areas. The executive management team is led by 79 | [Dr. Donald E. Mager](https://www.linkedin.com/in/don-mager-2652615/) 80 | and [Dr. Scott A. Van 81 | Wart](https://www.linkedin.com/in/scott-van-wart-2b6002a/). 82 | 83 | [Finch Studio](https://finchstudio.io/) is an integrated modeling 84 | environment for pharmacometricians, clinical pharmacologists, and other 85 | team members to visualize, develop, and organize PK/PD models and data. 86 | It includes a modern NONMEM code editor and workbench, interactive data 87 | tables and visualizations, and a PK/PD model library. The development 88 | team is led by [Dr. Mohamed 89 | Ismail](https://www.linkedin.com/in/mohamed-ismail-bb54a367/). 90 | 91 | nonmem2mrgsolve was developed at ePD by [Andrew 92 | Santulli](https://www.linkedin.com/in/andrew-santulli-219034156/). 93 | 94 | ## Vignette 95 | 96 | Three case study models are provided within the vignette folder. The 97 | following section will use these examples to provide a brief tutorial on 98 | how to implement nonmem2mrgsolve into the model development and 99 | simulation workflow. To get started, download nonmem2mrgsolve and copy 100 | the vignette folder to a convenient file location. 101 | 102 | ### Example 1: A 1-compartment model with first-order absorption 103 | 104 | Within the vignette >> models directory, you should find three 105 | folders: 106 | 107 | 108 | 109 | This first example is drugx-oral-1cmt-101, in which you will find the 110 | NONMEM control stream (.ctl) and output files (.ext and .lst). The 111 | nonmem2mrgsolve package does not require the .lst file, it is provided 112 | solely for user reference. The nonmem2mrgsolve-translated mrgsolve code, 113 | along with the mrgsolve code following any necessary user modifications, 114 | are provided as well for reference, but could be deleted at this step 115 | and recreated during the vignette. The run\_nonmem2mrgsolve\_drugx.R 116 | file contains all the code presented for this example of the vignette. 117 | 118 | 119 | 120 | Now that the directory structure is clear, start R, load the 121 | nonmem2mrgsolve package, and set the working directory to immediately 122 | before entering the vignette folder: 123 | 124 | ``` r 125 | library("nonmem2mrgsolve") 126 | setwd("Your file path to vignette folder here") 127 | ``` 128 | 129 | Translating the NONMEM model into mrgsolve code is accomplished using a 130 | single function call: 131 | 132 | ``` r 133 | nonmem2mrgsolve( 134 | "mod1.ctl", # the NONMEM run name 135 | "./vignette/models/drugx-oral-1cmt-101/", # path to mod1.ctl and mod1.ext, from the working directory (which was set earlier) 136 | out.filename = "mrgsolve_code_drugx-oral", # name for the mrgsolve code .R output file 137 | sigdig = 3 # number of significant digits to report thetas and omegas to within the mrgsolve code (optional) 138 | ) 139 | ``` 140 | 141 | During the translation, the final parameter estimates (thetas and 142 | omegas) are obtained from the NONMEM .ext file, while the parameter and 143 | differential equations are pulled from the NONMEM .ctl file. There are 144 | several optional inputs to the nonmem2mrgsolve function, as detailed in 145 | the usage statement. 146 | 147 | When the translation is finished, the mrgsolve code will print to the R 148 | console and will also be written to a .R file: 149 | 150 | 151 | 152 | 153 | Now is a good time to check whether the nonmem2mrgsolve-translated 154 | mrgsolve code requires any user modifications in order to compile: 155 | 156 | ``` r 157 | source("./vignettes/models/drugx-oral-1cmt-101/mrgsolve_code_drugx-oral.R") 158 | mrgsolve::mcode("Test_Unmodified_Translation",code) 159 | ``` 160 | 161 | In this example manual user changes to the mrgsolve code are not needed, 162 | since the model successfully compiled: 163 | 164 | 165 | 166 | If certain model complexities are present, the 167 | nonmem2mrgsolve-translated mrgsolve code may fail to compile into an 168 | mrgsolve model object. The compilation failure will provide informative 169 | error messages for locating the line of code that needs attention. The 170 | compilation failure will also prevent the user from running simulations 171 | without first addressing problems in the code. 172 | 173 | As a final step before conducting simulations, the user should validate 174 | the mrgsolve model. There is an intuitive and established framework 175 | [(Here)](https://mrgsolve.org/blog/posts/2023-update-validation.html). 176 | Model validation remains the responsibility of the user and should 177 | always be performed, regardless of the robustness of the translation 178 | software or the experience of the user. 179 | 180 | ### Example 2: A QSS Target-Mediated Drug Disposition (TMDD) Model and Indirect Response PK-PD Model 181 | 182 | This example is located within the evolocumab-tmdd-qss-pkpd-101 folder 183 | of the vignette >> models directory. Since the steps for 184 | translating the NONMEM model into mrgsolve code are equivalent to those 185 | presented in Example 1, the tutorial for this case study will start at 186 | compiling the nonmem2mrgsolve-translated mrgsolve code into an mrgsolve 187 | model object. The complete code for running the earlier steps as well is 188 | included within the run\_nonmem2mrgsolve\_evolocumab.R file. 189 | 190 | Attempting to compile the nonmem2mrgsolve-translated mrgsolve code 191 | results in a fatal error: 192 | 193 | ``` r 194 | source("./vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd.R") 195 | mrgsolve::mcode("Test_Unmodified_Translation",code) 196 | ``` 197 | 198 | 199 | 200 | From the error message it is clear that the issue occurred when the 201 | NONMEM dataset column “TIME” was being used in the differential equation 202 | code block ($DES). Mrgsolve syntax requires this to be labeled as 203 | “SOLVERTIME”. 204 | 205 | The user can manually make this single change while leaving the rest of 206 | the nonmem2mrgsolve code unmodified: 207 | 208 | 209 | 210 | Compiling the corrected mrgsolve code is successful: 211 | 212 | ``` r 213 | source("./vignette/models/evolocumab-tmdd-qss-pkpd-101/mrgsolve_code_evolocumab-tmdd_user-modified.R") 214 | mrgsolve::mcode("Test_Modified_Translation",code) 215 | ``` 216 | 217 | 218 | 219 | ### Example 3: A Whole-body Physiologically-based Pharmacokinetic (PBPK) Model 220 | 221 | This example is located within the mavoglurant-pbpk-101 folder of the 222 | vignette >> models directory. Since the steps for translating the 223 | NONMEM model into mrgsolve code are equivalent to those presented in 224 | Example 1, the tutorial for this case study will start at compiling the 225 | nonmem2mrgsolve-translated mrgsolve code into an mrgsolve model object. 226 | The complete code for running the earlier steps as well is included 227 | within the run\_nonmem2mrgsolve\_mavoglurant.R file. 228 | 229 | Attempting to compile the nonmem2mrgsolve-translated mrgsolve code 230 | results in a fatal error: 231 | 232 | ``` r 233 | source("./vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk.R") 234 | mrgsolve::mcode("Test_Unmodified_Translation",code) 235 | ``` 236 | 237 | 238 | 239 | From the error message it is clear that the issue occurred because 240 | “RATE” was not declared in the parameter block ($PARAM). Additionally, 241 | this should be renamed since “RATE” is a reserved term. 242 | 243 | The user can manually make these two changes while leaving the rest of 244 | the nonmem2mrgsolve code unmodified: 245 | 246 | 247 | 248 | 249 | Compiling the corrected mrgsolve code is successful: 250 | 251 | ``` r 252 | source("./vignette/models/mavoglurant-pbpk-101/mrgsolve_code_mavoglurant-pbpk_user-modified.R") 253 | mrgsolve::mcode("Test_Modified_Translation",code) 254 | ``` 255 | 256 | 257 | -------------------------------------------------------------------------------- /vignette/models/evolocumab-tmdd-qss-pkpd-101/mod1.ext: -------------------------------------------------------------------------------- 1 | TABLE NO. 1: First Order Conditional Estimation with Interaction: Goal Function=MINIMUM VALUE OF OBJECTIVE FUNCTION: Problem=1 Subproblem=0 Superproblem1=0 Iteration1=0 Superproblem2=0 Iteration2=0 2 | ITERATION THETA1 THETA2 THETA3 THETA4 THETA5 THETA6 THETA7 THETA8 THETA9 THETA10 THETA11 THETA12 THETA13 SIGMA(1,1) SIGMA(2,1) SIGMA(2,2) SIGMA(3,1) SIGMA(3,2) SIGMA(3,3) SIGMA(4,1) SIGMA(4,2) SIGMA(4,3) SIGMA(4,4) SIGMA(5,1) SIGMA(5,2) SIGMA(5,3) SIGMA(5,4) SIGMA(5,5) SIGMA(6,1) SIGMA(6,2) SIGMA(6,3) SIGMA(6,4) SIGMA(6,5) SIGMA(6,6) OMEGA(1,1) OMEGA(2,1) OMEGA(2,2) OMEGA(3,1) OMEGA(3,2) OMEGA(3,3) OMEGA(4,1) OMEGA(4,2) OMEGA(4,3) OMEGA(4,4) OMEGA(5,1) OMEGA(5,2) OMEGA(5,3) OMEGA(5,4) OMEGA(5,5) OMEGA(6,1) OMEGA(6,2) OMEGA(6,3) OMEGA(6,4) OMEGA(6,5) OMEGA(6,6) OMEGA(7,1) OMEGA(7,2) OMEGA(7,3) OMEGA(7,4) OMEGA(7,5) OMEGA(7,6) OMEGA(7,7) OMEGA(8,1) OMEGA(8,2) OMEGA(8,3) OMEGA(8,4) OMEGA(8,5) OMEGA(8,6) OMEGA(8,7) OMEGA(8,8) OMEGA(9,1) OMEGA(9,2) OMEGA(9,3) OMEGA(9,4) OMEGA(9,5) OMEGA(9,6) OMEGA(9,7) OMEGA(9,8) OMEGA(9,9) OMEGA(10,1) OMEGA(10,2) OMEGA(10,3) OMEGA(10,4) OMEGA(10,5) OMEGA(10,6) OMEGA(10,7) OMEGA(10,8) OMEGA(10,9) OMEGA(10,10) OMEGA(11,1) OMEGA(11,2) OMEGA(11,3) OMEGA(11,4) OMEGA(11,5) OMEGA(11,6) OMEGA(11,7) OMEGA(11,8) OMEGA(11,9) OMEGA(11,10) OMEGA(11,11) OBJ 3 | 0 2.00000E-01 3.00000E+00 3.00000E-01 2.00000E+00 5.00000E+00 3.00000E-01 5.00000E-02 6.00000E-01 7.20000E-01 3.00000E-01 1.00000E+02 1.00000E+00 1.00000E+00 1.00000E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 2.00000E+01 1.00000E-01 0.00000E+00 3.00000E-02 0.00000E+00 0.00000E+00 1.00000E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 3.00000E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 4.00000E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E-01 1086.3838460923159 4 | 5 2.29118E-01 2.73796E+00 2.91523E-01 2.13719E+00 6.01452E+00 2.98617E-01 5.20895E-02 6.57805E-01 7.20000E-01 3.01963E-01 1.10326E+02 1.00000E+00 1.18667E+00 1.10321E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.05507E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.01167E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 2.00588E+01 9.01675E-02 0.00000E+00 4.19772E-02 0.00000E+00 0.00000E+00 1.09115E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 3.46154E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.03854E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 4.21868E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.32728E-01 967.64923264060440 5 | 10 2.26975E-01 2.77816E+00 2.83491E-01 2.11312E+00 5.79326E+00 2.86335E-01 5.26971E-02 5.90550E-01 7.20000E-01 3.04109E-01 1.12687E+02 1.00000E+00 1.39555E+00 1.10852E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.05847E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00704E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.94044E+01 7.33444E-02 0.00000E+00 4.02079E-02 0.00000E+00 0.00000E+00 1.12162E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 4.15634E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 8.85756E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 3.84321E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.34740E-01 931.29183180794371 6 | 14 2.27519E-01 2.71888E+00 2.76328E-01 2.11519E+00 5.88516E+00 2.66550E-01 5.27932E-02 5.82106E-01 7.20000E-01 3.04108E-01 1.13402E+02 1.00000E+00 1.40930E+00 1.10726E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.05965E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00778E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.94094E+01 7.08338E-02 0.00000E+00 4.02637E-02 0.00000E+00 0.00000E+00 1.12326E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 4.20141E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 8.63569E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 3.75476E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.27169E-01 925.42846322732066 7 | -1000000000 2.27505E-01 2.71313E+00 2.76166E-01 2.11422E+00 5.88232E+00 2.65911E-01 5.28221E-02 5.82450E-01 7.20000E-01 3.04556E-01 1.13171E+02 1.00000E+00 1.40841E+00 1.10733E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.05962E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00776E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.94098E+01 7.09136E-02 0.00000E+00 4.02987E-02 0.00000E+00 0.00000E+00 1.12360E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 4.19950E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 8.69048E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 3.75891E-02 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.27478E-01 925.42846322732066 8 | -1000000001 1.74350E-02 1.53564E-01 3.69797E-02 6.65827E-02 4.27552E-01 1.91712E-02 5.45485E-04 5.30281E-02 1.00000E+10 7.20359E-03 5.32769E+00 1.00000E+10 1.76937E-01 1.08487E-03 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 9.00031E-04 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.54320E-03 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 6.02031E+00 3.75953E-02 1.00000E+10 2.38118E-02 1.00000E+10 1.00000E+10 4.81766E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 2.17804E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 3.66865E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.34560E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 5.35063E-02 0.0000000000000000 9 | -1000000002 3.33111E-04 8.48327E-02 1.09549E-01 1.75826E-01 2.11550E-01 2.48065E-01 2.97136E-01 3.10314E-01 3.85042E-01 4.23934E-01 5.06184E-01 5.61623E-01 7.06197E-01 8.70759E-01 9.85069E-01 1.05094E+00 1.24722E+00 1.52597E+00 1.79946E+00 2.44131E+00 3.60004E+00 4.45865E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.0000000000000000 10 | -1000000003 1.33849E+04 3.33111E-04 4.45865E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.0000000000000000 11 | -1000000004 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.05230E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.02938E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00387E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 4.40566E+00 2.66296E-01 0.00000E+00 2.00745E-01 0.00000E+00 0.00000E+00 3.35201E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 2.04927E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 2.94796E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.93879E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 3.57041E-01 0.0000000000000000 12 | -1000000005 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 5.15477E-03 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 4.37173E-03 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 7.68624E-03 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 6.83248E-01 7.05892E-02 1.00000E+10 5.93084E-02 1.00000E+10 1.00000E+10 7.18624E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 5.31419E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 6.22235E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 3.47020E-02 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 1.00000E+10 7.49302E-02 0.0000000000000000 13 | -1000000006 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E+00 0.00000E+00 0.00000E+00 1.00000E+00 0.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 0.00000E+00 1.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 1.00000E+00 0.00000E+00 0.0000000000000000 14 | -1000000007 1.34000E+02 5.00000E+01 5.40000E+01 5.90000E+01 4.90000E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.0000000000000000 15 | -1000000008 2.15199E+03 -5.40250E+00 7.26775E+00 1.37180E+01 9.65742E-01 1.63464E+03 5.42888E+02 -1.54095E+01 0.00000E+00 -2.20459E+01 4.40953E+00 0.00000E+00 1.46325E+00 -2.47565E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.21849E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 8.64844E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 -6.04295E-04 -4.74091E+00 0.00000E+00 -5.26454E+00 0.00000E+00 0.00000E+00 -7.69754E-01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 3.79399E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 -2.49076E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 -1.13438E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 -4.17262E+00 0.0000000000000000 16 | -------------------------------------------------------------------------------- /vignette/models/drugx-oral-1cmt-101/mod1.lst: -------------------------------------------------------------------------------- 1 | Tue 04/09/2024 2 | 03:11 PM 3 | $PROBLEM ev_no-delay_first-order_one-compartment_linear 4 | $INPUT ID TIME EVID AMT DV RACEN WTKG Race=DROP 5 | $DATA F1003-Asian-PK-Study.csv IGNORE=@ 6 | $SUBROUTINE ADVAN13 TRANS1 TOL=9 SUBROUTINES=D 7 | $MODEL COMP=(DEPOT,DEFDOSE) COMP=(CENTRAL,DEFOBS) 8 | $PK 9 | 10 | TVKA = THETA(1) 11 | KA = TVKA 12 | 13 | TVCL = THETA(2)*(WTKG/71.0)**THETA(4) 14 | CL = TVCL*EXP(ETA(1)) 15 | 16 | TVV = THETA(3)*(WTKG/71.0)**THETA(5) 17 | V = TVV*EXP(ETA(2)) 18 | S2 = V 19 | 20 | $DES 21 | 22 | DADT(1) = -KA*A(1) 23 | DADT(2) = KA*A(1) - (CL/V)*A(2) 24 | 25 | $ERROR 26 | 27 | IPRED = F 28 | IRES = DV-IPRED 29 | W = SQRT(IPRED**2*SIGMA(1,1)) 30 | IWRES = IRES/W 31 | Y = F + F*EPS(1) 32 | 33 | $THETA (0,0.783) ; KA; 1/hr ;Absorption Rate Constant 34 | (0,17.3) ; CL; L/hr ;Clearance 35 | (0,84.0) ; V; L ;Volume of Distribution 36 | 1.83 ; WTonCL 37 | 1 ; WTonV 38 | $OMEGA BLOCK(2) 39 | 0.0103 ; CL_ 40 | 0.00 0.111 ; V_ 41 | $SIGMA 0.0206 ; Proportional 42 | $ESTIMATION METHOD=1 INTER NOABORT MAXEVAL=9999 PRINT=5 NSIG=3 SIGL=9 43 | NOTHETABOUNDTEST NOOMEGABOUNDTEST NOSIGMABOUNDTEST 44 | $COVARIANCE PRINT=E UNCONDITIONAL 45 | $TABLE ID TIME DV MDV EVID IPRED CWRES IWRES ONEHEADER NOPRINT 46 | FILE=sdtab1 47 | $TABLE ID KA CL V ETAS(1:LAST) ONEHEADER NOPRINT FILE=patab1 ; model parameters 48 | $TABLE ID RACEN ONEHEADER NOPRINT FILE=catab1 ; categorical covariates 49 | $TABLE ID WTKG ONEHEADER NOPRINT FILE=cotab1 ; continuous covariates 50 | 51 | 52 | NM-TRAN MESSAGES 53 | 54 | WARNINGS AND ERRORS (IF ANY) FOR PROBLEM 1 55 | 56 | (WARNING 2) NM-TRAN INFERS THAT THE DATA ARE POPULATION. 57 | 58 | (WARNING 79) SIGMA IS USED ON THE RIGHT. WITH A SUBSEQUENT RUN, IF AN 59 | INITIAL ESTIMATE OF A DIAGONAL BLOCK OF SIGMA IS TO BE COMPUTED BY 60 | NONMEM, THAT BLOCK WILL BE SET TO AN IDENTITY MATRIX DURING THAT 61 | COMPUTATION. THIS COULD LEAD TO AN ARITHMETIC EXCEPTION.* 62 | 63 | * THE MAXIMUM NUMBER OF WARNINGS OF ONE OR MORE TYPES WAS REACHED. 64 | IT IS POSSIBLE THAT SOME WARNING MESSAGES WERE SUPPRESSED. 65 | 66 | License Registered to: Enhanced Pharmacodynamics LLC 67 | Expiration Date: 14 SEP 2024 68 | Current Date: 9 APR 2024 69 | Days until program expires : 155 70 | 1NONLINEAR MIXED EFFECTS MODEL PROGRAM (NONMEM) VERSION 7.4.4 71 | ORIGINALLY DEVELOPED BY STUART BEAL, LEWIS SHEINER, AND ALISON BOECKMANN 72 | CURRENT DEVELOPERS ARE ROBERT BAUER, ICON DEVELOPMENT SOLUTIONS, 73 | AND ALISON BOECKMANN. IMPLEMENTATION, EFFICIENCY, AND STANDARDIZATION 74 | PERFORMED BY NOUS INFOSYSTEMS. 75 | 76 | PROBLEM NO.: 1 77 | ev_no-delay_first-order_one-compartment_linear 78 | 0DATA CHECKOUT RUN: NO 79 | DATA SET LOCATED ON UNIT NO.: 2 80 | THIS UNIT TO BE REWOUND: NO 81 | NO. OF DATA RECS IN DATA SET: 1500 82 | NO. OF DATA ITEMS IN DATA SET: 8 83 | ID DATA ITEM IS DATA ITEM NO.: 1 84 | DEP VARIABLE IS DATA ITEM NO.: 5 85 | MDV DATA ITEM IS DATA ITEM NO.: 8 86 | 0INDICES PASSED TO SUBROUTINE PRED: 87 | 3 2 4 0 0 0 0 0 0 0 0 88 | 0LABELS FOR DATA ITEMS: 89 | ID TIME EVID AMT DV RACEN WTKG MDV 90 | 0(NONBLANK) LABELS FOR PRED-DEFINED ITEMS: 91 | KA CL V IPRED IWRES 92 | 0FORMAT FOR DATA: 93 | (E4.0,E5.0,E2.0,E4.0,E12.0,E2.0,E7.0,1F2.0) 94 | 95 | TOT. NO. OF OBS RECS: 1400 96 | TOT. NO. OF INDIVIDUALS: 100 97 | 0LENGTH OF THETA: 5 98 | 0DEFAULT THETA BOUNDARY TEST OMITTED: YES 99 | 0OMEGA HAS BLOCK FORM: 100 | 1 101 | 1 1 102 | 0DEFAULT OMEGA BOUNDARY TEST OMITTED: YES 103 | 0SIGMA HAS SIMPLE DIAGONAL FORM WITH DIMENSION: 1 104 | 0DEFAULT SIGMA BOUNDARY TEST OMITTED: YES 105 | 0INITIAL ESTIMATE OF THETA: 106 | LOWER BOUND INITIAL EST UPPER BOUND 107 | 0.0000E+00 0.7830E+00 0.1000E+07 108 | 0.0000E+00 0.1730E+02 0.1000E+07 109 | 0.0000E+00 0.8400E+02 0.1000E+07 110 | -0.1000E+07 0.1830E+01 0.1000E+07 111 | -0.1000E+07 0.1000E+01 0.1000E+07 112 | 0INITIAL ESTIMATE OF OMEGA: 113 | BLOCK SET NO. BLOCK FIXED 114 | 1 NO 115 | 0.1030E-01 116 | 0.0000E+00 0.1110E+00 117 | 0INITIAL ESTIMATE OF SIGMA: 118 | 0.2060E-01 119 | 0COVARIANCE STEP OMITTED: NO 120 | EIGENVLS. PRINTED: YES 121 | SPECIAL COMPUTATION: NO 122 | COMPRESSED FORMAT: NO 123 | GRADIENT METHOD USED: NOSLOW 124 | SIGDIGITS ETAHAT (SIGLO): -1 125 | SIGDIGITS GRADIENTS (SIGL): -1 126 | EXCLUDE COV FOR FOCE (NOFCOV): NO 127 | TURN OFF Cholesky Transposition of R Matrix (CHOLROFF): NO 128 | KNUTHSUMOFF: -1 129 | RESUME COV ANALYSIS (RESUME): NO 130 | SIR SAMPLE SIZE (SIRSAMPLE): -1 131 | NON-LINEARLY TRANSFORM THETAS DURING COV (THBND): 1 132 | PRECONDTIONING CYCLES (PRECOND): 0 133 | PRECONDTIONING TYPES (PRECONDS): TOS 134 | FORCED PRECONDTIONING CYCLES (PFCOND):0 135 | PRECONDTIONING TYPE (PRETYPE): 0 136 | FORCED POS. DEFINITE SETTING: (FPOSDEF):0 137 | 0TABLES STEP OMITTED: NO 138 | NO. OF TABLES: 4 139 | SEED NUMBER (SEED): 11456 140 | RANMETHOD: 3U 141 | MC SAMPLES (ESAMPLE): 300 142 | WRES SQUARE ROOT TYPE (WRESCHOL): EIGENVALUE 143 | 0-- TABLE 1 -- 144 | 0RECORDS ONLY: ALL 145 | 04 COLUMNS APPENDED: YES 146 | PRINTED: NO 147 | HEADERS: ONE 148 | FILE TO BE FORWARDED: NO 149 | FORMAT: S1PE11.4 150 | LFORMAT: 151 | RFORMAT: 152 | FIXED_EFFECT_ETAS: 153 | 0USER-CHOSEN ITEMS: 154 | ID TIME DV MDV EVID IPRED CWRES IWRES 155 | 0-- TABLE 2 -- 156 | 0RECORDS ONLY: ALL 157 | 04 COLUMNS APPENDED: YES 158 | PRINTED: NO 159 | HEADERS: ONE 160 | FILE TO BE FORWARDED: NO 161 | FORMAT: S1PE11.4 162 | LFORMAT: 163 | RFORMAT: 164 | FIXED_EFFECT_ETAS: 165 | 0USER-CHOSEN ITEMS: 166 | ID KA CL V ETA1 ETA2 167 | 0-- TABLE 3 -- 168 | 0RECORDS ONLY: ALL 169 | 04 COLUMNS APPENDED: YES 170 | PRINTED: NO 171 | HEADERS: ONE 172 | FILE TO BE FORWARDED: NO 173 | FORMAT: S1PE11.4 174 | LFORMAT: 175 | RFORMAT: 176 | FIXED_EFFECT_ETAS: 177 | 0USER-CHOSEN ITEMS: 178 | ID RACEN 179 | 0-- TABLE 4 -- 180 | 0RECORDS ONLY: ALL 181 | 04 COLUMNS APPENDED: YES 182 | PRINTED: NO 183 | HEADERS: ONE 184 | FILE TO BE FORWARDED: NO 185 | FORMAT: S1PE11.4 186 | LFORMAT: 187 | RFORMAT: 188 | FIXED_EFFECT_ETAS: 189 | 0USER-CHOSEN ITEMS: 190 | ID WTKG 191 | 1DOUBLE PRECISION PREDPP VERSION 7.4.4 192 | 193 | GENERAL NONLINEAR KINETICS MODEL WITH STIFF/NONSTIFF EQUATIONS (LSODA, ADVAN13) 194 | 0MODEL SUBROUTINE USER-SUPPLIED - ID NO. 9999 195 | 0MAXIMUM NO. OF BASIC PK PARAMETERS: 3 196 | 0COMPARTMENT ATTRIBUTES 197 | COMPT. NO. FUNCTION INITIAL ON/OFF DOSE DEFAULT DEFAULT 198 | STATUS ALLOWED ALLOWED FOR DOSE FOR OBS. 199 | 1 DEPOT ON YES YES YES NO 200 | 2 CENTRAL ON YES YES NO YES 201 | 3 OUTPUT OFF YES NO NO NO 202 | INITIAL (BASE) TOLERANCE SETTINGS: 203 | NRD (RELATIVE) VALUE(S) OF TOLERANCE: 9 204 | ANRD (ABSOLUTE) VALUE(S) OF TOLERANCE: 12 205 | 1 206 | ADDITIONAL PK PARAMETERS - ASSIGNMENT OF ROWS IN GG 207 | COMPT. NO. INDICES 208 | SCALE BIOAVAIL. ZERO-ORDER ZERO-ORDER ABSORB 209 | FRACTION RATE DURATION LAG 210 | 1 * * * * * 211 | 2 4 * * * * 212 | 3 * - - - - 213 | - PARAMETER IS NOT ALLOWED FOR THIS MODEL 214 | * PARAMETER IS NOT SUPPLIED BY PK SUBROUTINE; 215 | WILL DEFAULT TO ONE IF APPLICABLE 216 | 0DATA ITEM INDICES USED BY PRED ARE: 217 | EVENT ID DATA ITEM IS DATA ITEM NO.: 3 218 | TIME DATA ITEM IS DATA ITEM NO.: 2 219 | DOSE AMOUNT DATA ITEM IS DATA ITEM NO.: 4 220 | 221 | 0PK SUBROUTINE CALLED WITH EVERY EVENT RECORD. 222 | PK SUBROUTINE NOT CALLED AT NONEVENT (ADDITIONAL OR LAGGED) DOSE TIMES. 223 | 0ERROR SUBROUTINE CALLED WITH EVERY EVENT RECORD. 224 | 0DES SUBROUTINE USES COMPACT STORAGE MODE. 225 | 1 226 | 227 | 228 | #TBLN: 1 229 | #METH: First Order Conditional Estimation with Interaction 230 | 231 | ESTIMATION STEP OMITTED: NO 232 | ANALYSIS TYPE: POPULATION 233 | NUMBER OF SADDLE POINT RESET ITERATIONS: 0 234 | GRADIENT METHOD USED: NOSLOW 235 | CONDITIONAL ESTIMATES USED: YES 236 | CENTERED ETA: NO 237 | EPS-ETA INTERACTION: YES 238 | LAPLACIAN OBJ. FUNC.: NO 239 | NO. OF FUNCT. EVALS. ALLOWED: 9999 240 | NO. OF SIG. FIGURES REQUIRED: 3 241 | INTERMEDIATE PRINTOUT: YES 242 | ESTIMATE OUTPUT TO MSF: NO 243 | ABORT WITH PRED EXIT CODE 1: NO 244 | IND. OBJ. FUNC. VALUES SORTED: NO 245 | NUMERICAL DERIVATIVE 246 | FILE REQUEST (NUMDER): NONE 247 | MAP (ETAHAT) ESTIMATION METHOD (OPTMAP): 0 248 | ETA HESSIAN EVALUATION METHOD (ETADER): 0 249 | INITIAL ETA FOR MAP ESTIMATION (MCETA): 0 250 | SIGDIGITS FOR MAP ESTIMATION (SIGLO): 9 251 | GRADIENT SIGDIGITS OF 252 | FIXED EFFECTS PARAMETERS (SIGL): 9 253 | NOPRIOR SETTING (NOPRIOR): OFF 254 | NOCOV SETTING (NOCOV): OFF 255 | DERCONT SETTING (DERCONT): OFF 256 | FINAL ETA RE-EVALUATION (FNLETA): ON 257 | EXCLUDE NON-INFLUENTIAL (NON-INFL.) ETAS 258 | IN SHRINKAGE (ETASTYPE): NO 259 | NON-INFL. ETA CORRECTION (NONINFETA): OFF 260 | RAW OUTPUT FILE (FILE): psn.ext 261 | EXCLUDE TITLE (NOTITLE): NO 262 | EXCLUDE COLUMN LABELS (NOLABEL): NO 263 | FORMAT FOR ADDITIONAL FILES (FORMAT): S1PE12.5 264 | PARAMETER ORDER FOR OUTPUTS (ORDER): TSOL 265 | WISHART PRIOR DF INTERPRETATION (WISHTYPE):0 266 | KNUTHSUMOFF: 0 267 | INCLUDE LNTWOPI: NO 268 | INCLUDE CONSTANT TERM TO PRIOR (PRIORC): NO 269 | INCLUDE CONSTANT TERM TO OMEGA (ETA) (OLNTWOPI):NO 270 | ADDITIONAL CONVERGENCE TEST (CTYPE=4)?: NO 271 | EM OR BAYESIAN METHOD USED: NONE 272 | 273 | TOLERANCES FOR ESTIMATION/EVALUATION STEP: 274 | NRD (RELATIVE) VALUE(S) OF TOLERANCE: 9 275 | ANRD (ABSOLUTE) VALUE(S) OF TOLERANCE: 12 276 | TOLERANCES FOR COVARIANCE STEP: 277 | NRD (RELATIVE) VALUE(S) OF TOLERANCE: 9 278 | ANRD (ABSOLUTE) VALUE(S) OF TOLERANCE: 12 279 | TOLERANCES FOR TABLE/SCATTER STEP: 280 | NRD (RELATIVE) VALUE(S) OF TOLERANCE: 9 281 | ANRD (ABSOLUTE) VALUE(S) OF TOLERANCE: 12 282 | 283 | THE FOLLOWING LABELS ARE EQUIVALENT 284 | PRED=PREDI 285 | RES=RESI 286 | WRES=WRESI 287 | IWRS=IWRESI 288 | IPRD=IPREDI 289 | IRS=IRESI 290 | 291 | MONITORING OF SEARCH: 292 | 293 | 294 | 0ITERATION NO.: 0 OBJECTIVE VALUE: -6481.61695802832 NO. OF FUNC. EVALS.: 8 295 | CUMULATIVE NO. OF FUNC. EVALS.: 8 296 | NPARAMETR: 7.8300E-01 1.7300E+01 8.4000E+01 1.8300E+00 1.0000E+00 1.0300E-02 1.1100E-01 2.0600E-02 297 | PARAMETER: 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 1.0000E-01 298 | GRADIENT: 1.0023E+01 -2.5296E+01 -2.4393E+01 -1.6530E+02 -4.1748E+02 -4.7420E-01 1.5420E+02 2.7740E+00 299 | 300 | 0ITERATION NO.: 5 OBJECTIVE VALUE: -6548.92493583334 NO. OF FUNC. EVALS.: 48 301 | CUMULATIVE NO. OF FUNC. EVALS.: 56 302 | NPARAMETR: 8.2425E-01 1.7375E+01 8.9644E+01 1.9419E+00 2.1075E+00 1.0406E-02 1.6033E-02 2.0643E-02 303 | PARAMETER: 1.5134E-01 1.0432E-01 1.6502E-01 1.0611E-01 2.1075E-01 1.0512E-01 -8.6745E-01 1.0103E-01 304 | GRADIENT: 6.2602E+02 -1.6029E+02 1.5773E+02 5.8002E+02 2.2952E+03 -1.8179E+00 -2.6739E+01 -3.8335E+01 305 | 306 | 0ITERATION NO.: 10 OBJECTIVE VALUE: -6639.52360317143 NO. OF FUNC. EVALS.: 49 307 | CUMULATIVE NO. OF FUNC. EVALS.: 105 308 | NPARAMETR: 7.9254E-01 1.7345E+01 8.5272E+01 1.9097E+00 1.5673E+00 8.7425E-03 6.8631E-03 2.0454E-02 309 | PARAMETER: 1.1211E-01 1.0262E-01 1.1503E-01 1.0435E-01 1.5673E-01 1.8027E-02 -1.2917E+00 9.6442E-02 310 | GRADIENT: 2.7685E+02 -7.5585E+00 -2.3922E+02 9.4589E+02 -1.7651E+02 -3.3635E+01 -1.5951E+01 -1.5793E+01 311 | 312 | 0ITERATION NO.: 15 OBJECTIVE VALUE: -6645.44690748923 NO. OF FUNC. EVALS.: 46 313 | CUMULATIVE NO. OF FUNC. EVALS.: 151 314 | NPARAMETR: 7.8239E-01 1.7338E+01 8.5824E+01 1.8505E+00 1.5807E+00 1.0456E-02 7.6576E-03 2.0590E-02 315 | PARAMETER: 9.9217E-02 1.0217E-01 1.2149E-01 1.0112E-01 1.5807E-01 1.0750E-01 -1.2369E+00 9.9767E-02 316 | GRADIENT: -1.8742E-01 3.7008E-01 -7.7906E-03 1.5392E+00 4.0582E-01 -5.2822E-02 1.5006E-01 2.4771E-01 317 | 318 | 0ITERATION NO.: 20 OBJECTIVE VALUE: -6645.44730274261 NO. OF FUNC. EVALS.: 73 319 | CUMULATIVE NO. OF FUNC. EVALS.: 224 320 | NPARAMETR: 7.8242E-01 1.7338E+01 8.5830E+01 1.8512E+00 1.5811E+00 1.0461E-02 7.6491E-03 2.0589E-02 321 | PARAMETER: 9.9260E-02 1.0221E-01 1.2155E-01 1.0116E-01 1.5811E-01 1.0773E-01 -1.2375E+00 9.9744E-02 322 | GRADIENT: -6.2908E-02 -1.5248E-01 9.3741E-02 -2.0940E+00 -5.9376E-01 1.3092E-02 2.0193E-02 6.4205E-02 323 | 324 | #TERM: 325 | 0MINIMIZATION SUCCESSFUL 326 | NO. OF FUNCTION EVALUATIONS USED: 224 327 | NO. OF SIG. DIGITS IN FINAL EST.: 3.5 328 | 329 | ETABAR IS THE ARITHMETIC MEAN OF THE ETA-ESTIMATES, 330 | AND THE P-VALUE IS GIVEN FOR THE NULL HYPOTHESIS THAT THE TRUE MEAN IS 0. 331 | 332 | ETABAR: -4.1940E-05 -6.8459E-04 333 | SE: 9.6771E-03 7.6213E-03 334 | N: 100 100 335 | 336 | P VAL.: 9.9654E-01 9.2843E-01 337 | 338 | ETASHRINKSD(%) 4.9065E+00 1.2420E+01 339 | ETASHRINKVR(%) 9.5723E+00 2.3297E+01 340 | EBVSHRINKSD(%) 5.3297E+00 1.2753E+01 341 | EBVSHRINKVR(%) 1.0375E+01 2.3879E+01 342 | EPSSHRINKSD(%) 5.8347E+00 343 | EPSSHRINKVR(%) 1.1329E+01 344 | 345 | 346 | TOTAL DATA POINTS NORMALLY DISTRIBUTED (N): 1400 347 | N*LOG(2PI) CONSTANT TO OBJECTIVE FUNCTION: 2573.0278929730835 348 | OBJECTIVE FUNCTION VALUE WITHOUT CONSTANT: -6645.4473027426147 349 | OBJECTIVE FUNCTION VALUE WITH CONSTANT: -4072.4194097695313 350 | REPORTED OBJECTIVE FUNCTION DOES NOT CONTAIN CONSTANT 351 | 352 | TOTAL EFFECTIVE ETAS (NIND*NETA): 200 353 | 354 | #TERE: 355 | Elapsed estimation time in seconds: 49.94 356 | Elapsed covariance time in seconds: 57.79 357 | Elapsed postprocess time in seconds: 0.86 358 | 1 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | ************************************************************************************************************************ 380 | ******************** ******************** 381 | ******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ******************** 382 | #OBJT:************** MINIMUM VALUE OF OBJECTIVE FUNCTION ******************** 383 | ******************** ******************** 384 | ************************************************************************************************************************ 385 | 386 | 387 | 388 | 389 | 390 | 391 | #OBJV:******************************************** -6645.447 ************************************************** 392 | 1 393 | ************************************************************************************************************************ 394 | ******************** ******************** 395 | ******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ******************** 396 | ******************** FINAL PARAMETER ESTIMATE ******************** 397 | ******************** ******************** 398 | ************************************************************************************************************************ 399 | 400 | 401 | 402 | THETA - VECTOR OF FIXED EFFECTS PARAMETERS ********* 403 | 404 | 405 | TH 1 TH 2 TH 3 TH 4 TH 5 406 | 407 | 7.82E-01 1.73E+01 8.58E+01 1.85E+00 1.58E+00 408 | 409 | 410 | 411 | OMEGA - COV MATRIX FOR RANDOM EFFECTS - ETAS ******** 412 | 413 | 414 | ETA1 ETA2 415 | 416 | ETA1 417 | + 1.05E-02 418 | 419 | ETA2 420 | + 0.00E+00 7.65E-03 421 | 422 | 423 | 424 | SIGMA - COV MATRIX FOR RANDOM EFFECTS - EPSILONS **** 425 | 426 | 427 | EPS1 428 | 429 | EPS1 430 | + 2.06E-02 431 | 432 | 1 433 | 434 | 435 | OMEGA - CORR MATRIX FOR RANDOM EFFECTS - ETAS ******* 436 | 437 | 438 | ETA1 ETA2 439 | 440 | ETA1 441 | + 1.02E-01 442 | 443 | ETA2 444 | + 0.00E+00 8.75E-02 445 | 446 | 447 | 448 | SIGMA - CORR MATRIX FOR RANDOM EFFECTS - EPSILONS *** 449 | 450 | 451 | EPS1 452 | 453 | EPS1 454 | + 1.43E-01 455 | 456 | 1 457 | ************************************************************************************************************************ 458 | ******************** ******************** 459 | ******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ******************** 460 | ******************** STANDARD ERROR OF ESTIMATE ******************** 461 | ******************** ******************** 462 | ************************************************************************************************************************ 463 | 464 | 465 | 466 | THETA - VECTOR OF FIXED EFFECTS PARAMETERS ********* 467 | 468 | 469 | TH 1 TH 2 TH 3 TH 4 TH 5 470 | 471 | 9.56E-03 1.93E-01 9.54E-01 5.61E-02 5.84E-02 472 | 473 | 474 | 475 | OMEGA - COV MATRIX FOR RANDOM EFFECTS - ETAS ******** 476 | 477 | 478 | ETA1 ETA2 479 | 480 | ETA1 481 | + 1.37E-03 482 | 483 | ETA2 484 | + ......... 1.32E-03 485 | 486 | 487 | 488 | SIGMA - COV MATRIX FOR RANDOM EFFECTS - EPSILONS **** 489 | 490 | 491 | EPS1 492 | 493 | EPS1 494 | + 7.76E-04 495 | 496 | 1 497 | 498 | 499 | OMEGA - CORR MATRIX FOR RANDOM EFFECTS - ETAS ******* 500 | 501 | 502 | ETA1 ETA2 503 | 504 | ETA1 505 | + 6.68E-03 506 | 507 | ETA2 508 | + ......... 7.54E-03 509 | 510 | 511 | 512 | SIGMA - CORR MATRIX FOR RANDOM EFFECTS - EPSILONS *** 513 | 514 | 515 | EPS1 516 | 517 | EPS1 518 | + 2.71E-03 519 | 520 | 1 521 | ************************************************************************************************************************ 522 | ******************** ******************** 523 | ******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ******************** 524 | ******************** COVARIANCE MATRIX OF ESTIMATE ******************** 525 | ******************** ******************** 526 | ************************************************************************************************************************ 527 | 528 | 529 | TH 1 TH 2 TH 3 TH 4 TH 5 OM11 OM12 OM22 SG11 530 | 531 | TH 1 532 | + 9.14E-05 533 | 534 | TH 2 535 | + 4.43E-04 3.74E-02 536 | 537 | TH 3 538 | + 3.98E-03 4.32E-02 9.11E-01 539 | 540 | TH 4 541 | + 2.63E-05 -1.29E-03 2.97E-03 3.15E-03 542 | 543 | TH 5 544 | + -3.42E-05 1.99E-04 -9.29E-03 -6.97E-04 3.41E-03 545 | 546 | OM11 547 | + 1.65E-06 4.01E-05 -1.69E-05 1.74E-07 2.57E-06 1.87E-06 548 | 549 | OM12 550 | + ......... ......... ......... ......... ......... ......... ......... 551 | 552 | OM22 553 | + 1.61E-06 3.00E-05 -1.13E-05 -1.14E-05 1.72E-05 5.97E-07 ......... 1.74E-06 554 | 555 | SG11 556 | + 3.04E-07 2.42E-05 1.35E-04 -6.69E-07 -3.62E-06 1.49E-07 ......... -2.40E-07 6.03E-07 557 | 558 | 1 559 | ************************************************************************************************************************ 560 | ******************** ******************** 561 | ******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ******************** 562 | ******************** CORRELATION MATRIX OF ESTIMATE ******************** 563 | ******************** ******************** 564 | ************************************************************************************************************************ 565 | 566 | 567 | TH 1 TH 2 TH 3 TH 4 TH 5 OM11 OM12 OM22 SG11 568 | 569 | TH 1 570 | + 9.56E-03 571 | 572 | TH 2 573 | + 2.40E-01 1.93E-01 574 | 575 | TH 3 576 | + 4.36E-01 2.34E-01 9.54E-01 577 | 578 | TH 4 579 | + 4.90E-02 -1.19E-01 5.54E-02 5.61E-02 580 | 581 | TH 5 582 | + -6.12E-02 1.76E-02 -1.67E-01 -2.13E-01 5.84E-02 583 | 584 | OM11 585 | + 1.26E-01 1.52E-01 -1.30E-02 2.27E-03 3.22E-02 1.37E-03 586 | 587 | OM12 588 | + ......... ......... ......... ......... ......... ......... ......... 589 | 590 | OM22 591 | + 1.28E-01 1.18E-01 -8.99E-03 -1.54E-01 2.23E-01 3.31E-01 ......... 1.32E-03 592 | 593 | SG11 594 | + 4.09E-02 1.61E-01 1.82E-01 -1.54E-02 -7.98E-02 1.40E-01 ......... -2.34E-01 7.76E-04 595 | 596 | 1 597 | ************************************************************************************************************************ 598 | ******************** ******************** 599 | ******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ******************** 600 | ******************** INVERSE COVARIANCE MATRIX OF ESTIMATE ******************** 601 | ******************** ******************** 602 | ************************************************************************************************************************ 603 | 604 | 605 | TH 1 TH 2 TH 3 TH 4 TH 5 OM11 OM12 OM22 SG11 606 | 607 | TH 1 608 | + 1.43E+04 609 | 610 | TH 2 611 | + -9.46E+01 3.08E+01 612 | 613 | TH 3 614 | + -5.89E+01 -9.68E-01 1.48E+00 615 | 616 | TH 4 617 | + -1.27E+02 1.24E+01 -8.02E-01 3.46E+02 618 | 619 | TH 5 620 | + 2.23E+01 -1.82E+00 3.12E+00 5.79E+01 3.28E+02 621 | 622 | OM11 623 | + -8.99E+03 -3.90E+02 1.16E+02 -1.10E+03 5.49E+02 6.56E+05 624 | 625 | OM12 626 | + ......... ......... ......... ......... ......... ......... ......... 627 | 628 | OM22 629 | + -8.80E+03 -3.57E+02 -3.44E+01 2.20E+03 -3.02E+03 -2.59E+05 ......... 7.75E+05 630 | 631 | SG11 632 | + 8.46E+03 -1.01E+03 -2.87E+02 1.62E+03 6.69E+01 -2.68E+05 ......... 3.83E+05 1.98E+06 633 | 634 | 1 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | ************************************************************************************************************************ 656 | ******************** ******************** 657 | ******************** FIRST ORDER CONDITIONAL ESTIMATION WITH INTERACTION ******************** 658 | ******************** EIGENVALUES OF COR MATRIX OF ESTIMATE ******************** 659 | ******************** ******************** 660 | ************************************************************************************************************************ 661 | 662 | 663 | 1 2 3 4 5 6 7 8 664 | 665 | 4.51E-01 5.50E-01 7.17E-01 7.69E-01 1.04E+00 1.12E+00 1.59E+00 1.77E+00 666 | 667 | Elapsed finaloutput time in seconds: 0.90 668 | #CPUT: Total CPU Time in Seconds, 108.422 669 | Stop Time: 670 | Tue 04/09/2024 671 | 03:13 PM 672 | -------------------------------------------------------------------------------- /R/get_blocks.R: -------------------------------------------------------------------------------- 1 | ## Manipulating and Creating Each Block #### 2 | 3 | ## FUNCTION $PROB $INPUT $THETA #### 4 | 5 | get_block_input <- function(ctl0 = NULL, ext0 = NULL){ 6 | 7 | remove_param <- c("AMT", "DUR", "RATE", "DV", "MDV", "EVID", "CMT", "TIME", "ID", "$INPUT") # common NONMEM variables that should not appear in mrgsolve PARAM 8 | 9 | note_param1 <- c("DOSEN", "DOSENUM", "OCC", "CYC", "CYCLE", "DAY") 10 | note_param2 <- "TSFD" 11 | note_param3 <- c("TSLD","TSLDE") 12 | note_param4 <- c("DOSEUG","DOSEMG","DOSE","DOSEMGKG","DOSENG") 13 | 14 | note1 <- " /* NOTE: Parameter identified as time-varying. A full dataset must be supplied to mrgsolve or the parameter should instead be calculated in $ODE. */" 15 | note2 <- " /* NOTE: Parameter identified as time-varying. Please refer to TIME, self.time(), and SOLVERTIME if TSFD is equivalent to TIME. */" 16 | note3 <- " /* NOTE: Parameter identified as time-varying. Please refer to self.tad() and mrg::tadose. */" 17 | note4 <- " /* NOTE: Parameter identified as related to AMT. Please refer to self.amt() or supply in the dataset. */" 18 | 19 | input <- ctl0 %>% 20 | dplyr::filter(BLOCK == "INPUT")%>% 21 | dplyr::select(V1)%>% 22 | dplyr::mutate(V1 = paste(V1, collapse = " "))%>% # join all rows of input to single row 23 | dplyr::distinct() # remove duplicates 24 | 25 | input <- data.frame(V1 = strsplit(input$V1, "\\s")[[1]]) %>% # single row to many by white space 26 | dplyr::mutate(V1 = trimws(V1, which = "both"))%>% 27 | dplyr::filter(V1 != "") 28 | 29 | input <- input %>% 30 | dplyr::mutate(FLG_RM = ifelse(grepl("=DROP",V1) == T, 1, 0)) %>% # remove dropped parameters 31 | dplyr::mutate(FLG_RM = ifelse(toupper(V1) %in% remove_param, 1, FLG_RM)) %>% # remove input parameters common to NONMEM that should not appear in mrgsolve PARAM 32 | dplyr::filter(FLG_RM == 0)%>% 33 | dplyr::select(-FLG_RM) 34 | 35 | compareTo <- ctl0 %>% 36 | dplyr::filter(BLOCK == "DES" | BLOCK == "PK")%>% 37 | dplyr::select(V1) %>% 38 | dplyr::mutate(V1 = paste(V1, collapse = " "))%>% # join all rows of input to single row 39 | dplyr::distinct() # remove duplicates 40 | 41 | for(i in 1:length(input$V1)){ 42 | input[i, "FLG_KP"] <- length(grep(input[i,"V1"],compareTo$V1)) # keep only input parameters found in either $PK or $DES of CTL 43 | } 44 | 45 | input <- input %>% 46 | dplyr::filter(FLG_KP == 1)%>% 47 | dplyr::select(V1) 48 | 49 | mrg_code <- input %>% 50 | dplyr::mutate(NOTE = ifelse(toupper(V1) %in% note_param1, note1, 51 | ifelse(toupper(V1) %in% note_param2, note2, 52 | ifelse(toupper(V1) %in% note_param3, note3, 53 | ifelse(toupper(V1) %in% note_param4, note4, 54 | "")))))%>% 55 | dplyr::mutate(V1 = paste0(V1,"=NA_real_",ifelse(dplyr::row_number() == max(dplyr::row_number()), "", ""),NOTE))%>% # removed "," from second ifelse 3/17/2024 56 | dplyr::select(-NOTE) 57 | 58 | mrg_code <- ctl0 %>% 59 | dplyr::filter(substr(BLOCK,1,4) == "PROB")%>% 60 | dplyr::select(V1)%>% 61 | dplyr::mutate(V1 = gsub("\\$..*?\\s","$PROB ",V1))%>% 62 | dplyr::bind_rows(blank_df())%>% 63 | dplyr::bind_rows(data.frame(V1 = "$PARAM"))%>% 64 | dplyr::bind_rows(blank_df())%>% 65 | dplyr::bind_rows(mrg_code) 66 | 67 | names(ext0$THETA) <- NULL 68 | 69 | mrg_theta <- data.frame(V1 = c("$THETA","",paste(ext0$THETA, collapse = " "))) 70 | 71 | mrg_code <- mrg_code %>% 72 | dplyr::bind_rows(blank_df())%>% 73 | dplyr::bind_rows(mrg_theta) 74 | 75 | return(list(params = input, mrg_code = mrg_code)) 76 | } 77 | 78 | ## FUNCTION $MODEL #### 79 | 80 | get_block_model <- function(ctl0 = NULL, mrg_code = NULL){ 81 | 82 | input <- ctl0 %>% 83 | dplyr::filter(BLOCK == "MODEL")%>% 84 | dplyr::select(V1)%>% 85 | dplyr::mutate(V1 = paste(V1, collapse = " "))%>% # join all rows of input to single row 86 | dplyr::distinct() # remove duplicates 87 | 88 | input <- data.frame(V1 = strsplit(input$V1, "\\s")[[1]]) %>% # single row to many by white space 89 | dplyr::mutate(V1 = trimws(V1, which = "both"))%>% # remove white space 90 | dplyr::filter(V1 != "")%>% # remove white space 91 | dplyr::mutate(V1 = ifelse(V1 == "COMP" | V1 == "COMP=", ifelse(dplyr::lead(V1)=="=", paste0(V1,"=",dplyr::lead(V1,2)), paste0(V1,"=",dplyr::lead(V1))), V1))%>% # add = sign if not used 92 | dplyr::filter(substr(V1,1,4) == "COMP") %>% # filter to just compartment declares 93 | dplyr::mutate(V1 = gsub("COMP","",V1))%>% 94 | dplyr::mutate(V1 = gsub("=","",V1))%>% # get down to just names and options 95 | dplyr::mutate(V1 = gsub("\\(","",V1))%>% 96 | dplyr::mutate(V1 = gsub("\\)","",V1))%>% 97 | dplyr::mutate(V1 = gsub("\\,"," ",V1))%>% 98 | dplyr::mutate(V1 = gsub("\\s.*","",V1)) # remove anything after first white space 99 | 100 | mrg_code <- mrg_code %>% 101 | dplyr::bind_rows(blank_df())%>% 102 | dplyr::bind_rows(data.frame(V1 = "$CMT"))%>% 103 | dplyr::bind_rows(blank_df())%>% 104 | dplyr::bind_rows(input)%>% 105 | dplyr::bind_rows(blank_df())%>% 106 | # bind_rows(data.frame(V1 = "$PLUGIN Rccp"))%>% 107 | # bind_rows(blank_df())%>% 108 | dplyr::bind_rows(data.frame(V1 = "$MAIN"))%>% 109 | dplyr::bind_rows(blank_df()) 110 | 111 | return(list(cmts = input, mrg_code = mrg_code)) 112 | } 113 | 114 | ## FUNCTION $PK $DES #### 115 | 116 | get_block_pk <- function(ctl0 = NULL, mrg_code = NULL, cmts = NULL){ 117 | 118 | ### Initial Syntax Changes #### 119 | 120 | input <- ctl0 %>% 121 | dplyr::filter((BLOCK == "PK" | BLOCK == "DES"), FLG_BLOCK != 1)%>% 122 | dplyr::select(V1,BLOCK)%>% 123 | 124 | dplyr::mutate(V1 = gsub("EXP\\(","exp\\(",V1))%>% # convert to mrgsolve syntax 125 | dplyr::mutate(V1 = gsub("LOG\\(","log\\(",V1))%>% 126 | dplyr::mutate(V1 = gsub("LOG10\\(","log10\\(",V1))%>% 127 | dplyr::mutate(V1 = gsub("SQRT\\(","sqrt\\(",V1))%>% 128 | 129 | dplyr::mutate(V1 = gsub("\\s*ELSE\\s*IF\\s*\\(\\s*", "}else if\\(",V1))%>% # 06aug2024 changed all \\s to \\s* in this code header section; put call w/ most whitespace replacement first 130 | dplyr::mutate(V1 = gsub("\\s*ELSE\\s*IF\\s*\\(", "}else if\\(",V1))%>% # 06aug2024 131 | dplyr::mutate(V1 = gsub("ELSE\\s*IF\\s*\\(\\s*", "}else if\\(",V1))%>% # 06aug2024 132 | dplyr::mutate(V1 = gsub("ELSE\\s*IF\\s*\\(", "}else if\\(",V1))%>% # 06aug2024 133 | dplyr::mutate(V1 = gsub("\\s*ELSE\\s*IF\\(\\s*", "}else if\\(",V1))%>% # 06aug2024 134 | dplyr::mutate(V1 = gsub("\\s*ELSE\\s*IF\\(", "}else if\\(",V1))%>% # 06aug2024 135 | dplyr::mutate(V1 = gsub("ELSE\\s*IF\\(\\s*", "}else if\\(",V1))%>% # 06aug2024 136 | dplyr::mutate(V1 = gsub("ELSE\\s*IF\\(", "}else if\\(",V1))%>% # 06aug2024 137 | 138 | dplyr::mutate(V1 = gsub("\\s*IF\\s*\\(\\s*","if\\(",V1))%>% # 06aug2024 139 | dplyr::mutate(V1 = gsub("\\s*IF\\s*\\(","if\\(",V1))%>% # 06aug2024 140 | dplyr::mutate(V1 = gsub("IF\\s*\\(\\s*","if\\(",V1))%>% # 06aug2024 141 | dplyr::mutate(V1 = gsub("IF\\s*\\(","if\\(",V1))%>% 142 | dplyr::mutate(V1 = gsub("\\s*IF\\(\\s*","if\\(",V1))%>% # 06aug2024 143 | dplyr::mutate(V1 = gsub("\\s*IF\\(","if\\(",V1))%>% # 06aug2024 144 | dplyr::mutate(V1 = gsub("IF\\(\\s*","if\\(",V1))%>% # 06aug2024 145 | dplyr::mutate(V1 = gsub("IF\\(","if\\(",V1))%>% 146 | 147 | dplyr::mutate(V1 = gsub("\\s*ELSE\\s*","}else{",V1))%>% # 06aug2024 148 | dplyr::mutate(V1 = gsub("\\s*ELSE","}else{",V1))%>% # 06aug2024 149 | dplyr::mutate(V1 = gsub("ELSE\\s*","}else{",V1))%>% # 06aug2024 150 | dplyr::mutate(V1 = gsub("ELSE","}else{",V1))%>% 151 | 152 | dplyr::mutate(V1 = gsub("\\s*THEN\\s*","\\{",V1))%>% # 06aug2024 153 | dplyr::mutate(V1 = gsub("\\s*THEN","\\{",V1))%>% # 06aug2024 154 | dplyr::mutate(V1 = gsub("THEN\\s*","\\{",V1))%>% # 06aug2024 155 | dplyr::mutate(V1 = gsub("THEN","\\{",V1))%>% 156 | 157 | dplyr::mutate(V1 = gsub("\\s*ENDIF\\s*","\\}",V1))%>% #06aug2024 158 | dplyr::mutate(V1 = gsub("\\s*ENDIF","\\}",V1))%>% #06aug2024 159 | dplyr::mutate(V1 = gsub("ENDIF\\s*","\\}",V1))%>% #06aug2024 160 | dplyr::mutate(V1 = gsub("ENDIF","\\}",V1))%>% 161 | 162 | dplyr::mutate(V1 = gsub("\\s*\\.EQ\\.\\s*","==",V1))%>% 163 | dplyr::mutate(V1 = gsub("\\s*\\.NE\\.\\s*","!=",V1))%>% 164 | dplyr::mutate(V1 = gsub("\\s*\\.GT\\.\\s*",">",V1))%>% 165 | dplyr::mutate(V1 = gsub("\\s*\\.LT\\.\\s*","<",V1))%>% 166 | dplyr::mutate(V1 = gsub("\\s*\\.GE\\.\\s*",">=",V1))%>% 167 | dplyr::mutate(V1 = gsub("\\s*\\.LE\\.\\s*","<=",V1))%>% 168 | dplyr::mutate(V1 = gsub("\\s*\\.AND\\.\\s*","\\&\\&",V1))%>% #18mar2025 & to && to account for likely more common use case 169 | dplyr::mutate(V1 = gsub("\\s*\\.OR\\.\\s*","\\|\\|",V1))%>% #18mar2025 | to || to account for likely more common use case 170 | 171 | dplyr::mutate(V1 = gsub("\\.EQ\\.\\s*","==",V1))%>% 172 | dplyr::mutate(V1 = gsub("\\.NE\\.\\s*","!=",V1))%>% 173 | dplyr::mutate(V1 = gsub("\\.GT\\.\\s*",">",V1))%>% 174 | dplyr::mutate(V1 = gsub("\\.LT\\.\\s*","<",V1))%>% 175 | dplyr::mutate(V1 = gsub("\\.GE\\.\\s*",">=",V1))%>% 176 | dplyr::mutate(V1 = gsub("\\.LE\\.\\s*","<=",V1))%>% 177 | dplyr::mutate(V1 = gsub("\\.AND\\.\\s*","\\&\\&",V1))%>% #18mar2025 178 | dplyr::mutate(V1 = gsub("\\.OR\\.\\s*","\\|\\|",V1))%>% #18mar2025 179 | 180 | dplyr::mutate(V1 = gsub("\\s*\\.EQ\\.","==",V1))%>% 181 | dplyr::mutate(V1 = gsub("\\s*\\.NE\\.","!=",V1))%>% 182 | dplyr::mutate(V1 = gsub("\\s*\\.GT\\.",">",V1))%>% 183 | dplyr::mutate(V1 = gsub("\\s*\\.LT\\.","<",V1))%>% 184 | dplyr::mutate(V1 = gsub("\\s*\\.GE\\.",">=",V1))%>% 185 | dplyr::mutate(V1 = gsub("\\s*\\.LE\\.","<=",V1))%>% 186 | dplyr::mutate(V1 = gsub("\\s*\\.AND\\.","\\&\\&",V1))%>% #18mar2025 187 | dplyr::mutate(V1 = gsub("\\s*\\.OR\\.","\\|\\|",V1))%>% #18mar2025 188 | 189 | dplyr::mutate(V1 = gsub("\\.EQ\\.","==",V1))%>% 190 | dplyr::mutate(V1 = gsub("\\.NE\\.","!=",V1))%>% 191 | dplyr::mutate(V1 = gsub("\\.GT\\.",">",V1))%>% 192 | dplyr::mutate(V1 = gsub("\\.LT\\.","<",V1))%>% 193 | dplyr::mutate(V1 = gsub("\\.GE\\.",">=",V1))%>% 194 | dplyr::mutate(V1 = gsub("\\.LE\\.","<=",V1))%>% 195 | dplyr::mutate(V1 = gsub("\\.AND\\.","\\&\\&",V1))%>% #18mar2025 196 | dplyr::mutate(V1 = gsub("\\.OR\\.","\\|\\|",V1)) #18mar2025 197 | 198 | ### Flag Conditional Statements #### 199 | 200 | input <- input %>% 201 | dplyr::mutate(FLG_COND = ifelse(startsWith(V1,"if"), 1, 202 | ifelse(startsWith(V1, "else"), 1, 203 | ifelse(startsWith(V1,"{"), 1, 204 | ifelse(startsWith(V1, "}"), 1, 205 | 0))))) %>% # mark which lines are conditional statements so that double not added before 206 | dplyr::mutate(RM_FLG = as.numeric(grepl("ETASXI", V1))) %>% # remove lines of ETASXI since not needed in mrgsolve 207 | dplyr::filter(RM_FLG == 0)%>% 208 | dplyr::select(-RM_FLG)%>% 209 | dplyr::mutate(RM_FLG = ifelse( (endsWith(V1,"{") & dplyr::lead(V1) == "}") | (endsWith(dplyr::lag(V1),"{") & V1 == "}"), 1, 0))%>% # remove empty conditional statements 210 | dplyr::filter(RM_FLG == 0)%>% 211 | dplyr::select(-RM_FLG)%>% 212 | dplyr::mutate(FLG_COND2 = ifelse(FLG_COND == 0 | (endsWith(V1, "{") | V1 == "}" | endsWith(V1, "else")), 0, 1))%>% # identify single line conditional statements for expansion 213 | dplyr::mutate(ROW = dplyr::row_number()) 214 | 215 | ### Expand Single Line Conditional Statements to Multi-line #### 216 | 217 | tmp <- input %>% 218 | dplyr::filter(FLG_COND2 == 1)%>% 219 | dplyr::mutate(V1 = gsub("\\s*", "", V1))%>% # remove all white space from single line conditional statements; 06aug2024 changed //s to //s* 220 | dplyr::mutate(V1 = gsub("\\{", "", V1))%>% # remove { from single line conditional statements 221 | dplyr::mutate(V1 = gsub("\\}", "", V1)) # remove } from single line conditional statements 222 | 223 | if(nrow(tmp)>0){ 224 | 225 | ind_par <- par_match(data = tmp) 226 | 227 | tmp <- tmp %>% 228 | dplyr::bind_cols(data.frame(IND = ind_par)) 229 | 230 | tmp1 <- tmp %>% # expand out single line conditionals 231 | dplyr::mutate(V1 = substr(V1,1,IND))%>% 232 | dplyr::mutate(V1 = paste0(V1,"{"))%>% 233 | dplyr::select(-IND) 234 | 235 | tmp2 <- tmp %>% 236 | dplyr::mutate(V1 = substr(V1,IND+1,nchar(V1)))%>% 237 | dplyr::mutate(ROW = ROW+0.1)%>% 238 | dplyr::mutate(FLG_COND = 0)%>% 239 | dplyr::select(-IND) 240 | 241 | tmp3 <- tmp %>% 242 | dplyr::mutate(V1 = "}")%>% 243 | dplyr::mutate(ROW = ROW+0.2)%>% 244 | dplyr::select(-IND) 245 | 246 | input <- input %>% 247 | dplyr::filter(!ROW %in% tmp$ROW)%>% 248 | dplyr::bind_rows(tmp1)%>% 249 | dplyr::bind_rows(tmp2)%>% 250 | dplyr::bind_rows(tmp3)%>% 251 | dplyr::arrange(ROW)%>% 252 | dplyr::select(-FLG_COND2) 253 | 254 | rm(tmp,tmp1,tmp2,tmp3,ind_par) 255 | 256 | }else{ 257 | 258 | input <- input %>% 259 | dplyr::arrange(ROW) %>% 260 | dplyr::select(-FLG_COND2) 261 | } 262 | 263 | ### Remove Parenthesis from THETA() #### 264 | 265 | input <- input %>% 266 | dplyr::mutate(FLG_THETA = as.numeric(grepl("THETA\\(", V1))) 267 | 268 | tmp <- input %>% 269 | dplyr::filter(FLG_THETA==1) 270 | 271 | ind_par <- stringr::str_locate_all(tmp$V1,"THETA\\(") %>% sapply(., function(x) x[,2]) # locate only ends 272 | 273 | for(i in 1:length(tmp$V1)){ 274 | 275 | tmpl <- length(ind_par[[i]]) 276 | 277 | tmp[i,"V2"] <- substr(tmp[i,"V1"], 1, ind_par[[i]][1]-1) 278 | 279 | for(j in 1:tmpl){ 280 | tmps <- stringr::str_locate(substr(tmp[i,"V1"], ind_par[[i]][j]+1,nchar(tmp[i,"V1"])),"\\)")+ind_par[[i]][j] 281 | if(j != tmpl){ 282 | tmp[i,"V2"] <- paste0(tmp[i,"V2"], substr(tmp[i,"V1"], ind_par[[i]][j]+1, tmps-1), substr(tmp[i,"V1"], tmps+1, ind_par[[i]][j+1]-1)) 283 | }else{ 284 | tmp[i,"V2"] <- paste0(tmp[i,"V2"], substr(tmp[i,"V1"], ind_par[[i]][j]+1, tmps-1), substr(tmp[i,"V1"], tmps+1, nchar(tmp[i,"V1"]))) 285 | } 286 | rm(tmps) 287 | } 288 | rm(j,tmpl) 289 | } 290 | rm(i,ind_par) 291 | 292 | tmp <- tmp %>% 293 | dplyr::mutate(V1 = V2)%>% 294 | dplyr::select(-V2) 295 | 296 | input <- input %>% 297 | dplyr::filter(!ROW %in% tmp$ROW)%>% 298 | dplyr::bind_rows(tmp)%>% 299 | dplyr::arrange(ROW) 300 | 301 | rm(tmp) 302 | 303 | ### Change ** to pow() #### 304 | 305 | input <- input %>% 306 | dplyr::mutate(FLG_POW = as.numeric(grepl("\\*\\*", V1))) 307 | 308 | tmp <- input %>% 309 | dplyr::filter(FLG_POW==1) 310 | 311 | for(i in 1:length(tmp$V1)){ 312 | 313 | iter<-0 314 | tmps <- unlist(stringr::str_split(tmp[i,"V1"], "\\*\\*", n = 2)) 315 | 316 | while(length(tmps) > 1 & iter < 10000){ 317 | 318 | #### first half of pow(x,x) #### 319 | 320 | if(substr(tmps[1],nchar(tmps[1]),nchar(tmps[1])) != ")"){ 321 | 322 | ind1 <- stringr::str_locate_all(tmps[1], "\\+") %>% sapply(., function(x) x[,2]) # locate only ends 323 | ind2 <- stringr::str_locate_all(tmps[1], "\\-") %>% sapply(., function(x) x[,2]) # locate only ends 324 | ind3 <- stringr::str_locate_all(tmps[1], "\\/") %>% sapply(., function(x) x[,2]) # locate only ends 325 | ind4 <- stringr::str_locate_all(tmps[1], "\\*") %>% sapply(., function(x) x[,2]) # locate only ends 326 | ind5 <- stringr::str_locate_all(tmps[1], "\\=") %>% sapply(., function(x) x[,2]) # locate only ends 327 | ind6 <- stringr::str_locate_all(tmps[1], "\\(") %>% sapply(., function(x) x[,2]) # locate only ends 328 | 329 | indmax <- max(c(unlist(ind1),unlist(ind2),unlist(ind3),unlist(ind4),unlist(ind5),unlist(ind6))) 330 | 331 | tmps[1] <- paste0(substr(tmps[1],1,indmax),"pow(",substr(tmps[1],indmax+1,nchar(tmps[1])),",") 332 | 333 | rm(ind1,ind2,ind3,ind4,ind5,indmax) 334 | 335 | }else{ 336 | 337 | revtmps <- stringi::stri_reverse(tmps[1]) 338 | # revind <- str_locate(revtmps,"\\(")[,2] 339 | revind <- par_match(data = as.data.frame(revtmps), colnme = "revtmps", openChar = "\\)", closedChar = "\\(") 340 | ind <- nchar(revtmps)-revind+1 341 | 342 | ind2 <- -1 343 | 344 | if(ind >= 5){ # special case 345 | if(substr(tmps[1], ind-4, ind-1) == "sqrt"){ 346 | ind2 <- ind - 4 347 | } 348 | } 349 | 350 | if(ind >= 4){ # special case 351 | if(substr(tmps[1], ind-3, ind-1) == "exp"){ 352 | ind2 <- ind - 3 353 | } 354 | } 355 | 356 | if(ind2 > 0){ 357 | ind <- ind2 358 | } 359 | rm(ind2,revtmps,revind) 360 | 361 | tmps[1] <- paste0(substr(tmps[1],1,ind-1),"pow(",substr(tmps[1],ind,nchar(tmps[1])),",") 362 | } 363 | 364 | #### second half of pow(x,x) #### 365 | 366 | if(substr(tmps[2],1,1)=="(" | substr(tmps[2],1,4)=="exp(" | substr(tmps[2],1,5)=="sqrt("){ 367 | 368 | # ind <- str_locate(tmps[2],"\\)")[,2] 369 | ind <- par_match(data.frame(V1=tmps[2])) 370 | tmps[2] <- paste0(substr(tmps[2],1,ind),")",substr(tmps[2],ind+1,nchar(tmps[2]))) 371 | 372 | }else{ 373 | 374 | ind1 <- stringr::str_locate_all(tmps[2], "\\+") %>% sapply(., function(x) x[,2]) # locate only ends 375 | ind2 <- stringr::str_locate_all(tmps[2], "\\-") %>% sapply(., function(x) x[,2]) # locate only ends 376 | ind3 <- stringr::str_locate_all(tmps[2], "\\/") %>% sapply(., function(x) x[,2]) # locate only ends 377 | ind4 <- stringr::str_locate_all(tmps[2], "\\*") %>% sapply(., function(x) x[,2]) # locate only ends 378 | ind5 <- stringr::str_locate_all(tmps[2], "\\)") %>% sapply(., function(x) x[,2]) # locate only ends 379 | 380 | ind <- min(c(unlist(ind1),unlist(ind2),unlist(ind3),unlist(ind4),unlist(ind5),nchar(tmps[2]))) 381 | 382 | if(ind == nchar(tmps[2])){ 383 | tmps[2] <- paste0(trimws(tmps[2]),")") # 06aug2024 added trimws 384 | }else{ 385 | tmps[2] <- paste0(substr(tmps[2],1,ind-1),")",substr(tmps[2],ind,nchar(tmps[2]))) 386 | } 387 | rm(ind1,ind2,ind3,ind4) 388 | } 389 | rm(ind) 390 | 391 | #### combine pow(x,x) #### 392 | 393 | tmp[i,"V1"] <- paste0(tmps[1], tmps[2]) 394 | tmps <- unlist(stringr::str_split(tmp[i,"V1"], "\\*\\*", n = 2)) 395 | iter<-iter+1 396 | } 397 | if(iter==10000){ 398 | print("Error: While loop hit max allowed iterations.") 399 | } 400 | } 401 | rm(i,iter,tmps) 402 | 403 | input <- input %>% 404 | dplyr::filter(!ROW %in% tmp$ROW)%>% 405 | dplyr::bind_rows(tmp)%>% 406 | dplyr::arrange(ROW)%>% 407 | dplyr::select(-FLG_THETA,-FLG_POW) 408 | 409 | rm(tmp) 410 | 411 | ### Detect Variable Name (before = sign) #### 412 | 413 | special_rm <- c("CALLFL", "MTIME") 414 | special_convert_rm <- c("N") 415 | special_convert_kp <- c("F","D","R") # moved "R" and "D" from special_convert_rm 3/17/2024 416 | special_convert_kp2 <- c("ALAG") 417 | special_convert_init <- c("A_0(") 418 | 419 | special_rm <- append(special_rm, paste0(special_rm[2],"(",1:1000,")")) 420 | 421 | special_convert_rm <- paste0(special_convert_rm, sort(rep(1:length(cmts$V1), length(special_convert_rm)))) 422 | special_convert_kp <- paste0(special_convert_kp, sort(rep(1:length(cmts$V1), length(special_convert_kp)))) 423 | special_convert_kp2 <- paste0(special_convert_kp2, 1:length(cmts$V1)) 424 | special_convert_init <- paste0(special_convert_init,1:length(cmts$V1),")") 425 | 426 | input <- input %>% 427 | dplyr::mutate(V2 = stringr::str_split(V1, "=", n = 2, simplify = T)[,1])%>% 428 | dplyr::mutate(V3 = stringr::str_split(V1, "=", n = 2, simplify = T)[,2])%>% 429 | dplyr::mutate(V2 = suppressWarnings(ifelse(FLG_COND==1,NA,V2)))%>% 430 | dplyr::mutate(V3 = suppressWarnings(ifelse(FLG_COND==1,NA,V3)))%>% 431 | dplyr::mutate(V2 = trimws(V2,"both"))%>% 432 | dplyr::mutate(V3 = trimws(V3,"both"))%>% 433 | dplyr::mutate(FLG_COMMENT = ifelse(V2 %in% c(special_rm,special_convert_rm), 1, 0))%>% 434 | dplyr::mutate(FLG_SPEC1 = ifelse(V2 %in% c(special_convert_rm,special_convert_kp), 1, 0))%>% 435 | dplyr::mutate(FLG_SPEC2 = ifelse(V2 %in% special_convert_kp2, 1, 0))%>% 436 | dplyr::mutate(FLG_INIT = ifelse(V2 %in% special_convert_init, 1, 0))%>% 437 | dplyr::mutate(V1 = suppressWarnings(ifelse(FLG_SPEC1 == 1, paste0(substr(V2,1,1),"_",cmts[as.numeric(substr(V2,2,nchar(V2))),"V1"],"=",V3), V1)))%>% 438 | dplyr::mutate(V1 = suppressWarnings(ifelse(FLG_SPEC2 == 1, paste0(substr(V2,1,4),"_",cmts[as.numeric(substr(V2,5,nchar(V2))),"V1"],"=",V3), V1)))%>% 439 | dplyr::mutate(V1 = suppressWarnings(ifelse(FLG_INIT == 1, paste0(cmts[as.numeric(substr(V2,5,nchar(V2)-1)),"V1"],"_0=",V3), V1)))%>% 440 | dplyr::mutate(V2 = suppressWarnings(ifelse(FLG_SPEC1==1|FLG_SPEC2==1|FLG_INIT==1|FLG_COMMENT==1,NA,V2)))%>% 441 | dplyr::mutate(V3 = suppressWarnings(ifelse(FLG_SPEC1==1|FLG_SPEC2==1|FLG_INIT==1|FLG_COMMENT==1,NA,V3)))%>% 442 | dplyr::select(-FLG_SPEC1,-FLG_SPEC2,-FLG_INIT) 443 | 444 | ### If not conditional add ; to end of each line also comment out FLG_COMMENT rows #### 445 | 446 | input <- input %>% 447 | dplyr::mutate(V1 = trimws(V1,"both"))%>% 448 | dplyr::mutate(V1 = ifelse(FLG_COND == 0, paste0(V1,";"), V1))%>% 449 | dplyr::mutate(V3 = ifelse(FLG_COND == 0, paste0(V3,";"), V3))%>% # for ode block 450 | dplyr::mutate(V1 = ifelse(FLG_COMMENT == 1, paste0("/* ",V1," */"), V1)) 451 | 452 | ### If not conditional statement and not ode and not special reserved term add double to first occurrence of each variable #### 453 | 454 | input <- input %>% 455 | dplyr::mutate(FLG_ODE = ifelse(substr(V1,1,5)=="DADT(",1,0))%>% 456 | dplyr::group_by(V2)%>% 457 | dplyr::mutate(VAR_OCC = dplyr::row_number())%>% 458 | dplyr::ungroup()%>% 459 | as.data.frame()%>% 460 | dplyr::mutate(V1 = ifelse(FLG_COMMENT == 0 & FLG_ODE == 0 & FLG_COND == 0 & !is.na(V2) & VAR_OCC == 1, paste0("double ",V1), V1))%>% 461 | dplyr::mutate(V2.1 = ifelse(FLG_COMMENT == 0 & FLG_ODE == 0 & FLG_COND == 0 & !is.na(V2) & VAR_OCC == 1, paste0("double ",V2), V2))%>% # for ode block 462 | dplyr::select(-FLG_COMMENT,-VAR_OCC) 463 | 464 | ### Replace ODE syntax #### 465 | 466 | tmp <- input %>% 467 | dplyr::filter(BLOCK == "DES")%>% 468 | dplyr::mutate(V2.2 = ifelse(FLG_ODE == 1, substr(V2.1,6,nchar(V2.1)-1), V2.1))%>% 469 | dplyr::mutate(V2.3 = ifelse(FLG_ODE == 1, paste0("dxdt_",cmts[V2.2,"V1"]), V2.2)) 470 | 471 | tmp2 <- tmp %>% 472 | dplyr::filter(FLG_ODE == 0, !is.na(V2)) 473 | 474 | params2 <- c() 475 | 476 | if(length(tmp2$V2) > 0){ 477 | params2 <- c(params2,unique(tmp2$V2)) 478 | } 479 | rm(tmp2) 480 | 481 | tmp <- tmp %>% 482 | dplyr::select(-V2,-V2.1,-V2.2,-FLG_ODE) 483 | 484 | for(j in 1:nrow(tmp)){ 485 | for(i in 1:nrow(cmts)){ 486 | tmp[j,"V3"] <- stringr::str_replace_all(tmp[j,"V3"], paste0("A\\(",i,"\\)"), cmts[i,"V1"]) 487 | tmp[j,"V1"] <- stringr::str_replace_all(tmp[j,"V1"], paste0("A\\(",i,"\\)"), cmts[i,"V1"]) 488 | } 489 | rm(i) 490 | } 491 | rm(j) 492 | 493 | tmp <- tmp %>% 494 | dplyr::mutate(V1 = ifelse(FLG_COND == 0, paste0(V2.3,"=",V3), V1)) 495 | 496 | input <- input %>% 497 | dplyr::filter(BLOCK != "DES") 498 | 499 | params2 <- sort(c(params2, unique(input$V2))) 500 | params2 <- params2[which(!is.na(params2))] 501 | 502 | input <- input %>% 503 | dplyr::bind_rows(tmp)%>% 504 | dplyr::arrange(ROW)%>% 505 | dplyr::select(V1,BLOCK) 506 | 507 | ### Finalize mrg_code return #### 508 | 509 | mrg_code <- mrg_code %>% 510 | dplyr::bind_rows(data.frame(V1 = "/* NOTE: There is no guarantee to the accuracy of the NONMEM to mrgsolve translator. It remains the responsibility of the user to validate the resulting mrgsolve code. */"))%>% 511 | dplyr::bind_rows(blank_df())%>% 512 | dplyr::bind_rows(data.frame(V1 = "/* NOTE: The nonmem2mrgsolve package remains in active development, please report bugs and feature requests to improve future versions. */"))%>% 513 | dplyr::bind_rows(data.frame(V1 = "/* NOTE: If you find nonmem2mrgsolve helpful, please consider giving it a star at github.com/Andy00000000000/nonmem2mrgsolve. */"))%>% 514 | dplyr::bind_rows(blank_df())%>% 515 | # dplyr::bind_rows(data.frame(V1 = "/* NOTE: If a variable was declared within a conditional statement, then it may be missing double before the variable name. */"))%>% # comment out 3/17/2024 516 | dplyr::bind_rows(data.frame(V1 = "/* NOTE: The translator does not currently convert T or TIME to SOLVERTIME. */"))%>% 517 | dplyr::bind_rows(data.frame(V1 = "/* NOTE: The translator does not currently convert MTIME() to self.mtime(). */"))%>% 518 | # dplyr::bind_rows(data.frame(V1 = "/* NOTE: The translator does not currently handle IOV. */"))%>% # comment out 3/17/2024 519 | dplyr::bind_rows(blank_df())%>% 520 | dplyr::bind_rows(input %>% dplyr::filter(BLOCK == "PK") %>% dplyr::select(V1))%>% 521 | dplyr::bind_rows(blank_df())%>% 522 | dplyr::bind_rows(data.frame(V1 = "$ODE"))%>% 523 | dplyr::bind_rows(blank_df())%>% 524 | dplyr::bind_rows(input %>% dplyr::filter(BLOCK == "DES") %>% dplyr::select(V1))%>% 525 | dplyr::bind_rows(blank_df())%>% 526 | dplyr::bind_rows(data.frame(V1 = "$OMEGA @block"))%>% 527 | dplyr::bind_rows(blank_df()) 528 | 529 | return(list(mrg_code = mrg_code, params2 = params2)) 530 | 531 | ### End of Function #### 532 | } 533 | 534 | ## FUNCTION $OMEGA #### 535 | 536 | get_block_omega <- function(ext0 = NULL, mrg_code = NULL){ 537 | 538 | tmpomeg <- ext0$OMEGA 539 | tmpindex <- lower.tri(tmpomeg,diag=T) 540 | tmpomeg[which(tmpindex==F)] <- "" 541 | 542 | tmpomeg <- as.data.frame(tmpomeg) 543 | rownames(tmpomeg) <- NULL 544 | tmpomeg <- tmpomeg %>% 545 | dplyr::mutate(V1 = "") 546 | 547 | for(i in 1:(ncol(tmpomeg)-1)){ 548 | tmpomeg <- tmpomeg %>% 549 | dplyr::mutate(V1 = paste(V1, tmpomeg[,i])) 550 | } 551 | rm(i) 552 | 553 | tmpomeg <- tmpomeg %>% 554 | dplyr::select(V1)%>% 555 | dplyr::mutate(V1 = trimws(V1,"both")) 556 | 557 | mrg_code <- mrg_code %>% 558 | dplyr::bind_rows(tmpomeg) %>% 559 | dplyr::bind_rows(blank_df())%>% 560 | dplyr::bind_rows(data.frame(V1 = "$CAPTURE"))%>% 561 | dplyr::bind_rows(blank_df()) 562 | 563 | return(mrg_code) 564 | } 565 | 566 | ## FUNCTION $TABLE #### 567 | 568 | get_block_table<- function(ctl0 = ctl, mrg_code = mrg_code, params = all_params, cmts = cmts){ 569 | 570 | input <- ctl0 %>% 571 | dplyr::filter(BLOCK == "TABLE")%>% 572 | dplyr::select(V1)%>% 573 | dplyr::mutate(V1 = paste(V1, collapse = " "))%>% # join all rows of input to single row 574 | dplyr::distinct() # remove duplicates; this line likely isn't needed/redundant, but leaving until time to test 575 | 576 | input <- data.frame(V1 = strsplit(input$V1, "\\s")[[1]]) %>% # single row to many by white space 577 | dplyr::mutate(V1 = trimws(V1, which = "both"))%>% # remove white space 578 | dplyr::filter(V1 != "") 579 | 580 | input <- input %>% 581 | dplyr::filter(V1 != "$STABLE")%>% 582 | dplyr::filter(V1 %in% params)%>% 583 | dplyr::filter(!(V1 %in% cmts))%>% 584 | dplyr::distinct() # remove duplicates; 06aug2024 585 | 586 | mrg_code <- mrg_code %>% 587 | dplyr::bind_rows(input)%>% 588 | dplyr::bind_rows(blank_df()) 589 | 590 | return(mrg_code) 591 | } 592 | 593 | ## END #### 594 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------