RDKit是一款开源化学信息学与机器学习工具包,提供C++和Python的API接口。
配置好RDKit和Python2.7的环境,运行参考网站的部分代码的效果如下:
#!Python2.7
from rdkit.Chem import AllChem as Chem
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Descriptors
from rdkit import DataStructs
smi = 'CCCc1nn(C)c2C(=O)NC(=Nc12)c3cc(ccc3OCC)S(=O)(=O)N4CCN(C)CC4' #sildenafil
m = Chem.MolFromSmiles(smi)
m
smi2 = 'CCCc1nc(C)c2C(=O)N=C(Nn12)c3cc(ccc3OCC)S(=O)(=O)N4CCN(CC)CC4 #vardenafil
m2 = Chem.MolFromSmiles(smi2)
fp2 = Chem.GetMorganFingerprintAsBitVect(m2, 2, nBits=2048)
m2