Skip to contents

Module UI & server for download buttons.

Usage

downloadButtonUI(id)

downloadButtonServer(id, outplot, plot_type)

Arguments

id

Module id

outplot

reactive plot handle

plot_type

reactive/static value used for output filename

Value

UI returns tagList with download button UI. Server invisibly returns NULL (used for side effects).

Examples

library(shiny)
library(ggplot2)

# get example object
obj <- make_example_carnation_object()
#> estimating size factors
#> estimating dispersions
#> gene-wise dispersion estimates
#> mean-dispersion relationship
#> final dispersion estimates
#> fitting model and testing
res <- as.data.frame(obj$res[[1]])

# make MA plot
p <- ggplot(res, aes(x=baseMean, y=log2foldChange)) +
       geom_point(color='black', alpha=0.5)

outplot <- reactive({ p })

# app with a single button to download a plot
if(interactive()){
  shinyApp(
    ui = fluidPage(
           downloadButtonUI('p')
         ),
    server = function(input, output, session){
               downloadButtonServer('p', outplot, 'maplot')
             }
  )
}