RDKit:基于分子形状的比对(调用pymol)

分子形状比对

基于分子形状的比对对于虚拟筛选和骨架跃迁都是非常有用的。
RDKit分子形状比对实例:

#导入模块,同时载入数据

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit import RDConfig
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
from rdkit.Chem import PyMol
import os
mols = [ Chem.AddHs(m) for m in Chem.SDMolSupplier(“cdk2.sdf”)]

#启动pymol,并为每个结构生成构象异构体

v = PyMol.MolViewer()
cidslist=[]
for mol in mols:
mol.RemoveAllConformers()
cids = AllChem.EmbedMultipleConfs(mol, pruneRmsThresh=1.0)
cidslist.append(cids)

for idx in range(len(mols)):
mol = mols[idx]
for cid in cidslist[idx]:
AllChem.UFFOptimizeMolecule(mol, confId=cid)

#画出前五个分子图

Draw.MolsToGridImage(mols[:5], molsPerRow=5)

#载入形状模块

from rdkit.Chem.Subshape import SubshapeBuilder, SubshapeAligner, SubshapeObjects

#制作参考和探针分子

ref = Chem.Mol(mols[0].ToBinary())
probe = Chem.Mol(mols[1].ToBinary())
AllChem.CanonicalizeConformer(ref.GetConformer())
builder = SubshapeBuilder.SubshapeBuilder()
builder.gridDims = (20.,20.,10.)
builder.gridSpacing=0.5
builder.winRad = 4.

 

refShape = builder.GenerateSubshapeShape(ref)
probeShape = builder.GenerateSubshapeShape(probe)

#绘制ref mol和ref_shape

v.ShowMol(ref,name=”ref”)
SubshapeObjects.DisplaySubshape(v,refShape,’ref_Shape’)
v.server.do(‘set transparency=0.5’)
v.GetPNG()

 

 

 

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注