From 95bd5b4c381905a9fcbb179836b7fa861e7e5f3f Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 9 Jun 2016 12:35:02 +0200 Subject: 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 --- R/endpoints.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'R/endpoints.R') 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="_")] -- cgit v1.2.1