Skip to content

Commit

Permalink
Merge pull request #365 from metrumresearchgroup/next-version
Browse files Browse the repository at this point in the history
v0.8.11
  • Loading branch information
kylebaron authored Apr 26, 2018
2 parents a2d693a + 31b754c commit 3fa76d1
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 79 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: mrgsolve
Type: Package
Version: 0.8.10.9015
Version: 0.8.11
Title: Simulate from ODE-Based Population PK/PD and Systems Pharmacology
Models
Authors@R: c(
Expand Down Expand Up @@ -42,7 +42,7 @@ LinkingTo:
Suggests:
lattice,
testthat,
xml2,
xml2 (>= 1.2.0),
rmarkdown
LazyLoad: yes
NeedsCompilation: yes
Expand Down
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export(bmat)
export(cama)
export(carry.out)
export(carry_out)
export(ch)
export(cmat)
export(cmtn)
export(cvec)
Expand Down Expand Up @@ -128,7 +127,7 @@ export(relocate)
export(rename_cols)
export(req)
export(revar)
export(s)
export(s_)
export(see)
export(simargs)
export(smat)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# mrgsove 0.8.11
- Internal release
- Removed the function `s` and replaced with `s_`; this was not a problem
created by mrgsolve but rather by ggplot2, which calls `mgcv::s` via
`geom_smooth` under certian circumstances

# mrgsolve 0.8.10.9015
- Re-configured the list of data coming from `as.list.mrgmod` so that
the names match the names that you would pass to `update.mrgmod`; also
Expand Down
1 change: 0 additions & 1 deletion R/class_mrgmod.R
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ setMethod("as.list", "mrgmod", function(x, deep = FALSE, ...) {
project <- project(x)
model <- model(x)
fixed <- as.list(x@fixed)
fixedp <- names(x@fixed)
sigma <- as.list(smat(x))
omega <- as.list(omat(x))
init <- as.list(init(x))
Expand Down
8 changes: 7 additions & 1 deletion R/nmxml.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ nmxml <- function(run=numeric(0), project=character(0),
}

tree <- xml2::as_list(xml2::read_xml(target))
tree <- tree$output$nonmem$problem$estimation

# https://github.com/r-lib/xml2/blob/master/NEWS.md#xml2-120
if(packageVersion("xml2") >= "1.2.0") {
tree <- tree[["output"]][["nonmem"]][["problem"]][["estimation"]]
} else {
tree <- tree[["nonmem"]][["problem"]][["estimation"]]
}

th <- list()
om <- matrix(0,0,0)
Expand Down
9 changes: 2 additions & 7 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ tovec <- function(x,concat=TRUE) {
##' @examples
##'
##' cvec("A,B,C")
##' ch(A,B,C)
##' s(A,B,C)
##' s_(A,B,C)
##'
setGeneric("cvec", function(x,...) standardGeneric("cvec"))

Expand All @@ -255,11 +254,7 @@ setMethod("cvec", "character", as.cvec)

##' @export
##' @rdname cvec
ch <- function(...) as.character(match.call(expand.dots=TRUE))[-1]

##' @export
##' @rdname cvec
s <- ch
s_ <- function(...) as.character(match.call(expand.dots=TRUE))[-1]

##' Access or clear arguments for calls to mrgsim
##'
Expand Down
16 changes: 8 additions & 8 deletions inst/maintenance/unit/test-request.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ test_that("Req gets the right variables", {
x2 <- names(mod %>% Req(PERIPH,GUT) %>% mrgsim)
x3 <- names(mod %>% Req(PERIPH,b) %>% mrgsim)
x4 <- names(mod %>% Req(b,z) %>% mrgsim)
expect_identical(x1,s(ID,time,GUT,CENT,PERIPH,b,z))
expect_identical(x2,s(ID,time,PERIPH,GUT))
expect_identical(x3,s(ID,time,PERIPH,b))
expect_identical(x4,s(ID,time,b,z))
expect_identical(x1,s_(ID,time,GUT,CENT,PERIPH,b,z))
expect_identical(x2,s_(ID,time,PERIPH,GUT))
expect_identical(x3,s_(ID,time,PERIPH,b))
expect_identical(x4,s_(ID,time,b,z))
})


Expand All @@ -60,10 +60,10 @@ test_that("Req gets the right variables, with request", {
x2 <- names(mod %>% Req(PERIPH,GUT) %>% mrgsim)
x3 <- names(mod %>% Req(PERIPH,b) %>% mrgsim)
x4 <- names(mod %>% Req(z,b) %>% mrgsim)
expect_identical(x1,s(ID,time,CENT,b,z))
expect_identical(x2,s(ID,time,PERIPH,GUT))
expect_identical(x3,s(ID,time,PERIPH,b))
expect_identical(x4,s(ID,time,z,b))
expect_identical(x1,s_(ID,time,CENT,b,z))
expect_identical(x2,s_(ID,time,PERIPH,GUT))
expect_identical(x3,s_(ID,time,PERIPH,b))
expect_identical(x4,s_(ID,time,z,b))
})


Expand Down
Binary file modified inst/project/housemodel.RDS
Binary file not shown.
10 changes: 3 additions & 7 deletions man/cvec.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 39 additions & 41 deletions tests/testthat/test-as_list_mrgmod.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,44 @@ context("test-as_list_mrgmod")
options(mrgsolve_mread_quiet=TRUE)

test_that("check items in as.list output", {
expect_exists <- function(object,name) {
expect_true(name %in% names(object))
}
x <- as.list(mrgsolve:::house())
expect_exists(x, "start")
expect_exists(x, "end")
expect_exists(x, "delta")
expect_exists(x, "add")
expect_exists(x, "param")
expect_exists(x, "init")
expect_exists(x, "omega")
expect_exists(x, "sigma")
expect_exists(x, "request")
expect_exists(x, "atol")
expect_exists(x, "rtol")
expect_exists(x, "hmin")
expect_exists(x, "hmax")
expect_exists(x, "maxsteps")
expect_exists(x, "tscale")
expect_exists(x, "digits")
expect_exists(x, "code")
expect_exists(x, "cmt")
expect_exists(x, "neq")
expect_exists(x, "pars")
expect_exists(x, "npar")
expect_exists(x, "preclean")
expect_exists(x, "mindt")
expect_exists(x, "debug")
expect_exists(x, "verbose")
expect_exists(x, "envir")
expect_exists(x, "cfile")
expect_exists(x, "shlib")
expect_exists(x, "capture")
expect_exists(x, "details")
expect_exists(x, "sodll")
expect_exists(x, "soloc")
expect_exists(x, "covariates")
expect_exists(x, "fixedp")
expect_exists(x, "plugins")
expect_exists(x, "random")
expect_exists(x, "model")
expect_exists(x, "project")
x_names <- names(x)
expect_true("start" %in% x_names)
expect_true("end" %in% x_names)
expect_true("delta" %in% x_names)
expect_true("add" %in% x_names)
expect_true("param" %in% x_names)
expect_true("init" %in% x_names)
expect_true("omega" %in% x_names)
expect_true("sigma" %in% x_names)
expect_true("request" %in% x_names)
expect_true("atol" %in% x_names)
expect_true("rtol" %in% x_names)
expect_true("hmin" %in% x_names)
expect_true("hmax" %in% x_names)
expect_true("maxsteps" %in% x_names)
expect_true("tscale" %in% x_names)
expect_true("digits" %in% x_names)
expect_true("code" %in% x_names)
expect_true("cmt" %in% x_names)
expect_true("neq" %in% x_names)
expect_true("pars" %in% x_names)
expect_true("npar" %in% x_names)
expect_true("preclean" %in% x_names)
expect_true("mindt" %in% x_names)
expect_true("debug" %in% x_names)
expect_true("verbose" %in% x_names)
expect_true("envir" %in% x_names)
expect_true("cfile" %in% x_names)
expect_true("shlib" %in% x_names)
expect_true("capture" %in% x_names)
expect_true("details" %in% x_names)
expect_true("sodll" %in% x_names)
expect_true("soloc" %in% x_names)
expect_true("covariates" %in% x_names)
expect_true("fixed" %in% x_names)
expect_true("plugins" %in% x_names)
expect_true("random" %in% x_names)
expect_true("model" %in% x_names)
expect_true("project" %in% x_names)
})
6 changes: 3 additions & 3 deletions tests/testthat/test-nmxml.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ test_that("Model compiles", {
})

test_that("Labels are assigned to $OMEGA and $SIGMA", {
expect_equivalent(mod@omega@labels, list(s(a,b,c,d),s(x,y,z)))
expect_equivalent(mod@sigma@labels, list(s(e,f), s(h,i,j,k,l)))
expect_equivalent(mod@omega@labels, list(s_(a,b,c,d),s_(x,y,z)))
expect_equivalent(mod@sigma@labels, list(s_(e,f), s_(h,i,j,k,l)))
})


Expand All @@ -256,7 +256,7 @@ $OMEGA
mod <- mcode("label2", code,warn=FALSE, compile = FALSE)

test_that("Mixed labels / no labels and prefix", {
expect_equivalent(mod@omega@labels, list(s(x_a,x_b),s(.,.,.)))
expect_equivalent(mod@omega@labels, list(s_(x_a,x_b),s_(.,.,.)))
})


Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/test-rename.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@ mod <- mod %>% data_set(df)
## "Rename via carry.out #30"
test_that("tran item is renamed", {
out <- mod %>% carry.out(EVID=evid) %>% mrgsim
expect_true(all(is.element(s(RESP,CENT,EVID), names(out))))
expect_true(all(is.element(c("RESP","CENT","EVID"), names(out))))
out <- mod %>% carry.out(EVID=evid,addl) %>% mrgsim
expect_true(all(is.element(s(RESP,CENT,EVID,addl), names(out))))
expect_true(all(is.element(c("RESP","CENT","EVID","addl"), names(out))))
out <- mod %>% carry.out(X=addl) %>% mrgsim
expect_true(all(is.element(s(RESP,CENT,X), names(out))))
expect_true(all(is.element(c("RESP","CENT","X"), names(out))))
out <- mod %>% carry.out(EVID=evid,addl) %>% mrgsim
expect_false(all(is.element(s(evid), names(out))))
expect_false(all(is.element("evid", names(out))))
})


test_that("Item carried from data set is renamed", {
out <- mod %>% carry.out(Dose,WEIGHT = WT) %>% mrgsim
expect_true(all(is.element(s(RESP,CENT,WEIGHT), names(out))))
expect_true(all(is.element(s(Dose,WEIGHT), names(out))))
expect_true(all(is.element(s_(RESP,CENT,WEIGHT), names(out))))
expect_true(all(is.element(s_(Dose,WEIGHT), names(out))))
})


test_that("Item carried from data set is renamed", {
out <- mod %>% carry.out(FOO=BAR) %>% mrgsim
expect_equal(s(ID,time,CENT,RESP), names(out))
expect_equal(c("ID","time","CENT","RESP"), names(out))
})


Expand Down

0 comments on commit 3fa76d1

Please sign in to comment.