This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bioconductor as a source for the dependencies of an R package?

Hello,

I am writing an R package and my dependencies are almost all bioconductor packages. It works on my computer because I already have all of them installed but it does skip them for being unavailable when loading my package. Anybody have a fix?

Thanks!

r bioconductor

Can you please explain a bit more?

Please make sure the following commands complete without ERROR or WARNING. This ERROR or WARNING most of the times solve lot of problem.

R CMD build [Package_name]
R CMD check [Package_name.tar.gz]
R CMD BiocCheck [Package_name.tar.gz]

Well I have the packages on my github and I load them through the devtools packages. In the Description I have my packages stated as such

Depends:
    R (>= 3.2.3),
    limma (<= 3.26.8),
    oligo (<= 1.34.2),
    pd.hugene.2.0.st (<= 3.14.1),
    genefilter (<= 1.52.1),
    annotate (<= 1.48.0),
    hugene20sttranscriptcluster.db(<= 8.4.0),
    affycoretools(<= 1.42.0)
License: GNU GENERAL PUBLIC LICENSE V3.0
LazyData: true
RoxygenNote: 5.0.1.9000

But I believe when you do that it looks for CRAN repo packages. I need it to get them from bioconductor.

Add a BiocViews entry to your package DESCRIPTION. Devtools will then detect your package as a Bioconductor package and add the proper Bioconductor repositories needed to install the dependencies.

2 answers

The biocLite() function is the recommended way to access and install Bioconductor and Bioconductor-related packages. Take a look at the siteRepos argument to add the repository for your package and biocLite() will do the rest.

Ah yes I know how to install the packages for my own use. As you can see above I am writing a package that uses bioconductor packages. Are you saying I should instruct people who use my package to install it using biocLite() and then add my repo to that function?

Thanks!

Instruct them how to install biocLite() and then give them a command-line to install your package. It will look something like:

source('http://bioconductor.org/biocLite.R')
biocLite('MySuperSoftwareWithBioc',siteRepos=YOURREPOSITORY)

Dear Sean

I have a similar issue, and when I try to install my package using biocLite() it threw this error

Error: Line starting '<!DOCTYPE html> ...' is malformed!

for comparison I also tried installing Gviz from bioconductor github mirror. Got the same error.

biocLite("Gviz", siteRepos = "https://github.com/Bioconductor-mirror/Gviz")

BioC_mirror: https://bioconductor.org
Using Bioconductor 3.2 (BiocInstaller 1.20.1), R 3.2.2 (2015-08-14).

Installing package(s) ‘Gviz’

Error: Line starting '<!.DOCTYPE html>...' is malformed!

What would be the solution to that?

Thanks, Vivek

Well, in order to use biocLite(), a formal R repository must be in place. The biocLite() approach will not work directly from github. Yes, I agree that this is less than ideal....

I see.. So how are the bioconductor developers working with github dealing with this situation (or are there any)? I think it would be helpful to either add github url support to biocLite(), or get the devtools::install_github to support bioconductor urls, whichever is easier ..

UPDATE : after @jimhester 's reply to the post I found that devtools already supports bioconductor packages while installing. I just had to populate biocViews in my package DESCRIPTION. So that install_github can pick up from that.

Apparantly biocLite would also work after this, if you use it like this: biocLite("Bioconductor-mirror/Gviz")

I guess this solves the issue.

biocLite("your/amazing") works too (via devtools), without requiring you to label your package with the biocViews term. It does this by setting the argument repos to a value that includes Bioconductor repositories, BiocInstaller::biocinstallRepos(), so you can do that, too install_github("your/amazing", repos=BiocInstaller::biocinstallRepos())

Could you please specify how you changed DESCRIPTION? I add a line "biocViews:", but installation of bioconductor packages still failed...

@Vivian you need to add a term to biocViews. Eg :

biocViews : rnaseq

Update: This is not the recommended way of installing packages. Please use BiocManager::install("username/pkgrepo") to install a package from GitHub. We strongly recommend that you only do this in the devel version of Bioconductor (for developers); otherwise, simply install the package from either Bioconductor or CRAN using BiocManager::install("package").

Log in to answer this question.