Closed drc007 closed 2 years ago
Hello
Thanks for the feedback.
You are very correct, this should be catched much earlier.
If you are interested, I would welcome a PR, after some discussion where to put this check. Otherwise, it will be added in a future release.
/ Sam
Fixed on master and will be included in release 3.4.0
When running aizynthcli it will now skip target molecules that are not sanitizable
Great. Another option is to check the structures in advance. I've put a very simple Jupyter Notebook here https://www.macinchem.org/reviews/rdkitcheck/sdfOrsmicheck.php
Hi, I got this error for a molecule (a nitro group drawn incorrectly) this lead to a subsequent file not found error.
Traceback (most recent call last): File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/chem/mol.py", line 175, in sanitize AllChem.SanitizeMol(self.rd_mol) rdkit.Chem.rdchem.AtomValenceException: Explicit valence for atom # 19 N, 4, is greater than permitted
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/chrisswain/miniconda3/envs/aizynth-env/bin/aizynthcli", line 8, in
sys.exit(main())
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/interfaces/aizynthcli.py", line 270, in main
func(
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/interfaces/aizynthcli.py", line 183, in _process_multi_smiles
search_time = finder.tree_search()
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/aizynthfinder.py", line 187, in tree_search
is_solved = self.tree.one_iteration()
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/search/mcts/search.py", line 116, in one_iteration
leaf.expand()
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/search/mcts/node.py", line 234, in expand
) = self._expansion_policy(self.state.expandable_mols)
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/context/policy/policies.py", line 50, in call
return self.get_actions(molecules)
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/context/policy/policies.py", line 68, in get_actions
possible_actions, priors = self[name].get_actions(molecules)
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/context/policy/expansion_strategies.py", line 120, in get_actions
all_transforms_prop = self._predict(mol, model)
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/context/policy/expansion_strategies.py", line 161, in _predict
fp_arr = _make_fingerprint(mol, model)
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/context/policy/utils.py", line 18, in _make_fingerprint
fingerprint = obj.fingerprint(radius=2, nbits=len(model))
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/chem/mol.py", line 128, in fingerprint
self.sanitize()
File "/Users/chrisswain/miniconda3/envs/aizynth-env/lib/python3.8/site-packages/aizynthfinder/chem/mol.py", line 179, in sanitize
raise MoleculeException(f"Unable to sanitize molecule ({self.smiles})")
aizynthfinder.utils.exceptions.MoleculeException: Unable to sanitize molecule (n1(c(=O)[nH]c2c(c1=O)c(c(s2)C(=O)N(C)C)C)c1c(N(=O)O)cccc1 ID20001)