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

shiny-*, state: Streamline regeneration of m$run.

parent 9abcc7f2
No related branches found
Tags v1.2.1
No related merge requests found
Package: shinyscreen Package: shinyscreen
Title: Pre-screening of Mass Spectrometry Data Title: Pre-screening of Mass Spectrometry Data
Version: 1.2 Version: 1.2.1
Author: Todor Kondić Author: Todor Kondić
Maintainer: Todor Kondić <todor.kondic@uni.lu> Maintainer: Todor Kondić <todor.kondic@uni.lu>
Authors@R: Authors@R:
......
...@@ -167,7 +167,7 @@ unpack_app_state <- function(session,input,top_data_dir,project_path,packed_stat ...@@ -167,7 +167,7 @@ unpack_app_state <- function(session,input,top_data_dir,project_path,packed_stat
selected = packed_state$input[[inp]]) selected = packed_state$input[[inp]])
} }
gui <- create_gui(project_path) gui <- create_gui(project_path=project_path)
gui$compounds$lists <- packed_state$compounds$lists gui$compounds$lists <- packed_state$compounds$lists
gui$compounds$sets <- packed_state$compounds$sets gui$compounds$sets <- packed_state$compounds$sets
gui$datatab$file <- packed_state$datatab$file gui$datatab$file <- packed_state$datatab$file
...@@ -240,11 +240,14 @@ input2conf <- function(input,gui,conf=list()) { ...@@ -240,11 +240,14 @@ input2conf <- function(input,gui,conf=list()) {
app_state2state <- function(input,gui,m=NULL) { app_state2state <- function(input,gui,m=NULL) {
if (is.null(m)) m <- new_project(gui$paths$project) if (is.null(m)) m <- new_project(gui$paths$project)
m$run$paths <- shiny::reactiveValuesToList(gui$paths) ## m$run$paths <- shiny::reactiveValuesToList(gui$paths)
m$conf <- input2conf_setup(input,gui=gui) m$conf <- input2conf_setup(input,gui=gui)
m$conf <- input2conf_prescreen(input=input,conf=m$conf) m$conf <- input2conf_prescreen(input=input,conf=m$conf)
m$conf <- input2conf_figures(input,conf=m$conf) m$conf <- input2conf_figures(input,conf=m$conf)
m$conf <- input2conf_report(input,conf=m$conf) m$conf <- input2conf_report(input,conf=m$conf)
m$conf$paths$data <- gui$paths$data
m$run <- new_runtime_state(project=gui$paths$project,
conf=m$conf)
m$input$tab$mzml <- gui2datatab(gui) m$input$tab$mzml <- gui2datatab(gui)
m m
} }
......
...@@ -1004,10 +1004,6 @@ mk_shinyscreen_server <- function(projects,init) { ...@@ -1004,10 +1004,6 @@ mk_shinyscreen_server <- function(projects,init) {
packed_state=pack) packed_state=pack)
## Load computational state. ## Load computational state.
rvs$m <- readRDS(file=fn_state) rvs$m <- readRDS(file=fn_state)
rvs$m$run <- reinit_run_data(userdir=init$userdir,
top_data_dir=init$indir,
project=rvs$gui$project(),
run = rvs$m$run)
## If prescreen config invalid, reinit. ## If prescreen config invalid, reinit.
if (length(rvs$m$conf$prescreen)==0) rvs$m$conf <- input2conf_prescreen(input=input,conf=rvs$m$conf) if (length(rvs$m$conf$prescreen)==0) rvs$m$conf <- input2conf_prescreen(input=input,conf=rvs$m$conf)
...@@ -1028,11 +1024,6 @@ mk_shinyscreen_server <- function(projects,init) { ...@@ -1028,11 +1024,6 @@ mk_shinyscreen_server <- function(projects,init) {
} else { } else {
message("Initialising project: ",wd) message("Initialising project: ",wd)
rvs$gui <- create_gui(project_path=fullwd) rvs$gui <- create_gui(project_path=fullwd)
rvs$m$run <- new_runtime_state(fullwd)
} }
message("project: ",rvs$gui$project()) message("project: ",rvs$gui$project())
}, label = "project-b") }, label = "project-b")
......
...@@ -40,7 +40,7 @@ runtime_from_conf <- function(run,conf) { ...@@ -40,7 +40,7 @@ runtime_from_conf <- function(run,conf) {
run run
} }
reinit_run_data <- function(userdir,top_data_dir,project,run) { reinit_run_data <- function(userdir,top_data_dir,project,run=NULL) {
if (!is.null(run)) { if (!is.null(run)) {
olddata <- run$paths$data olddata <- run$paths$data
oldproject <- basename(run$paths$project) oldproject <- basename(run$paths$project)
...@@ -48,8 +48,8 @@ reinit_run_data <- function(userdir,top_data_dir,project,run) { ...@@ -48,8 +48,8 @@ reinit_run_data <- function(userdir,top_data_dir,project,run) {
message("Project has been renamed to: ",project) message("Project has been renamed to: ",project)
message("Old project name was: ", oldproject) message("Old project name was: ", oldproject)
} }
if (isTruthy(olddata)) run$paths$data <- file.path(top_user_dir,basename(olddata))
} }
if (isTruthy(olddata)) run$paths$data <- file.path(top_user_dir,basename(olddata))
run$project <- project run$project <- project
run$paths$project <- file.path(userdir,project) run$paths$project <- file.path(userdir,project)
run run
......
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