Contents

1 Introduction

Use the BiocManager package to install and manage packages from the Bioconductor project for the statistical analysis and comprehension of high-throughput genomic data.

Current Bioconductor packages are available on a ‘release’ version intended for every-day use, and a ‘devel’ version where new features are introduced. A new release version is created every six months. Using the BiocManager package helps users install packages from the same release.

2 Basic use

Use standard R installation procedures to install the BiocManager package. This command is requried only once per R installation.

chooseCRANmirror()
install.packages("BiocManager")

Install Bioconductor (or CRAN) packages with

BiocManager::install(c("GenomicRanges", "Organism.dplyr"))

Installed packages can be updated to their current version with

BiocManager::install()

Use version() to discover the version of Bioconductor currently in use.

BiocManager::version()
## [1] '3.9'

Bioconductor packages work best when they are all from the same release. Use valid() to identify packages that are out-of-date or from unexpected versions.

BiocManager::valid()
## Warning: 21 packages out-of-date; 2 packages too new
## 
## * sessionInfo()
## 
## R Under development (unstable) (2018-11-02 r75540)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.1 LTS
## 
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] BiocStyle_2.11.0
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.0         bookdown_0.7       digest_0.6.18     
##  [4] rprojroot_1.3-2    backports_1.1.2    magrittr_1.5      
##  [7] evaluate_0.12      stringi_1.2.4      rmarkdown_1.10    
## [10] tools_3.6.0        stringr_1.3.1      xfun_0.4          
## [13] yaml_2.2.0         compiler_3.6.0     BiocManager_1.30.4
## [16] htmltools_0.3.6    knitr_1.20        
## 
## Bioconductor version '3.9'
## 
##   * 21 packages out-of-date
##   * 2 packages too new
## 
## create a valid installation with
## 
##   BiocManager::install(c(
##     "BiocManager", "GenomicDataCommons", "GenomicRanges", "IRanges",
##     "RJSONIO", "RcppArmadillo", "S4Vectors", "TCGAbiolinks", "TCGAutils",
##     "TMB", "biocViews", "biomaRt", "bumphunter", "curatedMetagenomicData",
##     "dimRed", "dplyr", "flowCore", "ggpubr", "ggtree", "lme4", "rcmdcheck",
##     "shinyFiles", "tximportData"
##   ), update = TRUE, ask = FALSE)
## 
## more details: BiocManager::valid()$too_new, BiocManager::valid()$out_of_date

valid() returns an object that can be queried for detailed information about invalid packages, as illustrated in the following screen capture

> v <- valid()
Warning message:
6 packages out-of-date; 0 packages too new
> names(v)
[1] "out_of_date" "too_new"
> head(v$out_of_date, 2)
    Package LibPath
bit "bit"   "/home/mtmorgan/R/x86_64-pc-linux-gnu-library/3.5-Bioc-3.8"
ff  "ff"    "/home/mtmorgan/R/x86_64-pc-linux-gnu-library/3.5-Bioc-3.8"
    Installed Built   ReposVer Repository
bit "1.1-12"  "3.5.0" "1.1-13" "https://cran.rstudio.com/src/contrib"
ff  "2.2-13"  "3.5.0" "2.2-14" "https://cran.rstudio.com/src/contrib"
>

Packages available for your version of Bioconductor can be discovered with available(); the first argument can be used to filter package names based on a regular expression, e.g., ‘BSgenome’ package available for Homo sapiens

avail <- BiocManager::available()
length(avail)
## [1] 16261
BiocManager::available("BSgenome.Hsapiens")
##  [1] "BSgenome.Hsapiens.1000genomes.hs37d5"
##  [2] "BSgenome.Hsapiens.NCBI.GRCh38"       
##  [3] "BSgenome.Hsapiens.UCSC.hg17"         
##  [4] "BSgenome.Hsapiens.UCSC.hg17.masked"  
##  [5] "BSgenome.Hsapiens.UCSC.hg18"         
##  [6] "BSgenome.Hsapiens.UCSC.hg18.masked"  
##  [7] "BSgenome.Hsapiens.UCSC.hg19"         
##  [8] "BSgenome.Hsapiens.UCSC.hg19.masked"  
##  [9] "BSgenome.Hsapiens.UCSC.hg38"         
## [10] "BSgenome.Hsapiens.UCSC.hg38.masked"

Questions about installing and managing Bioconductor packages should be addressed to the Bioconductor support site.

3 Advanced use

3.1 Changing version

Use the version= argument to update all packages to a specific Bioconductor version

BiocManager::install(version="3.7")

Bioconductor versions are associated with specific R versions, as summarized here. To use the most recent version of Bioconductor may require installing a new version of R.

A special version, version="devel", allows use of Bioconductor packages that are under development.

3.2 Managing multiple versions

It is possible to have multiple versions of Bioconductor installed on the same computer. A best practice is to create an initial R installation. Then create and use a library for each version of Bioconductor. The library will contain all Bioconductor, CRAN, and other packages for that version of Bioconductor. We illustrate the process assuming use of Bioconductor version 3.7, available using R version 3.5

Create a directory to contain the library (replace USER_NAME with your user name on Windows)

  • Linux: ~/R/3.5-Bioc-3.7
  • macOS: ~/Library/R/3.5-Bioc-3.7/library
  • Windows: C:\Users\USER_NAME\Documents\R\3.5-Bioc-3.7

Set the environment variable R_LIBS_USER to this directory, and invoke R. Command line examples for Linux are

  • Linux: R_LIBS_USER=~/R/3.5-Bioc-3.7 R
  • macOS: R_LIBS_USER=~~/Library/R/3.5-Bioc-3.7/library R
  • Windows: cmd /C "set R_LIBS_USER=C:\Users\USER_NAME\Documents\R\3.5-Bioc-3.7 && R"

Once in R, confirm that the version-specific library path has been set

.libPaths()

On Linux and macOS, create a bash alias to save typing, e.g.,

  • Linux: alias Bioc3.7='R_LIBS_USER=~/R/3.5-Bioc-3.7 R'
  • macOS: alias Bioc3.7='R_LIBS_USER=~/Library/R/3.5-Bioc-3.7/library R'

Invoke these from the command line as Bioc3.7.

On Windows, create a shortcut. Go to My Computer and navigate to a directory that is in your PATH. Then right-click and choose New->Shortcut. In the “type the location of the item” box, put:

cmd /C "set R_LIBS_USER=C:\Users\USER_NAME\Documents\R\3.5-Bioc-3.7 && R"

Click “Next”. In the “Type a name for this shortcut” box, type Bioc-3.7.