Skip to content
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

Error in the decoding phase #63

Open
grassogianvito opened this issue Feb 4, 2025 · 2 comments
Open

Error in the decoding phase #63

grassogianvito opened this issue Feb 4, 2025 · 2 comments

Comments

@grassogianvito
Copy link

Hello,
I'm trying to convert the dataset available on Huggingface and decode it in SMILES code, but I get several errors. Do you have any information about this?

Best regards,

Gianvito

@maclandrol
Copy link
Member

Hello @grassogianvito , We have been informed, that there might be some issues with the huggingface dataset (predate these two commits that patch it #23, #25).

I would recommend reprocessing the full dataset ZINC dataset if you can. Otherwise, I will update it during the week.

Are you errors related to samples that could not be decoded into valid molecular graphs ?

@grassogianvito
Copy link
Author

grassogianvito commented Feb 5, 2025

Hello @maclandrol, thanks for your prompt answer. You can find below an example of code and error.

safe_notation = "CC6.N63.C3(C5C4.c15cnn2c1.C2C.c14ccc(Cl)cc1Cl"

try:
smi = safe.decode(safe_notation, canonical=True)
except safe.DecoderError:
pass


ArgumentError Traceback (most recent call last)
File ~/miniconda3/envs/CPPfeatures/lib/python3.10/site-packages/safe/converter.py:434, in decode(safe_str, as_mol, canonical, fix, remove_added_hs, remove_dummies, ignore_errors)
433 try:
--> 434 decoded = safe_obj.decoder(
435 safe_str,
436 as_mol=as_mol,
437 canonical=canonical,
438 fix=fix,
439 remove_dummies=remove_dummies,
440 remove_added_hs=remove_added_hs,
441 )
443 except Exception as e:

File ~/miniconda3/envs/CPPfeatures/lib/python3.10/site-packages/safe/converter.py:187, in SAFEConverter.decoder(self, inp, as_mol, canonical, fix, remove_dummies, remove_added_hs)
186 if canonical:
--> 187 out = dm.standardize_smiles(out)
188 return out

File ~/miniconda3/envs/CPPfeatures/lib/python3.10/site-packages/datamol/mol.py:409, in standardize_smiles(smiles)
398 r"""
399 Apply smile standardization procedure. This is a convenient function wrapped arrounf RDKit
400 smiles standardizer and tautomeric canonicalization.
(...)
406 standard_smiles: the standardized smiles
407 """
--> 409 smiles = rdMolStandardize.StandardizeSmiles(smiles)
410 return smiles

ArgumentError: Python argument types in
rdkit.Chem.MolStandardize.rdMolStandardize.StandardizeSmiles(NoneType)
did not match C++ signature:
StandardizeSmiles(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> smiles)

The above exception was the direct cause of the following exception:

SAFEDecodeError Traceback (most recent call last)
Cell In[8], line 11
10 try:
---> 11 smi = safe.decode(safe_notation, canonical=True) # CC(C)Cc1ccc(C(C)C(=O)O)cc1
12 except safe.DecoderError:

File ~/miniconda3/envs/CPPfeatures/lib/python3.10/site-packages/safe/converter.py:446, in decode(safe_str, as_mol, canonical, fix, remove_added_hs, remove_dummies, ignore_errors)
445 return None
--> 446 raise SAFEDecodeError(f"Failed to decode {safe_str}") from e
447 return decoded

SAFEDecodeError: Failed to decode CC6.N63.C3(C5C4.c15cnn2c1.C2C.c14ccc(Cl)cc1Cl

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
Cell In[8], line 12
10 try:
11 smi = safe.decode(safe_notation, canonical=True) # CC(C)Cc1ccc(C(C)C(=O)O)cc1
---> 12 except safe.DecoderError:
13 pass

AttributeError: module 'safe' has no attribute 'DecoderError'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants