lawremi / rtracklayer

R interface to genome annotation files and the UCSC genome browser
Other
28 stars 17 forks source link

restfulr can not process https #104

Open qiyubio opened 10 months ago

qiyubio commented 10 months ago

Hi, I think restfulr::RestUri can only process http, and that explain this error:

rtracklayer::ucscGenomes()
Error in names(df) <- names : attempt to set an attribute on NULL

This could be fixed by replace https with http.

https://github.com/lawremi/rtracklayer/blob/2f6627c04895e2edea03f3daa26a6d0e8e2d4a7a/R/ucsc.R#L1486

Should be changed to

url <- RestUri("http://api.genome.ucsc.edu/")

Although there are other part of the code using RestUri needs to be fix too.

qiyubio commented 10 months ago

sessionInfo()

R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Rocky Linux 8.7 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: /usr/local/intel/2022.1.2.146/mkl/2022.0.2/lib/intel64/libmkl_rt.so.2;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: America/New_York
tzcode source: system (glibc)

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] rtracklayer_1.62.0   GenomicRanges_1.54.1 GenomeInfoDb_1.36.4
[4] IRanges_2.36.0       S4Vectors_0.40.1     BiocGenerics_0.48.1

loaded via a namespace (and not attached):
 [1] Matrix_1.6-1.1              compiler_4.3.0
 [3] rjson_0.2.21                crayon_1.5.2
 [5] SummarizedExperiment_1.32.0 Biobase_2.62.0
 [7] stringr_1.5.1               Rsamtools_2.18.0
 [9] bitops_1.0-7                Biostrings_2.70.1
[11] GenomicAlignments_1.38.0    parallel_4.3.0
[13] BiocParallel_1.36.0         yaml_2.3.7
[15] lattice_0.22-5              XVector_0.42.0
[17] S4Arrays_1.2.0              XML_3.99-0.15
[19] DelayedArray_0.28.0         MatrixGenerics_1.14.0
[21] GenomeInfoDbData_1.2.11     rlang_1.1.2
[23] stringi_1.8.1               SparseArray_1.2.2
[25] cli_3.6.1                   magrittr_2.0.3
[27] zlibbioc_1.48.0             grid_4.3.0
[29] lifecycle_1.0.4             glue_1.6.2
[31] codetools_0.2-19            abind_1.4-5
[33] RCurl_1.98-1.13             restfulr_0.0.15
[35] matrixStats_1.1.0           tools_4.3.0
[37] BiocIO_1.12.0
sanchit-saini commented 10 months ago

I tested it and could not replicate it. Can you make sure all packages are updated to the latest Bioconductor 3.18 (release)? By running following code and test it again whether it is fixed or not:

BiocManager::install(version = "3.18")

Tests

library(restfulr)
response <- read(RestUri('https://api.genome.ucsc.edu/list/ucscGenomes'))
length(response)
# [1] 5
head(response, n = 4)
# $downloadTime
# [1] "2023:11:24T11:36:14Z"
#
# $downloadTimeStamp
# [1] 1700825774
#
# $dataTime
# [1] "2022-11-08T08:23:50"
# 
# $dataTimeStamp
# [1] 1667924630
library(rtracklayer)
genomes <- ucscGenomes()
length(genomes)
# [1] 4
nrow(genomes)
# [1] 220

sessionInfo

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.11.0
LAPACK: /usr/lib/liblapack.so.3.11.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Asia/Kolkata
tzcode source: system (glibc)

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] restfulr_0.0.15      rtracklayer_1.62.0   GenomicRanges_1.54.1
[4] GenomeInfoDb_1.38.1  IRanges_2.36.0       S4Vectors_0.40.1
[7] BiocGenerics_0.48.1

loaded via a namespace (and not attached):
 [1] crayon_1.5.2                DelayedArray_0.28.0
 [3] SummarizedExperiment_1.32.0 GenomicAlignments_1.38.0
 [5] rjson_0.2.21                RCurl_1.98-1.13
 [7] Biostrings_2.70.1           XML_3.99-0.14
 [9] MatrixGenerics_1.14.0       Biobase_2.62.0
[11] grid_4.3.2                  abind_1.4-5
[13] bitops_1.0-7                yaml_2.3.7
[15] compiler_4.3.2              codetools_0.2-19
[17] XVector_0.42.0              BiocParallel_1.36.0
[19] lattice_0.22-5              SparseArray_1.2.2
[21] BiocIO_1.12.0               parallel_4.3.2
[23] GenomeInfoDbData_1.2.11     Matrix_1.6-3
[25] tools_4.3.2                 matrixStats_1.1.0
[27] Rsamtools_2.18.0            zlibbioc_1.48.0
[29] S4Arrays_1.2.0
qiyubio commented 10 months ago

rtracklayer_1.62.0 is only available for BioC/3.18. I guess the only difference here is the R version, although I'm not sure if that would be the cause of issue.