Skip to contents

Retrieves traits via the NHGRI-EBI GWAS Catalog REST API. The REST API is queried multiple times with the criteria passed as arguments (see below). By default all traits that match the criteria supplied in the arguments are retrieved: this corresponds to the default option set_operation set to 'union'. If you rather have only the traits that match simultaneously all criteria provided, then set set_operation to 'intersection'.

Usage

get_traits(
  study_id = NULL,
  association_id = NULL,
  efo_id = NULL,
  pubmed_id = NULL,
  efo_uri = NULL,
  efo_trait = NULL,
  set_operation = "union",
  verbose = FALSE,
  warnings = TRUE
)

Arguments

study_id

A character vector of GWAS Catalog study accession identifiers.

association_id

A character vector of GWAS Catalog association identifiers.

efo_id

A character vector of EFO identifiers.

pubmed_id

An integer vector of PubMed identifiers.

efo_uri

A character vector of EFO URIs.

efo_trait

A character vector of EFO trait descriptions, e.g., 'uric acid measurement'.

set_operation

Either 'union' or 'intersection'. This tells how traits retrieved by different criteria should be combined: 'union' binds together all results removing duplicates and 'intersection' only keeps same traits found with different criteria.

verbose

A logical indicating whether the function should be verbose about the different queries or not.

warnings

A logical indicating whether to print warnings, if any.

Value

A traits object.

Details

Please note that all search criteria are vectorised, thus allowing for batch mode search, e.g., one can search by multiple trait identifiers at once by passing a vector of identifiers to efo_id.

Examples

if (FALSE) {
# Get traits by study identifier
get_traits(study_id = 'GCST001085', warnings = FALSE)

# Get traits by association identifier
get_traits(association_id = '25389945', warnings = FALSE)

# Get a trait by its EFO identifier
get_traits(efo_id = 'EFO_0005537', warnings = FALSE)
}