diff --git a/DESCRIPTION b/DESCRIPTION index 85b225b..0f83485 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,9 +1,16 @@ Package: ieugwasr Title: R Interface to the OpenGWAS Database API -Version: 0.1.6 -Authors@R: +Version: 0.1.7 +Authors@R: c( person("Gibran", "Hemani", , "g.hemani@bristol.ac.uk", role = c("aut", "cre"), - comment = c(ORCID = "0000-0003-0920-1055")) + comment = c(ORCID = "0000-0003-0920-1055")), + person("Ben", "Elsworth", , "Ben.Elsworth@bristol.ac.uk", role = "aut", + comment = c(ORCID = "0000-0001-7328-4233")), + person("Tom", "Palmer", , "tom.palmer@bristol.ac.uk", role = "aut", + comment = c(ORCID = "0000-0003-4655-4511")), + person("Rita", "Rasteiro", , "rita.rasteiro@bristol.ac.uk", role = "aut", + comment = c(ORCID = "0000-0002-4217-3060")) + ) Description: R interface to the OpenGWAS database API. Includes a wrapper to make generic calls to the API, plus convenience functions for specific queries. @@ -30,3 +37,4 @@ VignetteBuilder: knitr Encoding: UTF-8 Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.1 diff --git a/R/afl2.r b/R/afl2.r index 50bd66b..368c4f1 100644 --- a/R/afl2.r +++ b/R/afl2.r @@ -39,7 +39,7 @@ afl2_list <- function(variantlist=c("reduced", "hapmap3")[1]) afl2_rsid <- function(rsid, reference="1000g") { out <- api_query("variants/afl2", list(rsid=rsid)) %>% get_query_content() - if(class(out) == "response") + if(inherits(out, "response")) { return(out) } else if(is.data.frame(out)) { @@ -60,7 +60,7 @@ afl2_rsid <- function(rsid, reference="1000g") afl2_chrpos <- function(chrpos, reference="1000g") { out <- api_query("variants/afl2", list(chrpos=chrpos)) %>% get_query_content() - if(class(out) == "response") + if(inherits(out, "response")) { return(out) } else if(is.data.frame(out)) { diff --git a/R/api.R b/R/api.R index 7f67f15..bd08463 100644 --- a/R/api.R +++ b/R/api.R @@ -2,10 +2,11 @@ #' #' @param where Which API to use. Choice between `"public"`, `"private"`, `"dev1"`, `"dev2"`. #' Default = `"public"`. +#' @param silent Silent? Default = FALSE #' #' @export #' @return NULL -select_api <- function(where="public") +select_api <- function(where="public", silent=FALSE) { url <- switch(where, public = "http://gwas-api.mrcieu.ac.uk/", @@ -20,7 +21,9 @@ select_api <- function(where="public") } options(ieugwasr_api=url) - message("API: ", where, ": ", url) + if(!silent) { + message("API: ", where, ": ", url) + } } diff --git a/R/query.R b/R/query.R index 3714c6b..aae0d71 100644 --- a/R/query.R +++ b/R/query.R @@ -63,14 +63,14 @@ api_query <- function(path, query=NULL, access_token=check_access_token(), silent=TRUE ) } - if('try-error' %in% class(r)) + if(inherits(r, 'try-error')) { if(grepl("Timeout", as.character(attributes(r)$condition))) { stop("The query to MR-Base exceeded ", timeout, " seconds and timed out. Please simplify the query") } } - if(! 'try-error' %in% class(r)) + if(! inherits(r, 'try-error')) { if(r$status_code >= 500 & r$status_code < 600) { @@ -94,7 +94,7 @@ api_query <- function(path, query=NULL, access_token=check_access_token(), message("Failed to retrieve results from server. See error status message in the returned object and contact the developers if the problem persists.") return(r) } - if('try-error' %in% class(r)) + if(inherits(r, 'try-error')) { if(grepl("Could not resolve host", as.character(attributes(r)$condition))) { @@ -145,11 +145,6 @@ api_status <- function() return(o) } -print.ApiStatus <- function(x) -{ - lapply(names(x), function(y) cat(format(paste0(y, ":"), width=30, justify="right"), x[[y]], "\n")) -} - #' Get list of studies with available GWAS summary statistics through API #' @@ -180,10 +175,6 @@ gwasinfo <- function(id=NULL, access_token = check_access_token()) return(out) } -print.GwasInfo <- function(x) -{ - dplyr::glimpse(x) -} #' Extract batch name from study ID #' @@ -246,7 +237,7 @@ associations <- function(variants, id, proxies=1, r2=0.8, align_alleles=1, palin maf_threshold=maf_threshold ), access_token=access_token) %>% get_query_content() - if(class(out) == "response") + if(inherits(out, "response")) { return(out) } else if(is.data.frame(out)) { @@ -316,7 +307,7 @@ phewas <- function(variants, pval = 0.00001, batch=c(), access_token=check_acces pval=pval, index_list=batch ), access_token=access_token) %>% get_query_content() - if(class(out) != "response") + if(!inherits(out, "response")) { out <- out %>% dplyr::as_tibble() %>% fix_n() if(nrow(out) > 0) @@ -377,7 +368,7 @@ tophits <- function(id, pval=5e-8, clump = 1, r2 = 0.001, kb = 10000, pop="EUR", kb=kb, pop=pop ), access_token=access_token) %>% get_query_content() - if(class(out) == "response") + if(inherits(out, "response")) { return(out) } else if(is.data.frame(out)) { diff --git a/R/variants.R b/R/variants.R index df7daa7..bc26e71 100644 --- a/R/variants.R +++ b/R/variants.R @@ -15,7 +15,7 @@ variants_gene <- function(gene, radius=0) { message("Looking up ", gene[i]) o <- api_query(paste0('variants/gene/', gene[i], "?radius=", format(radius, scientific=FALSE))) %>% get_query_content() - if(class(o) != "response") + if(! inherits(o, "response")) { l[[gene[i]]] <- o %>% dplyr::bind_rows() %>% format_variants() } @@ -35,7 +35,7 @@ variants_gene <- function(gene, radius=0) variants_rsid <- function(rsid) { o <- api_query("variants/rsid", list(rsid = rsid)) %>% get_query_content() - if(! class(o) %in% "response") + if(! inherits(o, "response")) { if(!is.data.frame(o) & is.list(o)) { @@ -62,7 +62,7 @@ variants_chrpos <- function(chrpos, radius=0) { o <- api_query("variants/chrpos", list(chrpos = chrpos, radius=radius)) %>% get_query_content() - if(! class(o) %in% "response") + if(! inherits(o, "response")) { o %>% dplyr::bind_rows() %>% format_variants() %>% return() } else { diff --git a/docs/404.html b/docs/404.html index 0782770..d0f8b20 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,66 +1,27 @@ - - - - + + + + - Page not found (404) • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - -
-
- + +
+ + + - - -
+
+
-
+ + - - diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 80267c5..d0fdc4d 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,66 +1,12 @@ - - - - - - - -License • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -License • ieugwasr - + + - - - -
-
- -
- -
+
+
-
- +
- - + + diff --git a/docs/LICENSE.html b/docs/LICENSE.html index e074a83..287f15a 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -1,66 +1,12 @@ - - - - - - - -MIT License • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MIT License • ieugwasr - + + - - - -
-
- -
- -
+
+
-
- +
- - + + diff --git a/docs/articles/guide.html b/docs/articles/guide.html index 3ed5cb5..10bfc5b 100644 --- a/docs/articles/guide.html +++ b/docs/articles/guide.html @@ -19,6 +19,8 @@ + +
+
-

The IEU GWAS database comprises over 10,000 curated, QC’d and harmonised complete GWAS summary datasets and can be queried using an API. See here for documentation on the API itself. This R package is a wrapper to make generic calls to the API, plus convenience functions for specific queries.

-
-

-Authentication

-

Most datasets in the database are public and don’t need authentication. But if you want to access a private dataset that is linked to your (gmail) email address, you need to authenticate the query using a method known as Google OAuth2.0.

+

The IEU GWAS database +comprises over 10,000 curated, QC’d and harmonised complete GWAS summary +datasets and can be queried using an API. See here for documentation on +the API itself. This R package is a wrapper to make generic calls to the +API, plus convenience functions for specific queries.

+
+

Authentication +

+

Most datasets in the database are public and don’t need +authentication. But if you want to access a private dataset that is +linked to your (gmail) email address, you need to authenticate the query +using a method known as Google OAuth2.0.

Essentially - you run this command at the start of your session:

-
ieugwasr::get_access_token()
-

which will open up a web browser asking you to provide your google username and password, and upon doing so a directory will be created in your working directory called ieugwasr_oauth. This directory contains a file that looks like this: <random_string>_<email@address>. It is a binary file (not human readable), which contains your access token, and it acts as a convenient way to hold a randomly generated password.

-

If you are using a server which doesn’t have a graphic user interface then the ieugwasr::get_access_token() method is not going to work. You need to generate the ieugwasr_oauth directory and token file on a computer that has a web browser, and then copy that directory (containing the token file) to your server (to the relevant work directory).

-

If you are using R in a working directory that does not have write permissions then this command will fail, please navigate to a directory that does have write permissions.

-

If you need to run this in a non-interactive script then you can generate the token file on an interactive computer, copy that file to the working directory that R will be running from, and then run a batch (non-interactive).

+
+ieugwasr::get_access_token()
+

which will open up a web browser asking you to provide your google +username and password, and upon doing so a directory will be created in +your working directory called ieugwasr_oauth. This +directory contains a file that looks like this: +<random_string>_<email@address>. It is a binary +file (not human readable), which contains your access token, and it acts +as a convenient way to hold a randomly generated password.

+

If you are using a server which doesn’t have a graphic user interface +then the ieugwasr::get_access_token() method is not going +to work. You need to generate the ieugwasr_oauth directory +and token file on a computer that has a web browser, and then copy that +directory (containing the token file) to your server (to the relevant +work directory).

+

If you are using R in a working directory that does not have write +permissions then this command will fail, please navigate to a directory +that does have write permissions.

+

If you need to run this in a non-interactive script then you can +generate the token file on an interactive computer, copy that file to +the working directory that R will be running from, and then run a batch +(non-interactive).

You can test to see if you have authenticated using the function

-
ieugwasr::check_access_token()
-

It will return NULL if you are not authenticated, or a long random token string if you are.

-

To unauthenticate, simply delete the relevant file in the ieugwasr_oauth folder, or delete the folder entirely.

+
+ieugwasr::check_access_token()
+

It will return NULL if you are not authenticated, or a +long random token string if you are.

+

To unauthenticate, simply delete the relevant file in the +ieugwasr_oauth folder, or delete the folder entirely.

-
-

-General API queries

-

The API has a number of endpoints documented here. A general way to access them in R is using the api_query function. There are two types of endpoints - GET and POST.

+
+

General API queries +

+

The API has a number of endpoints documented here. A general way to +access them in R is using the api_query function. There are +two types of endpoints - GET and POST.

  • -GET - you provide a single URL which includes the endpoint and query. For example, for the association endpoint you can obtain some rsids in some studies, e.g. +GET - you provide a single URL which includes the +endpoint and query. For example, for the association +endpoint you can obtain some rsids in some studies, e.g.
  • -POST - Here you send a “payload” to the endpoint. So, the path specifies the endpoint and you add a list of query specifications. This is useful for long lists of rsids being queried, for example +POST - Here you send a “payload” to the endpoint. So, +the path specifies the endpoint and you add a list of query +specifications. This is useful for long lists of rsids being queried, +for example
-

The api_query function returns a response object from the httr package. See below for a list of functions that make the input and output to api_query more convenient.

+

The api_query function returns a response +object from the httr package. See below for a list of +functions that make the input and output to api_query more +convenient.

-
-

-Get API status

- +
+

Get API status +

+
-
-

-Get list of all available studies

- +
+

Get list of all available studies +

+
-
-

-Get list of a specific study

-
-gwasinfo("ieu-a-2")
+
+

Get list of a specific study +

+
+gwasinfo("ieu-a-2")
-
-

-Extract particular associations from particular studies

+
+

Extract particular associations from particular studies +

Provide a list of variants to be obtained from a list of studies:

-
-associations(variants=c("rs123", "7:105561135"), id=c("ieu-a-2", "ieu-a-7"))
-

By default this will look for LD proxies using 1000 genomes reference data (Europeans only, the reference panel has INDELs removed and only retains SNPs with MAF > 0.01). This behaviour can be turned off using proxies=0 as an argument.

-

Note that the queries are performed on rsids, but chromosome:position values will be automatically converted. A range query can be done using e.g.

-
-associations(variants="7:105561135-105563135", id=c("ieu-a-2"), proxies=0)
+
+associations(variants=c("rs123", "7:105561135"), id=c("ieu-a-2", "ieu-a-7"))
+

By default this will look for LD proxies using 1000 genomes reference +data (Europeans only, the reference panel has INDELs removed and only +retains SNPs with MAF > 0.01). This behaviour can be turned off using +proxies=0 as an argument.

+

Note that the queries are performed on rsids, but chromosome:position +values will be automatically converted. A range query can be done using +e.g.

+
+associations(variants="7:105561135-105563135", id=c("ieu-a-2"), proxies=0)
-
-

-Get the tophits from a study

+
+

Get the tophits from a study +

The tophits can be obtained using

-
tophits(id="ieu-a-2")
-

Note that it will perform strict clumping by default (r2 = 0.001 and radius = 10000kb). This can be turned off with clump=0.

+
+tophits(id="ieu-a-2")
+

Note that it will perform strict clumping by default (r2 = 0.001 and +radius = 10000kb). This can be turned off with clump=0.

-
-

-Perform PheWAS

-

Lookup association of specified variants across every study, returning at a particular threshold. Note that no LD proxy lookups are made here.

-
phewas(variants="rs1205", pval=1e-5)
-

PheWAS can also be performed in only specific subsets of the data. The datasets in the IGD are organised by batch, you can see info about it here: https://gwas.mrcieu.ac.uk/datasets/ or get a list of batches and their descriptions using:

-
batches()
+
+

Perform PheWAS +

+

Lookup association of specified variants across every study, +returning at a particular threshold. Note that no LD proxy lookups are +made here.

+
+phewas(variants="rs1205", pval=1e-5)
+

PheWAS can also be performed in only specific subsets of the data. +The datasets in the IGD are organised by batch, you can see info about +it here: https://gwas.mrcieu.ac.uk/datasets/ or get a list of +batches and their descriptions using:

+

You can perform PheWAS in only specified batches using:

-
phewas(variants="rs1205", pval=1e-5, batch=c('ieu-a', 'ukb-b'))
-

By default PheWAS is performed in all batches (which is of course somewhat slower).

+
+phewas(variants="rs1205", pval=1e-5, batch=c('ieu-a', 'ukb-b'))
+

By default PheWAS is performed in all batches (which is of course +somewhat slower).

-
-

-LD clumping

-

The API has a wrapper around plink version 1.90 and can use it to perform clumping with an LD reference panel from 1000 genomes reference data.

-
a <- tophits(id="ieu-a-2", clump=0)
-b <- ld_clump(
-    dplyr::tibble(rsid=a$name, pval=a$p, id=a$id)
-)
-

There are 5 super-populations that can be requested via the pop argument. By default this will use the Europeans subset (EUR super-population). The reference panel has INDELs removed and only retains SNPs with MAF > 0.01 in the selected population.

-

Note that you can perform the same operation locally if you provide a path to plink and a bed/bim/fam LD reference dataset. e.g.

-
ld_clump(
-    dplyr::tibble(rsid=a$name, pval=a$p, id=a$id),
-    plink_bin = "/path/to/plink",
-    bfile = "/path/to/reference_data"
-)
+
+

LD clumping +

+

The API has a wrapper around plink version 1.90 and +can use it to perform clumping with an LD reference panel from 1000 +genomes reference data.

+
+a <- tophits(id="ieu-a-2", clump=0)
+b <- ld_clump(
+    dplyr::tibble(rsid=a$name, pval=a$p, id=a$id)
+)
+

There are 5 super-populations that can be requested via the +pop argument. By default this will use the Europeans subset +(EUR super-population). The reference panel has INDELs removed and only +retains SNPs with MAF > 0.01 in the selected population.

+

Note that you can perform the same operation locally if you provide a +path to plink and a bed/bim/fam LD reference dataset. e.g.

+
+ld_clump(
+    dplyr::tibble(rsid=a$name, pval=a$p, id=a$id),
+    plink_bin = "/path/to/plink",
+    bfile = "/path/to/reference_data"
+)

See the following vignette for more information: Running local LD operations

-
-

-LD matrix

+
+

LD matrix +

Similarly, a matrix of LD r values can be generated using

-
ld_matrix(b$variant)
-

This uses the API by default but is limited to only 500 variants. You can use, instead, local plink and LD reference data in the same manner as in the ld_clump function, e.g.

-
ld_matrix(b$variant, plink_bin = "/path/to/plink", bfile = "/path/to/reference_data")
-

There are 5 super-populations that can be requested via the pop argument. By default this will use the Europeans subset (EUR super-population). The reference panel has INDELs removed and only retains SNPs with MAF > 0.01 in the selected population.

+
+ld_matrix(b$variant)
+

This uses the API by default but is limited to only 500 variants. You +can use, instead, local plink and LD reference data in the same manner +as in the ld_clump function, e.g.

+
+ld_matrix(b$variant, plink_bin = "/path/to/plink", bfile = "/path/to/reference_data")
+

There are 5 super-populations that can be requested via the +pop argument. By default this will use the Europeans subset +(EUR super-population). The reference panel has INDELs removed and only +retains SNPs with MAF > 0.01 in the selected population.

Super-populations:

  • EUR = European
  • @@ -217,66 +284,83 @@

See the following vignette for more information: Running local LD operations

-
-

-Variant information

-

Translating between rsids and chromosome:position, while also getting other information, can be achieved.

+
+

Variant information +

+

Translating between rsids and chromosome:position, while also getting +other information, can be achieved.

The chrpos argument can accept the following

  • <chr>:<position>
  • <chr>:<start>-<end>

For example

-
a <- variants_chrpos(c("7:105561135-105563135", "10:44865737"))
-

This provides a table with dbSNP variant IDs, gene info, and various other metadata. Similar data can be obtained from searching by rsid

-
b <- variants_rsid(c("rs234", "rs333"))
-

And a list of variants within a particular gene region can also be found. Provide a ensembl or entrez gene ID (e.g. ENSG00000123374 or 1017) to the following:

-
c <- variants_gene("ENSG00000123374")
+
+a <- variants_chrpos(c("7:105561135-105563135", "10:44865737"))
+

This provides a table with dbSNP variant IDs, gene info, and various +other metadata. Similar data can be obtained from searching by rsid

+
+b <- variants_rsid(c("rs234", "rs333"))
+

And a list of variants within a particular gene region can also be +found. Provide a ensembl or entrez gene ID (e.g. ENSG00000123374 or +1017) to the following:

+
+c <- variants_gene("ENSG00000123374")
-
-

-Extracting GWAS summary data based on gene region

-

Here is an example of how to obtain summary data for some datasets for a gene region. As an example, we’ll extract CDK2 (HGNC number 1017) from a BMI dataset (ieu-a-2)

-

Use the mygene bioconductor package to query the mygene.info API.

-
-library(mygene)
-a <- mygene::getGene("1017", fields="genomic_pos_hg19")
-r <- paste0(a[[1]]$genomic_pos_hg19$chr, ":", a[[1]]$genomic_pos_hg19$start, "-", a[[1]]$genomic_pos_hg19$end)
-b <- ieugwasr::associations(r, "ieu-a-2")
+
+

Extracting GWAS summary data based on gene region +

+

Here is an example of how to obtain summary data for some datasets +for a gene region. As an example, we’ll extract CDK2 (HGNC number 1017) +from a BMI dataset (ieu-a-2)

+

Use the mygene +bioconductor package to query the mygene.info API.

+
+library(mygene)
+a <- mygene::getGene("1017", fields="genomic_pos_hg19")
+r <- paste0(a[[1]]$genomic_pos_hg19$chr, ":", a[[1]]$genomic_pos_hg19$start, "-", a[[1]]$genomic_pos_hg19$end)
+b <- ieugwasr::associations(r, "ieu-a-2")
-
-

-1000 genomes annotations

-

The OpenGWAS database contains a database of population annotations from the 1000 genomes project - the alternative allele frequencies and the LD scores for each variant, calculated for each super population separately. Only variants are present if they are MAF > 1% in at least one super population. You can access this info in different ways

+
+

1000 genomes annotations +

+

The OpenGWAS database contains a database of population annotations +from the 1000 genomes project - the alternative allele frequencies and +the LD scores for each variant, calculated for each super population +separately. Only variants are present if they are MAF > 1% in at +least one super population. You can access this info in different +ways

  1. Look up a particular set of rsids

    -
    -ieugwasr::afl2_rsid(c("rs234", "rs123"))
    +
    +ieugwasr::afl2_rsid(c("rs234", "rs123"))
  2. Look up a set of positions or regions

    -
    -ieugwasr::afl2_chrpos("1:100000-900000")
    +
    +ieugwasr::afl2_chrpos("1:100000-900000")
  3. -

    Extract annotations for a list of 20k variants that are common in all super populations, and evenly spaced across the genome

    -
    -ieugwasr::afl2_list()
    +

    Extract annotations for a list of 20k variants that are common in +all super populations, and evenly spaced across the genome

    +
    +ieugwasr::afl2_list()
  4. Extract annotations for a 1.3 million HapMap3 variants

    -
    -ieugwasr::afl2_list("hapmap3")
    +
    +ieugwasr::afl2_list("hapmap3")
  5. -

    Infer the ancestry of a particular study by comparing the allele frequencies with different super population reference frequencies

    -
    -snplist <- ieugwasr::afl2_list()
    -eur_example <- associations(snplist$rsid, "ieu-a-2")
    -ieugwasr::infer_ancestry(eur_example, snplist)
    -eas_example <- associations(snplist$rsid, "bbj-a-10")
    -ieugwasr::infer_ancestry(eur_example, snplist)
    +

    Infer the ancestry of a particular study by comparing the allele +frequencies with different super population reference frequencies

    +
    +snplist <- ieugwasr::afl2_list()
    +eur_example <- associations(snplist$rsid, "ieu-a-2")
    +ieugwasr::infer_ancestry(eur_example, snplist)
    +eas_example <- associations(snplist$rsid, "bbj-a-10")
    +ieugwasr::infer_ancestry(eur_example, snplist)
@@ -293,11 +377,13 @@

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.7.

@@ -306,5 +392,7 @@

+ + diff --git a/docs/articles/index.html b/docs/articles/index.html index 7e712c1..1e95014 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,66 +1,12 @@ - - - - - - - -Articles • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Articles • ieugwasr - + + - - - -
-
- -
- - -
- +
- - + + diff --git a/docs/articles/local_ld.html b/docs/articles/local_ld.html index 1f2bc80..cfa1d2e 100644 --- a/docs/articles/local_ld.html +++ b/docs/articles/local_ld.html @@ -19,6 +19,8 @@ + +
+
-

We have tried to provide useful cloud-based functionality for many operations, including relatively demanding LD operations. If you are running a large number of LD operations, we request that you think about performing those locally rather than through the API. We have tried to write the software to enable this to work seamlessly. Some examples below.

+

We have tried to provide useful cloud-based functionality for many +operations, including relatively demanding LD operations. If you are +running a large number of LD operations, we request that you think about +performing those locally rather than through the API. We have tried to +write the software to enable this to work seamlessly. Some examples +below.

LD operations available on the OpenGWAS API

  • LD clumping
  • Generating LD matrices
  • Looking for LD proxies
-
-library(ieugwasr)
-#> API: public: http://gwas-api.mrcieu.ac.uk/
-
-

-LD clumping

-

The API has a wrapper around plink version 1.90 and can use it to perform clumping with an LD reference panel from 1000 genomes reference data.

-
a <- tophits(id="ieu-a-2", clump=0)
-b <- ld_clump(
-    dplyr::tibble(rsid=a$name, pval=a$p, id=a$id)
-)
-

There are 5 super-populations that can be requested via the pop argument. By default this will use the Europeans subset (EUR super-population). The reference panel has INDELs removed and only retains SNPs with MAF > 0.01 in the selected population.

-

Note that you can perform the same operation locally if you provide a path to plink and a bed/bim/fam LD reference dataset.

+
+library(ieugwasr)
+#> OpenGWAS updates:
+#>   Date: 2024-03-07
+#>   [>] There is exceptional load on the OpenGWAS servers.
+#>   [>] Urgent infrastructure development being performed.
+#>   [>] See local options for analysis: https://mrcieu.github.io/gwasvcf/.
+
+

LD clumping +

+

The API has a wrapper around plink version 1.90 and +can use it to perform clumping with an LD reference panel from 1000 +genomes reference data.

+
+a <- tophits(id="ieu-a-2", clump=0)
+b <- ld_clump(
+    dplyr::tibble(rsid=a$name, pval=a$p, id=a$id)
+)
+

There are 5 super-populations that can be requested via the +pop argument. By default this will use the Europeans subset +(EUR super-population). The reference panel has INDELs removed and only +retains SNPs with MAF > 0.01 in the selected population.

+

Note that you can perform the same operation locally if you provide a +path to plink and a bed/bim/fam LD reference dataset.

To get a path to plink you can do the following:

-
devtools::install_github("explodecomputer/genetics.binaRies")
-genetics.binaRies::get_plink_binary()
-

To get the same LD reference dataset that is used by the API, you can download it directly from here:

-

http://fileserve.mrcieu.ac.uk/ld/1kg.v3.tgz

-

This contains an LD reference panel for each of the 5 super-populations in the 1000 genomes reference dataset. e.g. for the European super population it has the following files:

+
+devtools::install_github("explodecomputer/genetics.binaRies")
+genetics.binaRies::get_plink_binary()
+

To get the same LD reference dataset that is used by the API, you can +download it directly from here:

+

http://fileserve.mrcieu.ac.uk/ld/1kg.v3.tgz

+

This contains an LD reference panel for each of the 5 +super-populations in the 1000 genomes reference dataset. e.g. for the +European super population it has the following files:

  • EUR.bed
  • EUR.bim
  • EUR.fam
-

Now supposing in R you have a dataframe, dat, with the following columns:

+

Now supposing in R you have a dataframe, dat, with the +following columns:

  • rsid
  • pval
  • trait_id

to perform clumping, just do the following:

-
ld_clump(
-    dplyr::tibble(rsid=dat$rsid, pval=dat$pval, id=dat$trait_id),
-    plink_bin = genetics.binaRies::get_plink_binary(),
-    bfile = "/path/to/reference/EUR"
-)
+
+ld_clump(
+    dplyr::tibble(rsid=dat$rsid, pval=dat$pval, id=dat$trait_id),
+    plink_bin = genetics.binaRies::get_plink_binary(),
+    bfile = "/path/to/reference/EUR"
+)
-
-

-LD matrix

+
+

LD matrix +

Similarly, a matrix of LD r values can be generated using

-
ld_matrix(b$variant)
-

This uses the API by default but is limited to only 500 variants. You can use, instead, local plink and LD reference data in the same manner as in the ld_clump function, e.g.

-
ld_matrix(
-    dat$rsid,
-    plink_bin = genetics.binaRies::get_plink_binary(),
-    bfile = "/path/to/reference/EUR"
-)
+
+ld_matrix(b$variant)
+

This uses the API by default but is limited to only 500 variants. You +can use, instead, local plink and LD reference data in the same manner +as in the ld_clump function, e.g.

+
+ld_matrix(
+    dat$rsid,
+    plink_bin = genetics.binaRies::get_plink_binary(),
+    bfile = "/path/to/reference/EUR"
+)
-
-

-LD proxies

-

To automatically extract variants from a dataset, and search for LD proxies when a requested variant is not present in the dataset, please look at the options available in the gwasvcf package:

-

https://mrcieu.github.io/gwasvcf/articles/guide.html#ld-proxies-1

+
+

LD proxies +

+

To automatically extract variants from a dataset, and search for LD +proxies when a requested variant is not present in the dataset, please +look at the options available in the gwasvcf package:

+

https://mrcieu.github.io/gwasvcf/articles/guide.html#ld-proxies-1

@@ -173,11 +197,13 @@

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.7.

@@ -186,5 +212,7 @@

+ + diff --git a/docs/articles/timings.html b/docs/articles/timings.html index 38d7069..754413d 100644 --- a/docs/articles/timings.html +++ b/docs/articles/timings.html @@ -19,6 +19,8 @@ + +
+
-
-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))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exprminlqmeanmedianuqmaxneval
rsid344.8312401.4341414.0923410.5237419.3438504.043110
chrpos373.0604416.8096961.1491491.6935627.19595020.660510
+ +

Get a set of SNPs to query:

+
+a <- tophits("ieu-a-2")
+rsid <- a$rsid
+chrpos <- paste0(a$chr, ":", a$position)
+length(rsid)
+
+

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
+)
+kable(summary(mbm))
-
-

-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))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exprminlqmeanmedianuqmaxneval
rsid453.2393481.4460891.1391545.4694640.99183809.856910
chrpos423.6441436.9337526.9655499.8642591.3069796.802210
+
+

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)
+rsid <- b$rsid
+

Window size

+
+format(radius * 2, scientific = FALSE, big.mark = ",")
+
+length(rsid)
+
+mbm <- microbenchmark("rsid" = {
+        b <- associations(rsid, "ieu-a-7", proxies=0)
+    },
+    "chrpos" = {
+        b <- associations(chrpos, "ieu-a-7", proxies=0)
+    }, times=10
+)
+kable(summary(mbm))
-
-

-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))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exprminlqmeanmedianuqmaxneval
rsid1.1916031.2405641.6303911.5011742.0102012.2084135
chrpos1.0141071.0324281.9589051.1558432.2905894.3015585
+
+

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)
+rsid <- b$rsid
+
+length(chrpos)
+

ranges of

+
+format(20000, scientific = FALSE, big.mark = ",")
+

size window, which is covered by

+
+length(rsid)
+

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
+)
+kable(summary(mbm))
@@ -598,11 +187,13 @@

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.7.

@@ -611,5 +202,7 @@

+ + diff --git a/docs/authors.html b/docs/authors.html index 01e6c81..07b5413 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,66 +1,12 @@ - - - - - - - -Authors • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Authors and Citation • ieugwasr - + + - - - - -
-
-
- -
+
- @@ -144,22 +107,20 @@

Authors

-
- +
- - + + diff --git a/docs/index.html b/docs/index.html index f94f435..67f396a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,20 +5,24 @@ -R interface to the IEU GWAS database API • ieugwasr +R Interface to the OpenGWAS Database API • ieugwasr - - + + + +
-
- +
+ - -

The IEU GWAS database comprises over 10,000 curated, QC’d and harmonised complete GWAS summary datasets and can be queried using an API. See here for documentation on the API itself. This R package is a wrapper to make generic calls to the API, plus convenience functions for specific queries.

+

The IEU GWAS database comprises over 10,000 curated, QC’d and harmonised complete GWAS summary datasets and can be queried using an API. See here for documentation on the API itself. This R package is a wrapper to make generic calls to the API, plus convenience functions for specific queries.

Methods currently implemented:

  • Get meta data about specific or all studies
  • @@ -108,60 +105,74 @@
  • Perform LD clumping using the server, or locally
  • Obtain LD matrices for a list of SNPs using the server or locally (e.g. for fine mapping, colocalisation or Mendelian randomization)
-

See [https://github.com/MRCIEU/gwasglue] for information about how to connect the genotype and LD data to other packages involving colocalisation, finemapping, visualisation and MR.

-
-

-Installation

+

See https://github.com/MRCIEU/gwasglue for information about how to connect the genotype and LD data to other packages involving colocalisation, finemapping, visualisation and MR.

+
+

Installation +

You can install the developer version of ieugwasr with:

-
-devtools::install_github("mrcieu/ieugwasr")
-

Browse the vignettes etc for information on how to use this package: https://mrcieu.github.io/ieugwasr/

+
+remotes::install_github("mrcieu/ieugwasr")
+

Browse the vignettes etc for information on how to use this package: https://mrcieu.github.io/ieugwasr/

- - + + diff --git a/docs/reference/afl2_list.html b/docs/reference/afl2_list.html index 6878b75..fdaf7c1 100644 --- a/docs/reference/afl2_list.html +++ b/docs/reference/afl2_list.html @@ -1,67 +1,15 @@ - - - - - - - -Retrieve a allele frequency and LD scores for pre-defined lists of variants — afl2_list • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Retrieve a allele frequency and LD scores for pre-defined lists of variants — afl2_list • ieugwasr - - - - + + -
-
- -
- -
+
-

Data frame includes 1000 genomes metadata including sample sizes, allele frequency and LD score, separated by 5 super populations (EUR = European, AFR = African, EAS = East Asian, AMR = Admixed American, SAS = South Asian)

+

Data frame includes 1000 genomes metadata including sample sizes, +allele frequency and LD score, separated by 5 super populations +(EUR = European, AFR = African, EAS = East Asian, AMR = Admixed American, +SAS = South Asian)

-
afl2_list(variantlist = c("reduced", "hapmap3")[1])
+
+
afl2_list(variantlist = c("reduced", "hapmap3")[1])
+
-

Arguments

- - - - - - -
variantlist

Choose pre-defined list. reduced = ~20k SNPs that are common in all super populations (default). hapmap3 = ~1.3 million hm3 SNPs

+
+

Arguments

+
variantlist
+

Choose pre-defined list. reduced = ~20k SNPs that are +common in all super populations (default). hapmap3 = ~1.3 million hm3 SNPs

-

Value

+
+
+

Value

+ -

Data frame

+

Data frame

+
+
-
- +
- - + + diff --git a/docs/reference/afl2_rsid.html b/docs/reference/afl2_rsid.html index da71aa1..70b0682 100644 --- a/docs/reference/afl2_rsid.html +++ b/docs/reference/afl2_rsid.html @@ -1,67 +1,12 @@ - - - - - - - -Look up allele frequencies and LD scores for 1000 genomes populations by rsid — afl2_rsid • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Look up allele frequencies and LD scores for 1000 genomes populations by rsid — afl2_rsid • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,50 +68,48 @@

Look up allele frequencies and LD scores for 1000 genomes populations by rsi

Look up allele frequencies and LD scores for 1000 genomes populations by rsid

-
afl2_rsid(rsid, reference = "1000g")
+
+
afl2_rsid(rsid, reference = "1000g")
+
+ +
+

Arguments

+
rsid
+

Vector of rsids

-

Arguments

- - - - - - - - - - -
rsid

Vector of rsids

reference

Default="1000g"

-

Value

+
reference
+

Default="1000g"

-

data frame

+
+
+

Value

+ + +

data frame

+
+
-
- +
- - + + diff --git a/docs/reference/api_query.html b/docs/reference/api_query.html index 6713669..f178d7a 100644 --- a/docs/reference/api_query.html +++ b/docs/reference/api_query.html @@ -1,67 +1,13 @@ - - - - - - - -Wrapper for sending queries and payloads to API — api_query • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Wrapper for sending queries and payloads to API — api_query • ieugwasr + + - - - - -
-
- -
- -
+
-

There are a number of different GET and POST endpoints in the GWAS database API. This is a generic way to access them

+

There are a number of different GET and POST endpoints in the GWAS database API. +This is a generic way to access them.

+
+ +
+
api_query(
+  path,
+  query = NULL,
+  access_token = check_access_token(),
+  method = "GET",
+  silent = TRUE,
+  encode = "json",
+  timeout = 300
+)
-
api_query(
-  path,
-  query = NULL,
-  access_token = check_access_token(),
-  method = "GET",
-  silent = TRUE,
-  encode = "json",
-  timeout = 300
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
path

Either a full query path (e.g. for get) or an endpoint (e.g. for post) queries

query

If post query, provide a list of arguments as the payload. NULL by default

access_token

Google OAuth2 access token. Used to authenticate level of access to data. By default, checks if already authenticated through get_access_token and if not then does not perform authentication

method

GET (default) or POST, DELETE etc

silent

TRUE/FALSE to be passed to httr call. TRUE by default

encode

Default = json, see httr::POST for options

timeout

Default = 300, avoid increasing this, preferentially simplify the query first.

- -

Value

- -

httr response object

+
+

Arguments

+
path
+

Either a full query path (e.g. for get) or an endpoint (e.g. for post) queries

+ + +
query
+

If post query, provide a list of arguments as the payload. NULL by default

+ + +
access_token
+

Google OAuth2 access token. +Used to authenticate level of access to data. By default, checks if already +authenticated through get_access_token and if not then does not perform authentication

+ + +
method
+

"GET" (default) or "POST", "DELETE" etc

+ + +
silent
+

TRUE/FALSE to be passed to httr call. TRUE by default

+ + +
encode
+

Default = "json", see httr::POST for options

+ + +
timeout
+

Default = 300, avoid increasing this, preferentially +simplify the query first.

+ +
+
+

Value

+ + +

httr response object

+
+
-
- +
- - + + diff --git a/docs/reference/api_status.html b/docs/reference/api_status.html index 5ab2ba9..0f31203 100644 --- a/docs/reference/api_status.html +++ b/docs/reference/api_status.html @@ -1,67 +1,12 @@ - - - - - - - -MR-Base server status — api_status • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MR-Base server status — api_status • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,38 +68,38 @@

MR-Base server status

MR-Base server status

-
api_status()
- +
+
api_status()
+
-

Value

+
+

Value

+ -

list of values regarding status

+

list of values regarding status

+
+
-
- +
- - + + diff --git a/docs/reference/associations.html b/docs/reference/associations.html index 247794b..aed8fca 100644 --- a/docs/reference/associations.html +++ b/docs/reference/associations.html @@ -1,67 +1,18 @@ - - - - - - - -Query specific variants from specific GWAS — associations • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Query specific variants from specific GWAS — associations • ieugwasr - + + - - - -
-
- -
- -
+
-

Every rsid is searched for against each requested GWAS id. To get a list of available GWAS ids, or to find their meta data, use gwasinfo. Can request LD proxies for instances when the requested rsid is not present in a particular GWAS dataset. This currently only uses an LD reference panel composed of Europeans in 1000 genomes version 3. It is also restricted to biallelic single nucleotide polymorphisms (no indels), with European MAF > 0.01.

+

Every rsid is searched for against each requested GWAS id. To get a list of +available GWAS ids, or to find their meta data, use gwasinfo. +Can request LD proxies for instances when the requested rsid is not present +in a particular GWAS dataset. This currently only uses an LD reference panel +composed of Europeans in 1000 genomes version 3. +It is also restricted to biallelic single nucleotide polymorphisms (no indels), +with European MAF > 0.01.

-
associations(
-  variants,
-  id,
-  proxies = 1,
-  r2 = 0.8,
-  align_alleles = 1,
-  palindromes = 1,
-  maf_threshold = 0.3,
-  access_token = check_access_token()
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
variants

Array of variants e.g. c("rs234", "7:105561135-105563135")

id

Array of GWAS studies to query. See gwasinfo for available studies

proxies

0 or (default) 1 - indicating whether to look for proxies

r2

Minimum proxy LD rsq value. Default=0.8

align_alleles

Try to align tag alleles to target alleles (if proxies = 1). 1 = yes (default), 0 = no

palindromes

Allow palindromic SNPs (if proxies = 1). 1 = yes (default), 0 = no

maf_threshold

MAF threshold to try to infer palindromic SNPs. Default = 0.3.

access_token

Google OAuth2 access token. Used to authenticate level of access to data. By default, checks if already authenticated through get_access_token and if not then does not perform authentication

- -

Value

- -

Dataframe

+
+
associations(
+  variants,
+  id,
+  proxies = 1,
+  r2 = 0.8,
+  align_alleles = 1,
+  palindromes = 1,
+  maf_threshold = 0.3,
+  access_token = check_access_token()
+)
+
+ +
+

Arguments

+
variants
+

Array of variants e.g. c("rs234", "7:105561135-105563135")

+ + +
id
+

Array of GWAS studies to query. See gwasinfo for available studies

+ + +
proxies
+

0 or (default) 1 - indicating whether to look for proxies

+ + +
r2
+

Minimum proxy LD rsq value. Default=0.8

+ + +
align_alleles
+

Try to align tag alleles to target alleles (if proxies = 1). +1 = yes (default), 0 = no

+ + +
palindromes
+

Allow palindromic SNPs (if proxies = 1). 1 = yes (default), 0 = no

+ + +
maf_threshold
+

MAF threshold to try to infer palindromic SNPs. Default = 0.3.

+ + +
access_token
+

Google OAuth2 access token. +Used to authenticate level of access to data. +By default, checks if already authenticated through get_access_token and +if not then does not perform authentication

+ +
+
+

Value

+ + +

Dataframe

+
+
-
- +
- - + + diff --git a/docs/reference/batch_from_id.html b/docs/reference/batch_from_id.html index a2e76ba..652d4a1 100644 --- a/docs/reference/batch_from_id.html +++ b/docs/reference/batch_from_id.html @@ -1,67 +1,12 @@ - - - - - - - -Extract batch name from study ID — batch_from_id • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Extract batch name from study ID — batch_from_id • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,46 +68,44 @@

Extract batch name from study ID

Extract batch name from study ID

-
batch_from_id(id)
+
+
batch_from_id(id)
+
-

Arguments

- - - - - - -
id

Array of study IDs

+
+

Arguments

+
id
+

Array of study IDs

-

Value

+
+
+

Value

+ -

Array of batch names

+

Array of batch names

+
+
-
- +
- - + + diff --git a/docs/reference/batches.html b/docs/reference/batches.html index cc6fc67..d7c482c 100644 --- a/docs/reference/batches.html +++ b/docs/reference/batches.html @@ -1,67 +1,12 @@ - - - - - - - -Get list of data batches in IEU GWAS database — batches • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Get list of data batches in IEU GWAS database — batches • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,46 +68,44 @@

Get list of data batches in IEU GWAS database

Get list of data batches in IEU GWAS database

-
batches(access_token = check_access_token())
+
+
batches(access_token = check_access_token())
+
-

Arguments

- - - - - - -
access_token

Google OAuth2 access token. Used to authenticate level of access to data

+
+

Arguments

+
access_token
+

Google OAuth2 access token. Used to authenticate level of access to data

-

Value

+
+
+

Value

+ -

data frame

+

data frame

+
+
-
- +
- - + + diff --git a/docs/reference/check_access_token.html b/docs/reference/check_access_token.html index 9ce2be8..9338d47 100644 --- a/docs/reference/check_access_token.html +++ b/docs/reference/check_access_token.html @@ -1,67 +1,13 @@ - - - - - - - -Check if authentication has been made — check_access_token • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Check if authentication has been made — check_access_token • ieugwasr - - + + - - -
-
- -
- -
+
-

If a call to get_access_token() has been made then it will have generated mrbase.oauth. Pass the token if it is present, if not, return NULL and do not authenticate.

+

If a call to get_access_token() has been made then it will have generated mrbase.oauth. +Pass the token if it is present, if not, return NULL and do not authenticate.

-
check_access_token()
- +
+
check_access_token()
+
-

Value

+
+

Value

+ -

NULL or access_token depending on current authentication state

+

NULL or access_token depending on current authentication state

+
+
-
- +
- - + + diff --git a/docs/reference/cor.html b/docs/reference/cor.html new file mode 100644 index 0000000..261b63e --- /dev/null +++ b/docs/reference/cor.html @@ -0,0 +1,96 @@ + +stats — cor • ieugwasr + + +
+
+ + + +
+
+ + +
+

stats

+
+ + + +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.7.

+
+ +
+ + + + + + + + diff --git a/docs/reference/dot-data.html b/docs/reference/dot-data.html new file mode 100644 index 0000000..06cc64f --- /dev/null +++ b/docs/reference/dot-data.html @@ -0,0 +1,96 @@ + +rlang .data — .data • ieugwasr + + +
+
+ + + +
+
+ + +
+

rlang .data

+
+ + + +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.7.

+
+ +
+ + + + + + + + diff --git a/docs/reference/editcheck.html b/docs/reference/editcheck.html index 197b6a2..63375c9 100644 --- a/docs/reference/editcheck.html +++ b/docs/reference/editcheck.html @@ -1,67 +1,12 @@ - - - - - - - -Check datasets that are in process of being uploaded — editcheck • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Check datasets that are in process of being uploaded — editcheck • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,50 +68,51 @@

Check datasets that are in process of being uploaded

Check datasets that are in process of being uploaded

-
editcheck(id, access_token = check_access_token())
+
+
editcheck(id, access_token = check_access_token())
+
+ +
+

Arguments

+
id
+

ID

-

Arguments

- - - - - - - - - - -
id

ID

access_token

Google OAuth2 access token. Used to authenticate level of access to data. By default, checks if already authenticated through get_access_token and if not then does not perform authentication

-

Value

+
access_token
+

Google OAuth2 access token. +Used to authenticate level of access to data. +By default, checks if already authenticated through get_access_token +and if not then does not perform authentication

-

Dataframe

+
+
+

Value

+ + +

Dataframe

+
+
-
- +
- - + + diff --git a/docs/reference/fill_n.html b/docs/reference/fill_n.html index c256cb3..638039a 100644 --- a/docs/reference/fill_n.html +++ b/docs/reference/fill_n.html @@ -1,68 +1,13 @@ - - - - - - - -Look up sample sizes when meta data is missing from associations — fill_n • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Look up sample sizes when meta data is missing from associations — fill_n • ieugwasr - - + + - - -
-
- -
- -
+
@@ -140,49 +70,49 @@

Look up sample sizes when meta data is missing from associations

Look up sample sizes when meta data is missing from associations

-
fill_n(d)
+    
+
fill_n(d)
+
+fill_n(d)
+
-fill_n(d)
+
+

Arguments

+
d
+

Output from associations

-

Arguments

- - - - - - -
d

Output from associations

+
+
+

Value

+ + +

Updated version of d

-

Value

-

Updated version of d

Updated version of d

+
+
-
- +
- - + + diff --git a/docs/reference/get_access_token.html b/docs/reference/get_access_token.html index 0349c3e..b62b7d0 100644 --- a/docs/reference/get_access_token.html +++ b/docs/reference/get_access_token.html @@ -1,67 +1,12 @@ - - - - - - - -Get access token for OAuth2 access to MR Base — get_access_token • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Get access token for OAuth2 access to MR Base — get_access_token • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,38 +68,38 @@

Get access token for OAuth2 access to MR Base

Get access token for OAuth2 access to MR Base

-
get_access_token()
- +
+
get_access_token()
+
-

Value

+
+

Value

+ -

access token string

+

access token string

+
+
-
- +
- - + + diff --git a/docs/reference/get_query_content.html b/docs/reference/get_query_content.html index 4ae0894..b073cad 100644 --- a/docs/reference/get_query_content.html +++ b/docs/reference/get_query_content.html @@ -1,67 +1,12 @@ - - - - - - - -Parse out json response from httr object — get_query_content • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Parse out json response from httr object — get_query_content • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,46 +68,45 @@

Parse out json response from httr object

Parse out json response from httr object

-
get_query_content(response)
+
+
get_query_content(response)
+
-

Arguments

- - - - - - -
response

Output from httr

+
+

Arguments

+
response
+

Output from httr

-

Value

+
+
+

Value

+ -

Parsed json output from query, often in form of data frame. If status code is not successful then return the actual response

+

Parsed json output from query, often in form of data frame. +If status code is not successful then return the actual response

+
+
-
- +

- - + + diff --git a/docs/reference/gwasinfo.html b/docs/reference/gwasinfo.html index bae24dc..cb02e5a 100644 --- a/docs/reference/gwasinfo.html +++ b/docs/reference/gwasinfo.html @@ -1,67 +1,12 @@ - - - - - - - -Get list of studies with available GWAS summary statistics through API — gwasinfo • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Get list of studies with available GWAS summary statistics through API — gwasinfo • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,50 +68,49 @@

Get list of studies with available GWAS summary statistics through API

Get list of studies with available GWAS summary statistics through API

-
gwasinfo(id = NULL, access_token = check_access_token())
+
+
gwasinfo(id = NULL, access_token = check_access_token())
+
+ +
+

Arguments

+
id
+

List of MR-Base IDs to retrieve. If NULL (default) retrieves all +available datasets

-

Arguments

- - - - - - - - - - -
id

List of MR-Base IDs to retrieve. If NULL (default) retrieves all available datasets

access_token

Google OAuth2 access token. Used to authenticate level of access to data

-

Value

+
access_token
+

Google OAuth2 access token. Used to authenticate level of access to data

-

Dataframe of details for all available studies

+
+
+

Value

+ + +

Dataframe of details for all available studies

+
+
-
- +
- - + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 53ca906..ce3ba07 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,66 +1,12 @@ - - - - - - - -Function reference • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function reference • ieugwasr - - + + - - -
-
- -
- -
+
- - - - - - - - - - -
-

All functions

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+

All functions

+

afl2_chrpos()

Look up allele frequencies and LD scores for 1000 genomes populations by chrpos

+

afl2_list()

Retrieve a allele frequency and LD scores for pre-defined lists of variants

+

afl2_rsid()

Look up allele frequencies and LD scores for 1000 genomes populations by rsid

+

api_query()

Wrapper for sending queries and payloads to API

+

api_status()

MR-Base server status

+

associations()

Query specific variants from specific GWAS

+

batch_from_id()

Extract batch name from study ID

+

batches()

Get list of data batches in IEU GWAS database

+

check_access_token()

Check if authentication has been made

+
+

cor

+

stats

+

.data

+

rlang .data

editcheck()

Check datasets that are in process of being uploaded

+

fill_n() fill_n()

Look up sample sizes when meta data is missing from associations

+

get_access_token()

Get access token for OAuth2 access to MR Base

+

get_query_content()

Parse out json response from httr object

+

gwasinfo()

Get list of studies with available GWAS summary statistics through API

+

infer_ancestry()

Infer ancestry of GWAS dataset by matching against 1000 genomes allele frequencies

+

ld_clump()

Perform LD clumping on SNP data

+

ld_clump_api()

Perform clumping on the chosen variants using through API

+

ld_clump_local()

Wrapper for clump function using local plink binary and ld reference dataset

+

ld_matrix()

Get LD matrix for list of variants

+

Get LD matrix for list of SNPs

ld_matrix_local()

Get LD matrix using local plink binary and reference dataset

+
+

ld_reflookup()

+

Check which rsids are present in a remote LD reference panel

legacy_ids()

Convert current IDs to legacy IDs

+

logging_info()

Details of how access token logs are used

+

phewas()

Perform fast phewas of a specific variants against all available GWAS datasets

+

revoke_access_token()

Revoke access token for MR Base

+

select_api()

Toggle API address between development and release

+

tophits()

Obtain top hits from a GWAS dataset

+

variants_chrpos()

Obtain information about chr pos and surrounding region

+

variants_gene()

Obtain variants around a gene

+

variants_rsid()

Obtain information about rsid

+

variants_to_rsid()

Convert mixed array of rsid and chrpos to list of rsid

- +
+
-
- +
- - + + diff --git a/docs/reference/infer_ancestry.html b/docs/reference/infer_ancestry.html index c0724ac..c38bf22 100644 --- a/docs/reference/infer_ancestry.html +++ b/docs/reference/infer_ancestry.html @@ -1,67 +1,12 @@ - - - - - - - -Infer ancestry of GWAS dataset by matching against 1000 genomes allele frequencies — infer_ancestry • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Infer ancestry of GWAS dataset by matching against 1000 genomes allele frequencies — infer_ancestry • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,50 +68,50 @@

Infer ancestry of GWAS dataset by matching against 1000 genomes allele frequ

Uses ~20k SNPs selected for common frequency across 5 major super populations

-
infer_ancestry(d, snpinfo = NULL)
+
+
infer_ancestry(d, snpinfo = NULL)
+
+ +
+

Arguments

+
d
+

Data frame containing at least rsid and eaf columns. +e.g. output from associations

-

Arguments

- - - - - - - - - - -
d

Data frame containing at least rsid and eaf columns. e.g. output from associations

snpinfo
-

Value

+
snpinfo
+

Output from afl2_list, afl2_rsid or afl2_chrpos. +If NULL then afl2_list() is used by default

-

data frame ordered by most likely ancestry

+
+
+

Value

+ + +

data frame ordered by most likely ancestry

+
+
-
- +
- - + + diff --git a/docs/reference/ld_clump.html b/docs/reference/ld_clump.html index 324599f..2dc0e2b 100644 --- a/docs/reference/ld_clump.html +++ b/docs/reference/ld_clump.html @@ -1,67 +1,13 @@ - - - - - - - -Perform LD clumping on SNP data — ld_clump • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Perform LD clumping on SNP data — ld_clump • ieugwasr - + + - - - -
-
- -
- -
+
-

Uses PLINK clumping method, where variants in LD within a particular window will be pruned. The SNP with the lowest p-value is retained.

+

Uses PLINK clumping method, where SNPs in LD within a particular window will be pruned. +The SNP with the lowest p-value is retained.

-
ld_clump(
-  dat = NULL,
-  clump_kb = 10000,
-  clump_r2 = 0.001,
-  clump_p = 0.99,
-  pop = "EUR",
-  access_token = NULL,
-  bfile = NULL,
-  plink_bin = NULL
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dat

Dataframe. Must have a variant name column ("rsid") and pval column called "pval". If id is present then clumping will be done per unique id.

clump_kb

Clumping kb window. Default is very strict, 10000

clump_r2

Clumping r2 threshold. Default is very strict, 0.001

clump_p

Clumping sig level for index variants. Default = 1 (i.e. no threshold)

pop

Super-population to use as reference panel. Default = "EUR". Options are EUR, SAS, EAS, AFR, AMR. 'legacy' also available - which is a previously used verison of the EUR panel with a slightly different set of markers

access_token

Google OAuth2 access token. Used to authenticate level of access to data

bfile

If this is provided then will use the API. Default = NULL

plink_bin

If null and bfile is not null then will detect packaged plink binary for specific OS. Otherwise specify path to plink binary. Default = NULL

- -

Value

- -

Data frame

+
+
ld_clump(
+  dat = NULL,
+  clump_kb = 10000,
+  clump_r2 = 0.001,
+  clump_p = 0.99,
+  pop = "EUR",
+  access_token = NULL,
+  bfile = NULL,
+  plink_bin = NULL
+)
+
+ +
+

Arguments

+
dat
+

Dataframe. Must have a variant name column (rsid) and pval column called pval. +If id is present then clumping will be done per unique id.

+ + +
clump_kb
+

Clumping kb window. Default is very strict, 10000

+ + +
clump_r2
+

Clumping r2 threshold. Default is very strict, 0.001

+ + +
clump_p
+

Clumping sig level for index variants. Default = 1 (i.e. no threshold)

+ + +
pop
+

Super-population to use as reference panel. Default = "EUR". +Options are "EUR", "SAS", "EAS", "AFR", "AMR". +'legacy' also available - which is a previously used verison of the EUR +panel with a slightly different set of markers

+ + +
access_token
+

Google OAuth2 access token. Used to authenticate level of access to data

+ + +
bfile
+

If this is provided then will use the API. Default = NULL

+ + +
plink_bin
+

If NULL and bfile is not NULL then will detect +packaged plink binary for specific OS. Otherwise specify path to plink binary. +Default = NULL

+ +
+
+

Value

+ + +

Data frame

+
+
+

Details

+

This function interacts with the OpenGWAS API, which houses LD reference panels +for the 5 super-populations in the 1000 genomes reference panel. +It includes only bi-allelic SNPs with MAF > 0.01, so it's quite possible that +a variant you want to include in the clumping process will be absent. +If it is absent, it will be automatically excluded from the results.

+

You can check if your variants are present in the LD reference panel using +ld_reflookup().

+

This function does put load on the OpenGWAS servers, which makes life more +difficult for other users. We have implemented a method and made available +the LD reference panels to perform clumping locally, see +ld_clump() and related vignettes for details.

+
+
-
- +
- - + + diff --git a/docs/reference/ld_clump_api.html b/docs/reference/ld_clump_api.html index 08c4f3c..7a87c1e 100644 --- a/docs/reference/ld_clump_api.html +++ b/docs/reference/ld_clump_api.html @@ -1,67 +1,12 @@ - - - - - - - -Perform clumping on the chosen variants using through API — ld_clump_api • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Perform clumping on the chosen variants using through API — ld_clump_api • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,70 +68,73 @@

Perform clumping on the chosen variants using through API

Perform clumping on the chosen variants using through API

-
ld_clump_api(
-  dat,
-  clump_kb = 10000,
-  clump_r2 = 0.1,
-  clump_p,
-  pop = "EUR",
-  access_token = check_access_token()
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - -
dat

Dataframe. Must have a variant name column ("variant") and pval column called "pval". If id is present then clumping will be done per unique id.

clump_kb

Clumping kb window. Default is very strict, 10000

clump_r2

Clumping r2 threshold. Default is very strict, 0.001

clump_p

Clumping sig level for index variants. Default = 1 (i.e. no threshold)

pop

Super-population to use as reference panel. Default = "EUR". Options are EUR, SAS, EAS, AFR, AMR

access_token

Google OAuth2 access token. Used to authenticate level of access to data#' @return Data frame of only independent variants

+
+
ld_clump_api(
+  dat,
+  clump_kb = 10000,
+  clump_r2 = 0.1,
+  clump_p,
+  pop = "EUR",
+  access_token = check_access_token()
+)
+
+ +
+

Arguments

+
dat
+

Dataframe. Must have a variant name column (variant) and pval column called pval. +If id is present then clumping will be done per unique id.

+ + +
clump_kb
+

Clumping kb window. Default is very strict, 10000

+ +
clump_r2
+

Clumping r2 threshold. Default is very strict, 0.001

+ + +
clump_p
+

Clumping sig level for index variants. Default = 1 (i.e. no threshold)

+ + +
pop
+

Super-population to use as reference panel. Default = "EUR". +Options are "EUR", "SAS", "EAS", "AFR", "AMR"

+ + +
access_token
+

Google OAuth2 access token. Used to authenticate level of access to data

+ +
+
+

Value

+ + +

Data frame of only independent variants

+
+
-
- +
- - + + diff --git a/docs/reference/ld_clump_local.html b/docs/reference/ld_clump_local.html index 0cca721..babd9c0 100644 --- a/docs/reference/ld_clump_local.html +++ b/docs/reference/ld_clump_local.html @@ -1,67 +1,12 @@ - - - - - - - -Wrapper for clump function using local plink binary and ld reference dataset — ld_clump_local • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Wrapper for clump function using local plink binary and ld reference dataset — ld_clump_local • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,66 +68,66 @@

Wrapper for clump function using local plink binary and ld reference dataset

Wrapper for clump function using local plink binary and ld reference dataset

-
ld_clump_local(dat, clump_kb, clump_r2, clump_p, bfile, plink_bin)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - -
dat

Dataframe. Must have a variant name column ("variant") and pval column called "pval". If id is present then clumping will be done per unique id.

clump_kb

Clumping kb window. Default is very strict, 10000

clump_r2

Clumping r2 threshold. Default is very strict, 0.001

clump_p

Clumping sig level for index variants. Default = 1 (i.e. no threshold)

bfile

If this is provided then will use the API. Default = NULL

plink_bin

Specify path to plink binary. Default = NULL. See https://github.com/explodecomputer/plinkbinr for convenient access to plink binaries

- -

Value

- -

data frame of clumped variants

+
+
ld_clump_local(dat, clump_kb, clump_r2, clump_p, bfile, plink_bin)
+
+ +
+

Arguments

+
dat
+

Dataframe. Must have a variant name column (variant) and pval column called pval. +If id is present then clumping will be done per unique id.

+ + +
clump_kb
+

Clumping kb window. Default is very strict, 10000

+ + +
clump_r2
+

Clumping r2 threshold. Default is very strict, 0.001

+ + +
clump_p
+

Clumping sig level for index variants. Default = 1 (i.e. no threshold)

+ + +
bfile
+

If this is provided then will use the API. Default = NULL

+ + +
plink_bin
+

Specify path to plink binary. Default = NULL. +See https://github.com/explodecomputer/plinkbinr for convenient access to plink binaries

+ +
+
+

Value

+ + +

data frame of clumped variants

+
+
-
- +
- - + + diff --git a/docs/reference/ld_matrix.html b/docs/reference/ld_matrix.html index a6e6818..77b76a0 100644 --- a/docs/reference/ld_matrix.html +++ b/docs/reference/ld_matrix.html @@ -1,69 +1,16 @@ - - - - - - - -Get LD matrix for list of variants — ld_matrix • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Get LD matrix for list of SNPs — ld_matrix • ieugwasr - - + + - - -
-
- -
- -
+
-

This function takes a list of variants and searches for them in samples from 1000 Genomes phase 3 data -It then creates an LD matrix of r values (signed, and not squared) -All LD values are with respect to the major alleles in the 1000G dataset. You can specify whether the allele names are displayed

+

This function takes a list of SNPs and searches for them in a specified +super-population in the 1000 Genomes phase 3 reference panel. +It then creates an LD matrix of r values (signed, and not squared). +All LD values are with respect to the major alleles in the 1000G dataset. +You can specify whether the allele names are displayed.

+
+ +
+
ld_matrix(
+  variants,
+  with_alleles = TRUE,
+  pop = "EUR",
+  bfile = NULL,
+  plink_bin = NULL
+)
-
ld_matrix(
-  variants,
-  with_alleles = TRUE,
-  pop = "EUR",
-  bfile = NULL,
-  plink_bin = NULL
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
variants

List of variants (rsids)

with_alleles

Whether to append the allele names to the SNP names. Default: TRUE

pop

Super-population to use as reference panel. Default = "EUR". Options are EUR, SAS, EAS, AFR, AMR. 'legacy' also available - which is a previously used verison of the EUR panel with a slightly different set of markers

bfile

If this is provided then will use the API. Default = NULL

plink_bin

If null and bfile is not null then will detect packaged plink binary for specific OS. Otherwise specify path to plink binary. Default = NULL

- -

Value

- -

Matrix of LD r values

+
+

Arguments

+
variants
+

List of variants (rsids)

+ + +
with_alleles
+

Whether to append the allele names to the SNP names. Default: TRUE

+ + +
pop
+

Super-population to use as reference panel. Default = "EUR". +Options are "EUR", "SAS", "EAS", "AFR", "AMR". +'legacy' also available - which is a previously used verison of the EUR +panel with a slightly different set of markers

+ + +
bfile
+

If this is provided then will use the API. Default = NULL

+ + +
plink_bin
+

If NULL and bfile is not NULL then will detect packaged +plink binary for specific OS. Otherwise specify path to plink binary. Default = NULL

+ +
+
+

Value

+ + +

Matrix of LD r values

+
+
+

Details

+

The data used for generating the LD matrix includes only bi-allelic SNPs +with MAF > 0.01, so it's quite possible that a variant you want to include +will be absent. If it is absent, it will be automatically excluded from the results.

+

You can check if your variants are present in the LD reference panel using +ld_reflookup()

+

This function does put load on the OpenGWAS servers, which makes life more +difficult for other users, and has been limited to analyse only up to 500 +variants at a time. We have implemented a method and made available the LD +reference panels to perform the operation locally, see ld_matrix() and +related vignettes for details.

+
+
-
- +
- - + + diff --git a/docs/reference/ld_matrix_local.html b/docs/reference/ld_matrix_local.html index 97910e2..a576839 100644 --- a/docs/reference/ld_matrix_local.html +++ b/docs/reference/ld_matrix_local.html @@ -1,67 +1,12 @@ - - - - - - - -Get LD matrix using local plink binary and reference dataset — ld_matrix_local • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Get LD matrix using local plink binary and reference dataset — ld_matrix_local • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,58 +68,58 @@

Get LD matrix using local plink binary and reference dataset

Get LD matrix using local plink binary and reference dataset

-
ld_matrix_local(variants, bfile, plink_bin, with_alleles = TRUE)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
variants

List of variants (rsids)

bfile

Path to bed/bim/fam ld reference panel

plink_bin

Specify path to plink binary. Default = NULL. See https://github.com/explodecomputer/plinkbinr for convenient access to plink binaries

with_alleles

Whether to append the allele names to the SNP names. Default: TRUE

- -

Value

- -

data frame

+
+
ld_matrix_local(variants, bfile, plink_bin, with_alleles = TRUE)
+
+ +
+

Arguments

+
variants
+

List of variants (rsids)

+ + +
bfile
+

Path to bed/bim/fam ld reference panel

+ + +
plink_bin
+

Specify path to plink binary. Default = NULL. +See https://github.com/explodecomputer/plinkbinr for convenient access to plink binaries

+ + +
with_alleles
+

Whether to append the allele names to the SNP names. +Default: TRUE

+ +
+
+

Value

+ + +

data frame

+
+
-
- +
- - + + diff --git a/docs/reference/ld_reflookup.html b/docs/reference/ld_reflookup.html new file mode 100644 index 0000000..ba8d67b --- /dev/null +++ b/docs/reference/ld_reflookup.html @@ -0,0 +1,122 @@ + +Check which rsids are present in a remote LD reference panel — ld_reflookup • ieugwasr + + +
+
+ + + +
+
+ + +
+

Provide a list of rsids that you may want to perform LD operations on to +check if they are present in the LD reference panel. If they are not then +some functions e.g. ld_clump will exclude them from the analysis, +so you may want to consider how to handle those variants in your data.

+
+ +
+
ld_reflookup(rsid, pop = "EUR")
+
+ +
+

Arguments

+
rsid
+

Array of rsids to check

+ + +
pop
+

Super-population to use as reference panel. Default = "EUR". +Options are "EUR", "SAS", "EAS", "AFR", "AMR"

+ +
+
+

Value

+ + +

Array of rsids that are present in the LD reference panel

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.7.

+
+ +
+ + + + + + + + diff --git a/docs/reference/legacy_ids.html b/docs/reference/legacy_ids.html index 14f8fc2..032935c 100644 --- a/docs/reference/legacy_ids.html +++ b/docs/reference/legacy_ids.html @@ -1,67 +1,12 @@ - - - - - - - -Convert current IDs to legacy IDs — legacy_ids • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Convert current IDs to legacy IDs — legacy_ids • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,46 +68,44 @@

Convert current IDs to legacy IDs

Convert current IDs to legacy IDs

-
legacy_ids(x)
+
+
legacy_ids(x)
+
-

Arguments

- - - - - - -
x

Vector of ids

+
+

Arguments

+
x
+

Vector of ids

-

Value

+
+
+

Value

+ -

vector of back compatible ids

+

vector of back compatible ids

+
+
-
- +

- - + + diff --git a/docs/reference/logging_info.html b/docs/reference/logging_info.html index a021c3c..e8f4ac4 100644 --- a/docs/reference/logging_info.html +++ b/docs/reference/logging_info.html @@ -1,67 +1,12 @@ - - - - - - - -Details of how access token logs are used — logging_info • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Details of how access token logs are used — logging_info • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,35 +68,32 @@

Details of how access token logs are used

Details of how access token logs are used

-
logging_info()
- +
+
logging_info()
+
+
-
- +
- - + + diff --git a/docs/reference/phewas.html b/docs/reference/phewas.html index a95848e..c2cfaaa 100644 --- a/docs/reference/phewas.html +++ b/docs/reference/phewas.html @@ -1,67 +1,12 @@ - - - - - - - -Perform fast phewas of a specific variants against all available GWAS datasets — phewas • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Perform fast phewas of a specific variants against all available GWAS datasets — phewas • ieugwasr - - - - + + -
-
- -
- -
+
-

This is faster than doing it manually through associations

+

This is faster than doing it manually through associations

-
phewas(
-  variants,
-  pval = 1e-05,
-  batch = c(),
-  access_token = check_access_token()
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
variants

Array of variants e.g. c("rs234", "7:105561135-105563135")

pval

p-value threshold. Default = 0.00001

batch

Vector of batch IDs to search across. If c() (default) then returns all batches

access_token

Google OAuth2 access token. Used to authenticate level of access to data. By default, checks if already authenticated through get_access_token and if not then does not perform authentication

- -

Value

- -

Dataframe

+
+
phewas(
+  variants,
+  pval = 1e-05,
+  batch = c(),
+  access_token = check_access_token()
+)
+
+ +
+

Arguments

+
variants
+

Array of variants e.g. c("rs234", "7:105561135-105563135")

+ + +
pval
+

p-value threshold. Default = 0.00001

+ + +
batch
+

Vector of batch IDs to search across. If c() (default) then returns all batches

+ + +
access_token
+

Google OAuth2 access token. +Used to authenticate level of access to data. +By default, checks if already authenticated through get_access_token and +if not then does not perform authentication

+ +
+
+

Value

+ + +

Dataframe

+
+
-
- +
- - + + diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html index 907fa23..aebcab1 100644 --- a/docs/reference/pipe.html +++ b/docs/reference/pipe.html @@ -1,67 +1,12 @@ - - - - - - - -Pipe operator — %>% • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Pipe operator — %>% • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,35 +68,32 @@

Pipe operator

See magrittr::%>% for details.

-
lhs %>% rhs
- +
+
lhs %>% rhs
+
+
-
- +
- - + + diff --git a/docs/reference/revoke_access_token.html b/docs/reference/revoke_access_token.html index 953825f..683e0c7 100644 --- a/docs/reference/revoke_access_token.html +++ b/docs/reference/revoke_access_token.html @@ -1,67 +1,12 @@ - - - - - - - -Revoke access token for MR Base — revoke_access_token • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Revoke access token for MR Base — revoke_access_token • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,35 +68,32 @@

Revoke access token for MR Base

Revoke access token for MR Base

-
revoke_access_token()
- +
+
revoke_access_token()
+
+
-
- +
- - + + diff --git a/docs/reference/select_api.html b/docs/reference/select_api.html index 7bb709f..030cdc2 100644 --- a/docs/reference/select_api.html +++ b/docs/reference/select_api.html @@ -1,67 +1,12 @@ - - - - - - - -Toggle API address between development and release — select_api • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Toggle API address between development and release — select_api • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,43 +68,43 @@

Toggle API address between development and release

Toggle API address between development and release

-
select_api(where = "public")
+
+
select_api(where = "public", silent = FALSE)
+
+ +
+

Arguments

+
where
+

Which API to use. Choice between "public", "private", "dev1", "dev2". +Default = "public".

+ -

Arguments

- - - - - - -
where

Which API to use. Choice between "local", "release", "test". Default = "local"

+
silent
+

Silent? Default = FALSE

+
+
-
- +
- - + + diff --git a/docs/reference/tophits.html b/docs/reference/tophits.html index ed19446..5a4669a 100644 --- a/docs/reference/tophits.html +++ b/docs/reference/tophits.html @@ -1,67 +1,12 @@ - - - - - - - -Obtain top hits from a GWAS dataset — tophits • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Obtain top hits from a GWAS dataset — tophits • ieugwasr - + + - - - -
-
- -
- -
+
@@ -138,83 +68,88 @@

Obtain top hits from a GWAS dataset

By default performs clumping on the server side.

-
tophits(
-  id,
-  pval = 5e-08,
-  clump = 1,
-  r2 = 0.001,
-  kb = 10000,
-  pop = "EUR",
-  force_server = FALSE,
-  access_token = check_access_token()
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
id

Array of GWAS studies to query. See gwasinfo for available studies

pval

use this p-value threshold. Default = 5e-8

clump

whether to clump (1) or not (0). Default = 1

r2

use this clumping r2 threshold. Default is very strict, 0.001

kb

use this clumping kb window. Default is very strict, 10000

pop

Super-population to use as reference panel. Default = "EUR". Options are EUR, SAS, EAS, AFR, AMR

force_server

By default will return preclumped hits. p-value threshold 5e-8, with r2 threshold 0.001 and kb threshold 10000, using only SNPs with MAF > 0.01 in the European samples in 1000 genomes. If force_server = TRUE then will recompute using server side LD reference panel.

access_token

Google OAuth2 access token. Used to authenticate level of access to data. By default, checks if already authenticated through get_access_token and if not then does not perform authentication

- -

Value

- -

Dataframe

+
+
tophits(
+  id,
+  pval = 5e-08,
+  clump = 1,
+  r2 = 0.001,
+  kb = 10000,
+  pop = "EUR",
+  force_server = FALSE,
+  access_token = check_access_token()
+)
+
+ +
+

Arguments

+
id
+

Array of GWAS studies to query. See gwasinfo for available studies

+ + +
pval
+

use this p-value threshold. Default = 5e-8

+ + +
clump
+

whether to clump (1) or not (0). Default = 1

+ + +
r2
+

use this clumping r2 threshold. Default is very strict, 0.001

+ + +
kb
+

use this clumping kb window. Default is very strict, 10000

+ + +
pop
+

Super-population to use as reference panel. Default = "EUR". +Options are "EUR", "SAS", "EAS", "AFR", "AMR"

+ + +
force_server
+

Logical. By default will return preclumped hits. +p-value threshold 5e-8, with r2 threshold 0.001 and kb threshold 10000, +using only SNPs with MAF > 0.01 in the European samples in 1000 genomes. +If force_server = TRUE then will recompute using server side LD reference panel.

+ + +
access_token
+

Google OAuth2 access token. +Used to authenticate level of access to data. +By default, checks if already authenticated through get_access_token +and if not then does not perform authentication

+ +
+
+

Value

+ + +

Dataframe

+
+
-
- +
- - + + diff --git a/docs/reference/variants_chrpos.html b/docs/reference/variants_chrpos.html index 47e7997..937417c 100644 --- a/docs/reference/variants_chrpos.html +++ b/docs/reference/variants_chrpos.html @@ -1,67 +1,12 @@ - - - - - - - -Obtain information about chr pos and surrounding region — variants_chrpos • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Obtain information about chr pos and surrounding region — variants_chrpos • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,50 +68,49 @@

Obtain information about chr pos and surrounding region

For a list of chromosome and positions, finds all variants within a given radius

-
variants_chrpos(chrpos, radius = 0)
+
+
variants_chrpos(chrpos, radius = 0)
+
+ +
+

Arguments

+
chrpos
+

list of <chr>:<pos> in build 37, +e.g. c("3:46414943", "3:122991235"). Also allows ranges e.g. "7:105561135-105563135"

-

Arguments

- - - - - - - - - - -
chrpos

list of <chr>:<pos> in build 37, e.g. c("3:46414943", "3:122991235"). Also allows ranges e.g "7:105561135-105563135"

radius

Radius around each chrpos, default = 0

-

Value

+
radius
+

Radius around each chrpos, default = 0

-

Data frame

+
+
+

Value

+ + +

Data frame

+
+
-
- +

- - + + diff --git a/docs/reference/variants_gene.html b/docs/reference/variants_gene.html index fdd51af..23283e9 100644 --- a/docs/reference/variants_gene.html +++ b/docs/reference/variants_gene.html @@ -1,67 +1,12 @@ - - - - - - - -Obtain variants around a gene — variants_gene • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Obtain variants around a gene — variants_gene • ieugwasr - - + + - - -
-
- -
- -
+
@@ -138,50 +68,49 @@

Obtain variants around a gene

Provide a gene identified, either Ensembl or Entrez

-
variants_gene(gene, radius = 0)
+
+
variants_gene(gene, radius = 0)
+
+ +
+

Arguments

+
gene
+

Vector of genes, either Ensembl or Entrez, +e.g. c("ENSG00000123374", "ENSG00000160791") or 1017

-

Arguments

- - - - - - - - - - -
gene

Vector of genes, either Ensembl or Entrez, e.g. c("ENSG00000123374", "ENSG00000160791") or 1017

radius

Radius around the gene region to include. Default = 0

-

Value

+
radius
+

Radius around the gene region to include. Default = 0

-

data frame

+
+
+

Value

+ + +

data frame with the following columns

+
+
-
- +
- - + + diff --git a/docs/reference/variants_rsid.html b/docs/reference/variants_rsid.html index 34d1d3a..f6ac17d 100644 --- a/docs/reference/variants_rsid.html +++ b/docs/reference/variants_rsid.html @@ -1,67 +1,12 @@ - - - - - - - -Obtain information about rsid — variants_rsid • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Obtain information about rsid — variants_rsid • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,46 +68,44 @@

Obtain information about rsid

Obtain information about rsid

-
variants_rsid(rsid)
+
+
variants_rsid(rsid)
+
-

Arguments

- - - - - - -
rsid

Vector of rsids

+
+

Arguments

+
rsid
+

Vector of rsids

-

Value

+
+
+

Value

+ -

data frame

+

data frame

+
+
-
- +
- - + + diff --git a/docs/reference/variants_to_rsid.html b/docs/reference/variants_to_rsid.html index 2d10f84..e7300b8 100644 --- a/docs/reference/variants_to_rsid.html +++ b/docs/reference/variants_to_rsid.html @@ -1,67 +1,12 @@ - - - - - - - -Convert mixed array of rsid and chrpos to list of rsid — variants_to_rsid • ieugwasr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Convert mixed array of rsid and chrpos to list of rsid — variants_to_rsid • ieugwasr - - - - + + -
-
- -
- -
+
@@ -138,46 +68,44 @@

Convert mixed array of rsid and chrpos to list of rsid

Convert mixed array of rsid and chrpos to list of rsid

-
variants_to_rsid(variants)
+
+
variants_to_rsid(variants)
+
-

Arguments

- - - - - - -
variants

Array of variants e.g. c("rs234", "7:105561135-105563135")

+
+

Arguments

+
variants
+

Array of variants e.g. c("rs234", "7:105561135-105563135")

-

Value

+
+
+

Value

+ -

list of rsids

+

list of rsids

+
+
-
- +
- - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 0000000..e5abf5b --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,147 @@ + + + + /404.html + + + /LICENSE-text.html + + + /LICENSE.html + + + /articles/guide.html + + + /articles/index.html + + + /articles/local_ld.html + + + /articles/timings.html + + + /authors.html + + + /index.html + + + /news/index.html + + + /reference/afl2_chrpos.html + + + /reference/afl2_list.html + + + /reference/afl2_rsid.html + + + /reference/api_query.html + + + /reference/api_status.html + + + /reference/associations.html + + + /reference/batch_from_id.html + + + /reference/batches.html + + + /reference/check_access_token.html + + + /reference/cor.html + + + /reference/create_finemapr_input.html + + + /reference/dot-data.html + + + /reference/editcheck.html + + + /reference/fill_n.html + + + /reference/get_access_token.html + + + /reference/get_query_content.html + + + /reference/gwasinfo.html + + + /reference/index.html + + + /reference/infer_ancestry.html + + + /reference/ld_clump.html + + + /reference/ld_clump_api.html + + + /reference/ld_clump_local.html + + + /reference/ld_matrix.html + + + /reference/ld_matrix_local.html + + + /reference/ld_reflookup.html + + + /reference/legacy_ids.html + + + /reference/logging_info.html + + + /reference/phewas.html + + + /reference/pipe.html + + + /reference/revoke_access_token.html + + + /reference/select_api.html + + + /reference/to_TwoSampleMR.html + + + /reference/toggle_api.html + + + /reference/tophits.html + + + /reference/variants_chrpos.html + + + /reference/variants_gene.html + + + /reference/variants_rsid.html + + + /reference/variants_to_rsid.html + + diff --git a/man/select_api.Rd b/man/select_api.Rd index fa7acc2..4d690a8 100644 --- a/man/select_api.Rd +++ b/man/select_api.Rd @@ -4,11 +4,13 @@ \alias{select_api} \title{Toggle API address between development and release} \usage{ -select_api(where = "public") +select_api(where = "public", silent = FALSE) } \arguments{ \item{where}{Which API to use. Choice between \code{"public"}, \code{"private"}, \code{"dev1"}, \code{"dev2"}. Default = \code{"public"}.} + +\item{silent}{Silent? Default = FALSE} } \description{ Toggle API address between development and release diff --git a/vignettes/local_ld.Rmd b/vignettes/local_ld.Rmd index d57e092..fe38c68 100644 --- a/vignettes/local_ld.Rmd +++ b/vignettes/local_ld.Rmd @@ -45,7 +45,7 @@ Note that you can perform the same operation locally if you provide a path to pl To get a path to plink you can do the following: -``` r +```r devtools::install_github("explodecomputer/genetics.binaRies") genetics.binaRies::get_plink_binary() ``` @@ -68,7 +68,7 @@ Now supposing in R you have a dataframe, `dat`, with the following columns: to perform clumping, just do the following: -``` r +```r ld_clump( dplyr::tibble(rsid=dat$rsid, pval=dat$pval, id=dat$trait_id), plink_bin = genetics.binaRies::get_plink_binary(), @@ -80,13 +80,13 @@ ld_clump( Similarly, a matrix of LD r values can be generated using -``` r +```r ld_matrix(b$variant) ``` This uses the API by default but is limited to only 500 variants. You can use, instead, local plink and LD reference data in the same manner as in the `ld_clump` function, e.g. -``` r +```r ld_matrix( dat$rsid, plink_bin = genetics.binaRies::get_plink_binary(), diff --git a/vignettes/timings.Rmd b/vignettes/timings.Rmd index 91a0133..79cd360 100644 --- a/vignettes/timings.Rmd +++ b/vignettes/timings.Rmd @@ -14,7 +14,8 @@ vignette: > ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + eval = FALSE ) ``` @@ -25,7 +26,7 @@ library(microbenchmark) library(ieugwasr) ``` -Get a set of SNPs too query: +Get a set of SNPs to query: ```{r} a <- tophits("ieu-a-2") @@ -59,7 +60,16 @@ b <- associations(chrpos, "ieu-a-7", proxies=0) rsid <- b$rsid ``` -This is a `r format(radius * 2, scientific = FALSE, big.mark = ",")` size window, which has `r length(rsid)` variants to lookup. + +Window size + +```{r} +format(radius * 2, scientific = FALSE, big.mark = ",") +``` + +```{r} +length(rsid) +```` ```{r} mbm <- microbenchmark("rsid" = { @@ -83,7 +93,23 @@ b <- associations(chrpos, "ieu-a-7", proxies=0) rsid <- b$rsid ``` -This `r length(chrpos)` ranges of `r format(20000, scientific = FALSE, big.mark = ",")` size window, which is covered by `r length(rsid)` variants to lookup. +```{r} +length(chrpos) +``` + +ranges of + +```{r} +format(20000, scientific = FALSE, big.mark = ",") +``` + +size window, which is covered by + +```{r} +length(rsid) +``` + +variants to lookup. ```{r}