Answers.Body: <p>As <a href="https://bioinformatics.stackexchange.com/a/18374/48">I answered</a> 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.</p>
  <p>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.</p>
  <p>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).</p>
  <p>To install these dependencies before that depends on the CI you use and the strategy used there (install from ppa, use RSPM, use <code>bspm::install</code>, ...) . However, I recommend to do it via <code>BiocManager::install</code> because this way you can install all packages from both CRAN and Bioconductor and their dependencies.</p>
  <p>Even if the package is on CRAN, github or just Bioconductor with <code>BiocManager::install</code> you'll be able to install all the dependencies and continue to check your package normally on the CI.</p>
  <hr />
  <p>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) .</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-23T21:39:43.667Z
Answers.Text: 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?
Answers.UserDisplayName: Edmondo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T09:44:07.783Z
Answers.Text: 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.
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T09:49:39.420Z
Answers.Text: 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!
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T16:55:20.923Z
Answers.Text: 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?
Answers.UserDisplayName: Edmondo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T17:22:24.617Z
Answers.Text: If you are using Github actions I recommend to check out [biocthis](https://bioconductor.org/packages/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.
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T19:26:01.030Z
Answers.Text: Thanks, very useful ! Can you share with me the links to the relevant documentation?
Answers.UserDisplayName: Edmondo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T20:11:23.203Z
Answers.Text: yes, you can find them  via `?remotes::install_deps`, `?BiocManager::repositories` on the terminal. And here are links to their respective manuals: [remotes](https://cran.r-project.org/web/packages/remotes/remotes.pdf), [BiocManager](https://cran.r-project.org/web/packages/BiocManager/BiocManager.pdf)
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-23T20:12:24.707Z
Answers.LastActivityDate: 2022-01-23T20:12:24.707Z
Answers.UserDisplayName: llrs
Body: <p>In a custom package which imports a package from Bioconductor, what is the right DESCRIPTION file?</p>
  <p>I added in my DESCRIPTION a line with Remote like so</p>
  <pre><code>Remotes: 
      bioc::3.14/dada2
   
  </code></pre>
  <p>as suggested by <a href="https://cran.r-project.org/web/packages/remotes/index.html" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/remotes/index.html</a> vignette, but it still failed the R <code>check()</code> with error &quot;Packages required not available&quot;. I am very confused about what is the right way to solve this problem, since multiple sources propose a different solution:</p>
  <ul>
  <li><p><a href="https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-Dependencies" rel="nofollow noreferrer">https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-Dependencies</a> mention Additional_repository key in the DESCRIPTION</p>
  </li>
  <li><p>mention Remotes, suggesting one add a Remotes entry to DESCRIPTION with a specific syntax for Bioconductor dependencies</p>
  </li>
  <li><p>The following post suggest using blockViews <a href="https://bioinformatics.stackexchange.com/questions/3365/r-package-development-how-does-one-automatically-install-bioconductor-packages/3375#3375">R package development: How does one automatically install Bioconductor packages upon package installation?</a></p>
  </li>
  </ul>
  <p>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</p>
  
Tags: <bioconductor>
Title: How to consume non-CRAN packages in custom package?
ThreadText: # How to consume non-CRAN packages in custom package?
  
  (Asked by: username_0 on 2022-01-23)
  
  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:
  
  * <https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-Dependencies> mention Additional\_repository key in the DESCRIPTION
  * mention Remotes, suggesting one add a Remotes entry to DESCRIPTION with a specific syntax for Bioconductor dependencies
  * The following post suggest using blockViews [R package development: How does one automatically install Bioconductor packages upon package installation?](https://bioinformatics.stackexchange.com/questions/3365/r-package-development-how-does-one-automatically-install-bioconductor-packages/3375#3375)
  
  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
  
  **Tags:** bioconductor
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-01-23. Score: 2
  
  As [I answered](https://bioinformatics.stackexchange.com/a/18374/48) 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) .
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_1**: 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.  
  > **username_1**: 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!  
  > **username_0**: 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?  
  > **username_1**: If you are using Github actions I recommend to check out [biocthis](https://bioconductor.org/packages/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.  
  > **username_0**: Thanks, very useful ! Can you share with me the links to the relevant documentation?  
  > **username_1**: yes, you can find them  via `?remotes::install_deps`, `?BiocManager::repositories` on the terminal. And here are links to their respective manuals: [remotes](https://cran.r-project.org/web/packages/remotes/remotes.pdf), [BiocManager](https://cran.r-project.org/web/packages/BiocManager/BiocManager.pdf)  
  
  ---
  
  