# This example implements a simple file browser for accessing results. library(shiny) library(shinyFiles) library(ChIPseeker) library(TxDb.Hsapiens.UCSC.hg19.knownGene) # Results are available in the directory specified by the outputDir environment # variable, red by Sys.getenv rootdir <- Sys.getenv('outputDir') shinyServer(function(input, output, session) { # The backend for a simple file chooser, restricted to the # rootdir we obtained above. # See https://github.com/thomasp85/shinyFiles observe({ print(getwd()); files <- list.files(path = rootdir, pattern = ".bed") cat("\nBed files found:\n\n") filenames <- as.list(paste0(rootdir, files)); names(filenames) <- files; print(filenames) txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene peakAnnoList <- lapply(filenames, annotatePeak, TxDb=txdb, tssRegion=c(-3000, 3000), verbose=FALSE) output$plot1 <- renderPlot({ plotAnnoBar(peakAnnoList) }) output$plot2 <- renderPlot({ plotDistToTSS(peakAnnoList) }) }) })