Skip to content

Instantly share code, notes, and snippets.

@eric-czech
Created August 9, 2021 19:12
Show Gist options
  • Save eric-czech/e599b7cbcdadb0b981e5c61438be6ce8 to your computer and use it in GitHub Desktop.
Save eric-czech/e599b7cbcdadb0b981e5c61438be6ce8 to your computer and use it in GitHub Desktop.
Zooma API Query for EFO disease
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