Skip to content

Commit

Permalink
Fix #69
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Feb 23, 2023
1 parent 77ea4a0 commit ca6ffd3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Imports:
pkgsearch,
remotes,
utils,
gh
gh,
vctrs
Depends:
R (>= 3.5.0)
VignetteBuilder: knitr
19 changes: 15 additions & 4 deletions R/memo_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,21 @@ NULL
if (bioc_version != "release" && utils::compareVersion(bioc_version, "2.0") == -1) {
stop("Bioconductor versions < 2.0 are not supported.", call. = FALSE)
}
con <- url(paste0("http://bioconductor.org/packages/", bioc_version, "/bioc/VIEWS"))
pkgs <- read.dcf(con)
close(con)
as.data.frame(pkgs)
suffixes <- c("bioc", "data/annotation", "data/experiment", "workflow")
output <- data.frame()
for (suffix in suffixes) {
view_url <- paste0("http://bioconductor.org/packages/", bioc_version, "/", suffix, "/VIEWS")
con <- url(view_url)
tryCatch({
raw_metadata <- suppressWarnings(read.dcf(con))
metadata <- as.data.frame(raw_metadata)
output <- vctrs::vec_rbind(output, metadata)
close(con)
}, error = function(e) {
close(con)
})
}
output
}

.memo_search_bioc <- memoise::memoise(.bioc_package_history, cache = cachem::cache_mem(max_age = 60 * 60))
Expand Down
12 changes: 11 additions & 1 deletion tests/testthat/test_resolve.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,18 @@ test_that("issue 68, correct querying of bioc packages from major releases", {
skip_on_cran()
expect_equal(.query_biocver("2007-04-27")$version, "2.0")
expect_false(is.numeric(.query_biocver("2007-04-27")$version))
expect_error(.query_snapshot_dependencies_bioc("affy", "2014-10-15"), NA)
expect_error(.query_snapshot_dependencies_bioc("affy", "2007-04-15")) ## pre 2.0
expect_error(.query_snapshot_dependencies_bioc("affy", "2007-04-27"), NA)
expect_error(.query_snapshot_dependencies_bioc("affy", "2014-10-15"), NA)
expect_equal(length(resolve("bioc::affy", snapshot_date = "2007-04-27")$ranglets), 1)
expect_equal(length(resolve("bioc::affy", snapshot_date = "2014-10-15")$ranglets), 1)
})

test_that("issue 69, complete bioc information", {
skip_if_offline()
skip_on_cran()
expect_true(nrow(.memo_search_bioc("3.3")) > 1211)
expect_true("affydata" %in% .memo_search_bioc("3.3")$Package)
expect_equal(.normalize_pkg("affydata", "3.3"), "bioc::affydata")
expect_equal(length(resolve("bioc::affydata", snapshot_date = "2016-06-15")$ranglets), 1)
})

0 comments on commit ca6ffd3

Please sign in to comment.