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!
get the PDB identifier and use the PDB API: https://www.rcsb.org/docs/programmatic-access/web-services-overview
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.
uh ? isn't https://files.rcsb.org/download/1hh3.pdb a PDB format ?
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.
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.