From 2e06f8cc3dee660e1b0b77ecbdba9c5c8788d1b1 Mon Sep 17 00:00:00 2001 From: werpuc Date: Mon, 11 May 2020 12:17:24 +0200 Subject: [PATCH] validation on time inputs in woods plot tab --- inst/HaDeX/server.R | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/inst/HaDeX/server.R b/inst/HaDeX/server.R index b6441eb2..2ca9d29c 100644 --- a/inst/HaDeX/server.R +++ b/inst/HaDeX/server.R @@ -794,7 +794,7 @@ server <- function(input, output, session) { observe({ - if(input[["calc_type"]] == "relative"){ + if(input[["calc_type"]] == "relative" & !input[["theory"]]){ show(id = "out_time_part") } @@ -864,6 +864,13 @@ server <- function(input, output, session) { all_dat <- reactive({ + if(!input[["theory"]]){ + validate(need(as.numeric(input[["in_time"]]) < as.numeric(input[["chosen_time"]]), "In time must be smaller than chosen time.")) + validate(need(as.numeric(input[["chosen_time"]]) < as.numeric(input[["out_time"]]), "Out time must be bigger than chosen time.")) + } + + + bind_rows(lapply(states_from_file(), function(i) calculate_state_deuteration(dat(), protein = input[["chosen_protein"]], state = i, @@ -1137,6 +1144,12 @@ server <- function(input, output, session) { validate(need(input[["compare_states"]], "Please select at least one state.")) validate(need(length(unique(filter(dat(), !is.na("Modification"), Protein == input[["chosen_protein"]])[["State"]])) > 1, "Not sufficient number of states without modifications.")) + if(!input[["theory"]]){ + validate(need(as.numeric(input[["in_time"]]) < as.numeric(input[["chosen_time"]]), "In time must be smaller than chosen time.")) + validate(need(as.numeric(input[["chosen_time"]]) < as.numeric(input[["out_time"]]), "Out time must be bigger than chosen time.")) + } + + tmp <- bind_rows(lapply(c(input[["state_first"]], input[["state_second"]]), function(i) calculate_state_deuteration(dat(), protein = input[["chosen_protein"]], state = i,