Search code examples
rpackagedependenciesr-package

R use packages installed through BiocManager in self packages


I am creating an R package to plot some data from VCF files. I need to include Biostrings package.

The problem is that if I specify Biostrings in my DESCRIPTION file:

#...
Imports:
  BiocManager (>= 1.30.19),
  tidyverse (>= 1.3.2),
  GenomicFeatures (>= 1.48.4),
  Biostrings (>= 2.64.1),
  ggbio (>= 1.44.1)
#...

It tells me it does not find it:

> devtools::install_github("cccnrc/plot-VCF")
Using github PAT from envvar GITHUB_TOKEN
Downloading GitHub repo cccnrc/plot-VCF@HEAD
Skipping 3 packages not available: ggbio, Biostrings, GenomicFeatures
✔  checking for file ‘/tmp/RtmpZkWQ8w/remotes2ee5f54e7e2a6/cccnrc-plot-VCF-d0a0d12/DESCRIPTION’ ...
─  preparing ‘plotVCF’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘plotVCF_0.0.0.9000.tar.gz’
   
Installing package into ‘/home/enrico/app/packrat-prove/plot-VCF-install/packrat/lib/x86_64-pc-linux-gnu/4.2.1’
(as ‘lib’ is unspecified)
ERROR: dependencies ‘GenomicFeatures’, ‘Biostrings’, ‘ggbio’ are not available for package ‘plotVCF’

On the other han, if I remove them from DESCRIPTION, the package does not work as it does not find the function:

#...
Error in loadNamespace(x) : there is no package called ‘Biostrings’
#...

How can I work this out? I tried to google and search here but no luck!


Solution

  • Use BiocManager to install your github package:

    BiocManager::install("cccnrc/plot-VCF")
    

    Or use BiocManager::repositories() to tell github_install() about additional repositories. devtools delegates to the remotes package, so use remotes directly

    remotes::install_github(
        "cccnrc/plot-VCF",
        repos = BiocManager::repositories()
    )
    

    Ask questions about Bioconductor on the Bioconductor support site.