This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get GO terms for list of NCBI genes from Gene Ontology API using Python

I'm trying to get GO terms for a list of NCBI/Entrez genes by querying the Gene Ontology API from Python. I've managed to do this for single genes, like this:

gene_id = 1493
r = requests.get("http://api.geneontology.org/api/bioentity/gene/NCBIGene:" + str(gene_id) + '/function',verify = False)

I could of course loop over my gene IDs one by one, but is there a way to query an entire gene set at once? The GO API documentation (http://api.geneontology.org/api) has some query examples for bioentity sets, but they don't seem to fit my use case.

python gene-ontology

1 answer

It is not possible, as the request is executed accepting only a string as a value. Visiting their github profile, it appears somehow as a scheduled enhancement https://github.com/geneontology/biolink-api/issues/13

Log in to answer this question.