Skip to content

Commit

Permalink
added selection of confidence in diff uc #106
Browse files Browse the repository at this point in the history
  • Loading branch information
werpuc committed May 17, 2022
1 parent 614fe18 commit 5418f82
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions R/kinetics.R
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ plot_differential_uptake_curve <- function(diff_uptake_dat = NULL,
show_houde_interval = FALSE,
show_tstud_confidence = FALSE){

uncertainty_type <- match.arg(uncertainty_type, c("ribbon", "bars", "bars + line"))

if(is.null(sequence)){ sequence <- diff_uptake_dat[["Sequence"]][1] }

states <- paste0(attr(diff_uptake_dat, "state_1"), "-", attr(diff_uptake_dat, "state_2"))
Expand Down Expand Up @@ -639,13 +641,13 @@ plot_differential_uptake_curve <- function(diff_uptake_dat = NULL,
} else if (uncertainty_type == "bars") {

diff_kin_plot <- diff_kin_plot +
geom_errorbar(aes(x = time_chosen, ymin = value - err_value, ymax = value + err_value, color = states),
geom_errorbar(aes(x = Exposure, ymin = value - err_value, ymax = value + err_value, color = states),
width = err_width)

} else if (uncertainty_type == "bars + line"){

diff_kin_plot <- diff_kin_plot +
geom_errorbar(aes(x = time_chosen, ymin = value - err_value, ymax = value + err_value, color = states),
geom_errorbar(aes(x = Exposure, ymin = value - err_value, ymax = value + err_value, color = states),
width = err_width) +
geom_line(aes(color = Sequence))

Expand Down
2 changes: 1 addition & 1 deletion inst/HaDeX/server/tab_uptake_curve_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ diff_kin_dat <- reactive({
state_1 = input[["diff_kin_state_1"]],
state_2 = input[["diff_kin_state_2"]],
# p_adjustment_method = "none",
# confidence_level = 0.98,
confidence_level = as.numeric(input[["diff_kin_confidence_level"]]),
time_0 = v_time_0,
time_100 = v_time_100,
deut_part = as.numeric(input[["deut_part"]])/100)
Expand Down
7 changes: 6 additions & 1 deletion inst/HaDeX/ui/ui_tab_uptake_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ diff_uptake_test <- function() HaDeX_plotSettingsSection(
value = FALSE),
checkboxInput_h(inputId = "diff_kin_show_tstud",
label = "t-Student test",
value = FALSE)
value = FALSE),
selectInput_h(inputId = "diff_kin_confidence_level",
label = "Confidence limit:",
choices = c("20%" = 0.2, "50%" = 0.5, "80%" = 0.8, "90%" = 0.9, "95%" = 0.95, "98%" = 0.98, "99%" = 0.99, "99.9%" = 0.999),
selected = 0.98)

)

##
Expand Down

0 comments on commit 5418f82

Please sign in to comment.