### General API Query (GET) Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Perform a GET request to an API endpoint. This example queries for specific rsids in given studies. ```r api_query("associations/ieu-a-2,ieu-a-7/rs234,rs123") ``` -------------------------------- ### Install ieugwasr from GitHub Source: https://mrcieu.github.io/ieugwasr/index.html Install the developer version of the ieugwasr package directly from its GitHub repository. ```r remotes::install_github("mrcieu/ieugwasr") ``` -------------------------------- ### Install ieugwasr from CRAN Source: https://mrcieu.github.io/ieugwasr/index.html Install the stable version of the ieugwasr package from CRAN. ```r install.packages("ieugwasr") ``` -------------------------------- ### Install PLINK binary using genetics.binaRies Source: https://mrcieu.github.io/ieugwasr/articles/local_ld.html Installs the PLINK binary and retrieves it for use with ieugwasr functions. This is a prerequisite for running local LD operations. ```R remotes::install_github("MRCIEU/genetics.binaRies") genetics.binaRies::get_plink_binary() ``` -------------------------------- ### Install ieugwasr from MRCIEU r-universe Source: https://mrcieu.github.io/ieugwasr/index.html Install the ieugwasr package from the MRCIEU r-universe repository, which may contain newer versions. ```r install.packages('ieugwasr', repos = c('https://mrcieu.r-universe.dev', 'https://cloud.r-project.org')) ``` -------------------------------- ### user() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Get user details. ```APIDOC ## user() ### Description Get user details. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get available batches Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Retrieves a list of available batches and their descriptions from the OpenGWAS database. ```r batches() ``` -------------------------------- ### batches() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Get list of data batches in IEU OpenGWAS database. ```APIDOC ## batches() ### Description Get list of data batches in IEU OpenGWAS database. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get List of Data Batches Source: https://mrcieu.github.io/ieugwasr/reference/batches.html Fetches a list of all available data batches from the IEU OpenGWAS database. Authentication may be required for certain endpoints. ```APIDOC ## Get list of data batches in IEU OpenGWAS database ### Description Retrieves a list of all available data batches in the IEU OpenGWAS database. ### Method GET ### Endpoint /batches ### Parameters #### Query Parameters - **opengwas_jwt** (string) - Optional - Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT. ### Response #### Success Response (200) - **data** (data frame) - A data frame containing information about the data batches. ### Request Example ``` GET /batches?opengwas_jwt=YOUR_JWT_TOKEN ``` ### Response Example ```json { "data": [ { "batch_id": "1000", "batch_name": "1000 Genomes", "description": "Phase 3 data from 1000 Genomes Project" }, { "batch_id": "ukbb", "batch_name": "UK Biobank", "description": "Subset of UK Biobank data" } ] } ``` ``` -------------------------------- ### Get GWAS file download URLs Source: https://mrcieu.github.io/ieugwasr/reference/gwasinfo_files.html Use gwasinfo_files to get a list of download URLs for files like VCF, TBI, and HTML reports associated with a GWAS dataset. URLs expire in 2 hours. Ensure you have access to the dataset. ```R gwasinfo_files(id, opengwas_jwt = get_opengwas_jwt(), ...) ``` -------------------------------- ### gwasinfo_files() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Get list of download URLs for each file associated with a dataset through API. ```APIDOC ## gwasinfo_files() ### Description Get list of download URLs for each file associated with a dataset through API. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get LD matrix using local PLINK binary and reference dataset Source: https://mrcieu.github.io/ieugwasr/reference/ld_matrix_local.html Use this function to compute the LD matrix locally. Specify the path to your PLINK binary and reference panel (bed/bim/fam files). ```R ld_matrix_local(variants, bfile, plink_bin, with_alleles = TRUE) ``` -------------------------------- ### Get User Details Source: https://mrcieu.github.io/ieugwasr/reference/user.html Retrieves details about the authenticated user. Authentication is handled via an OpenGWAS JWT. ```APIDOC ## Get User Details ### Description Retrieves details about the authenticated user. ### Method GET ### Endpoint /user ### Parameters #### Query Parameters - **opengwas_jwt** (string) - Optional - Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT. ### Response #### Success Response (200) - **user information** (object) - Contains the user's details. ``` -------------------------------- ### Get All Available Studies Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Retrieve a list of all studies available through the OpenGWAS API. ```r gwasinfo() ``` -------------------------------- ### ld_matrix() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Get LD matrix for list of SNPs. ```APIDOC ## ld_matrix() ### Description Get LD matrix for list of SNPs. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get Variant Info by rsID Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Retrieve variant information by providing a list of rsIDs. ```r b <- variants_rsid(c("rs234", "rs333")) ``` -------------------------------- ### gwasinfo() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Get list of studies with available GWAS summary statistics through API. ```APIDOC ## gwasinfo() ### Description Get list of studies with available GWAS summary statistics through API. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get API Status Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Check the current status of the OpenGWAS API. Requires the ieugwasr library to be loaded. ```r library(ieugwasr) api_status() ``` -------------------------------- ### Get User Details - ieugwasr Source: https://mrcieu.github.io/ieugwasr/reference/user.html Retrieves user details by authenticating with an OpenGWAS JWT. The JWT can be provided directly or set via the OPENGWAS_JWT environment variable. ```R user(opengwas_jwt = get_opengwas_jwt()) ``` -------------------------------- ### Get 1000 Genomes Annotations by Position Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Retrieve 1000 Genomes population annotations for a specified genomic position or region. ```r afl2_chrpos("1:100000-900000") ``` -------------------------------- ### Print GWAS Information (R) Source: https://mrcieu.github.io/ieugwasr/reference/print.GwasInfo.html This is the S3 method for printing objects of class 'GwasInfo'. It is automatically called when you print the output of the gwasinfo function. No specific setup is required beyond obtaining the GwasInfo object. ```R print(x, ...) ``` -------------------------------- ### Get 1000 Genomes Annotations for Common Variants Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Extract 1000 Genomes annotations for a list of 20,000 variants that are common across all super populations and evenly spaced across the genome. ```r afl2_list() ``` -------------------------------- ### Get list of studies with available GWAS summary statistics Source: https://mrcieu.github.io/ieugwasr/reference/gwasinfo.html Retrieve all available GWAS summary statistics datasets by calling gwasinfo without any arguments. Authentication may be required for protected endpoints. ```R gwasinfo(id = NULL, opengwas_jwt = get_opengwas_jwt(), ...) ``` -------------------------------- ### Get Tophits from a Study Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Retrieve the top associated variants (tophits) from a specified GWAS study. Strict clumping is applied by default. ```r tophits(id = "ieu-a-2") ``` -------------------------------- ### Get list of data batches Source: https://mrcieu.github.io/ieugwasr/reference/batches.html Call the `batches` function to retrieve a data frame of available GWAS data batches. Authentication is handled by `opengwas_jwt`, which can be obtained from the OpenGWAS API or set as an environment variable. ```r batches(opengwas_jwt = get_opengwas_jwt(), ...) ``` -------------------------------- ### Get Top Hits from GWAS Dataset Source: https://mrcieu.github.io/ieugwasr/reference/tophits.html Use this function to obtain top genetic hits from GWAS studies. It supports server-side clumping by default. Specify GWAS study IDs, p-value thresholds, clumping parameters (r2, kb), and reference population. ```R tophits( id, pval = 5e-08, clump = 1, r2 = 0.001, kb = 10000, pop = "EUR", force_server = FALSE, opengwas_jwt = get_opengwas_jwt(), ... ) ``` -------------------------------- ### Get list of studies with available GWAS summary statistics Source: https://mrcieu.github.io/ieugwasr/reference/gwasinfo.html Retrieves a dataframe containing details for all available GWAS studies. If an ID is provided, it returns details for that specific study. Otherwise, it returns all available datasets. ```APIDOC ## Get list of studies with available GWAS summary statistics through API ### Description Retrieves a dataframe of details for all available studies. If `id` is `NULL`, it retrieves all available datasets. Otherwise, it retrieves details for the specified OpenGWAS IDs. ### Method GET ### Endpoint /gwasinfo ### Parameters #### Query Parameters - **id** (string or list of strings) - Optional - List of OpenGWAS IDs to retrieve. - **opengwas_jwt** (string) - Optional - Used to authenticate protected endpoints. Obtain a JWT from https://api.opengwas.io. Can also be stored in .Renviron as OPENGWAS_JWT. ### Response #### Success Response (200) - **data** (dataframe) - A dataframe containing details for all available studies. ### Request Example ```R # Get all available studies gwasinfo() # Get a specific study by ID gwasinfo(id = "GCST000001") ``` ### Response Example ```json [ { "trait": "Alzheimer's disease", "study_accession": "GCST000001", "year": 2013, "author": "Sando et al.", "publication": "Nature Genetics", "journal_url": "http://www.nature.com/articles/ng.2585", "pubmedid": "23455511", "trait_reported": "Alzheimer's disease", "trait_mapped": "Alzheimer's disease", "trait_uri": "MONDO:0005136", "genome_build": "GRCh37", "ancestry_reported": "European", "ancestry_inference": "unknown", "ancestry_summary": "European", "ancestry_ncase": 13268, "ancestry_ncontrol": 29374, "ancestry_total": 42642, "unit": "log (OR)", "beta_unit": "log (OR)", "p_unit": "P", "ncase": 13268, "ncontrol": 29374, "total_sample_size": 42642, "download_url": "/downloads/GCST000001.tsv.gz", "source": "GWAS Catalog" } // ... more studies ] ``` ``` -------------------------------- ### Get LD matrix for list of SNPs Source: https://mrcieu.github.io/ieugwasr/reference/ld_matrix.html 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. ```APIDOC ## ld_matrix ### Description Generates an LD matrix for a given list of SNPs using a specified reference population. ### Usage ```R ld_matrix( variants, with_alleles = TRUE, pop = "EUR", opengwas_jwt = get_opengwas_jwt(), bfile = NULL, plink_bin = NULL, ... ) ``` ### Arguments * **variants** (list) - Required. A list of SNP rsids. * **with_alleles** (boolean) - Optional. Whether to append allele names to SNP names. Defaults to `TRUE`. * **pop** (string) - Optional. The super-population to use as a reference panel. Defaults to "EUR". Options include "EUR", "SAS", "EAS", "AFR", "AMR", and "legacy". * **opengwas_jwt** (string) - Optional. JWT for authenticating protected endpoints. Can be obtained from https://api.opengwas.io or set in .Renviron. * **bfile** (string) - Optional. Path to a local Bfile for API usage. Defaults to `NULL`. * **plink_bin** (string) - Optional. Path to the PLINK binary. If `NULL` and `bfile` is not `NULL`, the packaged PLINK binary for the OS will be detected. Defaults to `NULL`. * **...** - Additional arguments passed to `ld_matrix_api()`. ### Value Matrix of LD r values. ### Details The LD matrix generation uses bi-allelic SNPs with MAF > 0.01. Variants not meeting these criteria or absent from the reference panel will be excluded. Use `ld_reflookup()` to check variant presence. This function can be resource-intensive on OpenGWAS servers and is limited to 500 variants per call. Local execution is possible using `ld_matrix()` and related vignettes. ``` -------------------------------- ### Get LD matrix for list of SNPs Source: https://mrcieu.github.io/ieugwasr/reference/ld_matrix.html Use this function to obtain an LD matrix for a list of SNPs. It defaults to using the EUR super-population from the 1000 Genomes reference panel and includes allele names in the output. Authentication via opengwas_jwt is required for protected endpoints. ```R ld_matrix( variants, with_alleles = TRUE, pop = "EUR", opengwas_jwt = get_opengwas_jwt(), bfile = NULL, plink_bin = NULL, ... ) ``` -------------------------------- ### select_api Source: https://mrcieu.github.io/ieugwasr/reference/select_api.html Toggles the API address between development and release versions. ```APIDOC ## select_api ### Description Toggles the API address between development and release versions. ### Usage ```R select_api(where = "public", silent = FALSE) ``` ### Arguments * **where** (character) - Which API to use. Choice between `"public"`, `"private"`, `"dev1"`, `"dev2"`. Default = `"public"`. * **silent** (logical) - Silent? Default = `FALSE`. ### Value No return value, called for side effects. ``` -------------------------------- ### logging_info() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Details of how access token logs are used. ```APIDOC ## logging_info() ### Description Details of how access token logs are used. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### print(__) Source: https://mrcieu.github.io/ieugwasr/reference/index.html Print API status. ```APIDOC ## print(__) ### Description Print API status. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Call logging_info() function Source: https://mrcieu.github.io/ieugwasr/reference/logging_info.html This function is called for its side effects and does not return any value. Ensure it is called within the appropriate context for logging access token information. ```R logging_info() ``` -------------------------------- ### fill_n() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Look up sample sizes when meta data is missing from associations. ```APIDOC ## fill_n() ### Description Look up sample sizes when meta data is missing from associations. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### LD Clumping with Local PLINK Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Perform LD clumping locally by providing a path to PLINK and a BED/BIM/FAM LD reference dataset. ```r ld_clump( dplyr::tibble(rsid = a$rsid, pval = a$p, id = a$id), plink_bin = "/path/to/plink", bfile = "/path/to/reference_data" ) ``` -------------------------------- ### Check Datasets in Upload Process Source: https://mrcieu.github.io/ieugwasr/reference/editcheck.html Use this function to check datasets that are currently being uploaded. It requires a dataset ID and optionally an authentication token. ```R editcheck(id, opengwas_jwt = get_opengwas_jwt(), ...) ``` -------------------------------- ### Get Specific Study Information Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Retrieve information for a particular GWAS study by its ID. ```r gwasinfo("ieu-a-2") ``` -------------------------------- ### Verify API Authentication Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Make a request to the API to retrieve user information, confirming your JWT token is valid and working. ```r user() ``` -------------------------------- ### api_query() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Wrapper for sending queries and payloads to API. ```APIDOC ## api_query() ### Description Wrapper for sending queries and payloads to API. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### fill_n Source: https://mrcieu.github.io/ieugwasr/reference/fill_n.html Looks up sample sizes when meta data is missing from associations. It takes an output from `associations` as input and returns an updated version of it. ```APIDOC ## fill_n ### Description Look up sample sizes when meta data is missing from associations. ### Usage ```R fill_n(d, opengwas_jwt = get_opengwas_jwt(), ...) ``` ### Arguments * `d` (Output from `associations`): The input data frame. * `opengwas_jwt` (string): Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT. * `...` (Unused): For extensibility. ### Value Updated version of `d`. ``` -------------------------------- ### api_query Function Source: https://mrcieu.github.io/ieugwasr/reference/api_query.html A generic function to access various GET and POST endpoints in the GWAS database API. ```APIDOC ## api_query ### Description This function provides a generic way to access different GET and POST endpoints in the GWAS database API. ### Usage ```R api_query( path, query = NULL, opengwas_jwt = get_opengwas_jwt(), method = "GET", silent = TRUE, encode = "json", timeout = 300, override_429 = FALSE, x_api_source = paste0("ieugwasr/", utils::packageVersion("ieugwasr")) ) ``` ### Arguments * **path** (string) - Either a full query path (e.g. for get) or an endpoint (e.g. for post) queries. * **query** (list, optional) - If post query, provide a list of arguments as the payload. `NULL` by default. * **opengwas_jwt** (string, optional) - Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT. * **method** (string, optional) - Accepts `"GET"` (default), `"POST"`, `"DELETE"`, etc. * **silent** (boolean, optional) - `TRUE`/`FALSE` to be passed to httr call. `TRUE` by default. * **encode** (string, optional) - Default = `"json"`, see `httr::POST` for options. * **timeout** (numeric, optional) - Default = `300`. Avoid increasing this, preferentially simplify the query first. * **override_429** (boolean, optional) - Default=`FALSE`. If allowance is exceeded then the query will error before submitting a request to avoid getting blocked. If you are sure you want to submit the request then set this to TRUE. * **x_api_source** (string, optional) - Default = `paste0("ieugwasr/", utils::packageVersion("ieugwasr"))`. ### Value httr response object ``` -------------------------------- ### Get 1000 Genomes Annotations for HapMap3 Variants Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Extract 1000 Genomes annotations for the 1.3 million HapMap3 variants. ```r afl2_list("hapmap3") ``` -------------------------------- ### api_status() Source: https://mrcieu.github.io/ieugwasr/reference/index.html OpenGWAS server status. ```APIDOC ## api_status() ### Description OpenGWAS server status. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get Variants by Gene Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Find variants within a particular gene region by providing an Ensembl or Entrez gene ID. ```r c <- variants_gene("ENSG00000123374") ``` -------------------------------- ### Select API Endpoint Source: https://mrcieu.github.io/ieugwasr/reference/select_api.html Use this function to switch between the public, private, or development API endpoints. The default is the public endpoint. Setting `silent = TRUE` will suppress messages about the API change. ```R select_api(where = "public", silent = FALSE) ``` -------------------------------- ### LD Clumping with API Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Perform LD clumping using the API with a default LD reference panel from 1000 genomes. ```r a <- tophits(id = "ieu-a-2", clump = 0) b <- ld_clump( dplyr::tibble(rsid = a$rsid, pval = a$p, id = a$id) ) ``` -------------------------------- ### ld_clump_api() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Perform clumping on the chosen variants using through API. ```APIDOC ## ld_clump_api() ### Description Perform clumping on the chosen variants using through API. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### check_access_token() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Check if authentication has been made. ```APIDOC ## check_access_token() ### Description Check if authentication has been made. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get 1000 Genomes Annotations by rsID Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Look up population annotations, including alternative allele frequencies and LD scores, for a specific set of rsIDs from the 1000 Genomes project. ```r afl2_rsid(c("rs234", "rs123")) ``` -------------------------------- ### logging_info Source: https://mrcieu.github.io/ieugwasr/reference/logging_info.html This function logs information related to access tokens. It is called for its side effects and does not return any value. ```APIDOC ## logging_info() ### Description Logs details about access token usage. ### Usage ```R logging_info() ``` ### Value No return value, called for side effects. ``` -------------------------------- ### gwasinfo_files Source: https://mrcieu.github.io/ieugwasr/reference/gwasinfo_files.html Returns a list of download URLs for each file (.vcf.gz, .vcf.gz.tbi, _report.html) associated with a dataset. The URLs will expire in 2 hours. ```APIDOC ## gwasinfo_files ### Description Returns a list of download URLs for each file (.vcf.gz, .vcf.gz.tbi, _report.html) associated with a dataset. The URLs will expire in 2 hours. If a dataset is missing from the results, that means either the dataset doesn't exist or you don't have access to it. If a dataset is in the results but some/all links are missing, that means the files are unavailable. ### Method `gwasinfo_files(id, opengwas_jwt = get_opengwas_jwt(), ...)` ### Parameters #### Path Parameters - **id** (List) - Required - List of OpenGWAS IDs to retrieve. #### Query Parameters - **opengwas_jwt** (string) - Optional - Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a JWT. Provide the JWT string here, or store in .Renviron under the keyname OPENGWAS_JWT. - **...** - Unused, for extensibility ### Value Dataframe of details for requested studies ``` -------------------------------- ### Get Variant Info by Chromosome Position Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Retrieve variant information, including dbSNP IDs and gene info, by specifying chromosome and position. Accepts chr:position or chr:start-end formats. ```r a <- variants_chrpos(c("7:105561135-105563135", "10:44865737")) ``` -------------------------------- ### Perform LD clumping using local data Source: https://mrcieu.github.io/ieugwasr/articles/local_ld.html Performs LD clumping using local PLINK binaries and a specified LD reference panel. Requires a dataframe with 'rsid', 'pval', and 'trait_id' columns. ```R 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" ) ``` -------------------------------- ### Print API Status Method Source: https://mrcieu.github.io/ieugwasr/reference/print.ApiStatus.html This is the S3 method for printing the API status. It takes an object of class 'ApiStatus' as input and prints its status. Unused arguments are included for extensibility. ```R # S3 method for class 'ApiStatus' print(x, ...) ``` -------------------------------- ### General API Query (POST) Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Perform a POST request to an API endpoint, sending a list of query specifications in the payload. Useful for long lists of rsids. ```r api_query("associations", query = list(rsid = c("rs234", "rs123"), id = c("ieu-a-2", "ieu-a-7"))) ``` -------------------------------- ### print.ApiStatus Source: https://mrcieu.github.io/ieugwasr/reference/print.ApiStatus.html This S3 method is used to print the status of the API, typically the output from the `api_status` function. ```APIDOC ## print.ApiStatus ### Description Prints the status of the API. This is an S3 method for objects of class 'ApiStatus'. ### Usage ```R # S3 method for class 'ApiStatus' print(x, ...) ``` ### Arguments * `x` (Output from `api_status`): The object containing the API status information to be printed. * `...` (Unused): Placeholder for future extensibility. ### Value Prints the API status to the console. ``` -------------------------------- ### legacy_ids() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Convert current IDs to legacy IDs. ```APIDOC ## legacy_ids() ### Description Convert current IDs to legacy IDs. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### infer_ancestry() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Infer ancestry of GWAS dataset by matching against 1000 genomes allele frequencies. ```APIDOC ## infer_ancestry() ### Description Infer ancestry of GWAS dataset by matching against 1000 genomes allele frequencies. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get variants by chromosome and position Source: https://mrcieu.github.io/ieugwasr/reference/variants_chrpos.html Use this function to find all variants within a given radius of specified chromosome and positions. Input can be a list of chr:pos strings or ranges. Authentication may be required for protected endpoints. ```R variants_chrpos(chrpos = c("3:46414943", "3:122991235"), radius = 100000) ``` -------------------------------- ### Generate LD Matrix with Local PLINK Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Generate an LD matrix locally using PLINK and local LD reference data. ```r ld_matrix(b$variant, plink_bin = "/path/to/plink", bfile = "/path/to/reference_data") ``` -------------------------------- ### Get variants around a gene with default radius Source: https://mrcieu.github.io/ieugwasr/reference/variants_gene.html Retrieve variants around a gene using its Ensembl ID. The default radius is 0, meaning only variants directly overlapping the gene region will be returned unless a different radius is specified. ```r variants_gene(gene = "ENSG00000123374") ``` -------------------------------- ### print(__) Source: https://mrcieu.github.io/ieugwasr/reference/index.html Print GWAS information. ```APIDOC ## print(__) ### Description Print GWAS information. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Get variants around a gene using Ensembl ID Source: https://mrcieu.github.io/ieugwasr/reference/variants_gene.html Use this function to retrieve variants within a specified radius of a gene. Provide the gene identifier (Ensembl or Entrez) and optionally a radius. Authentication may be required for certain endpoints. ```r variants_gene(gene = "ENSG00000123374", radius = 50000) ``` -------------------------------- ### Generate LD matrix using local data Source: https://mrcieu.github.io/ieugwasr/articles/local_ld.html Generates an LD r value matrix using local PLINK binaries and a specified LD reference panel. Accepts a vector of rsids. ```R ieugwasr::ld_matrix( dat$rsid, plink_bin = genetics.binaRies::get_plink_binary(), bfile = "/path/to/reference/EUR" ) ``` -------------------------------- ### Get variants around a gene using Entrez ID Source: https://mrcieu.github.io/ieugwasr/reference/variants_gene.html This function retrieves genetic variants near a gene. It accepts Entrez IDs for gene identification and allows specifying a search radius. Authentication can be handled via an opengwas_jwt argument or an environment variable. ```r variants_gene(gene = 1017, radius = 50000) ``` -------------------------------- ### ld_matrix_local Source: https://mrcieu.github.io/ieugwasr/reference/ld_matrix_local.html Calculates the LD matrix using local PLINK binary and a reference dataset. ```APIDOC ## ld_matrix_local ### Description Calculates the LD matrix using local PLINK binary and a reference dataset. ### Usage ```R ld_matrix_local(variants, bfile, plink_bin, with_alleles = TRUE) ``` ### Arguments * **variants** (list) - Required - List of variants (rsids). * **bfile** (string) - Required - Path to bed/bim/fam ld reference panel. * **plink_bin** (string) - Optional - Specify path to plink binary. Default = `NULL`. See https://github.com/MRCIEU/genetics.binaRies for convenient access to plink binaries. * **with_alleles** (boolean) - Optional - Whether to append the allele names to the SNP names. Default: `TRUE`. ### Value data frame ``` -------------------------------- ### Retrieve Allele Frequency and LD Scores for Variant Lists Source: https://mrcieu.github.io/ieugwasr/reference/afl2_list.html Use this function to get ancestry-specific LD scores and allele frequencies for pre-defined lists of variants. Choose between a reduced set of common SNPs or the larger HapMap3 set. Authentication may be required for protected endpoints. ```R afl2_list(variantlist = "reduced", opengwas_jwt = get_opengwas_jwt(), ...) ``` -------------------------------- ### ld_clump_local Function Source: https://mrcieu.github.io/ieugwasr/reference/ld_clump_local.html Wrapper for clump function using local plink binary and ld reference dataset. ```APIDOC ## ld_clump_local ### Description Wrapper for clump function using local plink binary and ld reference dataset. ### Usage ```R 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** (numeric) - Clumping kb window. Default is very strict, `10000`. * **clump_r2** (numeric) - Clumping r2 threshold. Default is very strict, `0.001`. * **clump_p** (numeric) - Clumping sig level for index variants. Default = `1` (i.e. no threshold). * **bfile** (string) - If this is provided then will use the API. Default = `NULL`. * **plink_bin** (string) - Specify path to plink binary. Default = `NULL`. See https://github.com/MRCIEU/genetics.binaRies for convenient access to plink binaries. ### Value Data frame of clumped variants ``` -------------------------------- ### get_query_content() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Parse out json response from httr object. ```APIDOC ## get_query_content() ### Description Parse out json response from httr object. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### get_opengwas_jwt() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Retrieve OpenGWAS JSON Web Token from .Renviron file. ```APIDOC ## get_opengwas_jwt() ### Description Retrieve OpenGWAS JSON Web Token from .Renviron file. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Perform LD clumping using API data Source: https://mrcieu.github.io/ieugwasr/articles/local_ld.html Performs LD clumping using the OpenGWAS API with default reference data. This is a simpler alternative when local operations are not required. ```R a <- tophits(id="ieu-a-2", clump = 0) b <- ld_clump( dplyr::tibble(rsid = a$rsid, pval = a$p, id = a$id) ) ``` -------------------------------- ### editcheck() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Check datasets that are in process of being uploaded. ```APIDOC ## editcheck() ### Description Check datasets that are in process of being uploaded. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### tophits() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Obtain top hits from a GWAS dataset. ```APIDOC ## tophits() ### Description Obtain top hits from a GWAS dataset. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### afl2_list() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Retrieve allele frequency and LD scores for pre-defined lists of variants. ```APIDOC ## afl2_list() ### Description Retrieve allele frequency and LD scores for pre-defined lists of variants. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Local LD Clumping Function Wrapper Source: https://mrcieu.github.io/ieugwasr/reference/ld_clump_local.html Use this function to perform LD clumping using a local PLINK binary and a specified LD reference dataset. Ensure your input dataframe contains 'variant' and 'pval' columns. The 'id' column can be used for per-ID clumping. ```R ld_clump_local(dat, clump_kb, clump_r2, clump_p, bfile, plink_bin) ``` -------------------------------- ### Authenticate with OpenGWAS API Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Check if your JWT token is recognized by the ieugwasr package. Ensure you have set the OPENGWAS_JWT environment variable. ```r library(ieugwasr) get_opengwas_jwt() ``` -------------------------------- ### check_reset() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Check if OpenGWAS allowance needs to be reset. ```APIDOC ## check_reset() ### Description Check if OpenGWAS allowance needs to be reset. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Check OpenGWAS Allowance Reset Source: https://mrcieu.github.io/ieugwasr/reference/check_reset.html Use this function to check if the OpenGWAS allowance has been used up. It will error if a new query is submitted before the reset time to prevent IP blocking. Set `override_429` to `TRUE` to bypass this check. ```r check_reset(override_429 = FALSE) ``` -------------------------------- ### set_reset() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Set the reset time for OpenGWAS allowance. ```APIDOC ## set_reset() ### Description Set the reset time for OpenGWAS allowance. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Perform PheWAS in specific batches Source: https://mrcieu.github.io/ieugwasr/articles/guide.html Perform PheWAS in only specified batches using the 'batch' argument. ```r phewas(variants = "rs1205", pval = 1e-5, batch = c('ieu-a', 'ukb-b')) ``` -------------------------------- ### legacy_ids Source: https://mrcieu.github.io/ieugwasr/reference/legacy_ids.html Converts a vector of current IDs to their legacy ID equivalents. ```APIDOC ## legacy_ids ### Description Converts a vector of current IDs to their legacy ID equivalents. ### Usage ```R legacy_ids(x) ``` ### Arguments * `x` (vector) - A vector of IDs to be converted. ### Value Returns a vector of back-compatible (legacy) IDs. ``` -------------------------------- ### afl2_chrpos() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Look up allele frequencies and LD scores for 1000 genomes populations by chrpos. ```APIDOC ## afl2_chrpos() ### Description Look up allele frequencies and LD scores for 1000 genomes populations by chrpos. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### get_query_content Source: https://mrcieu.github.io/ieugwasr/reference/get_query_content.html Parses the JSON response from an API query. ```APIDOC ## get_query_content ### Description Parses out JSON response from an httr object. ### Usage ```R get_query_content(response) ``` ### Arguments * `response` (httr object) - Output from `api_query()` ### Value Parsed JSON output from query, often in the form of a data frame. If the status code is not successful, then the actual response is returned. ``` -------------------------------- ### ld_clump() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Perform LD clumping on SNP data. ```APIDOC ## ld_clump() ### Description Perform LD clumping on SNP data. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### editcheck Function Source: https://mrcieu.github.io/ieugwasr/reference/editcheck.html Checks datasets that are in process of being uploaded. It requires a dataset ID and an optional JWT for authentication. ```APIDOC ## editcheck ### Description Check datasets that are in process of being uploaded. ### Usage ```R editcheck(id, opengwas_jwt = get_opengwas_jwt(), ...) ``` ### Arguments * **id** (string) - Required - The ID of the dataset to check. * **opengwas_jwt** (string) - Optional - Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT. * **...** - Unused, for extensibility ### Value Dataframe ``` -------------------------------- ### associations() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Query specific variants from specific GWAS. ```APIDOC ## associations() ### Description Query specific variants from specific GWAS. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### Check OpenGWAS Server Status Source: https://mrcieu.github.io/ieugwasr/reference/api_status.html Use the `api_status` function to retrieve a list of values regarding the status of OpenGWAS servers. This function is designed for extensibility and accepts additional arguments. ```R api_status(...) ``` -------------------------------- ### print.GwasInfo Source: https://mrcieu.github.io/ieugwasr/reference/print.GwasInfo.html This S3 method is used to print GWAS information that has been retrieved using the `gwasinfo` function. ```APIDOC ## print.GwasInfo ### Description Prints GWAS information. ### Usage ```R # S3 method for class 'GwasInfo' print(x, ...) ``` ### Arguments * `x` (Output from `gwasinfo`): The GWAS information object to print. * `...` (Unused): For extensibility. ### Value Prints out GWAS information to the console. ``` -------------------------------- ### Check Access Token Status Source: https://mrcieu.github.io/ieugwasr/reference/check_access_token.html This function is deprecated and should not be used. It was previously used to check if an access token was set. Use `get_opengwas_jwt()` for current authentication status. ```R check_access_token() ``` -------------------------------- ### batch_from_id() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Extract batch name from study ID. ```APIDOC ## batch_from_id() ### Description Extract batch name from study ID. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### variants_rsid() Source: https://mrcieu.github.io/ieugwasr/reference/index.html Obtain information about rsid. ```APIDOC ## variants_rsid() ### Description Obtain information about rsid. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters N/A (Function Signature) ### Request Example N/A (Function Signature) ### Response N/A (Function Signature) ### Response Example N/A (Function Signature) ``` -------------------------------- ### check_reset Source: https://mrcieu.github.io/ieugwasr/reference/check_reset.html Checks if the OpenGWAS allowance needs to be reset. It prevents the IP from being blocked by erroring if a new query is submitted before the reset time. If the allowance has been used up, it displays a message indicating the reset time. The default behavior is to throw an error if the allowance is used up, but this can be overridden. ```APIDOC ## Function: check_reset ### Description Checks if a recent query indicated that the OpenGWAS allowance has been used up. To prevent the IP being blocked, it will error if the new query is being submitted before the reset time. If the allowance has been used up, it displays a message indicating the time when the allowance will be reset. By default, the function will throw an error if the allowance has been used up, but this behavior can be overridden by setting `override_429` to `TRUE`. ### Usage ```R check_reset(override_429 = FALSE) ``` ### Arguments * **override_429** (Logical) - Optional - Indicates whether to override the allowance reset check. Defaults to `FALSE`. ```