Entering edit mode
2.3 years ago
Recep
•
0
Hey, I tried to do id mapping on uniprot.org. When I enter API Request, I get the following result.
curl --form 'from=UniProtKB_AC-ID' \
--form 'to=Ensembl' \
--form 'ids=A0A0S2Z391,Q16611,Q9Y263,Q9UL54' \
https://rest.uniprot.org/idmapping/run
I converted this code to python (as follows)
import requests
files = {
'from': (None, 'UniProtKB_AC-ID'),
'to': (None, 'Ensembl'),
'ids': (None, 'A0A0S2Z391,Q16611,Q9Y263,Q9UL54'),
}
response = requests.post('https://rest.uniprot.org/idmapping/run', files=files)
How can i extract outputs from response? I mean the conversions.
Your code currently returns:
I have no idea, how this API works, but you get a jobId returned upon posting your request. You will likely need to use this Id to retrieve the results with a second API request somehow, but that should be documented.
You can also always check how other people did it, if you search for packages on PyPi, e.g. uniprot-cli.