Commit 58bbf5f0 authored by mmassaviol's avatar mmassaviol
Browse files

Add dry run

Create run summary when run pipeline
parent dfec4567
......@@ -637,6 +637,27 @@ generate_pages_server <- function() {
res <- res + '\t\ttoggle_inputs(input_list,T,F)\n'
res <- res + '}})\n'
}
# Event dry_run
res <- res + 'observeEvent({c(input$sidebarmenu,input$dry_run_button)}, {\n'
res <- res + '\n'
res <- res + '\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(input$sidebarmenu=="RULEGRAPH"){\n'
res <- res + '\t\tinput_list <- reactiveValuesToList(input)\n'
res <- res + '\t\ttoggle_inputs(input_list,F,F)\n'
res <- res + '\t\tpath_param <- paste0(input$results_dir,"/params.yml")\n'
res <- res + '\n'
res <- res + '\t\tsave_params(path_param)\n'
res <- res + '\n'
res <- res + '\t\tforce = force_rule(input$force_from)\n'
res <- res + '\t\tdry_out = system(paste0("snakemake -s /workflow/Snakefile --configfile ", paste0(input$results_dir,"/params.yml") ,\t" -d ", input$results_dir ,\t" --cores ", input$cores, " all ", force, " -n -p"),wait = T, intern=T)\n'
res <- res + '\t\tdryUI = tags$p(HTML(paste(dry_out, collapse = "<br/>")))\n'
res <- res + '\n'
res <- res + '\t\toutput$dry_run_div = renderUI(dryUI)\n'
res <- res + '\t\ttoggle_inputs(input_list,T,F)\n'
res <- res + '\t}})\n'
# Event Run
res <- res + '#\' Event when use '+ run$shiny_button$name +' button\n'
......@@ -683,11 +704,16 @@ generate_pages_server <- function() {
res <- res + '\t\tsystem(paste0("touch ",input$results_dir,"/logs/workflow.running"),wait = T)\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'
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"),wait = T)\n'
# RUN
res <- res + '\t\tforce = force_rule(input$force_from)\n'
res <- res + '\t\trerun = if (input$rerun_incomplete) "--rerun-incomplete" else ""\n'
## DRY RUN
res <- res + '\t\t\tsystem(paste0("snakemake -s /workflow/Snakefile --configfile ", paste0(input$results_dir,"/params.yml") ," -d ", input$results_dir ," --cores ", input$cores, " all ", force, " ", rerun, " -n -p > ", input$results_dir, "/Run_Summary_mqc.html"),wait = T)\n'
res <- res + '\t\t\tsystem(paste0("sed -i \'1 i\\\\<pre> \' ",input$results_dir,"/Run_Summary_mqc.html"))\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 ", force, " ",rerun),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'
......@@ -928,7 +954,8 @@ generate_app <- function() {
res <- res + 'source("./pages/pages_def_'+tolower(name)+'.R", local=T)\n'
}
if("RULEGRAPH" %in% names(APP)){
res <- res + "tabRULEGRAPH = fluidPage(box(title = 'Rule Graph :', width = 12, status = 'primary', collapsible = TRUE, solidHeader = TRUE, uiOutput('RULEGRAPH_svg'),actionButton('refresh_rg', 'Refresh', icon('sync'), class='btn btn-info')))\n"
res <- res + "tabRULEGRAPH = fluidPage(box(title = 'Rule Graph :', width = 12, status = 'primary', collapsible = TRUE, solidHeader = TRUE, uiOutput('RULEGRAPH_svg'),actionButton('refresh_rg', 'Refresh', icon('sync'), class='btn btn-info')),"
res <- res + "box(title = 'What will be done :', width = 12, status = 'primary', collapsible = TRUE, solidHeader = TRUE, uiOutput('dry_run_div', style = 'overflow-y: scroll; height: 600px'),actionButton('dry_run_button', 'Dry run', icon('play'), class='btn btn-info')))\n"
}
if("Report" %in% names(APP)){
res <- res + "tabReport = fluidPage(box(title = 'Report :', width = 12, status = 'primary', collapsible = TRUE, solidHeader = TRUE, uiOutput('report_html')))\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