Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document best way to handle BioConductor package dependencies for CRAN packages. #210

Closed
noamross opened this issue Nov 8, 2019 · 18 comments
Assignees
Milestone

Comments

@noamross
Copy link
Contributor

noamross commented Nov 8, 2019

Packages on CRAN can have BioConductor dependencies but they need the empty field biocViews: in their DESCRIPTION for installation to work properly. This is under-documented around the web so it will be useful to put it in the packaging guide as another way to find it.

https://bioinformatics.stackexchange.com/questions/3365/r-package-development-how-does-one-automatically-install-bioconductor-packages

The above is wrong but we should note the best way for packages to rely on BioConductor pacakges.

@maelle
Copy link
Member

maelle commented Jan 9, 2020

would you like to make a PR for that @noamross? :-)

@maelle maelle self-assigned this Jan 18, 2020
@maelle
Copy link
Member

maelle commented Jan 22, 2020

@noamross how does this work?! I can't find the related code via https://github.com/wch/r-source/search?utf8=%E2%9C%93&q=biocViews&type= and I only know of the remotes support

@maelle
Copy link
Member

maelle commented Jan 22, 2020

For https://cran.r-project.org/web/packages/aroma.core/ (where Bioconductor packages have correct links), the DESCRIPTION file as a DependsNote.

@noamross
Copy link
Contributor Author

Oh wow I have no idea and now I am very curious.

@maelle
Copy link
Member

maelle commented Jan 22, 2020

@maelle
Copy link
Member

maelle commented Jan 22, 2020

Relevant tools:::.get_standard_repository_URLs()

@maelle
Copy link
Member

maelle commented Jan 22, 2020

wch/r-source@94c4f33

@maelle
Copy link
Member

maelle commented Jan 22, 2020

@maelle
Copy link
Member

maelle commented Jan 22, 2020

@maelle
Copy link
Member

maelle commented Jan 22, 2020

It seems to be that there's no need to add anything to DESCRIPTION, i.e. one can handle Bioc dependencies like CRAN dependencies.

@maelle
Copy link
Member

maelle commented Jan 22, 2020

The user needs getOptions("repos") to return the necessary Bioc repo(s). See https://github.com/bioimaginggroup/nucim#installation (tested but I got a compilation error)

@maelle
Copy link
Member

maelle commented Jan 22, 2020

Now I'm not sure installing Bioc packages like that is recommended?! (e.g. now I can do install.packages("IRanges")).

@maelle
Copy link
Member

maelle commented Jan 22, 2020

@noamross noamross changed the title document biocViews requirements for BioConductor dependencies Document best way to handle BioConductor package dependencies for CRAN packages. Jan 22, 2020
@noamross
Copy link
Contributor Author

OK, so my original note above is wrong, I think. biocViews is actually something need if your package is on Bioconductor.

Perhaps the recommendation should just be that README and other documentation indicate the preferred way to install bioC dependencies - e.g., add https://bioconductor.org/packages/[X.X]/bioc to your repos options, or use biocLite.

Since CRAN and BioC have different release models, should best practice be to note the Bioconductor release version in DependsNote or something similar? @gmbecker or @HenrikBengtsson, perhaps you could advise?

@annakrystalli
Copy link
Contributor

So it appears from this issue that BiocViews: field points to the fact that some dependencies are hosted on the bioconductor remote.

Indeed adding a BiocViews: field solved a missing dependency error when I was trying to install the following package: https://github.com/llrs/BaseSet,
eg to reproduce the errors, ensure you do not have BiocStyle and org.Hs.eg.db packages installed and compare errors between:

devtools::install_github("llrs/BaseSet", dependencies = T, build_vignettes = T)

and my fork with added biocViews: field.

devtools::install_github("annakrystalli/BaseSet", dependencies = T, build_vignettes = T)

However, it does not work for Bioconductor packages with no binaries available.

For example, it does not install org.Hs.eg.db successfully. Indeed, even following the Installation instructions on the package's bioconductor page fails:

Installation

To install this package, start R (version "3.6") and enter:

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("org.Hs.eg.db")

I get:

Bioconductor version 3.10 (BiocManager 1.30.10), R 3.6.0 (2019-04-26)
Installing package(s) 'org.Hs.eg.db'

   package ‘org.Hs.eg.db’ is available as a source package but not as a binary

Warning message:
package ‘org.Hs.eg.db’ is not available (as a binary package for R version 3.6.0) 

It also prompts me to upgrade the just installed BiocStyle.

Old packages: 'BiocStyle'
Update all/some/none? [a/s/n]: 
a
trying URL 'https://bioconductor.org/packages/3.10/bioc/bin/macosx/el-capitan/contrib/3.6/BiocStyle_2.14.4.tgz'
Content type 'application/x-gzip' length 956336 bytes (933 KB)
==================================================

Indeed the BiocStyle version installed (2.12) through DESCRIPTION file and BiocViews: was not most recent. When accespting the prompt to update I get BiocStyle 2.14

In the end I managed to successfully install org.Hs.eg.db with:

BiocManager::install("org.Hs.eg.db", type = "source")

So it seems that BiocViews: does work (and I've had it work for other packages with bioconductor packages) but it does not necessarily install the most recent version, it does not work for source packages and the error messages are not very informative during installation of the dependent package, only when the failing dependecy is attempted to be installed the bioconductor way.

@llrs
Copy link
Member

llrs commented Jan 29, 2020

BiocViews is required by Bioconductor to classify the packages for easier finding of packages (now they are also experimenting with BioSchema). This allows to search for similar packages according to what they do, like this. I also have used in the past to indicate that there are some dependencies on Bioconductor. But I think it is not needed because there are some packages, like WGCNA, that depend on Bioconductor packages (GO.db) that don't have it on the DESCRIPTION file.

The recommended and official way to install the Bioconductor packages is using BiocManager. However, I am not sure how are the binaries built for Windows (Linux and OS builds are generally made available). In principle they should be available too, but the builders had some troubles for some weeks. I don't know of any heuristics to decide when one should install a package from source or using binaries. AFAIK the only solution is to try the binaries and if they fai, then build from source.

The latest version of Bioconductor is not granted in any case. BiocManager::valid() checks if the Bioconductor's (and CRAN) packages are on the latests version available for the R version you are using.

(Note that BiocManager import also remotes and you can install from github directly with BiocManager::install("llrs/BaseSet", dependencies = TRUE, build_vignettes = TRUE). Perhaps you could fill a bug to reinstall from source when the binaries are not available.)

@annakrystalli
Copy link
Contributor

Thank you so much for commenting @llrs ! It really helped clarify things for me.

POSTING RESPONSE FROM REVIEW ISSUE HERE FOR rOpenSci policy discussion

Aha, it seems I have been trying to install the package the wrong way all this time, by using devtools::use_github() as I normally do for editors checks when I should be using BiocManager::install()

However, when I try to install using BiocManager::install("llrs/BaseSet", dependencies = TRUE, build_vignettes = TRUE) I still get the same errors for a couple of suggested bioconductor packages I removed to test it out.

I'm really intrigued by the fact that the packages builds successfully for you on TRAVIS. Looking at your travis.yml I see you are testing on r: bioc-devel only. I think this where the testing computational environment and my own (and of reviewers and future collaborators) would differ. I feel also testing on r: release at the very least would give a better idea of what challenges others would encounter. Would you mind trying that out for me?

@maelle maelle added this to the 0.4.0 milestone Jan 30, 2020
@maelle
Copy link
Member

maelle commented Mar 12, 2020

A further issue might be opened if the current text can be improved for CI aspects. Thanks everyone for your input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants