This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Alignment REST API

Hello, I want to implement a rest api with python and requests to perform an alignment on Emboss needle https://www.ebi.ac.uk/Tools/psa/emboss_needle/

I have used the following code but I am getting the following error. I do not know what I'm doing wrong. Can somebody help me?

Thank you so much

import requests
base_url="https://www.ebi.ac.uk/Tools/services/rest/emboss_needle/run"
auth_data = {'email': 'joseludenia@gmail.com'}
params={"asequence":"agtgctagggaggatcgggatgcgatgca" , "bsequence":"agtgcttggaggatcatgctaggatgca"}
response=requests.post(base_url, data=auth_data,  params=params)
id=response.text
res=requests.get(f"https://www.ebi.ac.uk/Tools/services/rest/emboss_needle/result/{id}/aln")
print(res.text)

ERROR

<?xml version='1.0' encoding='UTF-8'?>
<error>
 <description>Job 'emboss_needle-R20230322-062343-0348-8675423-p1m' is still running</description>
</error>
emboss rest-api alignment needle python

1 answer

Why reinventing the wheel if they kindly give code for using their REST API? From https://www.ebi.ac.uk/seqdb/confluence/display/JDSAT/EMBOSS+Needle+Help+and+Documentation#EMBOSSNeedleHelpandDocumentation-RESTAPI

Yes, I agree, but is it possible to modify my code so that it doesn't return the error and keep waiting while the job is running? Thank you.

Just check what they'd implemented so far in their script (for example, in the clientPool function).

Log in to answer this question.