atom mapping in reaction #7133
-
I am creating reaction smiles using AllChem.ReactionFromSmarts as shown here: https://gist.github.com/greglandrum/8028f785fe3ab0162991b22f1f4a2653. I want the mapping of atom index between reactant and product. The following function https://github.com/rdkit/rdkit/issues/1269#issuecomment-278205412
gives a reasonable answer but when I try a reaction with two reactants, every reactant's index start from 0, hence there are overlapping index between reactants. For example:
So, the indexes 0, 1, 2, 3, 4 are repeated in the reactants. I would like to have unique ids for every atom which are mapped to the products. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It's tricky (possible, but tricky) to do this correctly. But there's an easy workaround. I think your best bet here is to combine the reactants into a single molecule and add parentheses to the reaction SMARTS to group the two reactants into one:
This outputs:
that is almost what you want, but it still has the parentheses around the reactants. You can remove those with a regular expression:
This outputs:
I think this ought to work |
Beta Was this translation helpful? Give feedback.
It's tricky (possible, but tricky) to do this correctly. But there's an easy workaround.
I think your best bet here is to combine the reactants into a single molecule and add parentheses to the reaction SMARTS to group the two reactants into one:
This outputs: