Skip to content

Commit

Permalink
Switch from RCurl::url_exists() to !httr::http_error()
Browse files Browse the repository at this point in the history
Recommended by @ChristopherWilks + discussed also with @nellore
  • Loading branch information
lcolladotor committed May 6, 2023
1 parent 70efda3 commit 4e217d7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Imports:
rtracklayer,
S4Vectors,
utils,
RCurl,
httr,
data.table,
R.utils,
Matrix,
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ importFrom(GenomicRanges,GRanges)
importFrom(GenomicRanges,mcols)
importFrom(Matrix,readMM)
importFrom(R.utils,gunzip)
importFrom(RCurl,url.exists)
importFrom(S4Vectors,DataFrame)
importFrom(SummarizedExperiment,"assayNames<-")
importFrom(SummarizedExperiment,"colData<-")
Expand All @@ -39,6 +38,7 @@ importFrom(SummarizedExperiment,assayNames)
importFrom(SummarizedExperiment,assays)
importFrom(SummarizedExperiment,colData)
importFrom(data.table,fread)
importFrom(httr,http_error)
importFrom(methods,is)
importFrom(rtracklayer,import.gff)
importFrom(sessioninfo,package_info)
Expand Down
4 changes: 2 additions & 2 deletions R/file_retrieve.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @export
#' @importFrom BiocFileCache bfcrpath
#' @importFrom methods is
#' @importFrom RCurl url.exists
#' @importFrom httr http_error
#'
#' @family internal functions for accessing the recount3 data
#' @examples
Expand Down Expand Up @@ -56,7 +56,7 @@ file_retrieve <-
## In case the url is a local file, there's no need to cache it then
if (file.exists(url)) {
return(url)
} else if (!url.exists(url)) {
} else if (http_error(url)) {
if (!grepl("tcga\\.recount_pred|gtex\\.recount_pred", url)) {
warning("The 'url' <",
url,
Expand Down
4 changes: 2 additions & 2 deletions R/project_homes.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#'
#' @return A `character()` vector with the available `project_home` options.
#'
#' @importFrom RCurl url.exists
#' @importFrom httr http_error
#' @family internal functions for accessing the recount3 data
#' @export
#'
Expand Down Expand Up @@ -43,7 +43,7 @@ project_homes <-
## Construct the URL for the homes_index file
homes_url <-
paste(recount3_url, organism, "homes_index", sep = "/")
if (url.exists(homes_url)) {
if (!http_error(homes_url)) {
homes_from_url <- readLines(homes_url)

## Cache the result for the resulting organism so we don't need
Expand Down
4 changes: 2 additions & 2 deletions vignettes/recount3-quickstart.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bib <- c(
interactiveDisplayBase = citation("interactiveDisplayBase")[1],
rtracklayer = citation("rtracklayer")[1],
S4Vectors = citation("S4Vectors")[1],
RCurl = citation("RCurl")[1],
httr = citation("httr")[1],
data.table = citation("data.table")[1],
R.utils = citation("R.utils")[1],
Matrix = citation("Matrix")[1],
Expand Down Expand Up @@ -564,13 +564,13 @@ The `r Biocpkg('recount3')` package `r citep(bib[['recount3']])` was made possib
* `r CRANpkg('covr')` `r citep(bib[['covr']])`
* `r CRANpkg('data.table')` `r citep(bib[['data.table']])`
* `r Biocpkg('GenomicRanges')` `r citep(bib[['GenomicRanges']])`
* `r CRANpkg('httr')` `r citep(bib[['httr']])`
* `r Biocpkg('interactiveDisplayBase')` `r citep(bib[['interactiveDisplayBase']])`
* `r CRANpkg('knitcitations')` `r citep(bib[['knitcitations']])`
* `r CRANpkg('knitr')` `r citep(bib[['knitr']])`
* `r CRANpkg('Matrix')` `r citep(bib[['Matrix']])`
* `r CRANpkg('pryr')` `r citep(bib[['pryr']])`
* `r CRANpkg('RefManageR')` `r citep(bib[['RefManageR']])`
* `r CRANpkg('RCurl')` `r citep(bib[['RCurl']])`
* `r CRANpkg('rmarkdown')` `r citep(bib[['rmarkdown']])`
* `r Biocpkg('rtracklayer')` `r citep(bib[['rtracklayer']])`
* `r CRANpkg('R.utils')` `r citep(bib[['R.utils']])`
Expand Down

0 comments on commit 4e217d7

Please sign in to comment.