library(downloadR) 

Download file

Multi-threaded

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

input_url <- "https://github.com/RajLabMSSM/Fine_Mapping/raw/master/Data/lead.SNP.coords.csv"
out_path <- downloadR::downloader(input_url = input_url,
                                  download_method = "axel",
                                  ### Set nThread >1 in practice 
                                  nThread = 1)
csv <- utils::read.csv(out_path)
knitr::kable(head(csv))

Single-threaded

out_path <- downloadR::downloader(input_url = input_url,
                                  download_method = "wget",
                                  force_overwrite = TRUE)
csv <- utils::read.csv(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) 

Load R data

load_rdata is a convenience function that can read .rda/.rda/.rdata or .rds files from a local or remote location.

fileName <- paste0("https://github.com/RajLabMSSM/",
                   "Fine_Mapping_Shiny/raw/master/www/BST1.finemap_DT.RDS")
dat <- load_rdata(fileName) 

Session Info

utils::sessionInfo()




RajLabMSSM/downloadR documentation built on May 12, 2024, 3:22 a.m.