Skip to content

Instantly share code, notes, and snippets.

@kozo2
Last active December 29, 2015 19:59
Show Gist options
  • Save kozo2/7720991 to your computer and use it in GitHub Desktop.
Save kozo2/7720991 to your computer and use it in GitHub Desktop.
import requests
ORGANISM = "hsa"
pathways = requests.get('http://rest.kegg.jp/list/pathway/' + ORGANISM)
for line in pathways.content.split('\n'):
pathwayid = line.split('\t')[0].replace('path:', '')
kgml = requests.get('http://rest.kegg.jp/get/' + pathwayid + '/kgml')
f = open(pathwayid + '.xml', 'w')
f.write(kgml.content)
f.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment