Open lmurba opened 5 years ago
Hello,
does download.file fail when you try to download other files? Does the following work from a fresh R session, and if so, does it also work after you've loaded ENCODExplorer?
download.file("https://www.r-project.org/Rlogo.png", destfile="Rlogo.png")
It seems download.file is working fine. The code you provided works when I paste it into a fresh R session as well as after I've loaded in ENCODExplorer.
The file downloads fine from here, so that's probably not the problem. Let's dig in. Are you familiar with the R debugger? download.file has the unfortunate downside of hiding the actual error code from us, so it makes it hard to understand what went wrong with curl.
First, do the following:
options(error=recover)
Then run the problematic code from ENCODExplorer. You will get a prompt that looks something like this:
trying URL 'http://Patate.com/poil'
Error in download.file("http://Patate.com/poil", destfile = "Blah") :
cannot open URL 'http://Patate.com/poil'
In addition: Warning message:
In download.file("http://Patate.com/poil", destfile = "Blah") :
cannot open URL 'http://Patate.com/poil': HTTP status was '404 Not Found'
Enter a frame number, or 0 to exit
1: download.file("http://Patate.com/poil", destfile = "Blah")
Selection:
Except you will have a different error, and more stack frames. Select the frame which says "download.file" and print the status variable by typing out it's name, like you would do in the normal R interpreter. Please also do the same with the url variable, and see if you can download it using your favourite web browser.
That should give us enough information to start figuring out the root of the issue!
The curl exit status was 127 and I was able to download the file outside of R without a problem.
I think the issue might be with the method="curl" argument in the following line download.file(url = paste0(encode_root, href), quiet = TRUE, destfile = fileName, method = "curl", extra = "-L
When I remove that argument and run the code separately it works fine. See code below: download.file("https://www.encodeproject.org/files/ENCFF001VCK/@@download/ENCFF001VCK.bed.gz", destfile = "ENCFF001VCK.bed.gz")
Exit code 127 means "Command not found". Could you try installing curl and try again? You can find it here: https://curl.haxx.se/windows/ . You might need to restart after the installation, just to be sure curl is on the PATH when R starts.
I understand this is cumbersome. I'll look into making ENCODExplorer not dependant on curl in the next release.
Hello,
I'm having issues using the downloadEncode() function. I'm trying to follow along with the tutorial and run the following code: query_results <- queryEncode(assay = "switchgear", target ="elavl1", file_format = "bed" , fixed = FALSE) downloadEncode(query_results)
I get the following error: Error in download.file(url = paste0(encode_root, href), quiet = TRUE, : 'curl' call had nonzero exit status
I really appreciate any help!
Matrix products: default
locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] curl_3.3 ENCODExplorer_2.10.0 shinythemes_1.1.2 DT_0.6 shiny_1.3.2
loaded via a namespace (and not attached): [1] Rcpp_1.0.1 compiler_3.6.0 pillar_1.4.1
[4] later_0.8.0 BiocManager_1.30.4 dbplyr_1.4.0
[7] AnnotationHub_2.16.0 tools_3.6.0 digest_0.6.19
[10] bit_1.1-14 jsonlite_1.6 RSQLite_2.1.1
[13] memoise_1.1.0 BiocFileCache_1.8.0 tibble_2.1.2
[16] pkgconfig_2.0.2 rlang_0.3.4 DBI_1.0.0
[19] yaml_2.2.0 parallel_3.6.0 stringr_1.4.0
[22] httr_1.4.0 dplyr_0.8.1 IRanges_2.18.1
[25] rappdirs_0.3.1 htmlwidgets_1.3 S4Vectors_0.22.0
[28] stats4_3.6.0 bit64_0.9-7 tidyselect_0.2.5
[31] data.table_1.12.2 Biobase_2.44.0 glue_1.3.1
[34] R6_2.4.0 AnnotationDbi_1.46.0 tidyr_0.8.3
[37] purrr_0.3.2 blob_1.1.1 magrittr_1.5
[40] promises_1.0.1 htmltools_0.3.6 BiocGenerics_0.30.0
[43] assertthat_0.2.1 interactiveDisplayBase_1.22.0 mime_0.6
[46] xtable_1.8-4 httpuv_1.5.1 stringi_1.4.3
[49] crayon_1.3.4