RDKitでsim matrix

RDKitは自分のお気に入りのツールです。
Pybelも優れているのだが最初に触ったのがRDKitということでよく使っています。
SDFから分子を読んで類似性でマップを作る場合

form rdkit import Chem
from rdkit.Chem import AllChem, DataStructs

out = open("hogehoge.txt","w")
mols = [m for m in Chem.SDMolSupplier("hoge.sdf")]
fps = [AllChem.GetMorganFingerprin(m,2) for m in mols]

for i in range(len(fps)):
    for j in range(i):
        tc = DataStructs.TanimotoSimilarity(mols[i],mols[j])
        if tc >= 0.7:
            out.write("%s\tsim\t%s\n"%(mols[i].GetProp("ID"),mols[j].GetProp("ID")))
out.close()

みたいな感じでしょうか。
テキストにタニモト係数0.7以上の化合物ペアが出るのでcytoscapeで見ると
ネットワークが見えるかと思います。結構このビジュアル方法私は好きです。

Published by iwatobipen

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

Leave a comment

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