Skip to content

Commit

Permalink
Merge pull request #813 from metrumresearchgroup/cran/0.11.0
Browse files Browse the repository at this point in the history
Cran/0.11.0
  • Loading branch information
kylebaron authored Apr 1, 2021
2 parents 4173a44 + dde16e6 commit 37c5815
Show file tree
Hide file tree
Showing 45 changed files with 2,572 additions and 125 deletions.
18 changes: 11 additions & 7 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ inst/validation
cran-comments.md
Rchecks
mrgsolve\.Rcheck
.github
inst/doc
\.github
Doxyfile
doxydoc
^.*\.Rproj$
^\.Rproj\.user$
vignettes/.*[.]toc$
vignettes/.*[.]log$
vignettes/.*[.]o$
vignettes/.*[.]so$
tests/.*[.]o$
tests/.*[.]so$
tests/testthat/.*[.]o$
Expand Down Expand Up @@ -48,7 +43,16 @@ _config.yml
Makefile
docs
^DOCS$
^build$
^./build$
^_pkgdown\.yml$
^\.drone\.yml$
^\.drone\.jsonnet$
^doc$
^Meta$
vignettes
vignettes/extra
vignettes/build
vignettes/mrgsolve-builds
vignettes/extra/mrgsolve-builds/


5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ Rchecks
!package/*.tar.gz
*00_pkg_src
inst/maintenance/unit/tests.md
doc
Meta
inst/maintenance/unit/mrgsolve-so*
vignettes/mrgsolve-builds
vignettes/extra/mrgsolve-builds/
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: mrgsolve
Title: Simulate from ODE-Based Models
Version: 0.10.9
Version: 0.11.0
Authors@R:
c(person(given = "Kyle T", family = "Baron",
role = c("aut", "cre"),
Expand All @@ -21,6 +21,9 @@ Authors@R:
person(given = "Felicien", family = "Le Louedec",
comment = c(ORCID = "0000-0003-3699-2729"),
role = "ctb"),
person(given = "Timothy", family = "Waterhouse",
comment = c(ORCID = "0000-0002-0954-9660"),
role = "ctb"),
person(given = "Metrum Research Group",
role = "cph"))
Maintainer: Kyle T Baron <[email protected]>
Expand Down
86 changes: 37 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SHELL := /bin/bash
LIBDIR=${HOME}/Rlibs/lib
PACKAGE=mrgsolve
VERSION=$(shell grep Version DESCRIPTION |awk '{print $$2}')
TARBALL=${PACKAGE}_${VERSION}.tar.gz
Expand All @@ -13,12 +12,36 @@ all:
make build
make install

drone:
bump-dev:
Rscript -e 'usethis::use_version("dev")'

tag-version:
git tag $(VERSION)
git push origin $(VERSION)

package:
make house
R CMD build --md5 $(PKGDIR)
R CMD check --as-cran ${TARBALL}
make doc
make build
make install
make pkgdown

check:
make house
make doc
make build
R CMD check ${TARBALL} --no-manual
make unit

check-only:
R CMD check --as-cran ${TARBALL}

cran:
make house
make doc
make build
export _MRGSOLVE_SKIP_MODLIB_BUILD_=false
Rscript -e '$(LOAD_CANDIDATE); $(TEST_UNIT)'
R CMD CHECK --as-cran ${TARBALL}

spelling:
Rscript -e 'spelling::spell_check_package(".")'
Expand All @@ -36,33 +59,21 @@ no-test:
make build
R CMD check ${TARBALL} --no-tests --no-manual

everything:
make all
make pkgdown

pkgdown:
Rscript "inst/maintenance/pkgdown.R"
cp -r DOCS/ ../../mrgsolve/docs/
touch ../../mrgsolve/docs/.nojekyll
#cp -r DOCS/ ../mrgsolve/docs/
#touch ../mrgsolve/docs/.nojekyll

unit:
Rscript -e 'testthat::test_dir("inst/maintenance/unit")'

cran:
make house
make doc
make build
export _MRGSOLVE_SKIP_MODLIB_BUILD_=false
R CMD CHECK --as-cran ${TARBALL}

readme:
Rscript -e 'rmarkdown::render("README.Rmd")'

.PHONY: doc
doc:
Rscript -e "roxygen2::roxygenize()"

.PHONY: build
build:
R CMD build --md5 $(PKGDIR) --no-manual

Expand All @@ -72,24 +83,6 @@ install:
install-build:
R CMD INSTALL --build --install-tests ${TARBALL}

check:
make house
make doc
make build
R CMD check ${TARBALL} --no-manual
make unit

qcheck:
make doc
make build
R CMD check ${TARBALL} --no-manual --no-codoc

check-cran:
make house
make doc
make build
R CMD check --as-cran ${TARBALL}

test:
R CMD INSTALL ${PKGDIR}
make test-all
Expand Down Expand Up @@ -126,15 +119,10 @@ check-winhub:
doxygen:
doxygen doxyfile

bump-dev:
Rscript -e 'usethis::use_version("dev")'

tag-version:
git tag $(VERSION)
git push origin $(VERSION)

testing:
cp ${TARBALL} ${MRGSOLVE_TEST_LOC}
touch ${MRGSOLVE_TEST_LOC}/${TARBALL}
cp -r inst/maintenance/unit ${MRGSOLVE_TEST_LOC}
cd ${MRGSOLVE_TEST_LOC} && git commit -am "testing release" && git push -u origin master
# possibly no longer in use
drone:
make house
R CMD build --md5 $(PKGDIR)
R CMD check --as-cran ${TARBALL}
export _MRGSOLVE_SKIP_MODLIB_BUILD_=false
Rscript -e '$(LOAD_CANDIDATE); $(TEST_UNIT)'
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# mrgsolve 0.11.0

- The absolute paths to nonmem output files (`root.xml` or `root.ext`) are now
saved in the model object when nonmem results are imported via `$NMEXT` or
`$NMXML`; paths are accessible by coercing the model object with `as.list()`
and looking at the `nm_import` item (#802)
- Add Tim Waterhouse as contributor (#809)
- Add `root` argument to `$NMEXT` and `$NMXML` so that the nonmem output files
are located relative to the `working` directory (default, previous behavior)
or the directory where the `cppfile` is stored; `cppfile` will eventually
replace `working` as the default (#803)
- Models based on `$PRED` now respect the `obsonly` option (#811)

# mrgsolve 0.10.9

- Dosing into a compartment that is off at the time of the dose turns the
Expand Down
9 changes: 5 additions & 4 deletions R/class_mrgmod.R
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ setMethod("names", "mrgmod", function(x) {
#' - `random`: names and labels of `$OMEGA` and `$SIGMA`
#' - `code`: model source code from `cfile`
#' - `details`: model details data frame
#' - `nm_import`: a character vector listing the names of nonmem output files
#' that were read to import estimates from a completed nonmem run
#' - `cpp_variables`: a data frame listing variables internal to the model
#' cpp file
#' - `atol`: see [solversettings]
Expand Down Expand Up @@ -513,7 +515,8 @@ setMethod("as.list", "mrgmod", function(x, deep = FALSE, ...) {
advan <- x@advan
functions <- funset(x)
}
cpp_variables <- x@shlib[["cpp_variables"]]
cpp_variables <- shlib(x)[["cpp_variables"]]
nm_import <- shlib(x)[["nm_import"]]
details <- x@annot
code <- x@code
random <- names(x)[c("omega", "sigma", "omega_labels", "sigma_labels")]
Expand All @@ -537,15 +540,13 @@ setMethod("as.list", "mrgmod", function(x, deep = FALSE, ...) {
init <- as.list(init(x))
param <- as.list(param(x))
cmt <- cmt(x)

covariates <- as.character(x@shlib$covariates)
covariates <- as.character(shlib(x)[["covariates"]])
pars <- pars(x)
neq <- neq(x)
npar <- npar(x)
})
})


#' Select parameter values from a model object
#'
#' The \code{$} and \code{[[} operators get the value
Expand Down
14 changes: 7 additions & 7 deletions R/handle_spec_block.R
Original file line number Diff line number Diff line change
Expand Up @@ -509,18 +509,16 @@ handle_spec_block.specTABLE <- function(x, env, ...) {

# NMXML --------------------------------
#' @export
handle_spec_block.specNMXML <- function(x, ...) {
parseNMXML(dump_opts(x), ...)
}

## Functions for handling code blocks
parseNMXML <- function(x, env, ...) {
pos <- attr(x,"pos")
handle_spec_block.specNMXML <- function(x, env, ...) {
x <- dump_opts(x)
pos <- attr(x, "pos")
x <- tolist(x, envir = env$ENV)
x$env <- env
xml <- do.call(nmxml, x)
env[["param"]][[pos]] <- xml$theta
env[["omega"]][[pos]] <- xml$omega
env[["sigma"]][[pos]] <- xml$sigma
env[["nm_import"]] <- c(env[["nm_import"]], xml[["file"]])
return(NULL)
}

Expand All @@ -530,10 +528,12 @@ handle_spec_block.specNMEXT <- function(x, env, ...) {
x <- dump_opts(x)
pos <- attr(x, "pos")
x <- tolist(x, envir = env$ENV)
x$env <- env
ext <- do.call(nmext, x)
env[["param"]][[pos]] <- ext$theta
env[["omega"]][[pos]] <- ext$omega
env[["sigma"]][[pos]] <- ext$sigma
env[["nm_import"]] <- c(env[["nm_import"]], ext[["file"]])
return(NULL)
}

Expand Down
2 changes: 1 addition & 1 deletion R/matlist.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
##' $OMEGA
##' 1 2 3
##'
##' $OMEGA @block
##' $OMEGA \@block
##' 1 0.1 2
##'
##' $OMEGA \@cor
Expand Down
15 changes: 8 additions & 7 deletions R/modspec.R
Original file line number Diff line number Diff line change
Expand Up @@ -589,17 +589,18 @@ parse_env <- function(spec, incoming_names = names(spec),project,ENV=new.env())
n <- length(spec)
mread.env <- new.env()
mread.env$project <- project
mread.env$param <- vector("list",n)
mread.env$fixed <- vector("list",n)
mread.env$init <- vector("list",n)
mread.env$omega <- vector("list",n)
mread.env$sigma <- vector("list",n)
mread.env$annot <- vector("list",n)
mread.env$param <- vector("list", n)
mread.env$fixed <- vector("list", n)
mread.env$init <- vector("list", n)
mread.env$omega <- vector("list", n)
mread.env$sigma <- vector("list", n)
mread.env$annot <- vector("list", n)
mread.env$ode <- vector("list", n)
mread.env$namespace <- vector("list", n)
mread.env$capture <- vector("list",n)
mread.env$capture <- vector("list", n)
mread.env$error <- character(0)
mread.env$covariates <- character(0)
mread.env$nm_import <- character(0)
mread.env$ENV <- ENV
mread.env$blocks <- names(spec)
mread.env$incoming_names <- incoming_names
Expand Down
1 change: 1 addition & 0 deletions R/mread.R
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ mread <- function(model, project = getOption("mrgsolve.project", getwd()),
inc <- spec[["INCLUDE"]]
if(is.null(inc)) inc <- character(0)
x@shlib[["include"]] <- inc
x@shlib[["nm_import"]] <- mread.env[["nm_import"]]
x@shlib[["source"]] <- file.path(build$soloc,build$compfile)
x@shlib[["md5"]] <- build[["md5"]]

Expand Down
Loading

0 comments on commit 37c5815

Please sign in to comment.