Created
June 19, 2019 09:25
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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