You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In some cases the SanitizeRxn function replaces list of atoms with a wildcard ,e.g.: [H,C:4][C:1]([H])([#6:5])[O:2][H]>>[H,C:4][C:1](=[O:2])[#6:5] gives [*:4][C&!H0:1]([#6:5])[O&!H0:2]>>[*:4][C:1](=[O:2])[#6:5] [H,C:4][C:1]([H])([O:2][H])[C:5][C:3]>>[H,C:4][C:1](=[O:2])[C:5][C:3] gives [*:4][C&!H0:1]([O&!H0:2])[C:5][C:3]>>[*:4][C:1](=[O:2])[C:5][C:3] [O:3]([H])[C:1]([H,C:4])[C:2]([H,C:6])[O:5][H]>>[O:3]=[C:1]([H,C:4]).[C:2]([H,C:6])=[O:5] gives [O&!H0:3][C:1]([*:4])[C:2]([*:6])[O&!H0:5]>>[O:3]=[C:1][*:4].[C:2]([*:6])=[O:5] [O:6]([H])[C:5]([C:4])([H,C:7])[C:2][C:1](=[O:3])[O:8][C:9]>>[C:4][C:5]([H,C:7])=[O:6].[C:2]([H])[C:1](=[O:3])[O:8][C:9] gives [O&!H0:6][C:5]([C:4])([*:7])[C:2][C:1](=[O:3])[O:8][C:9]>>[C:4][C:5]([*:7])=[O:6].[C:2]([#1])[C:1](=[O:3])[O:8][C:9] [c:1][C,S:2]([H])=[O]>>[c:1][H].[Cl][C,S:2]([H])=[O] gives [c:1][!H0:2]=O>>[c:1][#1].Cl[*:2]([#1])=O
The template [O:6]([H])[C:5]([C:4])([H,C:7])[C:2][C:1](=[O:3])[O:8][C:9]>>[C:4][C:5]([H,C:7])=[O:6].[C:2]([H])[C:1](=[O:3])[O:8][C:9] should not produce any results for CC(O)(Cl)CC(=O)OC as there is chlorine in the place where either carbon or hydrogen should match(index 7). However, after sanitization, this reaction does match and produces following results COC(=O)CC(C)(O)Cl>>CC(=O)Cl.[H]CC(=O)OC.
To Reproduce
from rdkit.Chem import AllChem
from rdkit.Chem import rdChemReactions
def canonicalize_template(template: str) -> str:
reaction = rdChemReactions.ReactionFromSmarts(template)
AllChem.SanitizeRxn(reaction)
return rdChemReactions.ReactionToSmarts(reaction)
for template in [
"[H,C:4][C:1]([H])([#6:5])[O:2][H]>>[H,C:4][C:1](=[O:2])[#6:5]",
"[H,C:4][C:1]([H])([O:2][H])[C:5][C:3]>>[H,C:4][C:1](=[O:2])[C:5][C:3]",
"[O:3]([H])[C:1]([H,C:4])[C:2]([H,C:6])[O:5][H]>>[O:3]=[C:1]([H,C:4]).[C:2]([H,C:6])=[O:5]",
"[O:6]([H])[C:5]([C:4])([H,C:7])[C:2][C:1](=[O:3])[O:8][C:9]>>[C:4][C:5]([H,C:7])=[O:6].[C:2]([H])[C:1](=[O:3])[O:8][C:9]",
"[c:1][C,S:2]([H])=[O]>>[c:1][H].[Cl][C,S:2]([H])=[O]",
]:
print(canonicalize_template(template))
Observed behavior
Atom lists are replaced with wildcards.
Describe the bug
In some cases the
SanitizeRxn
function replaces list of atoms with a wildcard ,e.g.:[H,C:4][C:1]([H])([#6:5])[O:2][H]>>[H,C:4][C:1](=[O:2])[#6:5]
gives[*:4][C&!H0:1]([#6:5])[O&!H0:2]>>[*:4][C:1](=[O:2])[#6:5]
[H,C:4][C:1]([H])([O:2][H])[C:5][C:3]>>[H,C:4][C:1](=[O:2])[C:5][C:3]
gives[*:4][C&!H0:1]([O&!H0:2])[C:5][C:3]>>[*:4][C:1](=[O:2])[C:5][C:3]
[O:3]([H])[C:1]([H,C:4])[C:2]([H,C:6])[O:5][H]>>[O:3]=[C:1]([H,C:4]).[C:2]([H,C:6])=[O:5]
gives[O&!H0:3][C:1]([*:4])[C:2]([*:6])[O&!H0:5]>>[O:3]=[C:1][*:4].[C:2]([*:6])=[O:5]
[O:6]([H])[C:5]([C:4])([H,C:7])[C:2][C:1](=[O:3])[O:8][C:9]>>[C:4][C:5]([H,C:7])=[O:6].[C:2]([H])[C:1](=[O:3])[O:8][C:9]
gives[O&!H0:6][C:5]([C:4])([*:7])[C:2][C:1](=[O:3])[O:8][C:9]>>[C:4][C:5]([*:7])=[O:6].[C:2]([#1])[C:1](=[O:3])[O:8][C:9]
[c:1][C,S:2]([H])=[O]>>[c:1][H].[Cl][C,S:2]([H])=[O]
gives[c:1][!H0:2]=O>>[c:1][#1].Cl[*:2]([#1])=O
The template
[O:6]([H])[C:5]([C:4])([H,C:7])[C:2][C:1](=[O:3])[O:8][C:9]>>[C:4][C:5]([H,C:7])=[O:6].[C:2]([H])[C:1](=[O:3])[O:8][C:9]
should not produce any results forCC(O)(Cl)CC(=O)OC
as there is chlorine in the place where either carbon or hydrogen should match(index 7). However, after sanitization, this reaction does match and produces following resultsCOC(=O)CC(C)(O)Cl>>CC(=O)Cl.[H]CC(=O)OC
.To Reproduce
Observed behavior
Atom lists are replaced with wildcards.
Expected behavior
Atom lists should not be replaced.
Configuration (please complete the following information):
2024.3.6
macOS Sonoma 14.7.1
3.11.10
uv pip install rdkit
The text was updated successfully, but these errors were encountered: