import_sumstats {MungeSumstats}R Documentation

Import full genome-wide GWAS summary statistics from Open GWAS

Description

Requires internet access to run.

Usage

import_sumstats(
  ids,
  vcf_dir = tempdir(),
  vcf_download = TRUE,
  save_dir = tempdir(),
  write_vcf = FALSE,
  download_method = "download.file",
  quiet = TRUE,
  force_new_vcf = FALSE,
  nThread = 1,
  parallel_across_ids = FALSE,
  ...
)

Arguments

ids

List of Open GWAS study IDs (e.g. c("prot-a-664", "ieu-b-4760")).

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.

save_dir

Directory to save formatted summary statistics in.

write_vcf

Whether to write as VCF (TRUE) or tabular file (FALSE).

download_method

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

quiet

Run quietly.

force_new_vcf

Overwrite a previously downloaded VCF with the same path name.

nThread

Number of threads to use for parallel processes.

parallel_across_ids

If parallel_across_ids=TRUE and nThread>1, then each ID in ids will be processed in parallel.

...

Additional arguments passed to format_sumstats.

Value

Either a named list of data objects or paths, depending on the arguments passed to format_sumstats.

Examples

#only run the examples if user has internet access:
if(try(is.character(getURL("www.google.com")))==TRUE){
### Search by criteria
metagwas <- find_sumstats(
    traits = c("parkinson", "alzheimer"),
    min_sample_size = 5000
)
### Only use a subset for testing purposes
ids <- (dplyr::arrange(metagwas, nsnp))$id

### Default usage
## You can supply \code{import_sumstats()}
## with a list of as many OpenGWAS IDs as you want,
## but we'll just give one to save time.

## Call uses reference genome as default with more than 2GB of memory,
## which is more than what 32-bit Windows can handle so remove certain checks
## commented out down to runtime
# datasets <- import_sumstats(ids = ids[1])
}

[Package MungeSumstats version 1.2.4 Index]