Commit a905c2b0 authored by mmassaviol's avatar mmassaviol
Browse files

Add selection of step to reach in the workflow

parent da09680d
......@@ -569,6 +569,8 @@ generate_pages_server <- function() {
res <- res + '\tpath_param <- paste0(input$results_dir,"/params.yml")\n\n'
res <- res + '\tres <- ""'
res <- res + resG
res <- res + '\tres = paste0(res, paste("final_step:", paste0(\'\"\', input$final_step, \'\"\'), "\\n", sep = " "))\n'
res <- res + '\ta = yaml.load_file("/workflow/params.total.yml")\n'
res <- res + '\tb = yaml.load(res)\n'
res <- res + '\tanotb = subset(names(a), !(names(a)%in%names(b)))\n'
......@@ -589,7 +591,7 @@ generate_pages_server <- function() {
res <- res + '\tsystem(paste0("rm ",input$results_dir,"/rulegraph*"))\n\n'
res <- res + '\toutUI = tryCatch({\n'
res <- res + '\t\tsystem(paste0("snakemake -s /workflow/Snakefile --configfile ",input$results_dir,"/params.yml -d ",input$results_dir," --rulegraph > ",input$results_dir,"/rulegraph",i,".dot"),intern=T)\n'
res <- res + '\t\tsystem(paste0("snakemake -s /workflow/Snakefile --configfile ",input$results_dir,"/params.yml -d ",input$results_dir," all --rulegraph > ",input$results_dir,"/rulegraph",i,".dot"),intern=T)\n'
res <- res + '\t\tsystem(paste0("cat ",input$results_dir,"/rulegraph",i,".dot | dot -Tsvg -Gratio=0.75 > ",input$results_dir,"/rulegraph",i,".svg"),intern=T)\n'
res <- res + '\t\ttagList(img(src = paste0("results/rulegraph",i,".svg") ,alt = "Rulegraph of Snakemake jobs",width="100%",height="auto"))},\n'
res <- res + '\terror = function(e){return(tags$p(paste0("error : ",e$message)))},\n'
......@@ -638,24 +640,25 @@ generate_pages_server <- function() {
res <- res + '\n\n'
res <- res + '\toutUI = tryCatch({\n'
res <- res + 'outUI = tryCatch({\n'
res <- res + '\t\tif (!dir.exists(paste0(input$results_dir,"/logs"))){\n'
res <- res + '\t\tdir.create(paste0(input$results_dir,"/logs"))\n'
res <- res + '\t}\n'
res <- res + '\tif (!file.exists(paste0(input$results_dir,"/logs/runlog.txt"))){\n'
res <- res + '\t\tfile.create(paste0(input$results_dir,"/logs/runlog.txt"))\n'
res <- res + '\t}\n'
res <- res + '\t\tif (input$final_step=="all"){\n'
res <- res + '\t\t\tgoto = "all"\n'
res <- res + '\t\t}\n'
res <- res + '\t\telse{\n'
res <- res + '\t\t\tgoto = c[[input$final_step]]\n'
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",paste("-u -m snakemake", "-s", "/workflow/Snakefile" ,\t"--configfile", paste0(input$results_dir,"/params.yml") ,\t"-d", input$results_dir ,\t"--cores", input$cores , sep = " " ),wait = FALSE, stdout = paste0(input$results_dir,"/logs/runlog.txt"), stderr = paste0(input$results_dir,"/logs/runlog.txt"))\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 --config final_step=", goto ),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/report.html",width="100%", height="900px")},\n'
res <- res + '\terror = function(e){return(tags$p(paste0("error : ",e$message)))},\n'
res <- res + '\twarning = function(w){return(tags$p(paste0("warning : ",w$message)))})\n'
res <- res + '})\n\n'
res <- res + '\twarning = function(w){return(tags$p(paste0("warning : ",w$message)))})\n\n'
res <- res + '})\n'
write(res, APP$project+"/server/opt_global.R")
}
......@@ -699,6 +702,14 @@ generate_menu <- function() {
}
res <- res + '\ttags$br(),\n'
# select step to reach
choices = "list("
for(step in APP$pages){
choices <- choices + "'" + step$label + "'='" + step$name + "',"
}
res <- res + 'selectInput("final_step", label = "Select the step to reach : ", selected = "all", choices = '+choices+'"All"="all")),'
#
res <- res + '\tactionButton("'+ APP$run$shiny_button$name +'", "'+ APP$run$shiny_button$label +'", icon("'+ APP$run$shiny_button$icon +'"), class="'+ APP$run$shiny_button$class +'"),\n\n'
......
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