This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bioconductor : Setting local install directory for packages

I have installed Bioconductor (see R terminal below):

> source("http://bioconductor.org/biocLite.R")
> biocLite()
.
.
.
Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  'lib = "/usr/lib64/R/library"' is not writable
Would you like to use a personal library instead?  (y/n) y
Would you like to create a personal library
~/R/x86_64-redhat-linux-gnu-library/3.2
to install packages into?  (y/n) n

If I say no to the default directory, it boots me out of the installation with the error:

Error in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  : unable to install packages

I want to install the Bioconductor packages in a directory of my choosing without it cluttering up my home directory. How do I do this?

rna-seq bioconductor

2 answers

Just like for install.packages, you can specify the location using the lib argument:

biocLite(pkgs, lib="~/R/library")
?biocLite

     ...: Additional arguments. 'lib.loc' is passed to 'old.packages'
          (used to determine the library location of installed packages
          to be updated). 'lib' is passed to 'install.packages' (used
          to determine the library location where 'pkgs' are to be
          installed).

Actually, that does work... i.e.

> biocLite("easyRNASeq", lib="/path/to/home/local/R-3.2.1")

yields

.
.
.
Old packages: 'boot', 'class', 'cluster', 'codetools', 'foreign', 'KernSmooth',
  'lattice', 'MASS', 'Matrix', 'mgcv', 'nlme', 'nnet', 'rpart', 'spatial',
  'survival'

Update all/some/none? [a/s/n]: a

Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  'lib = "/usr/lib64/R/library"' is not writable
Would you like to use a personal library instead?  (y/n) y

Would you like to create a personal library
~/R/x86_64-redhat-linux-gnu-library/3.2
to install packages into?  (y/n) n

Error in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  : 
  unable to install packages

It appears that it installed easyRNASeq and associated packages in the correct location. It is however still giving me an error and it won't let put the updated source packages in a directory of my choosing.

You also need to tell it where to look for old packages to update. This should fix the error:

biocLite(pkgs, lib.loc = "~/R/local_library", lib="~/R/local_library")

From ?biocLite():

Additional arguments. 'lib.loc' is passed to 'old.packages' (used to determine the library location of installed packages to be updated). 'lib' is passed to 'install.packages' (used to determine the library location where 'pkgs' are to be installed).

Log in to answer this question.