Today I tried to use pymol module in RDKit.
I think PyMol is great tool to visualize molecule tool.
And RDKit has PyMol module.
At first, I installed PyMol using home brew.
It was easy to install pymol.
Home brew works very well. :-)
$ brew tap homebrew/science $ brew install python --with-brewed-tk --enable-threads --with-x11 $ brew install pymol
Next, launches Pymol in a sever mode.
$pymol -R
Let’s write code.
I used CIRpy to get target molecule smiles.
CIRpy is a Python interface for the Chemical Identifier Resolver (CIR) by the CADD Group at the NCI/NIH. If you interested in it, please refer following site, .
I got smiles of imatinib as test molecule.
from rdkit import Chem from rdkit.Chem import AllChem from rdkit import RDConfig import os from rdkit.Chem.Draw import IPythonConsole from rdkit.Chem import Draw import cirpy smi = cirpy.resolve('imatinib', 'smiles',['name_by_chemspider']) # print smi # You can get C1(=CC=NC(=N1)NC2=CC(=CC=C2C)NC(=O)C3=CC=C(C=C3)CN4CCN(CC4)C)C5=CC=CN=C5 from rdkit.Chem import PyMol mol = Chem.MolFromSmiles(smi)
OK, next I set MolViewer
from rdkit.Chem import PyMol mol = Chem.MolFromSmiles(smi)
The molecule that from smile strings has no coordinate information.
So, I generated 3D structure information using EmbedMultipleConfs Module.
This conformation is not global minimum structure !
AllChem.EmbedMultipleConfs(mol) AllChem.UFFOptimizeMolecule(mol, maxIters=1000)
I got 3D conformation about imatinib.
So, I could get PyMol view
v.ShowMol(mol) v.GetPNG(h=200)
Now I could see following image.
Let’s get PharmacoPhore information.
I think the most easy way is using command mode.
At first save the molecule as molfile.
mol_block = Chem.MolToMolBlock(mol) f=open("imatinib.mol", "w") f.write(mol_block) f.close()
Next, type the command (in IPython mode)
!python /usr/local/lib/python2.7/site-packages/rdkit/Chem/Features/ShowFeats.py imatinib.mol v.GetPNG()
It was so cool !
ref URL
http://www.ub.edu/cbdd/?q=content/mapping-chemical-features-molecules-using-rdkit
http://nbviewer.ipython.org/4316435