I use the diffdock (link to diffdock on github) to dock a peptide with protein and this tool give me a ligand in sdf file format. I traslate this ligand sdf format file to a pdb format file and find the pdbfile lack res information. I wonder if tools/code can automaticly complete this file. I need the UNK become the residue types like pdb.This my error pdb file(this structure is a peptide)enter image description here enter image description here

HETATM    1  C   UNK     0       9.797  22.501  -6.484  0.00  0.00           C 
HETATM    2  C   UNK     0      10.366  21.086  -6.446  0.00  0.00           C 
HETATM    3  O   UNK     0       9.550  20.218  -7.135  0.00  0.00           O 
HETATM    4  N   UNK     0      11.710  21.084  -6.978  0.00  0.00           N 
HETATM    5  C   UNK     0      11.793  20.201  -8.123  0.00  0.00           C 
HETATM    6  C   UNK     0      11.151  20.760  -9.346  0.00  0.00           C 
HETATM    7  C   UNK     0      11.586  20.031 -10.581  0.00  0.00           C 
HETATM    8  C   UNK     0      13.000  20.308 -10.986  0.00  0.00           C 
HETATM    9  C   UNK     0      13.397  19.716 -12.309  0.00  0.00           C 
HETATM   10  N   UNK     0      12.636  18.523 -12.633  0.00  0.00           N 
HETATM   11  C   UNK     0      11.861  18.392 -13.830  0.00  0.00           C 
HETATM   12  O   UNK     0      11.837  19.364 -14.611  0.00  0.00           O 
HETATM   13  C   UNK     0      11.148  17.131 -14.065  0.00  0.00           C 
HETATM   14  C   UNK     0      11.800  16.246 -15.085  0.00  0.00           C 
  • 1
    $\begingroup$ Please don't post images of text. We cannot use them: we can't copy, we can't search. Also, this makes the post heavier for people with slow connections. Instead, copy/paste the text directly into your question and use the formatting tools to format it as code. $\endgroup$
    – terdon
    Mar 21 at 11:59
  • $\begingroup$ open babel add correct res type to pdb when you feed peptide sdf file, use cheminfo.org/Chemistry/Cheminformatics/FormatConverter/… and litemol.org/Viewer to check it out – $\endgroup$
    – pippo1980
    Mar 23 at 21:28

1 Answer 1


An SDF file lacks residue information, including atom name. Although for the latter, the molFileAlias atomic property is frequently used.

Adding residue info

There are several ways to do this, such as in RDKit (blog post):

from rdkit import Chem
from rdkit.Chem import AllChem

from typing import List

with Chem.SDMolSupplier('👾👾.sdf') as mol_store:
     mols: List[Chem.Mol] = list(mol_store)

mol: Chem.Mol
for mol in mols:
    atom: Chem.Atom
    for i, atom in enumerate(mol.GetAtoms()):
        info = AllChem.AtomPDBResidueInfo(atomName=f'ATM{i}',

mol: Chem.Mol
for mol in mols:
    name: str = mol.GetProp('_Name')
    Chem.MolToPDBFile(mol, f'{name}.pdb')


  • Atom names do have somewhat of a standard format, C1, C2, C3. I am being lazy in the above. If your ligand is present in the RCSB PDB, it will have a chemical component info on the PDB: example and it is often imperative to obey the atom names and atom index from there.
  • PyMOL or pymol2 module can also add PDB information, therein the residue index is not an integer but a string as it combines w/ insertion code.
  • In some tools, you lose the bond order, but if you have a SDF and not a PDB, then you are safe. But if you have a reference it's easy to fix.
from rdkit import Chem
from rdkit.Chem import AllChem
template: Chem.Mol = Chem.MolFromSmiles('👾👾👾👾👾👾')
AllChem.AssignBondOrdersFromTemplate(template, mol)
  • $\begingroup$ it seem c++ language which i'm not good at, can you provied a python language? the code you provided make error in my pycharm. $\endgroup$ Mar 23 at 8:14
  • $\begingroup$ It's the compchem module in Python. It runs on PyBind11 C++, so pycharm incorrectly does not like the methods not receiving the instance. #noqa will keep it quiet. I did write the code in the SO editor so I cannot guarantee it runs bug-free. from typing import List is the only thing missing as far as I can tell. $\endgroup$ Mar 23 at 18:56

Your Answer

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

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