The GWASapi package provides access to the NHGRI-EBI catalog of GWAS summary statistics. For details on the API, see its documentation, as well as Pjotr Prins’s documentation at github.
You can install GWASapi from GitHub.
You first need to install the remotes.
Then use remotes::install_github() to install
GWASapi.
Load the package with library().
The purpose of the GWASapi package is to provide access to summary statistics for human GWAS. First, you can get lists of studies and traits that are available.
To get lists of studies, use list_studies(). The default
is to return just 20 studies. You can control that limit with the
argument size. You can also use start to step
through the full set.
To retrieve all studies, set a higher limit
To get a list of traits, use list_traits(). Again the
default is to return just 20 values. To get all traits, use the
size argument.
The traits are returned as identifiers like
"EFO_0000249". To get a description of a trait, you can use
the ontology lookup service, for example https://www.ebi.ac.uk/efo/EFO_0001360
Chromosomes are stored as integers 1-24.
To get associations for a specific variant by its rs-number, use
get_variant(). If you know the chromosome it is on, you’ll
get faster results by providing the chromosome. And again, the default
is to return just 20 values, so use the size and
start arguments if you want a comprehensive list. The
result is a data frame with columns such as
base_pair_location, p_value,
study_accession, and trait.
Use the arguments p_lower and p_upper to
focus on associations with p-value in a specified range. For example, to
get all of the associations with p-value < 10-10, you
would do:
To get associations for a specific region, use
get_asso(). For example, to get the region from 19.2 Mbp to
19.3 Mbp on chr 19:
You can restrict those results to a particular study.
To get associations for a given trait, use
get_trait_asso(). You can’t restrict this to a given
chromosome region.