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

Error in get_studies #13

Closed alexb-84 closed 3 years ago

alexb-84 commented 3 years ago

Hi there,

I found an issue happening during the parsing of the JSON object returned by the GWAS Catalog API. When a study has "diseaseTrait": null , the gwasrapidd::get_studies function raises the following error:

> Error in obj$content$studies$diseaseTrait$trait : 
> $ operator is invalid for atomic vectors

This function call reproduces the error:

gwasrapidd::get_studies(association_id = '62871909', verbose = T)
#> Base URL: https://www.ebi.ac.uk/gwas/rest/api.
#> Requesting resource: https://www.ebi.ac.uk/gwas/rest/api/associations/62871909/study.
#> Using the user agent: gwasrapidd: GWAS R API Data Download.
#> Response code: 200.
#> Response content type: application/json.
#> Error in obj$content$studies$diseaseTrait$trait : 
#>   $ operator is invalid for atomic vectors

I am running gwasrapidd 0.99.9 on R 4.0.3.

I guess a simple check on the JSON names (e.g. !is.null(obj$content$studies$diseaseTrait)) before accessing the data could work as a fix.

ramiromagno commented 3 years ago

Hi @alexb-84,

Thank you for reporting this issue!

I will look into it soon.

ramiromagno commented 3 years ago

Hi @alexb-84,

Could you please reinstall gwasrapidd and test whether this issue has been indeed resolved?

alexb-84 commented 3 years ago

Hi @ramiromagno,

Thanks for the fast fix. I just reinstalled gwasrapidd and tested it. I can confirm now it is working fine on my side.

Best,

Ale

ramiromagno commented 3 years ago

Thank you for the feedback!

ramiromagno commented 1 year ago

Hi @alexb-84: I would like to reach out by email. Could you contact at rmagno at pattern.institute?