Commit 8ed00454 authored by Midoux Cedric's avatar Midoux Cedric

treeScript

parent 94ef920c
...@@ -1044,7 +1044,7 @@ shinyServer ...@@ -1044,7 +1044,7 @@ shinyServer
}) })
output$treeUI <- renderUI({ output$treeUI <- renderUI({
validate(need(data16S(), "")) validate(need(phy_tree(data16S(), errorIfNULL = FALSE), ""))
box( box(
title = "Setting : " , title = "Setting : " ,
width = NULL, width = NULL,
...@@ -1078,8 +1078,52 @@ shinyServer ...@@ -1078,8 +1078,52 @@ shinyServer
"treeShape", "treeShape",
label = "Shape : ", label = "Shape : ",
choices = c("..." = 0, sample_variables(data16S())) choices = c("..." = 0, sample_variables(data16S()))
),
collapsedBox(verbatimTextOutput("treeScript"), title = "RCode")
)
})
output$treeScript <- renderText({
scriptArgs <- c(
glue(
"physeq = prune_taxa(names(sort(taxa_sums(data), decreasing = TRUE)[1:{input$treeTopOtu}]), data)"
) )
) )
if (input$treeSample) {
scriptArgs <- c(scriptArgs, "method = \"sampledodge\"")
} else {
scriptArgs <- c(scriptArgs, "method = \"treeonly\"")
}
if (!is.null(checkNull(input$treeCol))) {
scriptArgs <- c(scriptArgs, glue("color = \"{input$treeCol}\""))
}
if (!is.null(checkNull(input$treeShape))) {
scriptArgs <- c(scriptArgs, glue("shape = \"{input$treeShape}\""))
}
scriptArgs <- c(scriptArgs, "size = \"abundance\"")
if (!is.null(checkNull(input$treeRank))) {
scriptArgs <-
c(scriptArgs, glue("label.tips = \"{input$treeRank}\""))
}
scriptArgs <- c(scriptArgs,
"sizebase = 5",
"ladderize = \"left\"",
"plot.margin = 0")
if (!is.null(checkNull(input$treeTitle))) {
scriptArgs <- c(scriptArgs, glue("title = \"{input$treeTitle}\""))
}
script <- c(
scriptHead,
"# Plot phylogenetic tree",
glue("p <- plot_tree({glue_collapse(scriptArgs, sep=', ')})")
)
if (input$treeRadial) {
script <- c(script,
"p <- p + coord_polar(theta = \"y\")")
}
script <- c(script, "", "plot(p)")
return(glue_collapse(script, sep = "\n"))
}) })
output$tree <- renderPlot({ output$tree <- 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