diff --git a/server.R b/server.R index bcc438e5745d6231321ba06b1ac3eaff12a7208e..5fe94a7f1fca9da79a8b48e300468a48165beda5 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( @@ -100,10 +100,11 @@ shinyServer row.names = 1, na.strings = NA ) + sample_data(d)$SampleID <- rownames(sample_data(d)) } } else { n <- data.frame(sample_names(d) , row.names = sample_names(d)) - names(n) <- "sample_names" + names(n) <- "SampleID" sample_data(d) <- n } if (input$rareData) { @@ -119,13 +120,9 @@ shinyServer }) output$rarefactionMin <- renderText({ - if (!is.null(input$fileBiom)) { - paste("(min sample =", format(min(sample_sums(data16S( - - ))), big.mark = " "), "reads)") - } else { - paste("(min sample =", 0, "reads)") - } + validate(need(input$fileBiom, ""), need(input$demo == "input", "")) + paste("(min sample =", format(min(sample_sums(data16S( + ))), big.mark = " "), "reads)") }) output$phyloseqPrint <- renderPrint({ @@ -743,10 +740,7 @@ shinyServer selectInput( "acpLabel", label = "Label :", - choices = c( - "..." = 0, - sample_variables(data16S()) - ) + choices = c("..." = 0, sample_variables(data16S())) ), selectInput( "acpCol", diff --git a/ui.R b/ui.R index 75bb619b43ef2610dd640f1c00bb1291176066d7..fa82fdf8898e3b37b51b9a5911dc1a24b80209a5 100644 --- a/ui.R +++ b/ui.R @@ -7,174 +7,173 @@ shinyUI(dashboardPage( selectInput( "demo", label = "Select demo data", - choices = list( - "Input data" = "input", - "Chaillou et al., 2015" = "food"#, - # "Mach et al., 2015" = "kinetic", - # "Morton et al., 2017" = "soil", - # "Ravel et al., 2011" = "ravel", - #"GlobalPatterns" = "GlobalPatterns", - #"biorare" - ), - selected = 1 - ) - ), - hr(width = "90%"), - tags$div( - title = "Fichier d'abondance au format BIOM produit avec FROGS avec 'FROGS BIOM to std BIOM'", - fileInput( - "fileBiom", - label = h4("Fichier d'abondance :"), - placeholder = "data.biom" + choices = list("Input data" = "input", + "Chaillou et al., 2015" = "food"#, + # "Mach et al., 2015" = "kinetic", + # "Morton et al., 2017" = "soil", + # "Ravel et al., 2011" = "ravel", + #"GlobalPatterns" = "GlobalPatterns", + #"biorare"), + selected = 1 + ) ), - radioButtons( - "biomFormat", - label = NULL, - inline = TRUE, - choices = list(`STD BIOM` = "std", - `FROGS BIOM` = "frogs"), - selected = "std" - ) - ), - tags$div( - style = "text-align:center", - title = "Rarefier les données avec un tirage aléatoire pour supprimer l'effet de la profondeur de séquençage", - checkboxInput("rareData", label = "Rarefier les donnees.", value = TRUE), - textOutput("rarefactionMin") - ), - tags$div( - title = "Tableau de métadonnées avec en colonne les variables, en ligne les échantillons. \nAssurez vous de bien respecter l'ortographe des noms d'échantillons (1ère colonne). \nL'import d'une table excel est possible mais déconseillé.", - fileInput( - "fileMeta", - label = h4("Metadata :"), - placeholder = "data.csv" - ) - ), - radioButtons( - "CSVsep", - label = "CSV Séparateur", - inline = TRUE, - choices = list( - `<tab>` = "\t", - `,` = ",", - `;` = ";", - excel = "excel" - ) - ), - tags$div( - title = "Arbre phylogéniques des OTU enracinné", - fileInput( - "fileTree", - label = h4("Arbre :"), - placeholder = "data.nwk" - ) - )#, - # tags$div( - # title = "Séquences FASTA des OTU", - # fileInput( - # "fileSeq", - # label = h4("Séquences de references :"), - # placeholder = "data.fasta" - # ) - # ) - ), - dashboardBody( - tabsetPanel( - tabPanel( - "Summary", - verbatimTextOutput("phyloseqPrint"), - uiOutput("summaryTable") + hr(width = "90%"), + tags$div( + title = "Fichier d'abondance au format BIOM produit avec FROGS avec 'FROGS BIOM to std BIOM'", + fileInput( + "fileBiom", + label = h4("Fichier d'abondance :"), + placeholder = "data.biom" + ), + radioButtons( + "biomFormat", + label = NULL, + inline = TRUE, + choices = list(`STD BIOM` = "std", + `FROGS BIOM` = "frogs"), + selected = "std" + ) ), - tabPanel( - "Histo global", - plotOutput("histo", height = 700), - uiOutput("histUI") + tags$div( + style = "text-align:center", + title = "Rarefier les données avec un tirage aléatoire pour supprimer l'effet de la profondeur de séquençage", + checkboxInput("rareData", label = "Rarefier les donnees.", value = TRUE), + textOutput("rarefactionMin") ), - tabPanel( - "Histo selectif", - plotOutput("histoFocus", height = 700), - box( - title = "Paramètres", - width = NULL, - status = "primary", - uiOutput("histFocusUIfocusRank"), - uiOutput("histFocusUIfocusTaxa"), - uiOutput("histFocusUIfocusNbTaxa"), - uiOutput("histFocusUIfocusGrid"), - uiOutput("histFocusUIfocusX") + tags$div( + title = "Tableau de métadonnées avec en colonne les variables, en ligne les échantillons. \nAssurez vous de bien respecter l'ortographe des noms d'échantillons (1ère colonne). \nL'import d'une table excel est possible mais déconseillé.", + fileInput( + "fileMeta", + label = h4("Metadata :"), + placeholder = "data.csv" ) ), - tabPanel( - "Clustering", - plotOutput("clust", height = 700), - uiOutput("clustUI") + radioButtons( + "CSVsep", + label = "CSV Séparateur", + inline = TRUE, + choices = list( + `<tab>` = "\t", + `,` = ",", + `;` = ";", + excel = "excel" + ) ), - tabPanel("Richesse alpha", box( - width = NULL, tabsetPanel( - tabPanel( - "Courbes", - plotOutput("richnessA", height = 700), - uiOutput("richnessAUI") - ), - tabPanel("Tables", uiOutput("richnessATable")) + tags$div( + title = "Arbre phylogéniques des OTU enracinné", + fileInput( + "fileTree", + label = h4("Arbre :"), + placeholder = "data.nwk" ) - )), - tabPanel( - "Richesse beta", - selectInput( - "richnessBDist", - label = "Distance :", - choices = list( - "bray", - "jaccard", - "unifrac", - "wunifrac", - "dpcoa", - "jsd", - "euclidean" + )#, + # tags$div( + # title = "Séquences FASTA des OTU", + # fileInput( + # "fileSeq", + # label = h4("Séquences de references :"), + # placeholder = "data.fasta" + # ) + # ) + ), + dashboardBody( + tabsetPanel( + tabPanel( + "Summary", + verbatimTextOutput("phyloseqPrint"), + uiOutput("summaryTable") + ), + tabPanel( + "Histo global", + plotOutput("histo", height = 700), + uiOutput("histUI") + ), + tabPanel( + "Histo selectif", + plotOutput("histoFocus", height = 700), + box( + title = "Paramètres", + width = NULL, + status = "primary", + uiOutput("histFocusUIfocusRank"), + uiOutput("histFocusUIfocusTaxa"), + uiOutput("histFocusUIfocusNbTaxa"), + uiOutput("histFocusUIfocusGrid"), + uiOutput("histFocusUIfocusX") ) ), - box(width = NULL, tabsetPanel( - tabPanel( - "Heatmap", - plotOutput("richnessB", height = 700), - uiOutput("richnessBUI") - ), - tabPanel( - "Networks", - plotOutput("networkB", height = 700), - uiOutput("networkBUI") + tabPanel( + "Clustering", + plotOutput("clust", height = 700), + uiOutput("clustUI") + ), + tabPanel("Richesse alpha", box( + width = NULL, tabsetPanel( + tabPanel( + "Courbes", + plotOutput("richnessA", height = 700), + uiOutput("richnessAUI") + ), + tabPanel("Tables", uiOutput("richnessATable")) + ) + )), + tabPanel( + "Richesse beta", + selectInput( + "richnessBDist", + label = "Distance :", + choices = list( + "bray", + "jaccard", + "unifrac", + "wunifrac", + "dpcoa", + "jsd", + "euclidean" + ) ), - tabPanel("Tables", uiOutput("richnessBTable")) - )) - ), - tabPanel( - "Courbe de rarefaction", - plotOutput("rarefactionCurve", height = 700), - uiOutput("rarefactionCurveUI") - ), - tabPanel( - "Arbre phylo", - plotOutput("tree", height = 700), - uiOutput("treeUI") - ), - tabPanel( - "Heatmap", - plotOutput("Heatmap", height = 700), - uiOutput("HeatmapUI") - ), - tabPanel( - "Analyses multivariées", - plotOutput("acp", height = 700), - uiOutput("acpUI") - ), - tabPanel( - "et plus ...", - div( - "Merci d'adresser vos remarques, bugs, demandes, besoins et conseils à ", - a(href = "mailto:cedric.midoux@irstea.fr?subject=[Easy16S]", "cedric.midoux@irstea.fr") + box(width = NULL, tabsetPanel( + tabPanel( + "Heatmap", + plotOutput("richnessB", height = 700), + uiOutput("richnessBUI") + ), + tabPanel( + "Networks", + plotOutput("networkB", height = 700), + uiOutput("networkBUI") + ), + tabPanel("Tables", uiOutput("richnessBTable")) + )) + ), + tabPanel( + "Courbe de rarefaction", + plotOutput("rarefactionCurve", height = 700), + uiOutput("rarefactionCurveUI") + ), + tabPanel( + "Arbre phylo", + plotOutput("tree", height = 700), + uiOutput("treeUI") + ), + tabPanel( + "Heatmap", + plotOutput("Heatmap", height = 700), + uiOutput("HeatmapUI") + ), + tabPanel( + "Analyses multivariées", + plotOutput("acp", height = 700), + uiOutput("acpUI") + ), + tabPanel( + "et plus ...", + div( + "Merci d'adresser vos remarques, bugs, demandes, besoins et conseils à ", + a(href = "mailto:cedric.midoux@irstea.fr?subject=[Easy16S]", "cedric.midoux@irstea.fr") + ) ) ) ) - ) -)) + )) + \ No newline at end of file