Skip to contents

This function attempts to get a variant by its variant identifier and checks the response code. If the response code is 200 then the response has been successful, meaning that the variant does exist in the GWAS Catalog. If the response is 404 then the variant is not found in the Catalog database. Other errors are mapped to NA.

Usage

exists_variant(variant_id = NULL, verbose = FALSE, page_size = 20L)

Arguments

variant_id

A character vector of GWAS Catalog variant identifiers.

verbose

Whether the function should be verbose about the different queries or not.

page_size

An integer scalar indicating the page value to be used in the JSON requests, can be between 1 and 1000.

Value

A named logical vector, TRUE indicates that the variant does exist in the Catalog, FALSE otherwise. NA codes other types of errors. The names of the vector are the variant identifiers passed as

variant_id.

Examples

exists_variant('rs12345')
#> rs12345 
#>    TRUE 

exists_variant('rs11235813')
#> rs11235813 
#>      FALSE