-
Notifications
You must be signed in to change notification settings - Fork 0
/
bioc-dependencies.R
43 lines (40 loc) · 1.16 KB
/
bioc-dependencies.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#' Get dependencies of a package in Bioconductor
#'
#' @description This function queries Bioconductor for dependencies of the
#' selected package for given Bioconductor release.
#'
#' @template package
#' @template bioc-release
#'
#' @return A data frame with three columns, all in string format:
#' * `package` (package name),
#' * `version` (minimum version requirement or `NA` if none),
#' * `type` (dependency type, e.g. `"Imports"`).
#'
#' @examples
#' \donttest{
#' wood_bioc_dependencies("Biostrings")
#'
#' # Will dependencies change?
#' wood_bioc_dependencies("Biostrings", "devel")
#' # And what about dependencies in the past?
#' wood_bioc_dependencies("Biostrings", "2.10")
#' wood_bioc_dependencies("Biostrings", "1.5")
#' }
#'
#' @family bioc
#' @family dependencies
#' @export
wood_bioc_dependencies <- function(package, release = "release") {
assert_param_package(package)
assert_param_bioc_release(release)
desc <- bioc_PACKAGES_cache(release)[[package]]
# TODO: extract as validate_bioc_package()
if (is.null(desc)) {
stopf(
"Can't find package `%1$s` in Bioconductor release `%2$s`.",
package, release
)
}
extract_dependencies(desc)
}