<blockquote>
<p>Bizarrely, Obabel seems to have written a PDB that was incorrectly spaced for the OP as seen in <a href="https://bioinformatics.stackexchange.com/questions/13586/error-pasing-the-following-line-in-pdb/13595">Error pasing the following line in pdb</a></p>
</blockquote>
<p>If you can use python, <code>rdkit</code> is a great package for cheminformatics —best installed via conda though.</p>
<p>It allows you do all sorts of things, such as match substructures, embed conformers, edit compounds, compute advanced parameters and many forms of shape &amp; colour finger-/foot-printings.</p>
<p>Given a multi-compound sdf you can read each individual molecule and write them out as PDBs.</p>
<pre><code>from rdkit import Chem
with i, mol in enumerate(Chem.SDMolSupplier('in.sdf')):
    Chem.MolToPDBFile(f'out_{i}.pdb')
</code></pre>
<p>We can be fancier with the output name</p>
<pre><code>from rdkit import Chem
import re
with mol in Chem.SDMolSupplier('in.sdf'):
    # The headerline of a mol file is retrieved oddly.
    name = mol.GetProp('_Name')
    # make filename safe
    slugify = lambda name: re.sub(r'[\W_.-]+', '-', name)
    Chem.MolToPDBFile(f'{slugify(name)}.pdb')
</code></pre>
<p>To specify what name (<em>e.g.</em> <code>CA</code>) each atom gets and what is the residue name, chain and residue position —information absent in the sdf, it gets a bit odd.</p>
<pre><code>  names = [' CA ', ' CB ', ' CG ', ' CD '] # say
  for i, atom in enumerate(mol.GetAtoms()):
        info = Chem.AtomPDBResidueInfo(names[i], # or whatever.
                                       residueName='LIG')
</code></pre>
<p>For more see <a href="http://blog.matteoferla.com/2020/03/atom-names-purely-in-rdkit.html" rel="nofollow noreferrer">this blog post</a>.</p>

CC BY-SA 4.0
2020-06-22T17:42:35.547Z
for the rdkit sdf to pdb conversion, should i enter the multi entry sdf filename in the line below;
"with mol in Chem.SDMolSupplier('in.sdf'):"
Shahbaaz
CC BY-SA 4.0
2020-06-22T20:25:30.390Z
Correct `in.sdf` is an example filename —the quotes must be there or it will think it a variable. If you are unfamiliar with python this route is probably not the best way.
Matteo Ferla
CC BY-SA 4.0
2020-06-23T05:32:06.827Z
I am unfamiliar with python however I am currently trying to learn it from scratch.

Thank you
Shahbaaz
CC BY-SA 4.0
2020-06-22T16:24:48.280Z
2020-06-22T16:24:48.280Z
Matteo Ferla
<p>Use <a href="http://openbabel.org/wiki/Main_Page" rel="nofollow noreferrer">OpenBabel</a>.</p>
<p>Something like <code>babel -isdf file_in.sdf -opdb file_out.pdb</code>.</p>

CC BY-SA 4.0
2020-06-18T11:26:12.290Z
2020-06-18T11:26:12.290Z
jgreener
<p>I am currently working on identifying effective antiviral compounds against the corona virus. I have downloaded the Covid-19 AntiViral Candidate Compounds Dataset from the www.cas.org webpage, the link to which I have provided below. Me and a few other doctors are using Docking software to predict the docking capacity of these anti-viral compounds. Docking software requires the anti-viral compounds to be in the .pdb file format only then is it recognized by Automated docking software. <strong>Is there any way I can convert the .sdf file containing the anti-viral compounds to .pdb file or is there a way of obtaining the .pdb files for list of anti-viral compounds</strong>.</p>

<p><em>Thank you for your time and patience,
Anas Hussain.</em> </p>

<p><strong>Anti-Viral Candidate Compounds Dataset</strong>
<a href="https://www.cas.org/covid-19-antiviral-compounds-dataset" rel="nofollow noreferrer">https://www.cas.org/covid-19-antiviral-compounds-dataset</a></p>

<pdb><docking>
.SDF file to .PDB file
# .SDF file to .PDB file

(Asked by: username_0 on 2020-06-17)

I am currently working on identifying effective antiviral compounds against the corona virus. I have downloaded the Covid-19 AntiViral Candidate Compounds Dataset from the www.cas.org webpage, the link to which I have provided below. Me and a few other doctors are using Docking software to predict the docking capacity of these anti-viral compounds. Docking software requires the anti-viral compounds to be in the .pdb file format only then is it recognized by Automated docking software. **Is there any way I can convert the .sdf file containing the anti-viral compounds to .pdb file or is there a way of obtaining the .pdb files for list of anti-viral compounds**.

*Thank you for your time and patience,
Anas Hussain.*

**Anti-Viral Candidate Compounds Dataset**
<https://www.cas.org/covid-19-antiviral-compounds-dataset>

**Tags:** pdb, docking

---

## 2 answers

### Answer by username_1 on 2020-06-22. Score: 1

Bizarrely, Obabel seems to have written a PDB that was incorrectly spaced for the OP as seen in Error pasing the following line in pdb

If you can use python, rdkit is a great package for cheminformatics —best installed via conda though.
It allows you do all sorts of things, such as match substructures, embed conformers, edit compounds, compute advanced parameters and many forms of shape & colour finger-/foot-printings.
Given a multi-compound sdf you can read each individual molecule and write them out as PDBs.
from rdkit import Chem
with i, mol in enumerate(Chem.SDMolSupplier('in.sdf')):
    Chem.MolToPDBFile(f'out_{i}.pdb')

We can be fancier with the output name
from rdkit import Chem
import re
with mol in Chem.SDMolSupplier('in.sdf'):
    # The headerline of a mol file is retrieved oddly.
    name = mol.GetProp('_Name')
    # make filename safe
    slugify = lambda name: re.sub(r'[\W_.-]+', '-', name)
    Chem.MolToPDBFile(f'{slugify(name)}.pdb')

To specify what name (e.g. CA) each atom gets and what is the residue name, chain and residue position —information absent in the sdf, it gets a bit odd.
  names = [' CA ', ' CB ', ' CG ', ' CD '] # say
  for i, atom in enumerate(mol.GetAtoms()):
        info = Chem.AtomPDBResidueInfo(names[i], # or whatever.
                                       residueName='LIG')

For more see this blog post.

> **Comments:**
> **username_0**: for the rdkit sdf to pdb conversion, should i enter the multi entry sdf filename in the line below; "with mol in Chem.SDMolSupplier('in.sdf'):"  
> **username_1**: Correct `in.sdf` is an example filename —the quotes must be there or it will think it a variable. If you are unfamiliar with python this route is probably not the best way.  
> **username_0**: I am unfamiliar with python however I am currently trying to learn it from scratch.  Thank you  

---

### Answer by username_2 on 2020-06-18. Score: 1

Use [OpenBabel](http://openbabel.org/wiki/Main_Page).

Something like `babel -isdf file_in.sdf -opdb file_out.pdb`.


---

