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

Cannot load vocab -- mol is None #48

Open
tawe141 opened this issue Aug 28, 2019 · 0 comments
Open

Cannot load vocab -- mol is None #48

tawe141 opened this issue Aug 28, 2019 · 0 comments

Comments

@tawe141
Copy link

tawe141 commented Aug 28, 2019

I get the following error with this code after generating the vocabulary:

from fast_jtnn import *
vocab = Vocab('data/moses/vocab.txt')
[16:21:52] SMILES Parse Error: syntax error for input: 'd'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-b4fa4df471ab> in <module>()
----> 1 vocab = Vocab('data/moses/vocab.txt')

/home/erictaw/icml18-jtnn/fast_jtnn/vocab.pyc in __init__(self, smiles_list)
     14         self.vocab = smiles_list
     15         self.vmap = {x:i for i,x in enumerate(self.vocab)}
---> 16         self.slots = [get_slots(smiles) for smiles in self.vocab]
     17         Vocab.benzynes = [s for s in smiles_list if s.count('=') >= 2 and Chem.MolFromSmiles(s).GetNumAtoms() == 6] + ['C1=CCNCC1']
     18         Vocab.penzynes = [s for s in smiles_list if s.count('=') >= 2 and Chem.MolFromSmiles(s).GetNumAtoms() == 5] + ['C1=NCCN1','C1=NNCC1']

/home/erictaw/icml18-jtnn/fast_jtnn/vocab.pyc in get_slots(smiles)
      5 def get_slots(smiles):
      6     mol = Chem.MolFromSmiles(smiles)
----> 7     return [(atom.GetSymbol(), atom.GetFormalCharge(), atom.GetTotalNumHs()) for atom in mol.GetAtoms()]
      8 
      9 class Vocab(object):

AttributeError: 'NoneType' object has no attribute 'GetAtoms'

This error arises when RDKit reads an invalid SMILES string. Why is this happening?

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

1 participant