Commit d14cb37b authored by Midoux Cedric's avatar Midoux Cedric

downloadHandler

parent e56f1d6b
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")
)
......@@ -66,5 +66,3 @@ output$tableGlom <- DT::renderDataTable(server = FALSE, {
dplyr::select(-rowname)
beautifulTable(joinGlom)
})
uiOutput("downloadUI")
Summary <- div(verbatimTextOutput("phyloseqPrint"),
uiOutput("sampledataTable"),
withLoader(uiOutput("summaryTable")),
uiOutput("downloadUI"),
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",
......
......@@ -163,3 +163,32 @@ observeEvent(input$okData, {
showModal(dataInput(failed = TRUE))
}
})
output$downloadData <- {
downloadHandler(
filename = function() {
paste("Easy16S-data", Sys.Date(), "RData", sep = ".")
},
content = function(file) {
data <- physeq()
save(data, file = file)
}
)
}
output$downloadUI <- renderUI({
validate(need(physeq(), ""))
tags$div(
style = "text-align:center",
title = "Download data 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)")
# })
......@@ -13,7 +13,6 @@ shinyServer
{
source("internals.R")
source("panels/dataInput.R", local = TRUE)
source("panels/Sidebar-server.R", local = TRUE)
source("panels/Summary-server.R", local = TRUE)
source("panels/barplot-server.R", local = TRUE)
source("panels/heatmap-server.R", local = TRUE)
......
library(shinydashboard)
library(shinycustomloader)
#source("panels/Sidebar-ui.R", local = TRUE)
source("panels/Summary-ui.R", local = TRUE)
source("panels/barplot-ui.R", local = TRUE)
source("panels/heatmap-ui.R", local = TRUE)
......@@ -18,7 +17,6 @@ dashboardHeader(title = "Easy16S"),
dashboardSidebar(
actionButton("dataButton", "Select your data"),
sidebarMenu(
#menuItem("Data", tabName = "Data", icon = icon("dashboard")),
menuItem("Summary", tabName = "Summary", icon = icon("dashboard")),
menuItem("Barplot", tabName = "barplot", icon = icon("dashboard")),
menuItem("Heatmap", tabName = "heatmap", icon = icon("dashboard")),
......@@ -33,7 +31,6 @@ dashboardHeader(title = "Easy16S"),
)),
dashboardBody(
tabItems(
#tabItem(tabName = "Data", Sidebar),
tabItem(tabName = "Summary", Summary),
tabItem(tabName = "barplot", barplot),
tabItem(tabName = "heatmap", heatmap),
......
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