Skip to content

Commit

Permalink
Merge pull request #804 from metrumresearchgroup/release/0.10.9
Browse files Browse the repository at this point in the history
Release/0.10.9
  • Loading branch information
kylebaron authored Mar 8, 2021
2 parents e056e69 + 802d5b8 commit 4173a44
Show file tree
Hide file tree
Showing 27 changed files with 1,411 additions and 378 deletions.
2 changes: 1 addition & 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.8
Version: 0.10.9
Authors@R:
c(person(given = "Kyle T", family = "Baron",
role = c("aut", "cre"),
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ S3method(handle_spec_block,specPARAM)
S3method(handle_spec_block,specPKMODEL)
S3method(handle_spec_block,specPLUGIN)
S3method(handle_spec_block,specPRED)
S3method(handle_spec_block,specSET)
S3method(handle_spec_block,specSIGMA)
S3method(handle_spec_block,specTABLE)
S3method(handle_spec_block,specTHETA)
Expand Down Expand Up @@ -246,6 +245,7 @@ importFrom(rlang,as_label)
importFrom(rlang,enquo)
importFrom(rlang,enquos)
importFrom(rlang,eval_tidy)
importFrom(rlang,is_named)
importFrom(rlang,quo_name)
importFrom(rlang,quos)
importFrom(rlang,syms)
Expand Down
19 changes: 19 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# mrgsolve 0.10.9

- Dosing into a compartment that is off at the time of the dose turns the
compartment back on regardless of whether bioavailability is zero or non-zero
(this is a bug fix where the compartment was not turned on when
bioavailability was zero). (#800)
- `simeta()` and `simeps()` now accept an (optional) integer argument to limit
re-simulation to single ETA or EPS values (#789)
- `as.list(mod)` output now includes a data frame of `C++` variables and
pre-processor definitions in the `cpp_variables` slot. (#780)
- `$PARAM`, `$THETA`, `$CMT`, `$INIT`, `$OMEGA` and `$SIGMA` blocks all include
the directives `@object` and `@as_object` so that block contents can be
specified programmatically. `@object` names an object that was coded into
`$ENV` and `@as_object` indicates that the block contains code to realize
the object. See `?BLOCK_PARSE` help topic for more information on how this
all works. (#783)
- `$NMEXT` now lets the user select between multiple tables for scraping
parameter estimates. (#782)

# mrgsolve 0.10.8
- Allow simulation from compartmental models with negative times #778
- Enable dynamic capture of pre-processor directives at compile time #776
Expand Down
1 change: 1 addition & 0 deletions R/Aaaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#' @importFrom magrittr %>%
#' @importFrom tibble tibble as_tibble
#' @importFrom rlang quos enquo enquos quo_name syms !!! !! eval_tidy as_label
#' @importFrom rlang is_named
#' @importFrom lifecycle deprecate_soft
#' @importFrom glue glue
#' @importFrom Rcpp evalCpp
Expand Down
17 changes: 2 additions & 15 deletions R/annot.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2013 - 2019 Metrum Research Group
# Copyright (C) 2013 - 2021 Metrum Research Group
#
# This file is part of mrgsolve.
#
Expand Down Expand Up @@ -110,12 +110,9 @@ parse_annot_line <- function(x, novalue=FALSE, noname=FALSE,context="not given")
##'
##' mrgsolve:::details(mod)
##'
details <- function(x,complete=FALSE,values=TRUE,...) {

details <- function(x, complete = FALSE, values = TRUE,...) {
stopifnot(is.mrgmod(x))

ans <- x@annot[["data"]]

if(nrow(ans)==0) {
ans <- cobble_details(x)
} else {
Expand All @@ -134,9 +131,7 @@ store_annot <- function(x,what,loc=soloc(x),...) {
}

cobble_details <- function(x) {

ans <- list()

par <- as.numeric(param(x))
if(length(par) > 0) {
ans[[1]] <- tibble(block="PARAM",name=names(par))
Expand All @@ -159,23 +154,18 @@ cobble_details <- function(x) {
value = unname(this_mat))
}
}


ans <- dplyr::bind_rows(ans)
ans <- dplyr::mutate(ans,descr='.', units='.', options='.')
ans <- ans[,c("block","name","descr","units","options"),drop=FALSE]
as.data.frame(ans)

}

complete_details <- function(annot,x) {

par <- as.numeric(param(x))
cmt <- as.numeric(init(x))
fx <- as.numeric(x@fixed)
name <- unique(annot[annot$block %in% c("PARAM", "CMT", "FIXED"),"name"])
dum <- annot[0,]

if(length(par) > 0) {
miss <- setdiff(names(par),name)
if(length(miss) > 0) {
Expand All @@ -185,7 +175,6 @@ complete_details <- function(annot,x) {
}
annot <- dplyr::bind_rows(annot,par)
}

if(length(cmt) > 0) {
miss <- setdiff(names(cmt),name)
if(length(miss) > 0) {
Expand All @@ -195,7 +184,6 @@ complete_details <- function(annot,x) {
}
annot <- dplyr::bind_rows(annot,cmt)
}

if(length(fx) > 0) {
miss <- setdiff(names(fx),name)
if(length(miss) > 0) {
Expand All @@ -216,7 +204,6 @@ add_detail_values <- function(annot,x) {
x <- tibble(name=names(x),value=x)
annot <- dplyr::left_join(annot,x,by="name")
return(annot)

}

#nocov end
Expand Down
4 changes: 4 additions & 0 deletions R/class_matlist.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ dim_matlist <- function(x) {

create_matlist <- function(x=list(),class,labels=list(),signature=NULL,...) {
x <- x[!sapply(x,nrow)==0]
# names ---
if(is.null(names(x))) names(x) <- rep("...", length(x))
names(x)[nchar(names(x))==0] <- "..."
# end names ---
if(is.null(unlist(labels))) {
labels <- lapply(x, function(y) rep('.',nrow(y)))
}
# check for duplicates ----
all <- unlist(labels, use.names=FALSE)
all <- all[all != "."]
if(any(duplicated(all))) {
Expand All @@ -100,6 +103,7 @@ create_matlist <- function(x=list(),class,labels=list(),signature=NULL,...) {
stop("duplicate labels found when creating matlist object: ", dup,
call.=FALSE)
}
# done check for duplicates ---
x <- new(class, data=x, labels=labels)
x@n <- dim_matlist(x)
return(x)
Expand Down
4 changes: 3 additions & 1 deletion 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
#' - `cpp_variables`: a data frame listing variables internal to the model
#' cpp file
#' - `atol`: see [solversettings]
#' - `rtol`: see [solversettings]
#' - `ss_atol`: absolute tolerance to use when advancing to PK steady state
Expand All @@ -477,7 +479,6 @@ setMethod("names", "mrgmod", function(x) {
#' - `envir`: the model environment
#' - `plugins`: plugins invoked in the model
#' - `digits`: number of digits to request in simulated data

#' - `tscale`: multiplicative scalar for time in results only
#' - `mindt`: simulation output time below which there model will assume to
#' have not advanced
Expand Down Expand Up @@ -512,6 +513,7 @@ setMethod("as.list", "mrgmod", function(x, deep = FALSE, ...) {
advan <- x@advan
functions <- funset(x)
}
cpp_variables <- x@shlib[["cpp_variables"]]
details <- x@annot
code <- x@code
random <- names(x)[c("omega", "sigma", "omega_labels", "sigma_labels")]
Expand Down
1 change: 1 addition & 0 deletions R/class_numericlist.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ null_list <- setNames(list(), character(0))
valid.numericlist <- function(object) {
x1 <- all(sapply(object@data,single.number))
x2 <- all(names(object@data) !="")
x2 <- rlang::is_named(object@data)
x3 <- !any(grepl("=|\\.",names(object),perl=TRUE))

x <- x1 & x2 & x3
Expand Down
Loading

0 comments on commit 4173a44

Please sign in to comment.