Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check connectivity before creating hub accessors #93

Merged
merged 6 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: depmap
Type: Package
Title: Cancer Dependency Map Data Package
Version: 1.17.4
Version: 1.17.5
Authors@R: c(person(given = "Laurent", family = "Gatto",
email = "[email protected]",
comment = c(ORCID = "0000-0002-1520-2268"),
Expand Down Expand Up @@ -33,6 +33,7 @@ Imports:
AnnotationHub,
BiocFileCache,
httr2,
curl,
tibble
License: Artistic-2.0
Encoding: UTF-8
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ importFrom(BiocFileCache,bfcquery)
importFrom(BiocFileCache,bfcrpath)
importFrom(ExperimentHub,ExperimentHub)
importFrom(ExperimentHub,createHubAccessors)
importFrom(curl,has_internet)
importFrom(httr2,req_perform)
importFrom(httr2,request)
importFrom(httr2,resp_body_json)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# depmap 1.17

## Changes in version 1.17.5

- Check if there's internet connectivity before creating hub
accessors.

## Changes in version 1.17.4

- Fix .onLoad() to create Hub accessors for all experiments, including
Expand Down
15 changes: 14 additions & 1 deletion R/loading_functions.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
##' @importFrom utils read.csv
##' @importFrom ExperimentHub createHubAccessors
.createDepMapHubAccessors <- function(pkgname = "depmap") {
fls <- dir(system.file("extdata", pkgname),
full.names = TRUE, pattern = "metadata")
sapply(fls,
function(fl) {
titles <- read.csv(fl, stringsAsFactors = FALSE)$Title
ExperimentHub::createHubAccessors(pkgname, titles)
})
}


##' @importFrom AnnotationHub query
##' @importFrom ExperimentHub ExperimentHub

Expand All @@ -9,7 +22,7 @@ depmap_data_loading <- function(name) {
}

#' @export
depmap_rnai <- function()
depmap_rnai <- function()
depmap_data_loading("rnai")

#' @export
Expand Down
15 changes: 6 additions & 9 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
##' @importFrom utils read.csv
##' @importFrom ExperimentHub createHubAccessors
##' @importFrom curl has_internet
.onLoad <- function(libname, pkgname) {
fls <- dir(system.file("extdata", package = pkgname),
full.names = TRUE, pattern = "metadata")
sapply(fls,
function(fl) {
titles <- read.csv(fl, stringsAsFactors = FALSE)$Title
ExperimentHub::createHubAccessors(pkgname, titles)
})
if (curl::has_internet())
.createDepMapHubAccessors()
else
warning("Not internet connectivity. Unable to create Hub accessors.",
call. = FALSE)
}

.onAttach <- function(libname, pkgname) {
Expand Down
Loading