[R] Handling dependencies on Bioconductor packages for packages on CRAN
Martin Morgan
mtmorg@n@b|oc @end|ng |rom gm@||@com
Tue Dec 7 23:23:25 CET 2021
One possibility is to make graph a Suggests: dependency, and preface any code using it (or, e.g., in an .onLoad function) with
if (!requireNamespace("graph", quietly = TRUE))
stop(
"install the Bioconductor 'graph' package using these commands\n\n",
## standard Bioconductor package installation instructions
" if (!requireNamespace('BiocManager', quiety = TRUE))\n",
" install.packages('BiocManager')\n",
" BiocManager::install('graph')\n\n"
)
Use graph:: for any function used in the graph package. The code could be simplified if BiocManager were an Imports: dependency of your package -- it would already be installed. The 'Suggests:' dependency would not cause problems with CRAN, because Suggest'ed packages are available when the package is built / checked.
The user experience of package installation would be 'non-standard' (didn't I just install gRbase??), so this is not an ideal solution.
Martin
On 12/4/21, 10:55 AM, "R-help on behalf of Søren Højsgaard" <r-help-bounces using r-project.org on behalf of sorenh using math.aau.dk> wrote:
Dear all
My gRbase package imports the packages from Bioconductor: graph, RBGL and Rgraphviz
If these packages are not installed, then gRbase can not be installed. The error message is:
ERROR: dependency ‘graph’ is not available for package ‘gRbase’
If I, prior to installation, run setRepositories and highlight 'BioC software', then gRbase installs as it should, because the graph package from Bioconductor is installed along with it. However, this extra step is an obstacle to many users of the package which means that either people do not use the package or people ask questions about this issue on stack overflow, R-help, by email to me etc. It is not a problem to get the package on CRAN because, I guess, the CRAN check machines already have the three bioconductor packages installed.
Therefore, I wonder if there is a way of specifying, in the DESCRIPTION file or elsewhere, that these packages should be installed automatically from bioconductor.
An alternative would be if one could force the error message
ERROR: dependency ‘graph’ is not available for package ‘gRbase’
to be accompanied by a message about what the user then should do.
Any good suggestions? Thanks in advance.
Best regards
Søren
[[alternative HTML version deleted]]
______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list