Skip to content

Instantly share code, notes, and snippets.

@GenDataPro
Created March 3, 2016 13:13
Show Gist options
  • Save GenDataPro/7b522ef8b0a5f505586e to your computer and use it in GitHub Desktop.
Save GenDataPro/7b522ef8b0a5f505586e to your computer and use it in GitHub Desktop.
import requests, sys
import json
gene_id = "NCOR2"
response = requests.get("http://rest.ensembl.org/lookup/symbol/homo_sapiens/{}?content-type=application/json;expand=1".format(gene_id))
json_data = response.content.decode("utf-8")
data = json.loads(json_data)
i = 0
numbers = []
while i < len(data.get('Transcript',[])):
print data['Transcript'][i]['Translation']['id']
numbers.append(i)
i = i + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment