1
$\begingroup$

In a custom package which imports a package from Bioconductor, what is the right DESCRIPTION file?

I added in my DESCRIPTION a line with Remote like so

Remotes: 
    bioc::3.14/dada2
 

as suggested by https://cran.r-project.org/web/packages/remotes/index.html vignette, but it still failed the R check() with error "Packages required not available". I am very confused about what is the right way to solve this problem, since multiple sources propose a different solution:

What is the appropriate way to declare dependencies on packages on Bioconductor? The remotes support helped me satisfy a dependency on a package from Github, but not for bioconductor

$\endgroup$
0

1 Answer 1

2
$\begingroup$

As I answered on the linked question, the right way to declare packages from repositories recognized by R is to just declare normally on the Imports, Depends, Enhances and LinkingTo.

Bioconductor is an accepted repository so it doesn't need to be added on Additional_repository field. BiocViews is a required field from Bioconductor. As CRAN accepts other fields on the DESCRIPTION it could be used by CRAN packages.

You don't mention it but if you found this problem and it wasn't on your computer were you are developing the package it means you are using a continuous integration test. The problem with CI like Github actions, travis, appveyor or other is that dependencies must be installed before (as they should on your computer).

To install these dependencies before that depends on the CI you use and the strategy used there (install from ppa, use RSPM, use bspm::install, ...) . However, I recommend to do it via BiocManager::install because this way you can install all packages from both CRAN and Bioconductor and their dependencies.

Even if the package is on CRAN, github or just Bioconductor with BiocManager::install you'll be able to install all the dependencies and continue to check your package normally on the CI.


Additional_repositories is for other non standard repositories like a personal one or other a specific of a project. It is used by only ~100 packages of the 18765 packages on CRAN. But there are many more dependencies from CRAN to Bioconductor (and vice versa) .

$\endgroup$
7
  • $\begingroup$ That's a surprising behavior. I need to install BiocManager manager and all the Bioconductor dependencies to succeed in check(). This is not really very user friendly. Is there a way to do that with a single command in a fresh R environment? $\endgroup$
    – Edmondo
    Commented Jan 23, 2022 at 21:39
  • $\begingroup$ This is very user friendly, as dependency installation (of the right Bioconductor release) is taken care for you. Otherwise you need to manually chase down each dependency from each repository on the right version. In a single line: R -e install.packages("BiocManager"); BiocManager::install("my_package", dependencies = c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")) This will install my_package and all the dependencies. $\endgroup$
    – llrs
    Commented Jan 24, 2022 at 9:44
  • 1
    $\begingroup$ A note about check: if you are using check you are not a user, you are a developer of R extensions. To be able to provide high quality packages to users R CMD check my_package is used, but to check the package it needs all the dependencies (otherwise it cannot fully check the package). If you don't want to check your package you can simply build the package R CMD build my_package and share the tar.gz file. This will provide the package to users without any check (it could even be that your package is not installable). Hope this helps! $\endgroup$
    – llrs
    Commented Jan 24, 2022 at 9:49
  • $\begingroup$ Thank you. Is there a way to install all dependencies from DESCRIPTION you are suggesting without running an install of my_package? Something that I need to run before R CMD check on a new renv. This is very user friendly, as dependency installation (of the right Bioconductor release) is taken care for you. Otherwise you need to manually chase down each dependency from each repository on the right version. In a single line: R -e install.packages("BiocManager"); BiocManager::install_deps(dependencies = c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")) or something like that? $\endgroup$
    – Edmondo
    Commented Jan 24, 2022 at 16:55
  • $\begingroup$ If you are using Github actions I recommend to check out biocthis as it helps setting this. You could also use remotes::install_deps(repos = BiocManager::repositories()) which would only install dependencies from the right repositories but not the package being installed. $\endgroup$
    – llrs
    Commented Jan 24, 2022 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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