Commit 5e8f1b63 authored by Midoux Cedric's avatar Midoux Cedric

panels/Sidebar + panels/Summary

parent 7fcb53ea
Help <- div(HTML("<p>
Questions, problems or comments regarding this application should be sent to
<a href = \"mailto:cedric.midoux@irstea.fr?subject=[Easy16S]\">cedric.midoux@irstea.fr</a>
</p>
<p>
For more information about this tool, you can refer to
<a href = \"http://migale.jouy.inra.fr/sites/migale.jouy.inra.fr.drupal7.migale.jouy.inra.fr/files/JOBIM2018_poster.pdf\">this poster</a>.
</p>
<p>
<u>The demo dataset :</u> Chaillou, S., et al. \"
<a href = \"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4409155/\">
Origin and ecological selection of core and food-specific bacterial communities associated with meat and seafood spoilage.</a>\"
<i>The ISME journal</i> 9.5 (2015): 1105.
<br>
16S survey of bacterial communities from 8 different food products, distributed as 4 meat products and 4 seafoods. Used to find core microbiota of food products.
</p>
<br>
<p align=\"center\" position=\"absolute\" bottom\"80px\">
<img src=\"migale.png\" width=\"100\"/>
<img src=\"Irstea.png\" width=\"100\"/>
</p>
"
)
)
output$downloadData <- {
downloadHandler(
filename = function() {
paste("Easy16S-data", Sys.Date(), "RData", sep = ".")
},
content = function(file) {
save(data, file = file)
}
)
}
output$downloadUI <- renderUI({
validate(need(data16S(), ""))
tags$div(
style = "text-align:center",
title = "Download as RData",
downloadButton("downloadData", "Download", style = "color: black; background-color: gray90")
)
})
output$rarefactionMin <- renderText({
validate(need(input$fileBiom, ""),
need(input$dataset == "input", ""))
paste("(min sample =", format(min(sample_sums(data16S(
))), big.mark = " "), "reads)")
})
Sidebar <- sidebarMenu(
tags$div(
title = "Select a dataset for demonstration purpose",
selectInput(
"dataset",
label = "Select dataset : ",
choices = list(
"Input data" = "input",
"Rdata" = "rdata",
"Demo : Chaillou et al., 2015" = "food"
),
# "Mach et al., 2015" = "kinetic", "Morton et al., 2017" = "soil", "Ravel et al., 2011" = "ravel", "biorare" = "biorare", "GlobalPatterns" = "GlobalPatterns"
selected = 1
)
),
hr(),
tags$div(
title = "RData where 'data' is a phyloseq object.",
fileInput("fileRData",
label = "RData : ",
placeholder = "data.RData")
),
hr(),
tags$div(
title = "Abundance BIOM file come from FROGS with 'FROGS BIOM to std BIOM', Qiime or another metagenomic tool.",
fileInput("fileBiom",
label = "Abundance BIOM file : ",
placeholder = "data.biom"),
radioButtons(
"biomFormat",
label = NULL,
inline = TRUE,
choices = list(`STD BIOM` = "std",
`FROGS BIOM` = "frogs"),
selected = "std"
)
),
tags$div(
style = "text-align:center",
title = "Resample dataset such that all samples have the same library size. \nIt's using an random sampling without replacement.",
checkboxInput("rareData", label = "Rarefy dataset", value = TRUE),
textOutput("rarefactionMin")
),
tags$div(
title = "Metadata table with variables (in columns) and samples (in rows). \nMake sure you follow the exact spelling of the sample names (1st column). \nThe import of an excel table is possible but not recommended.",
fileInput("fileMeta",
label = "Metadata table : ",
placeholder = "data.csv")
),
radioButtons(
"CSVsep",
label = "CSV separator : ",
inline = TRUE,
choices = list(
`<tab>` = "\t",
`,` = ",",
`;` = ";",
excel = "excel"
)
),
tags$div(
title = "Phylogenetic tree",
fileInput("fileTree",
label = "Phylogenetic tree : ",
placeholder = "data.nwk")
),
# tags$div(
# title = "Representative FASTA sequences of OTU",
# fileInput(
# "fileSeq",
# label = "FASTA sequences : "),
# placeholder = "data.fasta"
# )
# ),
uiOutput("downloadUI")
)
output$phyloseqPrint <- renderPrint({
validate(
need(
data16S(),
"Firstly, you should select a demo dataset or upload an abundance BIOM file.\nFor example, with Galaxy, a BIOM file can be obtained at the end of FROGS workflow with the 'FROGS BIOM to std BIOM' tool. \nMake sure that the phyloseq object in the RData file is called 'data'."
)
)
data16S()
})
output$sampledataTable <- renderUI({
validate(need(sample_data(data16S(), errorIfNULL = FALSE), ""))
collapsedBox(renderTable({
(sapply(sample_data(data16S()), class))
}, rownames = TRUE, colnames = FALSE),
title = "Class of sample_data")
})
output$summaryTable <- renderUI({
validate(need(data16S(), ""))
box(
title = "Tables",
width = NULL,
status = "primary",
tabsetPanel(
tabPanel("otu_table",
beautifulTable(
data.frame(OTU = taxa_names(data16S()), otu_table(data16S()))
)),
tabPanel("tax_table",
beautifulTable(
data.frame(OTU = taxa_names(data16S()), tax_table(data16S()))
)),
tabPanel("sample_data",
#as.data.frame(sapply(sample_data(data16S()), class)),
beautifulTable(
data.frame(SAMPLE = sample_names(data16S()), sample_data(data16S()))
)),
tabPanel(
"agglomerate_taxa",
radioButtons(
"glomRank",
label = "Taxonomic rank : ",
choices = rank_names(data16S()),
inline = TRUE
),
DT::dataTableOutput("tableGlom")
)
)
)
})
output$tableGlom <- DT::renderDataTable(server = FALSE, {
Glom <- tax_glom(data16S(), input$glomRank, NArm = FALSE)
taxTableGlom <- Glom %>%
tax_table() %>%
as.data.frame(stringsAsFactors = FALSE) %>%
dplyr::select(input$glomRank:1) %>%
tibble::rownames_to_column()
otuTableGlom <- Glom %>%
otu_table() %>%
as.data.frame(stringsAsFactors = FALSE) %>%
tibble::rownames_to_column()
joinGlom <-
dplyr::left_join(taxTableGlom, otuTableGlom, by = "rowname") %>%
dplyr::select(-rowname)
beautifulTable(joinGlom)
})
Summary <- div(verbatimTextOutput("phyloseqPrint"),
uiOutput("sampledataTable"),
withLoader(uiOutput("summaryTable")),
tags$footer("Questions, problems or comments regarding this application should be sent to ",
a(href = "mailto:cedric.midoux@irstea.fr?subject=[Easy16S]", "cedric.midoux@irstea.fr"),
align = "center",
style = "position:absolute;bottom: 0;width: 100%;color: grey;padding: 10px;# background-color: white;z-index: 1000;"
)
)
......@@ -8,6 +8,8 @@ library(factoextra)
shinyServer
(function(input, output, session)
{
source("panels/Sidebar-server.R", local = TRUE)
source("panels/Summary-server.R", local = TRUE)
source("panels/histo-server.R", local = TRUE)
source("panels/histoFocus-server.R", local = TRUE)
source("panels/heatmap-server.R", local = TRUE)
......@@ -152,101 +154,4 @@ shinyServer
"data",
""
)
output$downloadData <- {
downloadHandler(
filename = function() {
paste("Easy16S-data", Sys.Date(), "RData", sep = ".")
},
content = function(file) {
save(data, file = file)
}
)
}
output$downloadUI <- renderUI({
validate(need(data16S(), ""))
tags$div(
style = "text-align:center",
title = "Download as RData",
downloadButton("downloadData", "Download", style = "color: black; background-color: gray90")
)
})
output$rarefactionMin <- renderText({
validate(need(input$fileBiom, ""),
need(input$dataset == "input", ""))
paste("(min sample =", format(min(sample_sums(data16S(
))), big.mark = " "), "reads)")
})
output$phyloseqPrint <- renderPrint({
validate(
need(
data16S(),
"Firstly, you should select a demo dataset or upload an abundance BIOM file.\nFor example, with Galaxy, a BIOM file can be obtained at the end of FROGS workflow with the 'FROGS BIOM to std BIOM' tool. \nMake sure that the phyloseq object in the RData file is called 'data'."
)
)
data16S()
})
output$sampledataTable <- renderUI({
validate(need(sample_data(data16S(), errorIfNULL = FALSE), ""))
collapsedBox(renderTable({
(sapply(sample_data(data16S()), class))
}, rownames = TRUE, colnames = FALSE),
title = "Class of sample_data")
})
output$summaryTable <- renderUI({
validate(need(data16S(), ""))
box(
title = "Tables",
width = NULL,
status = "primary",
tabsetPanel(
tabPanel("otu_table",
beautifulTable(
data.frame(OTU = taxa_names(data16S()), otu_table(data16S()))
)),
tabPanel("tax_table",
beautifulTable(
data.frame(OTU = taxa_names(data16S()), tax_table(data16S()))
)),
tabPanel("sample_data",
#as.data.frame(sapply(sample_data(data16S()), class)),
beautifulTable(
data.frame(SAMPLE = sample_names(data16S()), sample_data(data16S()))
)),
tabPanel(
"agglomerate_taxa",
radioButtons(
"glomRank",
label = "Taxonomic rank : ",
choices = rank_names(data16S()),
inline = TRUE
),
DT::dataTableOutput("tableGlom")
)
)
)
})
output$tableGlom <- DT::renderDataTable(server = FALSE, {
Glom <- tax_glom(data16S(), input$glomRank, NArm = FALSE)
taxTableGlom <- Glom %>%
tax_table() %>%
as.data.frame(stringsAsFactors = FALSE) %>%
dplyr::select(input$glomRank:1) %>%
tibble::rownames_to_column()
otuTableGlom <- Glom %>%
otu_table() %>%
as.data.frame(stringsAsFactors = FALSE) %>%
tibble::rownames_to_column()
joinGlom <-
dplyr::left_join(taxTableGlom, otuTableGlom, by = "rowname") %>%
dplyr::select(-rowname)
beautifulTable(joinGlom)
})
})
library(shinydashboard)
library(shinycustomloader)
source("panels/Sidebar-ui.R", local = TRUE)
source("panels/Summary-ui.R", local = TRUE)
source("panels/histo-ui.R", local = TRUE)
source("panels/histoFocus-ui.R", local = TRUE)
source("panels/heatmap-ui.R", local = TRUE)
......@@ -10,106 +12,15 @@ source("panels/mds-ui.R", local = TRUE)
source("panels/pca-ui.R", local = TRUE)
source("panels/tree-ui.R", local = TRUE)
source("panels/cluster-ui.R", local = TRUE)
source("panels/Help-ui.R", local = TRUE)
shinyUI(dashboardPage(
dashboardHeader(title = "Easy16S"),
dashboardSidebar(
tags$div(
title = "Select a dataset for demonstration purpose",
selectInput(
"dataset",
label = "Select dataset : ",
choices = list(
"Input data" = "input",
"Rdata" = "rdata",
"Demo : Chaillou et al., 2015" = "food"
),
# "Mach et al., 2015" = "kinetic", "Morton et al., 2017" = "soil", "Ravel et al., 2011" = "ravel", "biorare" = "biorare", "GlobalPatterns" = "GlobalPatterns"
selected = 1
)
),
hr(),
tags$div(
title = "RData where 'data' is a phyloseq object.",
fileInput("fileRData",
label = "RData : ",
placeholder = "data.RData")
),
hr(),
tags$div(
title = "Abundance BIOM file come from FROGS with 'FROGS BIOM to std BIOM', Qiime or another metagenomic tool.",
fileInput("fileBiom",
label = "Abundance BIOM file : ",
placeholder = "data.biom"),
radioButtons(
"biomFormat",
label = NULL,
inline = TRUE,
choices = list(`STD BIOM` = "std",
`FROGS BIOM` = "frogs"),
selected = "std"
)
),
tags$div(
style = "text-align:center",
title = "Resample dataset such that all samples have the same library size. \nIt's using an random sampling without replacement.",
checkboxInput("rareData", label = "Rarefy dataset", value = TRUE),
textOutput("rarefactionMin")
),
tags$div(
title = "Metadata table with variables (in columns) and samples (in rows). \nMake sure you follow the exact spelling of the sample names (1st column). \nThe import of an excel table is possible but not recommended.",
fileInput("fileMeta",
label = "Metadata table : ",
placeholder = "data.csv")
),
radioButtons(
"CSVsep",
label = "CSV separator : ",
inline = TRUE,
choices = list(
`<tab>` = "\t",
`,` = ",",
`;` = ";",
excel = "excel"
)
),
tags$div(
title = "Phylogenetic tree",
fileInput("fileTree",
label = "Phylogenetic tree : ",
placeholder = "data.nwk")
),
# tags$div(
# title = "Representative FASTA sequences of OTU",
# fileInput(
# "fileSeq",
# label = "FASTA sequences : "),
# placeholder = "data.fasta"
# )
# ),
uiOutput("downloadUI")
),
dashboardSidebar(Sidebar),
dashboardBody(
tabsetPanel(
tabPanel(
"Summary",
verbatimTextOutput("phyloseqPrint"),
uiOutput("sampledataTable"),
withLoader(uiOutput("summaryTable")),
tags$footer(
"Questions, problems or comments regarding this application should be sent to ",
a(href = "mailto:cedric.midoux@irstea.fr?subject=[Easy16S]", "cedric.midoux@irstea.fr"),
align = "center",
style = "position:absolute;
bottom: 0;
width: 100%;
color: grey;
padding: 10px;
# background-color: white;
z-index: 1000;
"
)
),
tabPanel("Summary",
Summary),
tabPanel("Global barplot",
histo),
tabPanel("Filtered barplot",
......@@ -131,34 +42,8 @@ shinyUI(dashboardPage(
tabPanel("Clustering",
cluster),
tabPanel("Help",
div(
HTML(
"<p>
Questions, problems or comments regarding this application should be sent to
<a href = \"mailto:cedric.midoux@irstea.fr?subject=[Easy16S]\">cedric.midoux@irstea.fr</a>
</p>
<p>
For more information about this tool, you can refer to
<a href = \"http://migale.jouy.inra.fr/sites/migale.jouy.inra.fr.drupal7.migale.jouy.inra.fr/files/JOBIM2018_poster.pdf\">this poster</a>.
</p>
<p>
<u>The demo dataset :</u> Chaillou, S., et al. \"
<a href = \"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4409155/\">
Origin and ecological selection of core and food-specific bacterial communities associated with meat and seafood spoilage.</a>\"
<i>The ISME journal</i> 9.5 (2015): 1105.
<br>
16S survey of bacterial communities from 8 different food products, distributed as 4 meat products and 4 seafoods. Used to find core microbiota of food products.
</p>
<br>
<p align=\"center\" position=\"absolute\" bottom\"80px\">
<img src=\"migale.png\" width=\"100\"/>
<img src=\"Irstea.png\" width=\"100\"/>
</p>
"
)
))
)
)
))
Help)
)
)
)
)
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