diff --git a/R/shinyUI.R b/R/shinyUI.R index 89508bc66d36f5cfb0ca3e2ea25c9c09e31b5c10..a6eefb6b7f9500412a462c47f2c0f69478bbcfc9 100644 --- a/R/shinyUI.R +++ b/R/shinyUI.R @@ -723,6 +723,16 @@ mk_shinyscreen <- function(projDir=getwd(), NULL } + txt2tags<-function(txt){ + ## Turns a string into tags + x <- if (shiny::isTruthy(txt)) { + trimws(unlist(strsplit(txt, ","))) + } else list() + + + as.list(c("unspecified",x)) + } + server <- function(input,output,session) { @@ -782,12 +792,7 @@ mk_shinyscreen <- function(projDir=getwd(), get_all_tags<-shiny::reactive({ ## Returns all tags from the input box. tagsInp<-input$tagsInp - x <- if (shiny::isTruthy(tagsInp)) { - trimws(unlist(strsplit(tagsInp, ","))) - } else list() - - - as.list(c("unspecified",x)) + txt2tags(tagsInp) }) @@ -999,6 +1004,17 @@ mk_shinyscreen <- function(projDir=getwd(), for (nm in REST_TAB) { rvTab[[nm]]<-sav$tab[[nm]] } + + ## Restore tags. + mzmlTags <- levels(rvTab$mzml$tag) + currTags <- txt2tags(sav$input[["tagsInp"]]) + z <- unique(c(currTags, mzmlTags)) + z <- z[z != 'unspecified'] + alltags <- do.call(paste,c(as.list(z),sep=',')) + shiny::updateTextInput(session=session, + inputId="tagsInp", + value=alltags) + } }) @@ -1598,6 +1614,7 @@ mk_shinyscreen <- function(projDir=getwd(), { fchoice<-shinyFiles::parseFilePaths(root=volumes,input$mzMLB) paths<-fchoice[["datapath"]] + shiny::validate(need(rvTab$mzml,"There is no skeleton table. Sets? Tags?")) rvTab$mzml<-add_mzML_files(rvTab$mzml,paths) })