Commit 34260c1d authored by Midoux Cedric's avatar Midoux Cedric

downloadData

parent c1ce19e5
......@@ -163,17 +163,31 @@ observeEvent(input$okData, {
}
})
output$downloadData <- {
downloadHandler(
dataDownload <- function() {
modalDialog(
title = "Download data",
size = "s",
textInput("dataName", "File name : ", value = paste("Easy16S-data", Sys.Date(), sep = "-")),
radioButtons("dataFormat", "File format : ", choices = c("RData", "biom"), selected = "RData", inline = TRUE),
footer = tagList(modalButton("Cancel"),
downloadButton("okDownload", "Download")
)
)
}
output$okDownload <- downloadHandler(
filename = function() {
paste("Easy16S-data", Sys.Date(), "RData", sep = ".")
paste(input$dataName, input$dataFormat, sep = ".")
},
content = function(file) {
if (input$dataFormat == "RData") {
data <- physeq()
save(data, file = file)
} else if (input$dataFormat == "biom") {
write_phyloseq(physeq = physeq(), biom_file = file, biom_format = "frogs") #"standard"
}
)
}
}
)
plotDownload <- function() {
modalDialog(
......@@ -183,7 +197,7 @@ plotDownload <- function() {
numericInput("plotWidth", "Width : ", value = 7),
numericInput("plotHeight", "Height : ", value = 7),
numericInput("plotDPI", "DPI : ", value = 300),
radioButtons("plotFormat", "File format : ", choices = c("png", "pdf", "jpeg", "svg", "wmf"), selected = 1, inline = TRUE),
radioButtons("plotFormat", "File format : ", choices = c("png", "pdf", "jpeg", "svg", "wmf"), selected = "png", inline = TRUE),
footer = tagList(modalButton("Cancel"),
downloadButton("okPlot", "Download")
)
......
......@@ -34,6 +34,10 @@ shinyServer
showModal(dataInput())
})
observeEvent(input$downloadButton, {
showModal(dataDownload())
})
observeEvent(input$plotButton, {
showModal(plotDownload())
})
......
......@@ -20,8 +20,8 @@ dashboardHeader(title = "Easy16S"),
"Select your data",
icon = icon("upload"),
style = "width: 80% ; color: black ; background-color: gray90"),
downloadButton("downloadData",
"Download data as RData",
actionButton("downloadButton",
"Download data",
icon = icon("download"),
style = "width: 80% ; color: black ; background-color: gray90"),
actionButton("plotButton",
......
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