Commit c5257146 authored by Midoux Cedric's avatar Midoux Cedric

rework richnessAScript

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