By default, initialization of the rdchiralReactants class automatically overwrites any specified atom mapping in the input reactant_smiles to a range from 0 to the total number of atoms. However, there are cases where one would want to specify atom mappings (i.e. in a global context across multiple reactions).
For example, in the case where the user specifies:
This PR adds a flag custom_reactant_mapping which defaults to False such that behavior is still the same in all cases unless the user wants to keep a custom atom mapping for their reactant. Note that in doing so, all atoms must have a specified map number, or a key error will be thrown when running the reaction. Some random test cases were pulled from test_rdchiral_cases.json and given custom atom mappings to ensure that the functionality of running reactions still behaves as expected.
By default, initialization of the
rdchiralReactants
class automatically overwrites any specified atom mapping in the inputreactant_smiles
to a range from 0 to the total number of atoms. However, there are cases where one would want to specify atom mappings (i.e. in a global context across multiple reactions).For example, in the case where the user specifies:
We want
This PR adds a flag
custom_reactant_mapping
which defaults toFalse
such that behavior is still the same in all cases unless the user wants to keep a custom atom mapping for their reactant. Note that in doing so, all atoms must have a specified map number, or a key error will be thrown when running the reaction. Some random test cases were pulled fromtest_rdchiral_cases.json
and given custom atom mappings to ensure that the functionality of running reactions still behaves as expected.