library(knitr)
library(pander)
library(microbenchmark)
library(ieugwasr)
#> API: public: http://gwas-api.mrcieu.ac.uk/

Get a set of SNPs too query:

a <- tophits("ieu-a-2")
#> Using access token. For info on how this is used see logging_info()
#> ℹ 2021-01-31 14:57:07 > Setting client.id from options(googleAuthR.client_id)
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
rsid <- a$rsid
chrpos <- paste0(a$chr, ":", a$position)
length(rsid)
#> [1] 79

1. Comparison of rsid lookup vs chromosome:position

mbm <- microbenchmark("rsid" = {
        b <- associations(rsid, "ieu-a-7", proxies=0)
    },
    "chrpos" = {
        b <- associations(chrpos, "ieu-a-7", proxies=0)
    }, times=10
)
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
kable(summary(mbm))
expr min lq mean median uq max neval
rsid 344.8312 401.4341 414.0923 410.5237 419.3438 504.0431 10
chrpos 373.0604 416.8096 961.1491 491.6935 627.1959 5020.6605 10

2. Single range query

Specify a range, and then get the corresponding rsIDs in that range

radius <- 100000
chrpos <- paste0(a$chr[1], ":", a$position[1]-100000, "-", a$position[1]+100000)
b <- associations(chrpos, "ieu-a-7", proxies=0)
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
rsid <- b$rsid

This is a 210^{5} size window, which has 586 variants to lookup.

mbm <- microbenchmark("rsid" = {
        b <- associations(rsid, "ieu-a-7", proxies=0)
    },
    "chrpos" = {
        b <- associations(chrpos, "ieu-a-7", proxies=0)
    }, times=10
)
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
kable(summary(mbm))
expr min lq mean median uq max neval
rsid 453.2393 481.4460 891.1391 545.4694 640.9918 3809.8569 10
chrpos 423.6441 436.9337 526.9655 499.8642 591.3069 796.8022 10

3. Multiple range queries

Specify multiple ranges, and then get the corresponding rsIDs across all those ranges

chrpos <- paste0(a$chr, ":", a$position-10000, "-", a$position+10000)
b <- associations(chrpos, "ieu-a-7", proxies=0)
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
rsid <- b$rsid

This 79 ranges of 210^{4} size window, which is covered by 4508 variants to lookup.

mbm <- microbenchmark("rsid" = {
        b <- associations(rsid, "ieu-a-7", proxies=0)
    },
    "chrpos" = {
        b <- associations(chrpos, "ieu-a-7", proxies=0)
    }, times=5
)
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
#> Using access token. For info on how this is used see logging_info()
#> Using an auto-discovered, cached token.
#> To suppress this message, modify your code or options to clearly consent to the use of a cached token.
#> See gargle's "Non-interactive auth" vignette for more details:
#> https://gargle.r-lib.org/articles/non-interactive-auth.html
#> The googleAuthR package is using a cached token for explodecomputer@gmail.com.
kable(summary(mbm))
expr min lq mean median uq max neval
rsid 1.191603 1.240564 1.630391 1.501174 2.010201 2.208413 5
chrpos 1.014107 1.032428 1.958905 1.155843 2.290589 4.301558 5