11
$\begingroup$

I have an R package on github which uses multiple Bioconductor dependencies, 'myPackage'

If I include CRAN packages in the DESCRIPTION via Depends:, the packages will automatically install upon installation via devtools, i.e.

devtools::install_github('repoName/myPackage')

This is discussed in Section 1.1.3 Package Dependencies, in Writing R Extensions

Is there a way to streamline this such that packages from Bioconductor are automatically installed as well?

Normally, users install Bioconductor packages via BiocLite, e.g.

source("http://www.bioconductor.org/biocLite.R")
biocLite("edgeR")
$\endgroup$
  • 1
    $\begingroup$ Note that as of Bioconductor release 3.8 onwards, bioconductor packages are installed with BiocManager::install() which can be installed from CRAN $\endgroup$ – Tom Kelly Apr 19 at 15:05
7
$\begingroup$

There's a trick to this where one needs to add biocViews: to the package Description. That's the only solution I've ever seen to allowing automatic installation of bioconductor dependencies. If you need a couple of examples, then click through the link I posted and scroll down to pull requests referencing that issue, they will generally include the actual example.

$\endgroup$
  • $\begingroup$ I didn't find the examples in the pull requests you mentioned. However, I did search the github mirror on CRAN. There are DESCRIPTION files with a lone biocViews: line before Depends:. Others include tags, like biocViews: Infrastructure, RNA $\endgroup$ – ShanZhengYang Jan 22 '18 at 19:32
  • $\begingroup$ Maybe we should post an example DESCRIPTION so it's absolutely clear to future biohackers how this is done...this news needs to spread! $\endgroup$ – ShanZhengYang Jan 22 '18 at 19:57
  • 1
    $\begingroup$ You don't need anything after biocViews:, that alone suffices (see ?devtools::package_deps). $\endgroup$ – Devon Ryan Jan 22 '18 at 20:14
8
$\begingroup$

As suggested, here’s an example showing the relevant lines from a DESCRIPTION file from a CRAN/GitHub hosted project that has Bioconductor dependencies (truncated):

Depends:
    R (>= 3.3.0)
biocViews:
Imports:
    methods,
    snpStats,
    dplyr

The relevant bit is the empty biocViews: declaration, which allows the Bioconductor dependency {snpStats} to be automatically installed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.