0
$\begingroup$

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

$\endgroup$
9
  • $\begingroup$ If you want to download the structure – yes, a PDB file or mmCIF file (different file formats with the same structure). $\endgroup$
    – marcin
    Commented Nov 19, 2021 at 17:46
  • $\begingroup$ Thank you so much for your reply. But the pdb file is about the complex molecule(ligand-DNA). The above line says "We took the structure and coordinates of nogalamycin from the X-ray structure determined". The pdb id page shows ligand structure separately. .... download CCD file or instance file. Do you think I need to download only ligand file? $\endgroup$ Commented Nov 19, 2021 at 17:57
  • 1
    $\begingroup$ Ah, I overlooked that you are after the ligand only. Instance coordinates are taken from this structure (ligand extracted from the complex). Ideal coordinates are taken from the CCD (Chemical Component Dictionary) – the same ligand, but it's 3D structure doesn't need to be identical to the ligand in this complex. At least that's how I understand it. Another alternative is to download the PDB file with the whole structure and manually extract the ligand, but that's more cumbersome. $\endgroup$
    – marcin
    Commented Nov 19, 2021 at 21:29
  • $\begingroup$ there is a models.rcsb.org ModelServer, The ModelServer is a service for accessing subsets of macromolecular model data. I am sure there is a way to get just the ligand. Waiting for a Python client for the openAPI offered by it. somewhere it says Determines the output encoding (text based 'CIF' or binary 'BCIF'). Ligands can also be exported as 'SDF', 'MOL', or 'MOL2' $\endgroup$
    – pippo1980
    Commented Nov 19, 2021 at 21:33
  • 2
    $\begingroup$ Does this answer your question? Retrieve ID ligand from PDB file $\endgroup$
    – pippo1980
    Commented Nov 21, 2021 at 13:50

1 Answer 1

1
$\begingroup$

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&copy_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&copy_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&copy_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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.