Is there a reaction depiction option similar to the MolDraw2DCairo  which 
produces much better depictions that the simple Chem.Draw PIL images?

Or am I just doing this wrong?


Attempting to push a reaction through MolDraw2DCairo fails with:

Traceback (most recent call last):
  File "drawing_test.py", line 31, in <module>
    rc = rdMolDraw2D.PrepareMolForDrawing(rxn)
Boost.Python.ArgumentError: Python argument types in
    rdkit.Chem.Draw.rdMolDraw2D.PrepareMolForDrawing(ChemicalReaction)
did not match C++ signature:
    PrepareMolForDrawing(RDKit::ROMol const* mol, bool kekulize=True, bool 
addChiralHs=True, bool wedgeBonds=True, bool forceCoords=False)

Cheers,

Ed


sample code below:


from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit.Chem import rdDepictor
from rdkit.Chem.Draw import DrawingOptions

m1 = AllChem.MolFromSmiles('c1ccccc1N(C)C')
tmp = AllChem.Compute2DCoords(m1)
Draw.MolToFile(m1,'test_mol_image.png')
rdDepictor.Compute2DCoords(m1)

rxn = AllChem.ReactionFromSmarts('[C:1](=[O:2])[N:3]>>[N:1][C:3]=[O:2]')
rimage = Draw.ReactionToImage(rxn)
rimage.save('test_reaction_image.png')

mc = rdMolDraw2D.PrepareMolForDrawing(m1)
drawer = Draw.MolDraw2DCairo(300, 300)
drawer.DrawMolecule(mc)
drawer.FinishDrawing()
output = drawer.GetDrawingText()
with open('test_mol_image_2.png', 'wb') as pngf:
        pngf.write(output)


drawer2 = Draw.MolDraw2DCairo(600, 300)
rc = rdMolDraw2D.PrepareMolForDrawing(rxn)
drawer2.DrawMolecule(rc)





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to