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
I haven't looked into it, but when testing whether invalid SMILES would work properly (expected to return None), I tried this:
import selfies as sf
smiles = 'cc('
enc = sf.encoder(smiles)
which caused the program to hang and CPU usage to go really high.
When I did a KeyboardInterrupt, this is where it got stuck:
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
sf.encoder(smiles)
File "C:\Users\S1024501\AppData\Local\Programs\Python\Python39\lib\site-packages\selfies\encoder.py", line 66, in encoder
all_selfies.append(_translate_smiles(s))
File "C:\Users\S1024501\AppData\Local\Programs\Python\Python39\lib\site-packages\selfies\encoder.py", line 178, in _translate_smiles
selfies, _ = _translate_smiles_derive(smiles_gen, rings, derive_counter)
File "C:\Users\S1024501\AppData\Local\Programs\Python\Python39\lib\site-packages\selfies\encoder.py", line 230, in _translate_smiles_derive
N_as_symbols = get_symbols_from_n(branch_len - 1)
File "C:\Users\S1024501\AppData\Local\Programs\Python\Python39\lib\site-packages\selfies\grammar_rules.py", line 315, in get_symbols_from_n
n //= base
KeyboardInterrupt
This was reproducible, and also happened for 'co(', 'cccc(', 'cccc(1', 'cccccc(', '('. Any other value of smiles (valid or invalid!) I've tried so far has worked as expected, including the strings 'c(', 'ccc(', 'ccccc(', 'cccc)', 'cccc(c'.
'ccc(c' did actually return a valid SELFIE for butadiene, which seems reasonable. Interestingly, ')' returned only '' (empty string rather than None).
Sorry for semi-deliberately breaking your awesome program :D
The text was updated successfully, but these errors were encountered:
In selfies v2.0.0, we have implemented more stringent error checking, which, in particular, also checks for hanging open and closing branch brackets. For example,
importselfiesassfsf.encoder("cc(")
now raises a selfies.EncoderError with a description of the error cause
I haven't looked into it, but when testing whether invalid SMILES would work properly (expected to return None), I tried this:
which caused the program to hang and CPU usage to go really high.
When I did a KeyboardInterrupt, this is where it got stuck:
This was reproducible, and also happened for 'co(', 'cccc(', 'cccc(1', 'cccccc(', '('. Any other value of
smiles
(valid or invalid!) I've tried so far has worked as expected, including the strings 'c(', 'ccc(', 'ccccc(', 'cccc)', 'cccc(c'.'ccc(c' did actually return a valid SELFIE for butadiene, which seems reasonable. Interestingly, ')' returned only '' (empty string rather than None).
Sorry for semi-deliberately breaking your awesome program :D
The text was updated successfully, but these errors were encountered: