Ideally, we would use gwasvcf instead but it hasn't been made available on CRAN or Bioconductor yet, so we can't include it as a dep.

download_vcf(
  vcf_url,
  vcf_dir = tempdir(),
  vcf_download = TRUE,
  download_method = "download.file",
  force_new = FALSE,
  quiet = FALSE,
  timeout = 10 * 60,
  nThread = 1
)

Arguments

vcf_url

Remote URL to VCF file.

vcf_dir

Where to download the original VCF from Open GWAS. WARNING: This is set to tempdir() by default. This means the raw (pre-formatted) VCFs be deleted upon ending the R session. Change this to keep the raw VCF file on disk (e.g. vcf_dir="./raw_vcf").

vcf_download

Download the original VCF from Open GWAS.

download_method

"axel" (multi-threaded) or "download.file" (single-threaded) .

force_new

Overwrite a previously downloaded VCF with the same path name.

quiet

Run quietly.

timeout

How many seconds before giving up on download. Passed to download.file. Default: 10*60 (10min).

nThread

Number of threads to parallelize over.

Value

List containing the paths to the downloaded VCF and its index file.

Examples

#only run the examples if user has internet access:
if(try(is.character(getURL("www.google.com")))==TRUE){
vcf_url <- "https://gwas.mrcieu.ac.uk/files/ieu-a-298/ieu-a-298.vcf.gz"
out_paths <- download_vcf(vcf_url = vcf_url)
}
#> Error in getURL("www.google.com") : could not find function "getURL"