Can anybody please explain the below line to me.
"We took the structure and coordinates of nogalamycin from the X-ray structure determined in PDB code = 1D17"
What do I need to download from there....a pdb file or what?
Thank you
Can anybody please explain the below line to me.
"We took the structure and coordinates of nogalamycin from the X-ray structure determined in PDB code = 1D17"
What do I need to download from there....a pdb file or what?
Thank you
well wasnt able to figure out how to make openapigenerator work with rcsb pdb ModelServer https://models.rcsb.org/, I ended up with this code copying the webserver manual input results for ligands:
import requests
def main():
risposta = requests.get('https://models.rcsb.org/v1/1d17/ligand?encoding=cif©_all_categories=false&download=true&filename=out',
allow_redirects=True)
open('out.cif', 'wb').write(risposta.content)
print(risposta.status_code)
if __name__ == '__main__':
main()
unfortunately the server gives you the wrong ligand (try it out)
it says :' /v1/{id}/ligand Coordinates of the first group satisfying the given criteria.'
tried with:
risposta = requests.get('https://models.rcsb.org/v1/1d17/ligand?label_atom_id=NGM&encoding=cif©_all_categories=false&download=true&filename=out',
allow_redirects=True)
but no luck again, think problem is in downloaded file :
_model_server_params.name atom_site
_model_server_params.value '{"label_atom_id":"NGM"}' ###### here
but not an expert of APis and openAPI at all
EDITED:
eventually I got it right using in the code above:
risposta = requests.get('https://models.rcsb.org/v1/1d17/ligand?label_comp_id=NGM&encoding=cif©_all_categories=false&download=true&filename=out',
allow_redirects=True)
so I get a out.cif file containing NGM
using another database and FTP :
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 19 19:29:30 2021
@author: Pietro
https://bioinformatics.stackexchange.com/questions/18076/help-me-in-understanding-the-pdb-file#comment25289_18076
Ligand extract:
https://stackoverflow.com/questions/61390035/how-to-save-each-ligand-from-a-pdb-file-separately-with-bio-pdb
"""
from ftplib import FTP
import gzip
import os
from Bio.PDB import PDBParser, PDBIO, Select
def is_het(residue):
res = residue.id[0]
return res != " " and res != "W"
class ResidueSelect(Select):
def __init__(self, chain, residue):
self.chain = chain
self.residue = residue
def accept_chain(self, chain):
return chain.id == self.chain.id
def accept_residue(self, residue):
""" Recognition of heteroatoms - Remove water molecules """
return residue == self.residue and is_het(residue)
def extract_ligands(path):
""" Extraction of the heteroatoms of .pdb files """
for pfb_file in os.listdir(path):
i = 1
if pfb_file.endswith('.pdb') and not pfb_file.startswith("lig_"):
pdb_code = pfb_file[:-4]
pdb = PDBParser().get_structure(pdb_code, path + pfb_file)
io = PDBIO()
io.set_structure(pdb)
for model in pdb:
for chain in model:
for residue in chain:
if not is_het(residue):
continue
print(f"saving {chain} {residue}")
io.save(f"lig_{pdb_code}_{i}.pdb", ResidueSelect(chain, residue))
i += 1
def getFile(ftp, filename):
try:
# ftp.retrbinary("RETR", filename ,open(code+'.gz', 'wb').write)
ftp.retrbinary("RETR " + filename ,open(code+'.gz', 'wb').write)
except:
print("Error somewhere !!!!")
code = '1D17'
filename = 'pdb'+code.lower()+'.ent.gz' ## pdb1D17.ent.gz
print(filename)
ftp = FTP('ftp.wwpdb.org') # connect to host, default port
# ftp.login() # user anonymous, passwd anonymous@
print(ftp.login())
ftp.cwd('/pub/pdb/data/structures/all/pdb/')
print(ftp.pwd() )
getFile(ftp, filename)
zipped = gzip.open(code+'.gz', 'rb')
unzipped = zipped.read()
# print(unzipped)
saved = open(code+'.pdb', 'wb')
saved.write(unzipped)
saved.close()
path = './'
extract_ligands(path)
copying from : https://stackoverflow.com/questions/61390035/how-to-save-each-ligand-from-a-pdb-file-separately-with-bio-pdb
and using FTP from ftplib on http://ftp.wwpdb.org/pub/pdb/data/structures/all/pdb/ : PDB - FTP Archive over HTTP
NOGALAMYCIN is NGM third ligand downloaded (shuold be the only one according to https://www.rcsb.org/structure/1d17)
In any case I am failing at ubderstandung *,-) how https://models.rcsb.org/
Parameters are related to https://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/beginner%E2%80%99s-guide-to-pdb-structures-and-the-pdbx-mmcif-format , the mmcif format
but as I told before I can't read inside openapi.json OpenAPI Specification