RDKit toolkit实战二:Generating Similarity Maps Using Fingerprints

一、RDKit简介

RDKit是一款开源化学信息学与机器学习工具包,提供C++和Python的API接口。
RDKit官网http://www.rdkit.org/
RDKit的编译安装及Python(2.7)绑定见博文:
RDKit iPython Notebook参考网站:https://nbviewer.jupyter.org/gist/madgpap/7673276
参考网站:http://www.rdkit.org/docs/GettingStartedInPython.html#generating-similarity-maps-using-fingerprints
RDKit

实战体验

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!Python2.7
from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import SimilarityMaps
mol = Chem.MolFromSmiles('COc1cccc2cc(C(=O)NCCCCN3CCN(c4cccc5nccnc54)CC3)oc21')
refmol = Chem.MolFromSmiles('CCCN(CCCCN1CCN(c2ccccc2OC)CC1)Cc1ccc2ccccc2c1')
fp = SimilarityMaps.GetAPFingerprint(mol, fpType='normal')
fp = SimilarityMaps.GetTTFingerprint(mol, fpType='normal')
fp = SimilarityMaps.GetMorganFingerprint(mol, fpType='bv')
fig, maxweight = SimilarityMaps.GetSimilarityMapForFingerprint(refmol, mol, SimilarityMaps.GetMorganFingerprint)
from rdkit import DataStructs
fig, maxweight = SimilarityMaps.GetSimilarityMapForFingerprint(refmol, mol, lambda m,idx: SimilarityMaps.GetMorganFingerprint(m, atomId=idx, radius=1, fpType='count'), metric=DataStructs.TanimotoSimilarity)
print(maxweight)
weights = SimilarityMaps.GetAtomicWeightsForFingerprint(refmol, mol, SimilarityMaps.GetMorganFingerprint)
print(["%.2f " % w for w in weights])
fig = SimilarityMaps.GetSimilarityMapFromWeights(mol, weights)

Jupyter Notebooks效果

RDKit-SP1
RDKit-SP2
RDKit-SP3

推荐文章