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
{{ message }}
Repository navigation
ValueError('mapping overlap') triggered - unclear how #53
I am trying to add atom-mapping to around 90,000 reactions, using the following code:
from rdkit import Chem
am_rxns = []
for i, smiles_rxn in enumerate(rxns):
start = time.time()
r_mol = Chem.MolFromSmiles(smiles_rxn.split('>>')[0])
for a in range(r_mol.GetNumAtoms()):
r_mol.GetAtomWithIdx(a).ClearProp('molAtomMapNumber')
p_mol = Chem.MolFromSmiles(smiles_rxn.split('>>')[1])
for a in range(p_mol.GetNumAtoms()):
p_mol.GetAtomWithIdx(a).ClearProp('molAtomMapNumber')
smiles_rxn = Chem.MolToSmiles(r_mol, canonical=True) + ">>" + Chem.MolToSmiles(p_mol, canonical=True)
chython_smiles = smiles(smiles_rxn)
chython_smiles.reset_mapping() # assign atom mappings with the chython library
regular_smiles = format(chython_smiles, 'm')
am_rxns.append(regular_smiles)
At random points during the processing of these reactions, I get the exception shown below:
File "/scratch/project_2006950/multi-step-retrosynthesis/code/multidiff/mol_utils.py", line 85, in atom_map_reaction
chython_smiles.reset_mapping() # assign atom mappings with the chython library
File "/projappl/project_2006950/retrodiffuser/lib/python3.9/site-packages/chython/algorithms/mapping/attention.py", line 109, in reset_mapping
if self.fix_mapping(): # fix common mistakes in mechanisms
File "/projappl/project_2006950/retrodiffuser/lib/python3.9/site-packages/chython/algorithms/mapping/fixmapper.py", line 67, in fix_mapping
m.remap(mapping)
File "/projappl/project_2006950/retrodiffuser/lib/python3.9/site-packages/chython/containers/molecule.py", line 331, in remap
h = super().remap(mapping, copy=copy)
File "/projappl/project_2006950/retrodiffuser/lib/python3.9/site-packages/chython/containers/graph.py", line 168, in remap
raise ValueError('mapping overlap')
What's curious is that no specific input triggers this exception, so I am unsure how to reproduce it. I got it on 4 different machines though, each time for a different reaction. When I run the code on that specific reaction again I don't get any errors... Sorry if this is not very helpful, I will write an update once I have more information. Just thought I'll share in case somebody else came across the same issue.
I am using chython version 1.78 on both Linux and Mac OS.
Activity
stsouko commentedon Jan 13, 2025
Hi, Could provide 1-2 examples, please?