diff --git a/server.R b/server.R index e9ea8940ac2d6fa58213d1d1e45098f7845cbab5..501af28dbb54100eae23be74af4532a572def15c 100644 --- a/server.R +++ b/server.R @@ -27,7 +27,7 @@ shinyServer options = list( dom = "lBtip", pageLength = 10, - lengthMenu = list(c(10, 25, 50, 100,-1), list('10', '25', '50', '100', 'All')), + lengthMenu = list(c(10, 25, 50, 100, -1), list('10', '25', '50', '100', 'All')), buttons = list( 'colvis', list( @@ -172,6 +172,9 @@ shinyServer choices = rank_names(data16S()), inline = TRUE ), + textInput("barTitle", + label = "Title : ", + value = "OTU abundance barplot"), selectInput( "barGrid", label = "Subplot : ", @@ -192,7 +195,8 @@ shinyServer p <- plot_bar( physeq = data16S(), fill = input$barFill, - x = ifelse(is.null(checkNull(input$barX)), "Sample", input$barX) + x = ifelse(is.null(checkNull(input$barX)), "Sample", input$barX), + title = checkNull(input$barTitle) ) if (!is.null(checkNull(input$barGrid))) { p <- @@ -349,6 +353,20 @@ shinyServer ), inline = TRUE ), + radioButtons( + "richnessBoxplot", + label = "Representation : ", + choices = list( + "Dots only" = 1, + "Dots and boxplot" = 2, + "Boxplot only" = 3 + ), + selected = 2, + inline = TRUE + ), + textInput("richnessTitle", + label = "Title : ", + value = "Alpha diversity graphics"), selectInput( "richnessX", label = "X : ", @@ -363,17 +381,6 @@ shinyServer "richnessShape", label = "Shape : ", choices = c("..." = 0, sample_variables(data16S())) - ), - radioButtons( - "richnessBoxplot", - label = "Representation : ", - choices = list( - "Dots only" = 1, - "Dots and boxplot" = 2, - "Boxplot only" = 3 - ), - selected = 2, - inline = TRUE ) ) }) @@ -388,6 +395,7 @@ shinyServer )), "samples", input$richnessX), color = checkNull(input$richnessColor), shape = checkNull(input$richnessShape), + title = checkNull(input$richnessTitle), measures = checkNull(input$richnessMeasures) ) if (input$richnessBoxplot >= 2) { @@ -413,10 +421,13 @@ shinyServer width = NULL, status = "primary", selectInput( - "richnessOrder", + "richnessBOrder", label = "Sorting sample : ", choices = c("..." = 0, sample_variables(data16S())) - ) + ), + textInput("richnessBTitle", + label = "Title : ", + value = "Beta diversity heatmap") ) }) @@ -426,11 +437,11 @@ shinyServer beta <- melt(as(distance(data16S(), method = input$richnessBDist), "matrix")) colnames(beta) <- c("x", "y", "distance") - if (!is.null(checkNull(input$richnessOrder))) + if (!is.null(checkNull(input$richnessBOrder))) { - new_factor = as.factor(get_variable(data16S(), input$richnessOrder)) + new_factor = as.factor(get_variable(data16S(), input$richnessBOrder)) variable_sort <- - as.factor(get_variable(data16S(), input$richnessOrder)[order(new_factor)]) + as.factor(get_variable(data16S(), input$richnessBOrder)[order(new_factor)]) L = levels(reorder(sample_names(data16S()), as.numeric(new_factor))) beta$x <- factor(beta$x, levels = L) beta$y <- factor(beta$y, levels = L) @@ -440,7 +451,7 @@ shinyServer } p <- ggplot(beta, aes(x = x, y = y, fill = distance)) + geom_tile() - p <- p + theme( + p <- p + ggtitle(input$richnessBTitle) + theme( axis.text.x = element_text( angle = 90, hjust = 1, @@ -469,6 +480,9 @@ shinyServer checkboxInput("netwOrphan", label = "Keep orphans", value = TRUE), + textInput("netwTitle", + label = "Title : ", + value = "Beta diversity network"), selectInput( "netwCol", label = "Color : ", @@ -507,7 +521,7 @@ shinyServer shape = checkNull(input$netwShape), label = checkNull(input$netwLabel), hjust = 2, - title = NULL + title = checkNull(input$netwTitle) ) return(p) }) @@ -530,6 +544,7 @@ shinyServer step = 100, #step = input$rarefactionStep, color = checkNull(input$rarefactionColor), + label = checkNull(input$rarefactionLabel), se = FALSE ) if (!is.null(checkNull(input$rarefactionGrid))) { @@ -541,7 +556,7 @@ shinyServer p + geom_vline(xintercept = min(sample_sums(data16S())), color = "gray60") } - return(p) + return(p + ggtitle(input$rarefactionTitle)) }) @@ -559,11 +574,19 @@ shinyServer # value = 100 # ), checkboxInput("rarefactionMin", label = "Show min sample threshold", value = FALSE), + textInput("rarefactionTitle", + label = "Title : ", + value = "Rarefaction curves"), selectInput( "rarefactionColor", label = "Color : ", choices = c("..." = 0, sample_variables(data16S())) ), + selectInput( + "rarefactionLabel", + label = "Label : ", + choices = c("..." = 0, sample_variables(data16S())) + ), selectInput( "rarefactionGrid", label = "Subplot : ", @@ -578,6 +601,9 @@ shinyServer title = "Setting : " , width = NULL, status = "primary", + textInput("heatmapTitle", + label = "Title : ", + value = "Taxa heatmap by samples"), selectInput( "heatmapGrid", label = "Subplot : ", @@ -637,6 +663,7 @@ shinyServer )[1:input$heatmapTopOtu]), data16S()), distance = input$heatmapDist, method = input$heatmapMethod, + title = checkNull(input$heatmapTitle), sample.order = checkNull(input$heatmapX), low = "yellow", high = "red", @@ -672,6 +699,9 @@ shinyServer ), checkboxInput("treeRadial", label = "Radial tree", value = FALSE), checkboxInput("treeSample", label = "Show samples", value = TRUE), + textInput("treeTitle", + label = "Title : ", + value = "Phylogenetic tree"), selectInput( "treeCol", label = "Color : ", @@ -704,7 +734,8 @@ shinyServer label.tips = checkNull(input$treeRank), sizebase = 5, ladderize = "left", - plot.margin = 0 + plot.margin = 0, + title = checkNull(input$treeTitle) ) if (checkNull(input$treeRadial)) { return(p + coord_polar(theta = "y")) @@ -746,6 +777,9 @@ shinyServer selected = "MDS", choices = list("DCA", "CCA", "RDA", "CAP", "DPCoA", "NMDS", "MDS", "PCoA") ), + textInput("acpTitle", + label = "Title : ", + value = "Samples ordination graphic"), selectInput( "acpLabel", label = "Label : ", @@ -787,7 +821,7 @@ shinyServer distance = input$acpDist ), axes = as.numeric(input$acpAxes), - #c(1, 2), + title = checkNull(input$acpTitle), color = checkNull(input$acpCol), replicate = checkNull(input$acpRep), shape = checkNull(input$acpShape),