Commit 3ed871ab authored by mmassaviol's avatar mmassaviol
Browse files

Add program lauch for global button & comment of tabsetPanel system

parent a555ac4b
App:
project: "/home/jimmy/jimmy/projets/sag/app/pipeline" # important : if dir exist we delete all tree directory
project: "/home/mbb/Documents/sag/app/pipeline" # important : if dir exist we delete all tree directory
general:
title: "Pipeline in R"
skin: "purple" # other color : https://rstudio.github.io/shinydashboard/appearance.html
......@@ -142,4 +142,17 @@ App:
}
}
]
pipeline:
shiny_button:
{
name: runAllPipeline,
type: button,
icon: play,
class: btn btn-info,
label: Run pipeline,
}
program: "singularity exec /home/mbb/Documents/singularities/pipelineRNA.simg snakemake"
options:
- { name: "-s", type: value, value: "snakefile" }
output_format: markdown
output: /home/jimmy/jimmy/projets/sag/app/result.Rmd
App:
project: /home/mbb/Documents/sag/app2
general: { title: Pipeline in R, skin: purple, menu_width: 230 }
pages:
- icon: pencil
label: Quality check
name: qualitycheck
content:
- panel: Quality check
name: panel1
boxes:
- { name: fastqc, defined: true, concat_name_param: false }
pipeline:
shiny_button:
{
name: runP,
type: button,
icon: save,
class: btn btn-primary,
label: Run pipeline,
}
program: python
options:
- {
name: "",
type: value,
value: /home/jimmy/jimmy/projets/sag/app/mon_script.py,
}
- { name: -params_file, type: panel }
output_format: markdown
output: /home/jimmy/jimmy/projets/sag/app/result.Rmd
- name: quantification
icon: file
label: Quantification
content:
- panel: Quantification
name: panel2
boxes:
- { name: kallisto, defined: true, concat_name_param: false }
- { name: salmon, defined: true, concat_name_param: false }
pipeline:
shiny_button:
{
name: runApp,
type: button,
icon: play,
class: btn btn-primary,
label: Run,
}
program: pwd
options:
- { name: "", type: shiny, value: first_name }
- { name: "", type: shiny, value: last_name }
output_format: table
output: /home/jimmy/jimmy/projets/sag/app/cars.csv
pipeline:
shiny_button:
{
name: runAllPipeline,
type: button,
icon: play,
class: btn btn-info,
label: Run pipeline,
}
program: "singularity exec /home/mbb/Documents/singularities/pipelineRNA.simg snakemake"
options:
- { name: "-s", type: value, value: "snakefile" }
output_format: markdown
output: /home/jimmy/jimmy/projets/sag/app/result.Rmd
source("tools.R")
library(yaml)
path_yml <- "/home/jimmy/jimmy/projets/sag/app/pipelineR.yml"
path_yml <- "/home/mbb/Documents/sag/app/pipelineR2.yml"
path_tools <- "/home/jimmy/jimmy/projets/sag/predefined_tools/"
path_tools <- "/home/mbb/Documents/sag/predefined_tools/"
APP <<- yaml.load_file(path_yml)$App
files_tools <- paste0(path_tools, list.files(path_tools))
YML_TOOLS <<- get_predefined_tool(files_tools)
#============================================================
get_predefined_tool <- function(path) {
......@@ -308,19 +306,19 @@ generate_pages_server <- function() {
if(length(content) > 0) {
res <- res + ',\n\n'
res <- res + 'tabsetPanel(type = "tabs",\n\n'
#res <- res + 'tabsetPanel(type = "tabs",\n\n'
for(y in 1:length(content)) { # list panels
panel <- content[[y]]
res <- res + 'tabPanel("' + panel$panel + '", height = "300px", style = "overflow: hidden; overflow-y:scroll"'
#res <- res + 'tabPanel("' + panel$panel + '", height = "300px", style = "overflow: hidden; overflow-y:scroll"'
panel_boxes = panel$boxes
if(length(panel_boxes) > 0) {
res <- res + ', br(),\n'
#res <- res + ', br(),\n'
res <- res + '\tselectInput("select' + panel$name + '", label = "Select the tool to use : ", choices = list('
......@@ -334,6 +332,7 @@ generate_pages_server <- function() {
}
res <- res + ')),\n'
#res <- res + ',\n'
for(b in 1:length(panel_boxes)) { # draw boxes
......@@ -345,23 +344,25 @@ generate_pages_server <- function() {
res <- generate_page_box(panel, box, res)
if(b < length(panel_boxes)) {
res <- res + ',\n\n'
} else {
res <- res + '\n\n'
}
#if(b < length(panel_boxes)) {
# res <- res + ',\n\n'
#} else {
# res <- res + '\n\n'
#}
res <- res + ',\n\n'
}
}
if(y < length(content)) {
res <- res + '),\n\n'
} else {
res <- res + ')\n\n'
}
#if(y < length(content)) {
# res <- res + '),\n\n'
#} else {
# res <- res + ')\n\n'
#}
} # end panels
res = substr(res, 1, nchar(res)-3)
res <- res + ')\n\n'
#res <- res + ')\n\n'
}
......@@ -491,6 +492,8 @@ generate_pages_server <- function() {
if(length(panel_boxes) > 0) {
#resG <- resG + '\t\tres <- paste(res, "outil_' + APP$pages[[x]]$name + '_' + panel$name + ':", paste0(\'\"\', input$select' + panel$name + ', \'\"\'), "\\n", sep = " ")\n'
resG <- resG + '\t\tres <- paste(res, "'+APP$pages[[x]]$name + ':", paste0(\'\"\', input$select' + panel$name + ', \'\"\'), "\\n", sep = " ")\n'
for(b in 1:length(panel_boxes)) { # list boxes
box <- panel_boxes[[b]]
......@@ -508,7 +511,6 @@ generate_pages_server <- function() {
if(length(panel_content) > 0) {
resG <- resG + '\t\tres <- paste(res, "outil_' + APP$pages[[x]]$name + '_' + panel$name + ':", paste0(\'\"\', input$select' + panel$name + ', \'\"\'), "\\n", sep = " ")\n'
for(z in 1:length(panel_content)) {
......@@ -652,6 +654,7 @@ generate_pages_server <- function() {
}
file.replace(APP$project+"/server/opt_global.R")
pipeline <- APP$pipeline
res <- '#\' Event when use '+ id +' button\n'
res <- res + 'observeEvent(input$runAllPipeline, {\n\n'
......@@ -663,6 +666,35 @@ generate_pages_server <- function() {
res <- res + '\twrite(res, file=path_param)'
res <- res + '\n\n'
res <- res + '\tsystem(paste(" '
res <- res + pipeline$program + '", '
for(o in 1:length(pipeline$options)) {
option = pipeline$options[[o]]
if(option$type == "value") {
res <- res + '"' + option$name + '", "' + option$value + '" '
} else if (option$type == "shiny") {
res <- res + '"' + option$name + '", input$' + option$value + ' '
} else if(option$type == "shiny-file") {
res <- res + '"' + option$name + '", input$' + option$value + '$datapath '
} else if(option$type == "panel") {
res <- res + '"' + option$name + '", "' + APP$project + '/params/params_' + APP$pages[[x]]$name + '.yml"'
}
if(o < length(pipeline$options)) {
res <- res + ', '
}
}
res <- res + ', sep = " " ))\n\n'
res <- res + '\n\n'
res <- res + '})\n\n'
......@@ -691,7 +723,7 @@ generate_menu <- function() {
res <- res + ' tags$br(),\n\n'
res <- res + ' actionButton("runAllPipeline", "Generate", icon("play"), class="btn btn-info"),\n\n'
res <- res + ' actionButton("'+ APP$pipeline$shiny_button$name +'", "'+ APP$pipeline$shiny_button$label +'", icon("'+ APP$pipeline$shiny_button$icon +'"), class="'+ APP$pipeline$shiny_button$class +'"),\n\n'
res <- res + ' tags$br(),tags$br(),\n\n'
......@@ -740,6 +772,8 @@ generate <- function() {
print("Generate Start")
YML_TOOLS <<- get_predefined_tool(files_tools)
if(dir.exists(APP$project)) {
#unlink(APP$project, recursive=TRUE)
}
......@@ -752,13 +786,12 @@ generate <- function() {
dir.create.not.exist(APP$project + "/pages")
dir.create.not.exist(APP$project + "/server")
dir.create.not.exist(APP$project + "/params")
generate_pages_server()
dir.create.not.exist(APP$project + "/www")
dir.create.not.exist(APP$project + "/params")
path_rproj = APP$project + "/" + basename(APP$project) + ".Rproj"
generate_rproj(path_rproj)
......
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