Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avrilcoghlan/965a556d694be8dac2a6448307efb04e to your computer and use it in GitHub Desktop.
Save avrilcoghlan/965a556d694be8dac2a6448307efb04e to your computer and use it in GitHub Desktop.
Script to get a list of all Schistosoma mansoni protein-coding genes from WormBase ParaSite
# script to retrieve a list of all protein-coding Schistosoma mansoni genes from wormbase parasite
# example script taken from https://parasite.wormbase.org/rest-13/documentation/info/lookup_genome
import requests, sys
server = "https://parasite.wormbase.org"
ext = "/rest-13/lookup/genome/schistosoma_mansoni_prjea36577?biotypes=protein_coding"
# took the PRJEA from https://parasite.wormbase.org/Schistosoma_mansoni_prjea36577/Info/Index/
r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
if not r.ok:
r.raise_for_status()
sys.exit()
decoded = r.json()
# go through the genes and print them out one at a time:
cnt = 0
for gene in decoded:
cnt += 1
print(cnt," ",gene["id"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment