Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example script to retrieve phenotype data for a C. elegans gene using the WormBase REST API
# script to retrieve the phenotype info for a particular gene from WormBase
import requests, sys
server = ""
ext = "/rest/field/gene/WBGene00000079/phenotype"
r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
if not r.ok:
decoded = r.json()
# print(decoded)
# based on looking at the example
phenotypes = decoded["phenotype"]
phenotypes = phenotypes["data"]
for phenotype in phenotypes:
phenotype = phenotype["phenotype"]
phenotype_id = phenotype["id"]
label = phenotype["label"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.