rdkit: Export and re-import of RXNBlocks with aromatic bonds
Hi,
We have a process currently where we read in a reaction SMILES, generate a RXN block / file and read it back into RDKit, and want to export it back as reaction SMILES.
The issue is: if the reaction SMILES contains aromatic bonds, they are exported as aromatic bonds (Type 4) in the RXN file, but when they are imported back, they are considered as query features and exported accordingly into the reaction SMILES. Example:
rxn: AllChem.ChemicalReaction = AllChem.ReactionFromSmarts('Cc1[nH]c2ccccc2c1C(=O)CN.O=C(Cl)c1cc(Br)cn2ccnc12>>Cc1[nH]c2ccccc2c1C(=O)CNC(=O)c1cc(Br)cn2ccnc12', useSmiles=True)`
block = AllChem.ReactionToRxnBlock(rxn)
rxn = AllChem.ReactionFromRxnBlock(block)
smi = AllChem.MolToSmiles(rxn.GetReactantTemplate(0))
print(smi)
This results in:
CC1:N:C2:C:C:C:C:C:2:C:1C(=O)CN
Which is not a valid SMILES (aromatic bonds, but aliphatic atoms)
I would expect, upon creating the RXN block that structures get kekulized. Or at least to have the option to kekulize the structures upon exporting the reaction.
Configuration (please complete the following information):
- RDKit version: 2024.3.5
- OS: Windows 10
- Python version (if relevant): 3.9.15
- Are you using conda? Yes
- If you are using conda, which channel did you install the rdkit from? Conda-forge
- If you are not using conda: how did you install the RDKit?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (13 by maintainers)
@bp-kelley , @ptosco ,
Thanks a lot for your valuable input.
I would argue that exporting a reaction (not a query !) to a RXN block should not allow Type 4 atoms. According to the MDL/Biovia CTFile format manual, bond Types 4 to 8 are for queries only (BIOVIA Databases 2020 • CTFile Formats | Page 11). Therefore, if I am dealing with a reaction object in RDKit (again, not a query, since it was imported ‘as SMILES’), I would expect RDKit to run a “kekulization” on the reaction components when generating the RXN Block.