Commit cce9427d authored by Midoux Cedric's avatar Midoux Cedric

panels/cluster

parent bc1a53ec
output$clustUI <- renderUI({
validate(need(data16S(), ""))
box(
title = "Setting : " ,
width = NULL,
status = "primary",
selectInput(
"clustDist",
label = "Distance : ",
choices = list(
"bray",
"jaccard",
"unifrac",
"wunifrac",
"dpcoa",
"jsd",
"euclidean"
)
),
selectInput(
"clustMethod",
label = "Method : ",
choices = list(
"ward.D2",
"ward.D",
"single",
"complete",
"average",
"mcquitty",
"median",
"centroid"
)
),
selectInput(
"clustCol",
label = "Color : ",
choices = c("..." = 0, sample_variables(data16S()))
),
collapsedBox(verbatimTextOutput("clustScript"), title = "RCode")
)
})
output$clustScript <- renderText({
scriptArgs <- c(
"physeq = data",
glue("dist = \"{input$clustDist}\""),
glue("method = \"{input$clustMethod}\"")
)
if (!is.null(checkNull(input$clustCol))) {
scriptArgs <- c(scriptArgs, glue("color = \"{input$clustCol}\""))
}
script <- c(
scriptHead,
"# Plot samples clustering",
glue("p <- plot_clust({glue_collapse(scriptArgs, sep=', ')})")
)
script <- c(script, "", "plot(p)")
return(glue_collapse(script, sep = "\n"))
})
output$clust <- renderPlot({
validate(need(data16S(),
"Requires an abundance dataset"))
plot_clust(
physeq = data16S(),
dist = input$clustDist,
method = input$clustMethod,
color = checkNull(input$clustCol)
)
})
cluster <- fluidPage(withLoader(plotOutput("clust", height = 700)),
uiOutput("clustUI"))
......@@ -15,6 +15,7 @@ shinyServer
source("panels/richnessA-server.R", local = TRUE)
source("panels/richnessB-server.R", local = TRUE)
source("panels/tree-server.R", local = TRUE)
source("panels/cluster-server.R", local = TRUE)
checkNull <- function(x) {
if (!exists(as.character(substitute(x)))) {
......@@ -246,78 +247,6 @@ shinyServer
dplyr::select(-rowname)
beautifulTable(joinGlom)
})
output$clustUI <- renderUI({
validate(need(data16S(), ""))
box(
title = "Setting : " ,
width = NULL,
status = "primary",
selectInput(
"clustDist",
label = "Distance : ",
choices = list(
"bray",
"jaccard",
"unifrac",
"wunifrac",
"dpcoa",
"jsd",
"euclidean"
)
),
selectInput(
"clustMethod",
label = "Method : ",
choices = list(
"ward.D2",
"ward.D",
"single",
"complete",
"average",
"mcquitty",
"median",
"centroid"
)
),
selectInput(
"clustCol",
label = "Color : ",
choices = c("..." = 0, sample_variables(data16S()))
),
collapsedBox(verbatimTextOutput("clustScript"), title = "RCode")
)
})
output$clustScript <- renderText({
scriptArgs <- c(
"physeq = data",
glue("dist = \"{input$clustDist}\""),
glue("method = \"{input$clustMethod}\"")
)
if (!is.null(checkNull(input$clustCol))) {
scriptArgs <- c(scriptArgs, glue("color = \"{input$clustCol}\""))
}
script <- c(
scriptHead,
"# Plot samples clustering",
glue("p <- plot_clust({glue_collapse(scriptArgs, sep=', ')})")
)
script <- c(script, "", "plot(p)")
return(glue_collapse(script, sep = "\n"))
})
output$clust <- renderPlot({
validate(need(data16S(),
"Requires an abundance dataset"))
plot_clust(
physeq = data16S(),
dist = input$clustDist,
method = input$clustMethod,
color = checkNull(input$clustCol)
)
})
output$mdsUI <- renderUI({
validate(need(data16S(), ""))
......
......@@ -7,6 +7,7 @@ source("panels/rarefactionCurve-ui.R", local = TRUE)
source("panels/richnessA-ui.R", local = TRUE)
source("panels/richnessB-ui.R", local = TRUE)
source("panels/tree-ui.R", local = TRUE)
source("panels/cluster-ui.R", local = TRUE)
shinyUI(dashboardPage(
dashboardHeader(title = "Easy16S"),
......@@ -130,8 +131,7 @@ shinyUI(dashboardPage(
tabPanel("Phylogenetic tree",
tree),
tabPanel("Clustering",
withLoader(plotOutput("clust", height = 700)),
uiOutput("clustUI")),
cluster),
tabPanel("Help",
div(
HTML(
......
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