Hi Matt,

On Thu, May 1, 2014 at 11:19 PM, Matthew Lardy <mla...@gmail.com> wrote:

>
> Hopefully this is easy, but I have an ROMol object that I want to convert
> into a PDB file. It seems to me that the MolToPDBFile is exactly what I
> should be using, but I am missing the protons in the resulting file.
> What's weird is that the input file has protons, and I have added a step to
> protonate the molecule after reading just to ensure that they are there.
>
> Any idea of how to move through this?
>

If the Hs are there, they should end up being written to the PDB. Here's an
example:

In [5]: m = Chem.MolFromSmiles('C')
In [6]: m=Chem.AddHs(m)
In [7]: print Chem.MolToPDBBlock(m)
HETATM    1  C1  UNL     1       0.000   0.000   0.000  1.00  0.00
  C
HETATM    2  H1  UNL     1       0.000   0.000   0.000  1.00  0.00
  H
HETATM    3  H2  UNL     1       0.000   0.000   0.000  1.00  0.00
  H
HETATM    4  H3  UNL     1       0.000   0.000   0.000  1.00  0.00
  H
HETATM    5  H4  UNL     1       0.000   0.000   0.000  1.00  0.00
  H
CONECT    1    2    3    4    5
END

Are you sure that the molecule actually has had Hs added? You can check
this with the Debug() method:

In [8]: m.Debug()
Atoms:
0 6 C chg: 0  deg: 4 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 0
1 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 0 arom?: 0 chi: 0
 2 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 0 arom?: 0 chi: 0
3 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 0 arom?: 0 chi: 0
 4 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 0 arom?: 0 chi: 0
Bonds:
0 0->1 order: 1 conj?: 0 aromatic?: 0
 1 0->2 order: 1 conj?: 0 aromatic?: 0
2 0->3 order: 1 conj?: 0 aromatic?: 0
3 0->4 order: 1 conj?: 0 aromatic?: 0

Note: you mention Hs being removed on reading your input files. If you want
to preserve the Hs that are present in the input file, you can do this from
a mol block/file like this:

In [14]: print mb

     RDKit

  5  4  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  1  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  1  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  1  0  0  0  0  0  0
    0.0000    0.0000    0.0000 H   0  0  0  0  0  1  0  0  0  0  0  0
  1  2  1  0
  1  3  1  0
  1  4  1  0
  1  5  1  0
M  END

In [15]: nm = Chem.MolFromMolBlock(mb,removeHs=False)
In [16]: nm.GetNumAtoms()
Out[16]: 5


The PDB parsers take a similar argument.

-greg
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to