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

  • $\begingroup$ If you want to download the structure – yes, a PDB file or mmCIF file (different file formats with the same structure). $\endgroup$
    – marcin
    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$ 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
    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
    Nov 19, 2021 at 21:33
  • 2
    $\begingroup$ Does this answer your question? Retrieve ID ligand from PDB file $\endgroup$
    – pippo1980
    Nov 21, 2021 at 13:50

1 Answer 1


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',
  open('out.cif', 'wb').write(risposta.content)


if __name__ == '__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',

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


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',

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


Ligand extract:


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()
            for model in pdb:
                for chain in model:
                    for residue in chain:
                        if not is_het(residue):
                        print(f"saving {chain} {residue}")
                        io.save(f"lig_{pdb_code}_{i}.pdb", ResidueSelect(chain, residue))
                        i += 1

def getFile(ftp, filename):
        # ftp.retrbinary("RETR", filename ,open(code+'.gz', 'wb').write)
        ftp.retrbinary("RETR " + filename ,open(code+'.gz', 'wb').write)
        print("Error somewhere !!!!")

code = '1D17'
filename = 'pdb'+code.lower()+'.ent.gz'                 ## pdb1D17.ent.gz    


ftp = FTP('ftp.wwpdb.org')   # connect to host, default port

# ftp.login()               # user anonymous, passwd anonymous@


print(ftp.pwd()  )

getFile(ftp, filename)

zipped = gzip.open(code+'.gz', 'rb')

unzipped = zipped.read()

# print(unzipped)

saved = open(code+'.pdb', 'wb')


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


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.