How to get results from a curl
0
0
Entering edit mode
7 weeks 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.

Ensembl Biomart Uniprot • 210 views
ADD COMMENT
0
Entering edit mode

Your code currently returns:

response.json()
{'jobId': 'db942c3c2818e24dc10010136c59c89c2acdef7e'}

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.

ADD REPLY

Login before adding your answer.

Traffic: 1034 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6