Commit a36798bd authored by Midoux Cedric's avatar Midoux Cedric

rework histScript

parent ece485db
......@@ -28,7 +28,7 @@ shinyServer
options = list(
dom = "lBtip",
pageLength = 10,
lengthMenu = list(c(10, 25, 50, 100,-1), list('10', '25', '50', '100', 'All')),
lengthMenu = list(c(10, 25, 50, 100, -1), list('10', '25', '50', '100', 'All')),
buttons = list(
'colvis',
list(
......@@ -124,20 +124,18 @@ shinyServer
})
}
scriptHead = paste0(
"# Loading packages\n",
"source(\"https://raw.githubusercontent.com/mahendra-mariadassou/phyloseq-extended/master/R/load-extra-functions.R\")\n",
"\n",
"# Loading data\n",
paste0(
"load(\"",
paste("Easy16S-data", Sys.Date(), "RData", sep = "."),
"\") # if necessary, adapt the file path\n"
scriptHead <- c(
"# Loading packages",
"source(\"https://raw.githubusercontent.com/mahendra-mariadassou/phyloseq-extended/master/R/load-extra-functions.R\")",
"",
"# Loading data",
glue(
"load(\"Easy16S-data.{Sys.Date()}.RData\") # if necessary, adapt the file path"
),
"\n",
"# View data\n",
"data\n",
"\n"
"",
"# View data",
"data",
""
)
output$downloadData <- {
......@@ -240,31 +238,28 @@ shinyServer
})
output$histScript <- renderText({
paste0(
scriptArgs <- c("physeq = data",
glue("fill = \"{input$barFill}\""))
if (!is.null(checkNull(input$barX))) {
scriptArgs <- c(scriptArgs, glue("x = \"{input$barX}\""))
}
if (!is.null(checkNull(input$barTitle))) {
scriptArgs <- c(scriptArgs, glue("title = \"{input$barTitle}\""))
}
script <- c(
scriptHead,
"# Plot barplot\n",
"p <- plot_bar(physeq = data",
glue(", fill = \"{input$barFill}\""),
ifelse(is.null(checkNull(input$barX)),
"",
glue(", x = \"{input$barX}\"")),
ifelse(
is.null(checkNull(input$barTitle)),
"",
glue(", title = \"{input$barTitle}\"")
),
")\n",
ifelse(
is.null(checkNull(input$barGrid)),
"",
glue(
"p <- p + facet_grid(\". ~ {input$barGrid}\", scales = \"free_x\")
"
)
),
"\n",
"plot(p)"
"# Plot barplot",
glue("p <- plot_bar({glue_collapse(scriptArgs, sep=', ')})")
)
if (!is.null(checkNull(input$barGrid))) {
script <- c(script,
glue(
"p <- p + facet_grid(\". ~ {input$barGrid}\", scales = \"free_x\")"
))
}
script <- c(script, "", "plot(p)")
return(glue_collapse(script, sep = "\n"))
})
output$histo <- renderPlot({
......
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