Commit 5706c777 authored by Midoux Cedric's avatar Midoux Cedric

plot_ordination

parent 454513e0
......@@ -54,11 +54,6 @@ output$mdsUI <- renderUI({
label = "Ellipses : ",
choices = c("..." = 0, sample_variables(data16S()))
),
selectInput(
"mdsRep",
label = "Barycenters : ",
choices = c("..." = 0, sample_variables(data16S()))
),
collapsedBox(verbatimTextOutput("mdsScript"), title = "RCode")
)
})
......@@ -66,9 +61,8 @@ output$mdsUI <- renderUI({
output$mdsScript <- renderText({
scriptArgs <- c(
"physeq = data",
glue(
"ordination = ordinate(data, method = \"{input$mdsMethod}\", distance = \"{input$mdsDist}\")"
),
glue("ordination = ordinate(data, method = \"{input$mdsMethod}\", distance = \"{input$mdsDist}\")"),
"type = \"samples\"",
glue("axes = c({glue_collapse(input$mdsAxes, sep = ', ')})")
)
if (!is.null(checkNull(input$mdsCol))) {
......@@ -77,11 +71,6 @@ output$mdsScript <- renderText({
if (!is.null(checkNull(input$mdsShape))) {
scriptArgs <- c(scriptArgs, glue("shape = \"{input$mdsShape}\""))
}
if (!is.null(checkNull(input$mdsRep))) {
scriptArgs <- c(scriptArgs, glue("replicate = \"{input$mdsRep}\""))
} else {
scriptArgs <- c(scriptArgs, glue("replicate = NULL"))
}
if (!is.null(checkNull(input$mdsLabel))) {
scriptArgs <- c(scriptArgs, glue("label = \"{input$mdsLabel}\""))
}
......@@ -91,7 +80,7 @@ output$mdsScript <- renderText({
script <- c(
scriptHead,
"# MultiDimensional scaling",
glue("p <- plot_samples({glue_collapse(scriptArgs, sep=', ')})")
glue("p <- plot_ordination({glue_collapse(scriptArgs, sep=', ')})")
)
if (!is.null(checkNull(input$mdsEllipse))) {
script <- c(
......@@ -111,23 +100,19 @@ output$mds <- renderPlot({
need(data16S(), "Requires an abundance dataset"),
need(length(input$mdsAxes) == 2, "Requires two projections axes")
)
p <- plot_samples(
p <- plot_ordination(
data16S(),
ordination = ordinate(
data16S(),
method = input$mdsMethod,
distance = input$mdsDist
),
type = "samples",
axes = as.numeric(input$mdsAxes),
title = checkNull(input$mdsTitle),
color = checkNull(input$mdsCol),
replicate = if (is.null(checkNull(input$mdsRep))) {
NULL
} else {
checkNull(input$mdsRep)
},
shape = checkNull(input$mdsShape),
label = checkNull(input$mdsLabel)
label = checkNull(input$mdsLabel),
title = checkNull(input$mdsTitle)
)
if (!is.null(checkNull(input$mdsEllipse))) {
p <- p + stat_ellipse(aes_string(group = input$mdsEllipse))
......
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