diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2016-06-09 12:35:02 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2016-06-09 12:35:02 +0200 |
commit | 95bd5b4c381905a9fcbb179836b7fa861e7e5f3f (patch) | |
tree | 9e9e3cc5eabb987dd81abb9692666bb4a98d4163 /R/endpoints.R | |
parent | 0b36fb666b84321814eabbc1a25687ee70d789e6 (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
Diffstat (limited to 'R/endpoints.R')
-rw-r--r-- | R/endpoints.R | 8 |
1 files changed, 4 insertions, 4 deletions
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="_")]
|