Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ the dosing including dose amount and route.

* `get_halflife_points()` now correctly accounts for start time != 0 and sets
times outside of any interval to `NA` (#470)
* `pk.nca` will calculate `fe` and `clr` even if their dependant parameters (e.g, `ae`) were not requested to be calculated in the intervals (#473)

## New features

Expand Down
4 changes: 4 additions & 0 deletions R/pk.calc.urine.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ add.interval.col("clr.last",
unit_type="renal_clearance",
pretty_name="Renal clearance (from AUClast)",
formalsmap=list(auc="auclast"),
depends = c("ae", "auclast"),
desc="The renal clearance calculated using AUClast")
PKNCA.set.summary(
name="clr.last",
Expand All @@ -86,6 +87,7 @@ add.interval.col("clr.obs",
unit_type="renal_clearance",
pretty_name="Renal clearance (from AUCinf,obs)",
formalsmap=list(auc="aucinf.obs"),
depends = c("ae", "aucinf.obs"),
desc="The renal clearance calculated using AUCinf,obs")
PKNCA.set.summary(
name="clr.obs",
Expand All @@ -99,6 +101,7 @@ add.interval.col("clr.pred",
unit_type="renal_clearance",
pretty_name="Renal clearance (from AUCinf,pred)",
formalsmap=list(auc="aucinf.pred"),
depends = c("ae", "aucinf.pred"),
desc="The renal clearance calculated using AUCinf,pred")
PKNCA.set.summary(
name="clr.pred",
Expand Down Expand Up @@ -126,6 +129,7 @@ add.interval.col("fe",
unit_type="amount_dose",
pretty_name="Fraction excreted",
values=c(FALSE, TRUE),
depends = "ae",
desc="The fraction of the dose excreted")
PKNCA.set.summary(
name="fe",
Expand Down
32 changes: 32 additions & 0 deletions tests/testthat/test-pk.calc.all.R
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,38 @@ test_that("do not give rbind error when interval columns have attributes (#381)"
)
})


test_that("pk.nca can be run for each parameter independently (#473)", {

d_conc <- Theoph[Theoph$Subject %in% "1", ]
d_conc <- rbind(d_conc, mutate(d_conc, Time = Time + 25))
d_conc$volume <- 1
d_conc$duration <- 1
d_dose <- data.frame(Subject = "1", Time = c(0, 25), Dose = 5, duration = 1)

o_conc <- PKNCAconc(d_conc, formula = conc~Time|Subject, volume = "volume", duration = "duration")
o_dose <- PKNCAdose(d_dose, formula = Dose~Time|Subject, route = "intravascular", duration = "duration")

non_pknca_covered_params <- c(
"f", "time_above", "mrt.md.obs", "mrt.md.pred", "sparse_auclast", "sparse_auc_se", "sparse_auc_df",
"vss.md.obs", "vss.md.pred", "ceoi"
)
all_params <- setdiff(names(get.interval.cols()), c("start", "end", non_pknca_covered_params))
intervals <- data.frame(start = c(0, 25), end = c(25, Inf))

for (param in all_params){
intervals_with_param <- intervals
intervals_with_param[[param]] <- TRUE
o_data <- PKNCAdata(o_conc, o_dose, intervals = intervals_with_param)

expect_no_error(param_res <- pk.nca(o_data))
expect_false(
all(is.na(param_res$result$PPORRES)),
info = paste0("Parameter ", param, " can be calculated independently")
)
}
})

test_that("Cannot include and exclude half-life points at the same time (#406)", {
o_conc <- PKNCAconc(data = data.frame(conc = 1, time = 0, inex = TRUE), conc~time, include_half.life = "inex", exclude_half.life = "inex")
d_interval <- data.frame(start = 0, end = Inf, half.life = TRUE)
Expand Down