I'd like to know where each atom in a reaction product came from, but as far as I can tell, RDKit doesn't provide enough information. Here's what I found out empirically so far.
There are four kinds of product atoms: 1. New atoms: atoms are defined in the product template without a mapping number. These can't be mapped to reactant atoms, so there's no issue. 2. Unmatched atoms: atoms that were not matched by any atom from the reactant template but were carried over to the product because they were connected (directly or indirectly) to a mapped reactant atom. These have the "react_atom_idx" property, which holds the atom index of the atom in the reactant molecule. This is useful as long as the reactant side has only one molecule; when there are multiple molecules, it is not clear which reactant molecule a product atom came from. 3. Mapped dummy atoms: atoms which are defined as dummies in the product template and have a mapping number (e.g., [*:1]). These also get a "react_atom_idx" property, as well as an "old_mapno" property which holds the mapping number (1 for [*:1]) 4. Mapped non-dummy atoms: atoms which are NOT defined as dummies in the product template and have a mapping number (e.g., [C:1]). These have "old_mapno", but no "react_atom_idx". One thing I tried was to add my own unique atom identifier property to all reactant atoms before applying the reaction, but that didn't help because mapped atoms (types 3 and 4) don't preserve user properties (I guess these atoms are seen as "replacements" for the atoms they mapped, rather than "copies"?) I'd be willing to hack the RDKit source code if necessary and contribute my changes, but before starting such a project I'd like to hear if it's reasonable. One possibility would be to preserve user properties for mapped atoms. Alternatively we could add react_atom_idx to mapped non-dummy atoms, and also add a new "react_mol_idx" property? Best, Ivan
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss