このチャプターの目次
5. Smartsによる部分構造検索
部分構造検索の流れ
suppl = Chem.SDMolSupplier('xxx.sdf')
mols = [mol for mol in suppl]
patt = Chem.MolFromSmarts('smarts')
matches = [mol for mol in mols if mol.HasSubstructMatch(patt)]
Draw.MolsToGridImage(matches)
- 探す分子郡をmolsにいれる
- 部分構造をsmartsで作成
- mol.HasSubstructMatchで部分構造にあう分子を検索
Smartsの書き方
具体例
1. 分子を読み込み
suppl = Chem.SDMolSupplier('/content/drive/MyDrive/data/PubChem_TCI_phenol_records.sdf')
mols = [mol for mol in suppl]
len(suppl)
2. 部分構造を入力
patt = Chem.MolFromSmarts('c1cc([Br])ccc1')
Draw.MolsToGridImage([patt])
3. 部分構造にあう分子を検索して、一致した分子を表示
matches = [mol for mol in mols if mol.HasSubstructMatch(patt)]
Draw.MolsToGridImage(matches, subImgSize=(400, 400))