aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-06-09 12:35:02 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2016-06-09 12:35:02 +0200
commit95bd5b4c381905a9fcbb179836b7fa861e7e5f3f (patch)
tree9e9e3cc5eabb987dd81abb9692666bb4a98d4163
parent0b36fb666b84321814eabbc1a25687ee70d789e6 (diff)
Fix a bug in the listing of formation fractions
The bug could only occur if a parent compound with a metabolite would end in the letter 'f' and was therefore not noticed earlier
-rw-r--r--DESCRIPTION2
-rw-r--r--NEWS.md4
-rw-r--r--R/endpoints.R8
3 files changed, 9 insertions, 5 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index 2b027c58..2cdf3d1a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -3,7 +3,7 @@ Type: Package
Title: Routines for Fitting Kinetic Models with One or More State
Variables to Chemical Degradation Data
Version: 0.9.42.9000
-Date: 2016-04-21
+Date: 2016-06-06
Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"),
email = "jranke@uni-bremen.de"),
person("Katrin", "Lindenberger", role = "ctb"),
diff --git a/NEWS.md b/NEWS.md
index 4c3bf690..9b0181ed 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -14,6 +14,10 @@
- Remove an outdated reference to the inline package in the `compiled_models` vignette
+### Bug fixes
+
+- `endpoints`: When the name of a substance degrading to a metabolite (e.g. a parent compound) used in the model formulation ended in the letter `f`, some rate parameters could be listed as formation fractions with mixed up names. These would also appear in the summary.
+
## mkin 0.9.42 (2016-03-25)
### Major changes
diff --git a/R/endpoints.R b/R/endpoints.R
index 95966cf7..03c38ee0 100644
--- a/R/endpoints.R
+++ b/R/endpoints.R
@@ -15,7 +15,7 @@ endpoints <- function(fit) {
type = names(fit$mkinmod$map[[obs_var]])[1]
# Get formation fractions if directly fitted, and calculate remaining fraction to sink
- f_names = grep(paste("f", obs_var, sep = "_"), names(parms.all), value=TRUE)
+ f_names = grep(paste("^f", obs_var, sep = "_"), names(parms.all), value=TRUE)
if (length(f_names) > 0) {
f_values = parms.all[f_names]
f_to_sink = 1 - sum(f_values)
@@ -30,7 +30,7 @@ endpoints <- function(fit) {
# Get the rest
if (type == "SFO") {
- k_names = grep(paste("k", obs_var, sep="_"), names(parms.all), value=TRUE)
+ k_names = grep(paste("^k", obs_var, sep="_"), names(parms.all), value=TRUE)
k_tot = sum(parms.all[k_names])
DT50 = log(2)/k_tot
DT90 = log(10)/k_tot
@@ -50,7 +50,7 @@ endpoints <- function(fit) {
ep$distimes[obs_var, c("DT50back")] = DT50_back
}
if (type == "IORE") {
- k_names = grep(paste("k__iore", obs_var, sep="_"), names(parms.all), value=TRUE)
+ k_names = grep(paste("^k__iore", obs_var, sep="_"), names(parms.all), value=TRUE)
k_tot = sum(parms.all[k_names])
# From the NAFTA kinetics guidance, p. 5
n = parms.all[paste("N", obs_var, sep = "_")]
@@ -115,7 +115,7 @@ endpoints <- function(fit) {
}
if (type == "SFORB") {
# FOCUS kinetics (2006), p. 60 f
- k_out_names = grep(paste("k", obs_var, "free", sep="_"), names(parms.all), value=TRUE)
+ k_out_names = grep(paste("^k", obs_var, "free", sep="_"), names(parms.all), value=TRUE)
k_out_names = setdiff(k_out_names, paste("k", obs_var, "free", "bound", sep="_"))
k_1output = sum(parms.all[k_out_names])
k_12 = parms.all[paste("k", obs_var, "free", "bound", sep="_")]

Contact - Imprint