I really enjoyed OETK training.
Thanks a lot y_sama and organiser of the training.
And I told about rdkit with the TK specialist in break time.
TK specialist asked me that can RDKit draw molecule with highlight substructure.
I answered to him ‘yes… maybe…but I can’t show you example now…’.
Now I searched Web and found answer.
New version of RDKit can draw molecule as SVG.
Example is following.
I couldn’t view SVG image from web browser so, I uploaded picture.
And Snap shot is following picture.
If following code run from IPython notebook, it will get SVG image of molecule.
rdDepictor function is cool ;-).
from __future__ import print_function from rdkit import Chem from rdkit.Chem.Draw import IPythonConsole from IPython.display import SVG from rdkit import rdBase from rdkit.Chem import rdDepictor from rdkit.Chem.Draw import rdMolDraw2D mol = Chem.MolFromSmiles( "CN1CCN(S(=O)(C2=CC=C(OCC)C(C3=NC4=C(N(C)N=C4CCC)C(N3)=O)=C2)=O)CC1" ) rdDepictor.Compute2DCoords(mol) drawer = rdMolDraw2D.MolDraw2DSVG(400,200) drawer.DrawMolecule(mol) drawer.FinishDrawing() svg = drawer.GetDrawingText().replace('svg:','') SVG(svg)
Now I’ll try to evaluate TK.
If reader interested in rdDepictor, I recommend check the blog!
His post is very cool and useful.