Created
August 9, 2021 19:12
-
-
Save eric-czech/e599b7cbcdadb0b981e5c61438be6ce8 to your computer and use it in GitHub Desktop.
Zooma API Query for EFO disease
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from urllib.parse import quote_plus | |
def get_info(disease): | |
url_fmt = 'http://www.ebi.ac.uk/spot/zooma/v2/api/services/annotate?propertyValue={disease}&propertyType=disease&filter=ontologies:[efo]' | |
url = url_fmt.format(disease=quote_plus(disease)) | |
print(url) | |
res = requests.get(url).json() | |
if len(res) == 0: | |
return None | |
return dict( | |
zooma_name = res[0]['annotatedProperty']['propertyValue'], | |
efo_id = res[0]['_links']['olslinks'][0]['semanticTag'].split('/')[-1] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment