Commit 80704f20 authored by mmassaviol's avatar mmassaviol
Browse files

Update params file changes

Add unlock button
parent 353ef967
......@@ -542,19 +542,23 @@ generate_pages_server <- function() {
save_params <- save_params + resG
save_params <- save_params + '\t\tres = paste0(res, paste("final_step:", paste0(\'\"\', input$final_step, \'\"\'), "\\n", sep = " "))\n\n'
save_params <- save_params + '\ta = yaml.load_file("/workflow/params.total.yml")\n'
save_params <- save_params + '\tp = a[["params"]]\n'
save_params <- save_params + '\ta["params"] = NULL\n'
save_params <- save_params + '\tb = yaml.load(res)\n'
save_params <- save_params + '\tanotb = subset(names(a), !(names(a)%in%names(b)))\n'
save_params <- save_params + '\tc = c(a[anotb],b)\n'
save_params <- save_params + '\tpnotb = subset(names(p), !(names(p)%in%names(b)))\n'
save_params <- save_params + '\td = list()\n'
save_params <- save_params + '\td$params = c(p[pnotb],b)\n'
save_params <- save_params + '\tlogical = function(x) {\n'
save_params <- save_params + '\t\tresult <- ifelse(x, "True", "False")\n'
save_params <- save_params + '\t\tclass(result) <- "verbatim"\n'
save_params <- save_params + '\t\treturn(result)\n'
save_params <- save_params + '\t}\n'
save_params <- save_params + '\td = c(d,a)\n'
save_params <- save_params + '\tsamples = yaml.load(system(paste0("python3 /workflow/get_samples.py ",input$sample_dir," /Data/groups.csv ", input$sample_suffix),intern = T))\n'
save_params <- save_params + '\tc$samples = names(samples)\n'
save_params <- save_params + '\td$samples = names(samples)\n'
save_params <- save_params + '\tnames(samples) = NULL\n'
save_params <- save_params + '\tc$groups = unlist(samples)\n'
save_params <- save_params + '\twrite_yaml(c,path_param,handlers=list(logical = logical))\n'
save_params <- save_params + '\td$groups = unlist(samples)\n'
save_params <- save_params + '\twrite_yaml(d,path_param,handlers=list(logical = logical))\n'
save_params <- save_params + '\t}\n\n'
res <- save_params
......@@ -650,7 +654,12 @@ generate_pages_server <- function() {
res <- res + '\t\t}\n'
res <- res + '\t\tsystem(paste0("touch ",input$results_dir,"/logs/workflow.running"),wait = T)\n'
res <- res + '\t\tsystem2("python3",paste0("-u -m snakemake -s /workflow/Snakefile --configfile ", paste0(input$results_dir,"/params.yml") ,\t" -d ", input$results_dir ,\t" --cores ", input$cores, " all ", forcerun),wait = FALSE, stdout = paste0(input$results_dir,"/logs/runlog.txt"), stderr = paste0(input$results_dir,"/logs/runlog.txt"))\n'
# RULEGRAPH
res <- res + '\t\t\tsystem(paste0("snakemake -s /workflow/Snakefile --configfile ",input$results_dir,"/params.yml -d ",input$results_dir," all --rulegraph | dot -Tpng -Gratio=0.75 > ",input$results_dir,"/Rule_graph_mqc.png"))\n'
# RUN
res <- res + '\t\tsystem2("python3",paste0("-u -m snakemake -s /workflow/Snakefile --configfile ", paste0(input$results_dir,"/params.yml") ,\t" --forcerun all -d ", input$results_dir ,\t" --cores ", input$cores, " all ", forcerun),wait = FALSE, stdout = paste0(input$results_dir,"/logs/runlog.txt"), stderr = paste0(input$results_dir,"/logs/runlog.txt"))\n'
res <- res + '\t\ttags$iframe(src="results/multiqc_report.html",width="100%", height="900px")},\n'
res <- res + '\t\terror = function(e){\n'
res <- res + '\t\t\tsystem(paste0("touch ",input$results_dir,"/logs/workflow_end.error"),wait = T)\n'
......@@ -663,6 +672,12 @@ generate_pages_server <- function() {
for(page in APP$pages){
for(box in page$boxes){
for(cnt in box$content){
if ("prompt" %in% names(cnt)){
#res <- res + '\t\t'
res <- res + '\t\tobserveEvent({input$'+cnt$name+'},{showModal(modalDialog(title = "Info","'+cnt$prompt+'",easyClose = TRUE))},ignoreInit=TRUE)\n'
}
if ("volumes" %in% names(cnt)){
volumes = 'c('
for (key in names(cnt$volumes[[1]]))
......@@ -884,7 +899,7 @@ generate_app <- function() {
res <- res + "tabReport = fluidPage(box(title = 'Report :', width = 12, status = 'primary', collapsible = TRUE, solidHeader = TRUE, uiOutput('report_html')))\n"
}
res <- res + 'tabRUN = fluidPage(box(title = \'Run :\', width = 12 , status = \'primary\', collapsible = TRUE, solidHeader = TRUE, uiOutput(\'run_out\',style = \'overflow-y: scroll; height: 600px\')))\n'
res <- res + 'tabRUN = fluidPage(box(title = \'Run :\', width = 12 , status = \'primary\', collapsible = TRUE, solidHeader = TRUE, uiOutput(\'run_out\',style = \'overflow-y: scroll; height: 600px\')),actionButton("unlock", "Unlock the directory in case of previous failure"))\n'
res <- res + 'source("./R/menugauche.R", local=T)\n\n'
......@@ -938,26 +953,29 @@ generate_app <- function() {
res <- res + '\t\tparams = read_yaml(paste0(dossierAnalyse,"/params.yml"))\n'
res <- res + '\t\tfor (param in names(params$params_info)){\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "text" || params$params_info[[param]]$type == "input_dir" || params$params_info[[param]]$type == "output_dir"){\n'
res <- res + '\t\t\t\tupdateTextInput(session, param, value = params[[param]])\n'
res <- res + '\t\t\t\tupdateTextInput(session, param, value = params[["params"]][[param]])\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "textArea"){\n'
res <- res + '\t\t\t\tupdateTextAreaInput(session, paste0(param,"_server"), value = params[[param]])\n'
res <- res + '\t\t\t\tupdateTextAreaInput(session, paste0(param,"_server"), value = params[["params"]][[param]])\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "input_file" && params[[paste0(param,"_select")]] == "server"){\n'
res <- res + '\t\t\t\tupdateTextInput(session, paste0(param,"_server"), value = params[[param]])\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "input_file" && params[["params"]][[paste0(param,"_select")]] == "server"){\n'
res <- res + '\t\t\t\tupdateTextInput(session, paste0(param,"_server"), value = params[["params"]][[param]])\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "numeric"){\n'
res <- res + '\t\t\t\tupdateNumericInput(session, param, value = params[[param]])\n'
res <- res + '\t\t\t\tupdateNumericInput(session, param, value = params[["params"]][[param]])\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "radio"){\n'
res <- res + '\t\t\t\tupdateRadioButtons(session, param, selected = params[[param]])\n'
res <- res + '\t\t\t\tupdateRadioButtons(session, param, selected = params[["params"]][[param]])\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "select"){\n'
res <- res + '\t\t\t\tupdateSelectInput(session, param, selected = params[[param]])\n'
res <- res + '\t\t\t\tupdateSelectInput(session, param, selected = params[["params"]][[param]])\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t\tif (params$params_info[[param]]$type == "checkbox"){\n'
res <- res + '\t\t\t\tupdateCheckboxInput(session, param, value = params[["params"]][[param]])\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t}\n'
res <- res + '\t\tfor (step in params$steps){\n'
res <- res + '\t\t\tupdateSelectInput(session, paste0("select",step$name), selected = params[[step$name]])\n'
res <- res + '\t\t\tupdateSelectInput(session, paste0("select",step$name), selected = params[["params"]][[step$name]])\n'
res <- res + '\t\t}\n'
res <- res + '\t}\n'
res <- res + '\t# if rulegraph show it\n'
......@@ -1028,9 +1046,9 @@ generate_app <- function() {
res <- res + '\t\t\t\tfile.remove(paste0(input$results_dir,"/logs/workflow_end.error"))\n'
res <- res + '\t\t\t\tfile.remove(paste0(input$results_dir,"/logs/workflow.running"))\n'
res <- res + '\t\t\t}\n'
res <- res + '\t\t\tshinyjs::runjs(\n'
res <- res + '\t\t\t\t"var objDiv = document.getElementById(\'run_out\'); objDiv.scrollTop = objDiv.scrollHeight;"\n'
res <- res + '\t\t\t)\n'
#res <- res + '\t\t\tshinyjs::runjs(\n'
#res <- res + '\t\t\t\t"var objDiv = document.getElementById(\'run_out\'); objDiv.scrollTop = objDiv.scrollHeight;"\n'
#res <- res + '\t\t\t)\n'
res <- res + '\t\t}\n'
res <- res + '\t})\n'
res <- res + '\toutput$run_out <- renderUI({\n'
......@@ -1053,6 +1071,7 @@ generate_app <- function() {
res <- res + '\t\t\t\tshinyjs::enable(x)} else {\n'
res <- res + '\t\t\t\t\tshinyjs::disable(x) }\n'
res <- res + '\t\t}\n'
res <- res + '\tshinyjs::enable("unlock")\n'
res <- res + '\tshinyjs::enable("StopPipeline")\n'
res <- res + '\tshinyjs::enable("close_session")\n'
res <- res + '\t}\n'
......@@ -1089,6 +1108,15 @@ generate_app <- function() {
res <- res + '\t\tsession$close();\n'
res <- res + '\t})\n'
res <- res + 'observeEvent(input$unlock,{\n'
res <- res + '\t\tsystem2("python3",paste0("-u -m snakemake -s /workflow/Snakefile --configfile ", paste0(input$results_dir,"/params.yml") ,\t" --forcerun all -d ", input$results_dir ,\t" --cores ", input$cores, " all --unlock"),wait = TRUE, stdout = paste0(input$results_dir,"/logs/runlog.txt"), stderr = paste0(input$results_dir,"/logs/runlog.txt"));\n'
res <- res + '\t\tif (file.exists(paste0(input$results_dir,"/logs/workflow.running"))){\n'
res <- res + '\t\t\tfile.remove(paste0(input$results_dir,"/logs/workflow.running"))\n'
res <- res + '\t\t}\n'
res <- res + '\t\tinput_list <- reactiveValuesToList(input)\n'
res <- res + '\t\ttoggle_inputs(input_list,T,F)\n'
res <- res + '\t})\n'
res <- res + 'source("./server/opt_global.R", local=T)\n'
#for(x in 1:length(APP$pages)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment