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()
#> 2020-06-02 22:24:49> 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 349.2708 362.3545 413.5798 391.8393 437.9318 558.6509 10
chrpos 647.5397 688.9757 762.7688 796.6377 819.8019 845.2381 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.1739 578.9551 996.0897 1024.7580 1399.215 1460.228 10
chrpos 415.3743 474.9557 797.7826 586.3585 1342.320 1578.603 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.129369 1.145415 1.265160 1.265862 1.362830 1.422321 5
chrpos 2.387010 2.492825 2.549765 2.509175 2.556637 2.803176 5