Skip to content
Snippets Groups Projects
Unverified Commit fd294a3c authored by Todor Kondic's avatar Todor Kondic
Browse files

New names for lst2rv_lst and rv_lst2lst

* R/shiny-ui-base.R, R/shiny-ui-base.R (rv_lst2lst, lst2rv_lst,
  rev2list, list2rev): rv_lst2lst -> rev2list, lst2rv_lst -> list2rev

* R/shiny-ui-base.R(isol): New function.
  Alias for isolate.
parent ebbae7d5
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ obsrv <- shiny::observe
obsrv_e <- shiny::observeEvent
vols <- shinyFiles::getVolumes
vol_f <- vols()
isol <- shiny::isolate
volumes <- function() c(wd=getwd(), shinyFiles::getVolumes()())
validate1 <- function(expr,msg) shiny::validate(shiny::need(expr,msg))
......@@ -89,17 +90,17 @@ txt_file_input <- function(inputId,input,fileB,label,volumes) {
}
rv_lst2lst <- function(rv) {
rev2list <- function(rv) {
## Take reactive values structure and convert them to nested
## lists.
if (class(rv) != "reactivevalues")
rv else lapply(shiny::reactiveValuesToList(rv),rv_lst2lst)
rv else lapply(shiny::reactiveValuesToList(rv),rev2list)
}
lst2rv_lst <- function(lst) {
list2rev <- function(lst) {
## Take nested named list and create reactive values from it.
if (class(lst) != "list")
lst else do.call(react_v,lapply(lst,lst2rv_lst))
lst else do.call(react_v,lapply(lst,list2rev))
}
txt2tags <- function(txt) {
......
......@@ -158,7 +158,7 @@ react_conf_f <- function(input,output,session,rv,rf) {
unknown=input$unknown,
sets=input$sets)
rv <- load_compound_input(rv)
rv$input$tab <- lst2rv_lst(rv$input$tab)
rv$input$tab <- list2rev(rv$input$tab)
rv
})
......@@ -169,7 +169,7 @@ react_conf_f <- function(input,output,session,rv,rf) {
file2tab(file=rv$conf$data)
} else EMPTY_MZML
rv$input <- lst2rv_lst(rv$input)
rv$input <- list2rev(rv$input)
rv
})
......@@ -203,7 +203,7 @@ server_conf <- function(input,output,session,rv,rf) {
shinyFiles::shinyDirChoose(input, 'switchProjB',roots=volumes)
obsrv_e(input$saveConfB, {
conf<-rv_lst2lst(rv)
conf<-rev2list(rv)
vol <- vol_f()
fn <- shinyFiles::parseSavePath(roots=vol_f,input$saveConfB)[["datapath"]]
validate1(fn,msg="Invalid file to save config to.")
......@@ -213,7 +213,7 @@ server_conf <- function(input,output,session,rv,rf) {
obsrv_e(input$restoreConfB,{
fn <- shinyFiles::parseFilePaths(roots=volumes,input$restoreConfB)[["datapath"]]
assert(file.exists(fn), msg="The file is unreadable.")
rv$conf <- lst2rv_lst(read_conf(fn))
rv$conf <- list2rev(read_conf(fn))
for (nm in names(rv$conf$compounds)) {
shiny::updateTextInput(session=session,
inputId=nm,
......@@ -283,9 +283,6 @@ server_conf <- function(input,output,session,rv,rf) {
output$mzMLtabCtrl <- rhandsontable::renderRHandsontable({
input$updTagsB
message("BEFORE-----")
str(rv$input$tab$mzml)
rv <- rf$get_compounds()
rv <- rf$initial_mzml()
all_sets <- unique(rv$input$tab$setid$set)
......@@ -294,8 +291,7 @@ server_conf <- function(input,output,session,rv,rf) {
levels(df$set) <- all_sets
df$mode <- factor(df$mode)
levels(df$mode) <- names(MODEMAP)
message("AFTER-----")
str(rv$input$tab$mzml)
rhandsontable::rhandsontable(df,stretchH="all")
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment