环境
- 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])