EBISPOT / goci-rest

Apache License 2.0
4 stars 1 forks source link

Issue with Rest API raised by Yueji #40

Closed sajo-ebi closed 2 years ago

sajo-ebi commented 2 years ago

I am using api to retrieve studies of EFO traits using the following code via python:

EFO="EFO_0004339" # cardiovascular measurement link="https://www.ebi.ac.uk/gwas/rest/api/efoTraits/"+EFO+"/studies" studies=requests.get(link) text_file = open('/Users/yueji/downloads/error', "w") n = text_file.write(studies.text) text_file.close()

What I found from the result is at the end of this file, there is no “}” to finish this josn file. So that when I tried to use json.loads(studies.text) , it showed me error. I attached the josn file I extracted here for your reference. I am not sure is that I did not retrieve in a right way.https://app.zenhub.com/files/135733978/2b446e97-b28e-41f2-86c8-a4397d1005d8/download

ramiromagno commented 2 years ago

I think your issue is similar to mine: https://github.com/EBISPOT/goci-rest/issues/39

jiyue1214 commented 2 years ago

@ramiromagno I found this problem initially when I run the gwasrapidd with get_studies(efo_id="EFO_0004339"). It returned me an error that Error: parse error: premature EOF { "_embedded" : { "studie (right here) ------^ After that, I retrieved the JSON file and found the problem.

sprintell commented 2 years ago

The same problem might be responsible for the issue reported by Christopher Harrison today

Dear GWAS Catalog

A non-trivial subset of studies return an internal server error upon trying to access their metadata using your REST API. Interestingly, the web frontend still appears to work, for the small subset of affected studies that I tried.

There are about 8,000 such studies that I've found. I've attached a list of their accession IDs. You can see the error by going to:

https://www.ebi.ac.uk/gwas/rest/api/studies/${ACCESSION_ID}

https://app.zenhub.com/files/135733978/0d1181d8-f5a0-427d-9419-a0df6f76d3e4/download

sajo-ebi commented 2 years ago

@jiyue1214 the fix has been deployed , I have fired few requests from Ramiro sheet , they are working. Kindly confirm if your issue with API is reolved

jiyue1214 commented 2 years ago

Hi @sajo-ebi, I can transform API results into dataframe successfully now. My issue has been perfectly solved! Thank you so much for your help.