Failing to deploy shinyapp depending on Bioconductor packages

I am trying to publish an app that uses Bioconductor packages and deployment fails because a repository can't be found. I have deployed very similar apps (same app, different data) in the past and it runs locally, so I am pretty sure that the app is fine.

Here's a short reproducible example that illustrates my problem.

  1. I created the Old Faithful Geyser Data example app that comes with shiny: in RStudio, I used File > New File > New Shiny Web Application. I can successfully run it with shiny::runApp() and deploy it by clicking on the Publish button.
  2. Add a file, say data.R in the app directory containing
library("MSnbase")
data(msnset)
mean(exprs(filterNA(msnset)))

and add

source("data.R")

at the top of ui.R. The code above won't affect the app as such, just use a Bioconductor package, load an example data and perform some trivial data processing and calculation.
3. I can still successfully run the app locally, but when I try to republish it, or publish it as a new app, I get

Preparing to deploy application...DONE
Uploading bundle for application: 317710...DONE
Deploying bundle: 1308445 for application: 317710 ...
Waiting for task: 518771630
  building: Parsing manifest
################################ Begin Task Log ################################ 
################################# End Task Log ################################# 
Error: Unhandled Exception: Child Task 518771633 failed: Error parsing manifest: Unable to determine package source for Bioconductor package vsn: Repository must be specified
Execution halted

I tried to publish via RStudio and rsconnect::delployApp(). Here's the session information after running the app locally.

Thank you in advance for any pointers.

Laurent

> sessionInfo()
R version 3.4.4 Patched (2018-03-19 r74516)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/lapack/liblapack.so.3.0

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] MSnbase_2.4.2       ProtGenerics_1.10.0 BiocParallel_1.12.0
[4] mzR_2.12.0          Rcpp_0.12.16        Biobase_2.38.0     
[7] BiocGenerics_0.24.0 shiny_1.0.5        

loaded via a namespace (and not attached):
 [1] msdata_0.18.0         BiocInstaller_1.28.0  compiler_3.4.4       
 [4] pillar_1.2.1          plyr_1.8.4            bitops_1.0-6         
 [7] iterators_1.0.9       zlibbioc_1.24.0       tools_3.4.4          
[10] MALDIquant_1.17       digest_0.6.15         jsonlite_1.5         
[13] tibble_1.4.2          preprocessCore_1.40.0 gtable_0.2.0         
[16] lattice_0.20-35       rlang_0.2.0           foreach_1.4.4        
[19] yaml_2.1.18           IRanges_2.12.0        S4Vectors_0.16.0     
[22] stats4_3.4.4          grid_3.4.4            impute_1.52.0        
[25] R6_2.2.2              XML_3.98-1.10         RJSONIO_1.3-0        
[28] limma_3.34.9          ggplot2_2.2.1         scales_0.5.0.9000    
[31] pcaMethods_1.70.0     codetools_0.2-15      htmltools_0.3.6      
[34] mzID_1.16.0           rsconnect_0.8.8       mime_0.5             
[37] xtable_1.8-2          colorspace_1.3-2      httpuv_1.3.6.2       
[40] affy_1.56.0           RCurl_1.95-4.10       doParallel_1.0.11    
[43] lazyeval_0.2.1        munsell_0.4.3         vsn_3.46.0           
[46] affyio_1.48.0 
4 Likes

What is the value of getOption("repos")?

Do you have this configured to point to BioConductor?

Although the publishing process for Shiny Server and RStudio Connect uses packrat, the miniCRAN vignette demonstrates how to extract the repository values for BioConductor:

bioc <- local({
  env <- new.env()
  on.exit(rm(env))
  evalq(source("http://bioconductor.org/biocLite.R", local = TRUE), env)
  biocinstallRepos()
})

The resulting object bioc looks something like this:

> bioc

                                               BioCsoft 
           "https://bioconductor.org/packages/3.5/bioc" 
                                                BioCann 
"https://bioconductor.org/packages/3.5/data/annotation" 
                                                BioCexp 
"https://bioconductor.org/packages/3.5/data/experiment" 
                                              BioCextra 
          "https://bioconductor.org/packages/3.5/extra" 
                                                   CRAN 
                         "https://cloud.r-project.org/" 
                                              CRANextra 
                  "https://www.stats.ox.ac.uk/pub/RWin" 

You can use this information to configure your repos settings.

For more information, the support article Package management in RStudio Connect may help.

7 Likes

Indeed, thank you very much for this, which indeed fixed my issue.

The shinyapps documentation says:

Currently, the shinyapps.io service supports deploying packages installed from CRAN, GitHub (both public and private repos), and BioConductor.

which I understood as working out of the box, especially as Bioconductor repos seemed to be set automatically in my previous deployments. More generally, users never need to set these explicitly when using the recommentedBiocInstaller::biocLite function.

It would be helpful to provide a bit more details in the shinyapps documentation and/or a link to the Package management in RStudio Connect that you pointed out.

Anyway, thank you very much for your prompt reply.

4 Likes

Note that this solution no longer works. Attempting to source biocLite.R leads to the error:

Error: With R version 3.5 or greater, install Bioconductor packages using BiocManager; see Bioconductor - Install

3 Likes

For BiocManager, try this

library(BiocManager)
options(repos = BiocManager::repositories())
9 Likes

Thanks - that worked perfectly for me.

1 Like