ramiromagno / gwasrapidd

gwasrapidd: an R package to query, download and wrangle GWAS Catalog data
https://rmagno.eu/gwasrapidd/
Other
93 stars 14 forks source link

Unexpected error in get_variants_by_efo_id: Error: length(efo_trait) not greater than 0 #16

Closed ramiromagno closed 3 years ago

ramiromagno commented 3 years ago
gwasrapidd:::get_variants_by_efo_id(efo_id = 'EFO_0000000')
Warning: The request for https://www.ebi.ac.uk/gwas/rest/api/efoTraits/EFO_0000000 failed: response code was 404.
Error: length(efo_trait) not greater than 0
In addition: Warning message:
In gc_request_all(resource_url = resource_url, base_url = base_url,  :

 Error: length(efo_trait) not greater than 0 

That call should not err, but only trigger a warning.

The problem comes from not asserting the NULL value in: https://github.com/ramiromagno/gwasrapidd/blob/d51d07a2d6e97dff1d8ac601546f401ef0ac7977/R/get_variants.R#L181

and moving on to the call get_variants_by_efo_trait empty-handed.

A manifestation of issue #3 .