Skip to content

Instantly share code, notes, and snippets.

@privefl
Created March 27, 2019 10:15
Show Gist options
  • Save privefl/5be43e0dda189764ec34466fd3d2e239 to your computer and use it in GitHub Desktop.
Save privefl/5be43e0dda189764ec34466fd3d2e239 to your computer and use it in GitHub Desktop.
Download T1D summary statistics
urls <- gsubfn::strapply(
readLines("https://datadryad.org//resource/doi:10.5061/dryad.ns8q3"),
"<a href=\"(/bitstream/handle/10255/dryad\\.[0-9]+/meta_chr_[0-9]+\\?sequence=1)\">",
simplify = 'c')
sumstats <- purrr::map_dfr(urls, ~ {
download.file(paste0("https://datadryad.org", .x),
destfile = (tmp <- tempfile(fileext = ".txt")))
sumstats <- bigreadr::fread2(
tmp, select = c("chromosome", "position", "a0", "a1",
"beta.meta", "p.meta", "info_score.A", "info_score.I"))
na.omit(sumstats)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment