RDKit | 化合物亚结构搜索与结果输出

本文为博主原创文章,未经博主允许不得转载。
本文链接: https://blog.csdn.net/u012325865/article/details/102464673

环境

  • Python 3.6
  • RDKit 2019

方法

假定搜索目标化合物作为Mol字符串包含在称为mols的列表中。 可以在以下流程中执行部分结构搜索,并突出显示匹配化合物的匹配部分结构。

导入库

from rdkit.Chem import AllChem
from rdkit.Chem import Draw, Descriptors
from rdkit.Chem import PandasTools

生成部分结构作为查询

query = AllChem.MolFromSmiles("c1ccccc1c1ccccc1")
Draw.MolToImage(query)

分子库

suppl = AllChem.SDMolSupplier('structures.sdf')
mols = [x for x in suppl if x is not None]
print (len(mols)) 

部分结构检索

result = [m for m in mols if m.HasSubstructMatch(query)]

凸出显示

pattern = result[0].GetSubstructMatches(query)
Draw.MolToImage(result[0], highlightAtoms=pattern[0])


DrugAI

猜你喜欢

转载自blog.csdn.net/u012325865/article/details/102464673