RDKit and PyMol

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.UFFOptimizeMolecule(mol, maxIters=1000)

I got 3D conformation about imatinib.
So, I could get PyMol view


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")

Next, type the command (in IPython mode)

!python /usr/local/lib/python2.7/site-packages/rdkit/Chem/Features/ShowFeats.py imatinib.mol

Now I got following image.

It was so cool !
ref URL


Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: