5. 对于反应物库SMARTS的更改
注:对于SMARTS不是很熟悉,所以,我在怀疑某些SMARTS写错了,从其余地方进行查找,更新了反应物的SMARTS,放在这里。
6. 使用上述反应物对已经处理好的化学反应库进行匹配
6.1 首先枚举一下共有多少种可能反应
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
from itertools import combinations,permutations
# 反应物
reactants= ['C(=O)[O;H,-]','[CH;D2;!$(C-[!#6;!#1])]=O','[CX4][Cl,Br,I]','[R][Cl,Br,I]','[N;H2;D1;$(N-!@[#6]);!$(N-C=[O,N,S])]','[N;H1;D2;$(N(-[#6])-[#6]);!$(N-C=[O,N,S])]']
# 反应物两两配对,这步代码后来感觉没什么用
reactants_c = list(combinations(reactants,2))
注:
('C(=O)[O;H,-]', '[CH;D2;!$(C-[!#6;!#1])]=O'),
('C(=O)[O;H,-]', '[CX4][Cl,Br,I]'),
('C(=O)[O;H,-]', '[R][Cl,Br,I]'),
('C(=O)[O;H,-]', '[N;H2;D1;$(N-!@[#6]);!$(N-C=[O,N,S])]'),
('C(=O)[O;H,-]', '[N;H1;D2;$(N(-[#6])-[#6]);!$(N-C=[O,N,S])]'),
('[CH;D2;!$(C-[!#6;!#1])]=O', '[CX4][Cl,Br,I]'),
('[CH;D2;!$(C-[!#6;!#1])]=O', '[R][Cl,Br,I]'),
('[CH;D2;!$(C-[!#6;!#1])]=O', '[N;H2;D1;$(N-!@[#6]);!$(N-C=[O,N,S])]'),
('[CH;D2;!$(C-[!#6;!#1])]=O', '[N;H1;D2;$(N(-[#6])-[#6]);!$(N-C=[O,N,S])]'),
('[CX4][Cl,Br,I]', '[R][Cl,Br,I]'),
('[CX4][Cl,Br,I]', '[N;H2;D1;$(N-!@[#6]);!$(N-C=[O,N,S])]'),
('[CX4][Cl,Br,I]', '[N;H1;D2;$(N(-[#6])-[#6]);!$(N-C=[O,N,S])]'),
('[R][Cl,Br,I]', '[N;H2;D1;$(N-!@[#6]);!$(N-C=[O,N,S])]'),
('[R][Cl,Br,I]', '[N;H1;D2;$(N(-[#6])-[#6]);!$(N-C=[O,N,S])]'),
('[N;H2;D1;$(N-!@[#6]);!$(N-C=[O,N,S])]','[N;H1;D2;$(N(-[#6])-[#6]);!$(N-C=[O,N,S])]')
6.2 对每个反应都对这些反应物进行匹配
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
from itertools import combinations,permutations
# 反应物
reactants= ['C(=O)[O;H,-]','[CH;D2;!$(C-[!#6;!#1])]=O','[CX4][Cl,Br,I]','[R][Cl,Br,I]','[N;H2;D1;$(N-!@[#6]);!$(N-C=[O,N,S])]','[N;H1;D2;$(N(-[#6])-[#6]);!$(N-C=[O,N,S])]']
reactants_m= [Chem.MolFromSmarts(i) for i in reactants]
# 反应物两两配对,这步代码后来感觉没什么用
reactants_c = list(combinations(reactants,2))
# 上面已经拿到了接近于1+1=2的一些合成反应,现在,我们尝试来使用reactant_l_2中合成反应来匹配一下这些反应物
reactant_l_3 = []
for i in reactant_l_2:
#print(i)
reactant_1=i.split('>')[0].split('.')[0]
reactant_2=i.split('>')[0].split('.')[1]
reactant_1_mol = Chem.MolFromSmarts(reactant_1)
reactant_2_mol = Chem.MolFromSmarts(reactant_2)
for x in range(len(reactants_m)):
for y in range(len(reactants_m)):
if x != y:
try:
if reactant_1_mol.HasSubstructMatch(reactants_m[x]) and reactant_2_mol.HasSubstructMatch(reactants_m[y]):
reactant_l_3.append(i)
except: pass
reactant_l_3 = list(set(reactant_l_3))
# 去除重复之后为235种反应,明天看看,有多少种可以真实反应
参考
[1] Saldivar-Gonzalez F I , CSH García, Medina-Franco J L . Chemoinformatics-based enumeration of chemical libraries: a tutorial[J]. Journal of Cheminformatics, 2020, 12(1):64. [2] https://github.com/rdkit/rdkit/blob/master/Data/Functional_Group_Hierarchy.txt [3] https://application.wiley-vch.de/contents/jc_2452/2008/f700139_s.pdf [4] https://www.oecd.org/env/ehs/risk-assessment/Tutorial_3_Automated_workflow_for_ecotoxicity.pdf [5] https://www.chem.uzh.ch/zerbe/MedChem/Medicinal_Chemistry.pdf