diff --git a/R/api.R b/R/api.R index 9bc50502aec9125b049d98645989db33dd907506..5e90ae14f113b1f69ff7de08fea74ce1de17bc7c 100644 --- a/R/api.R +++ b/R/api.R @@ -273,47 +273,6 @@ mk_comp_tab <- function(m) { m } - -verify_compounds <- function(conf) { - ## * Existence of input files - - fns_cmpds <- conf$compounds$lists - fn_cmpd_sets <- conf$compounds$sets - - ## ** Compound lists and sets - - assert(isThingFile(fn_cmpd_sets), - msg=paste("Cannot find the compound sets file:",fn_cmpd_sets)) - - for (fn in fns_cmpds) { - assert(isThingFile(fn), msg=paste("Cannot find compound list:",fn)) - } - - ## * Data files - df_sets <- file2tab(fn_cmpd_sets) - all_sets<-unique(df_sets$set) - - return(list(conf=conf,all_sets=all_sets)) -} - -verify_data_df <- function(data_path,mzml,all_sets) { - no_file <- which(mzml[,!file.exists(file.path(data_path,file))]) - no_adducts <- which(mzml[,!(adduct %in% names(ADDUCTMAP))]) - no_sets <- which(mzml[,!(set %in% all_sets)]) - assert(length(no_file)==0,msg = paste("Non-existent data files at rows:",paste(no_file,collapse = ','))) - assert(length(no_adducts)==0,msg = paste("Unrecognised adducts at rows:",paste(no_adducts,collapse = ','))) - assert(length(no_sets)==0,msg = paste("Unknown sets at rows:",paste(no_sets,collapse = ','))) -} - -verify_data <- function(conf,run,all_sets) { - ## * Existence of input files - fn_data <- run$paths$datatab - assert(isThingFile(fn_data),msg=paste("Data table does not exist:",fn_data)) - mzml <- file2tab(fn_data) - verify_data_df(run$paths$data,mzml=mzml,all_sets) - return(conf) -} - #' @export concurrency <- function(m) { ## Reads the concurrency entry in the config. It is optional, if diff --git a/R/shiny-state.R b/R/shiny-state.R index 6759ecd9d8cf54b5de26b58777446a5fa7fc5306..3450504a994cd22c778eeede1145584d3d1ee4d8 100644 --- a/R/shiny-state.R +++ b/R/shiny-state.R @@ -482,75 +482,6 @@ gui2datatab <- function(gui) { } -pre_extr_val_block <- function(m) { - if (NROW(m$input$tab$cmpds)==0L) { - shinymsg("Compound table is still missing.",type="error") - return(F) - } - - if (NROW(m$input$tab$setid)==0L) { - shinymsg("Set table is still missing.",type="error") - return(F) - } - - if (NROW(m$input$tab$mzml)==0L) { - shinymsg("Table `datatab' is missing.",type="error") - return(F) - } - - xx <- m$input$tab$mzml - if (any(is.na(xx$tag))) { - shinymsg("Some `tag' entries in `datatab' have not been specified.",type='error') - return(F) - } - - if (any(is.na(xx$adduct))) { - shinymsg("Some `adduct' entries in `datatab' have not been specified.",type='error') - return(F) - } - - if (any(is.na(xx$set))) { - shinymsg("Some `set' entries in `datatab' have not been specified.",type='error') - return(F) - } - - return(T) -} - -pre_setup_val_block <- function(gui) { - - if (!isTruthy(gui$project)) { - shinymsg("No project yet.", type="error") - return(F) - } - - if (!isTruthy(head(gui$datatab$file,1))) { - shinymsg("No data files have been specified yet.", type="error") - return(F) - } - - if (!isTruthy(all(!is.na(gui$datatab$tag)))) { - shinymsg("Some tags in datatab are undefined.") - return(F) - } - - if (!isTruthy(all(!is.na(gui$datatab$tag)))) { - shinymsg("Some tags in datatab are undefined.") - return(F) - } - - if (!isTruthy(all(!is.na(gui$datatab$adduct)))) { - shinymsg("Some adducts in datatab are undefined.") - return(F) - } - - if (!isTruthy(all(!is.na(gui$datatab$set)))) { - shinymsg("Some sets in datatab are undefined.") - return(F) - } - T -} - ## SHINY HELPERS: COMPOUND INDEX diff --git a/R/shiny-ui-base.R b/R/shiny-ui-base.R index fb719c66d20762bcef04cba7e6eb0f1d7fae6934..94ec08af59772095756d5ad30a978c6ab0fe8887 100644 --- a/R/shiny-ui-base.R +++ b/R/shiny-ui-base.R @@ -22,13 +22,6 @@ obsrv = shiny::observe obsrv_e = shiny::observeEvent isol = shiny::isolate - - -embed_rmd <- function(fn) { -} - - - celledit_values <- function(col,values,labels=NULL,addna=T) { if (is.null(labels)) labels = values if (length(values)==0 || nchar(values)==0) return(character(0)) @@ -917,11 +910,6 @@ mk_shinyscreen_server <- function(projects,init) { choices = list.files(path=top_data_dir, pattern = CMPD_LIST_PATT)) - updateSelectInput(session = session, - inputId = "set_list", - choices = list.files(path=top_data_dir, - pattern = SET_LIST_PATT)) - updateSelectInput(session = session, inputId = "dfile_list", choices = list.files(path=top_data_dir, @@ -1050,13 +1038,6 @@ mk_shinyscreen_server <- function(projects,init) { message("(config) Selected compound lists: ", paste(sels,collapse = ",")) }) - observeEvent(input$set_list_b, { - sels = input$set_list - req(isTruthy(sels)) - message("(config) Selected set lists: ", paste(sels,collapse = ",")) - rvs$gui$compounds$sets = sels - }) - observeEvent(rf_get_sets(),{ sets = rf_get_sets() if (isTruthy(rf_get_sets())) { diff --git a/inst/rmd/app.Rmd b/inst/rmd/app.Rmd index 7536ec33040e341f890575839fbb6a728698170d..3dd68339c7cce8bbe20be52f0eb426d59369e989 100644 --- a/inst/rmd/app.Rmd +++ b/inst/rmd/app.Rmd @@ -34,8 +34,7 @@ def_summ_subset <- shinyscreen:::dtable("QA Column"=shinyscreen:::QA_FLAGS, validate <- shiny::validate ### def_state$input$tab$tags <- def_datatab rv_state <- list2rev(def_state) -compl_sets <- eventReactive(rv_state$input$tab$setid, - rv_state$input$tab$setid[,unique(set)]) + ### Reactive values to support some of the UI elements. ### rv_ui <- reactiveValues(datatab=def_tags)