Download file

Generic function for downloading files with a variety of methods, including multi-threaded downloading of a single file with axel.

rda_url <- "https://github.com/RajLabMSSM/echolocatoR/raw/master/data/BST1.rda"
out_path <- downloadR::downloader(input_url = rda_url,
                                  download_method = "axel")
## Downloading with axel (using 11 cores).
## + CONDA:: Identified axel executable in echoR env.
## Time difference of 2.717356 secs
BST1 <- downloadR::load_rdata(out_path)

Download VCF

More specialized downloading function for Variant Call Format (VCF) files that downloads both the VCF and its index file (if available).

vcf_url <- "https://gwas.mrcieu.ac.uk/files/ieu-a-298/ieu-a-298.vcf.gz"
out_paths <- downloadR::download_vcf(vcf_url = vcf_url)
## Downloading VCF ==> /var/folders/zq/h7mtybc533b1qzkys_ttgpth0000gn/T//RtmpVYiT6M/ieu-a-298.vcf.gz
## Downloading with download.file.
## Time difference of 0.28791 secs
## Downloading VCF index ==> https://gwas.mrcieu.ac.uk/files/ieu-a-298/ieu-a-298.vcf.gz.tbi
## Downloading with download.file.
## Time difference of 0.2106071 secs

Session Info

utils::sessionInfo()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] downloadR_0.99.0 BiocStyle_2.20.2
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.7          bslib_0.2.5.1       compiler_4.1.0     
##  [4] BiocManager_1.30.16 jquerylib_0.1.4     remotes_2.4.0      
##  [7] prettyunits_1.1.1   tools_4.1.0         testthat_3.0.4     
## [10] digest_0.6.27       pkgbuild_1.2.0      pkgload_1.2.1      
## [13] lattice_0.20-44     lifecycle_1.0.0     jsonlite_1.7.2     
## [16] evaluate_0.14       memoise_2.0.0       png_0.1-7          
## [19] rlang_0.4.11        Matrix_1.3-4        cli_3.0.1          
## [22] rstudioapi_0.13     parallel_4.1.0      yaml_2.2.1         
## [25] pkgdown_1.6.1       xfun_0.25           fastmap_1.1.0      
## [28] echoconda_0.99.0    withr_2.4.2         stringr_1.4.0      
## [31] knitr_1.33          desc_1.3.0          fs_1.5.0           
## [34] sass_0.4.0          systemfonts_1.0.2   devtools_2.4.2     
## [37] grid_4.1.0          rprojroot_2.0.2     reticulate_1.20    
## [40] glue_1.4.2          R6_2.5.1            textshaping_0.3.5  
## [43] processx_3.5.2      rmarkdown_2.10      bookdown_0.23      
## [46] sessioninfo_1.1.1   purrr_0.3.4         callr_3.7.0        
## [49] magrittr_2.0.1      usethis_2.0.1       ps_1.6.0           
## [52] htmltools_0.5.2     ellipsis_0.3.2      ragg_1.1.3         
## [55] stringi_1.7.4       cachem_1.0.6        crayon_1.4.1