Hi RDKitters,

I would like to renumber atoms of molecules according to a canonized order.

I used the code below and noticed that the 3D flag "RDKIT 2D" turns into 
"RDKIT 3D". Is it expected?
How could I switch it back to "RDKIT 2D"?
I remember seeing some function to toggle this flag, but just cannot put 
my fingers on it anymore...

Thank you!
Jose Manuel

RDKIT 2015.03.1

#/usr/bin/env python

from rdkit import Chem, rdBase

# define test molecule
molblock="""TEST_INPUT
      RDKit          2D

   5  5  0  0  0  0  0  0  0  0999 V2000
    -0.1105   -0.5357    0.0000 N   0  0  0  0  0  0  0  0  0  0  0 0
    -0.7779   -1.0207    0.0000 C   0  0  0  0  0  0  0  0  0  0  0 0
    -0.5230   -1.8052    0.0000 C   0  0  0  0  0  0  0  0  0  0  0 0
     0.3020   -1.8052    0.0000 C   0  0  0  0  0  0  0  0  0  0  0 0
     0.5569   -1.0207    0.0000 C   0  0  0  0  0  0  0  0  0  0  0 0
   1  2  1  0
   2  3  1  0
   3  4  1  0
   4  5  1  0
   1  5  1  0
M  END

$$$$
"""

print rdBase.rdkitVersion

print molblock    # RDKIT 2D

# renumber test molecule by canonical atom rank
mol = Chem.MolFromMolBlock(molblock)
order_c = list(Chem.CanonicalRankAtoms(mol, breakTies=True, 
includeChirality=True))
mol_c = Chem.RenumberAtoms(mol,order_c)
mol_c.SetProp("_Name", "TEST_OUTPUT")

# check result
print Chem.MolToMolBlock(mol_c)    # RDKIT 3D!

------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to