Commit c5257146 authored by Midoux Cedric's avatar Midoux Cedric

rework richnessAScript

parent a146766f
...@@ -450,7 +450,7 @@ shinyServer ...@@ -450,7 +450,7 @@ shinyServer
glue("method = \"{input$clustMethod}\"") glue("method = \"{input$clustMethod}\"")
) )
if (!is.null(checkNull(input$clustCol))) { if (!is.null(checkNull(input$clustCol))) {
scriptArgs <- c(scriptArgs, glue("col = \"{input$clustCol}\"")) scriptArgs <- c(scriptArgs, glue("color = \"{input$clustCol}\""))
} }
script <- c( script <- c(
scriptHead, scriptHead,
...@@ -536,60 +536,57 @@ shinyServer ...@@ -536,60 +536,57 @@ shinyServer
}) })
output$richnessAScript <- renderText({ output$richnessAScript <- renderText({
paste0( if (!is.null(checkNull(input$richnessMeasures))) {
measures <-
glue("measures = c(\"{glue_collapse(input$richnessMeasures, sep='\", \"')}\")")
} else {
measures <- NULL
}
scriptArgs <- c("physeq = data", measures)
if (!is.null(checkNull(input$richnessX))) {
scriptArgs <- c(scriptArgs, glue("x = \"{input$richnessX}\""))
}
if (!is.null(checkNull(input$richnessColor))) {
scriptArgs <-
c(scriptArgs, glue("color = \"{input$richnessColor}\""))
}
if (!is.null(checkNull(input$richnessShape))) {
scriptArgs <-
c(scriptArgs, glue("shape = \"{input$richnessShape}\""))
}
if (!is.null(checkNull(input$richnessTitle))) {
scriptArgs <-
c(scriptArgs, glue("title = \"{input$richnessTitle}\""))
}
script <- c(
scriptHead, scriptHead,
"# Plot boxplot of alpha diversity\n", "# Plot boxplot of alpha diversity",
"p <- plot_richness(physeq = data", glue(
ifelse( "p <- plot_richness({glue_collapse(scriptArgs, sep=', ')})"
is.null(checkNull(input$richnessX)), )
"", )
glue(", x = \"{input$richnessX}\"") if (input$richnessBoxplot >= 2) {
), script <- c(script,
ifelse( "p <- p + geom_boxplot()")
is.null(checkNull(input$richnessColor)), }
"", if (input$richnessBoxplot <= 2) {
glue(", color = \"{input$richnessColor}\"") script <- c(script,
), "p <- p + geom_point()")
ifelse( }
is.null(checkNull(input$richnessShape)), script <- c(script, "", "plot(p)")
"", script <- c(script, "", "# Tables")
glue(", shape = \"{input$richnessShape}\"") script <- c(
), script,
ifelse( glue(
is.null(checkNull(input$richnessTitle)), "t <- estimate_richness({glue_collapse(c(\"data\", measures), sep=', ')})"
"", )
glue(", title = \"{input$richnessTitle}\"")
),
ifelse(
is.null(checkNull(input$richnessMeasures)),
"",
glue(
", measures = c(\"{glue_collapse(input$richnessMeasures, sep='\", \"')}\")"
)
),
")\n",
ifelse((input$richnessBoxplot >= 2),
"p <- p + geom_boxplot()\n",
""),
ifelse((input$richnessBoxplot <= 2),
"p <- p + geom_point()\n",
""),
"\n",
"plot(p)",
"\n",
"\n",
"# Tables\n",
glue("t <- estimate_richness(data"),
ifelse(
is.null(checkNull(input$richnessMeasures)),
"",
glue(
", measures = c(\"{glue_collapse(input$richnessMeasures, sep='\", \"')}\")"
)
),
")\n",
"write.table(t, file = \"richness.tsv\", sep = \"\\t\", col.names = NA)"
) )
script <-
c(script,
"write.table(t, file = \"richness.tsv\", sep = \"\\t\", col.names = NA)")
return(glue_collapse(script, sep = "\n"))
}) })
output$richnessA <- renderPlot({ output$richnessA <- 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