Commit a36798bd authored by Midoux Cedric's avatar Midoux Cedric

rework histScript

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