-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardizer gets stuck on a molecule #4
Comments
Thanks for the bug report. This should now be fixed - there was a bug in the patterns that are used to decide whether the ionised atom should be changed, resulting in an infinite loop. Run |
Yes, with the update the example now completes. However a new molecule (ZINC000060321958) that previously finished now is giving problems. Like before I paste the example and traceback. smi="C[N+]1=C[CH-]N(C(=N)N)/C1=C/N+[O-]" StandardizeError Traceback (most recent call last) C:\Software\Miniconda\lib\site-packages\molvs\standardize.py in standardize(self, mol) C:\Software\Miniconda\lib\site-packages\molvs\charge.py in call(self, mol) C:\Software\Miniconda\lib\site-packages\molvs\charge.py in reionize(self, mol) StandardizeError: Reionizer entered an infinite loop! Please report as a MolVS bug. |
Sorry for dropping this - I hope this is now fixed with v0.0.9. Let me know if there are still any problems. |
Hi, I have been trying your module to standardize molecules. However it gets stuck with molecule ZINC000100026244. By the stacktrace when I do a keyboard interruption, it seems to get stuck at the reionize step. Is there a way to set a timeout period so that if it gets stuck like this I can just disregard this molecule and continue?
I put below the bug example and the stacktrace:
from rdkit import Chem
import molvs
smi="CCOC(=O)C(=O)[CH-]C#N"
s = molvs.Standardizer()
mol=Chem.MolFromSmiles(smi)
mol = s.standardize(mol)
KeyboardInterrupt Traceback (most recent call last)
in ()
2 s = molvs.Standardizer()
3 mol=Chem.MolFromSmiles(smi)
----> 4 mol = s.standardize(mol)
5 print(Chem.MolToSmiles(mol, True))
C:\Software\Miniconda\lib\site-packages\molvs\standardize.py in standardize(self, mol)
97 mol = self.disconnect_metals(mol)
98 mol = self.normalize(mol)
---> 99 mol = self.reionize(mol)
100 Chem.AssignStereochemistry(mol, force=True, cleanIt=True)
101 # TODO: Check this removes symmetric stereocenters
C:\Software\Miniconda\lib\site-packages\molvs\charge.py in call(self, mol)
152 def call(self, mol):
153 """Calling a Reionizer instance like a function is the same as calling its reionize(mol) method."""
--> 154 return self.reionize(mol)
155
156 def reionize(self, mol):
C:\Software\Miniconda\lib\site-packages\molvs\charge.py in reionize(self, mol)
195
196 while True:
--> 197 ppos, poccur = self._strongest_protonated(mol)
198 ipos, ioccur = self._weakest_ionized(mol)
199 if ioccur and poccur and ppos < ipos:
C:\Software\Miniconda\lib\site-packages\molvs\charge.py in _strongest_protonated(self, mol)
211 def _strongest_protonated(self, mol):
212 for position, pair in enumerate(self.acid_base_pairs):
--> 213 for occurrence in mol.GetSubstructMatches(pair.acid):
214 return position, occurrence
215 return None, None
KeyboardInterrupt:
The text was updated successfully, but these errors were encountered: