Uniprot API access to download .pdb files
0
1
Entering edit mode
11 months ago
BioGrad321 • 0

Hey everyone, fairly new to Bioinformatics so please cut me some slack.

Anyways, I am trying to work with the UniProt API and I am running into a bit of a wall. My goal is to write a URL that I can send through the requests library to return a pdb file for a given Uniprot ID. I don't think the Uniport API can actually return a response with the .pdb format, but if the information was present I would at least be able to convert it using another library.

Current Attempt:

requests.get(f"https://rest.uniprot.org/uniprotkb/search?query={Uniprot_ID_NUMBER}&fields=structure_3d").json())

The above request returns a json object with all the different PDB structure codes, however I need to find a way to actually receive the PDB files themselves.

UniProt API Link: https://www.uniprot.org/help/api_queries

Any advice here is greatly appreciated!

PDB API Python Uniprot • 1.5k views
ADD COMMENT
1
Entering edit mode

get the PDB identifier and use the PDB API: https://www.rcsb.org/docs/programmatic-access/web-services-overview

ADD REPLY
0
Entering edit mode

Ok this was actually something I was trying to do earlier but I was a bit confused on how to download a .pdb file from this API. I tried using this example URL provided by that website, "https://files.rcsb.org/download/1hh3.pdb1" to download a .pdb file, however I couldn't figure out how to download the retrieved text in .pdb format. It returned a response object that I was unable to write to a file.

Should I not be putting the above link into the requests library? Cause I see that if I simply click the link it prompts me to download.

ADD REPLY
1
Entering edit mode

uh ? isn't https://files.rcsb.org/download/1hh3.pdb a PDB format ?

ADD REPLY
0
Entering edit mode

Yea, the problem was that when I requests.get(https://files.rcsb.org/download/1hh3.pdb) it was returning a response object and I was having a difficult time figuring out how to turn that into a .pdb file.

ADD REPLY
0
Entering edit mode

Ok I realized that I should note here that I was able to get the file with urllib.request libary. Thanks for your help but I should be all good for now.

ADD REPLY

Login before adding your answer.

Traffic: 3260 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