wengong-jin / icml18-jtnn

Junction Tree Variational Autoencoder for Molecular Graph Generation (ICML 2018)
MIT License
514 stars 190 forks source link

A TypeError of one function in chemutils.py #12

Open limaosen0 opened 6 years ago

limaosen0 commented 6 years ago

Dear Wengong:

I test some functions in your code to learn some functions of Rdkit, and I met one TypeError which cannot be solved by myself.

The run function is in chemutils.py:

def get_clique_mol(mol, atoms): smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True) new_mol = Chem.MolFromSmiles(smiles, sanitize=False) new_mol = copy_edit_mol(new_mol).GetMol() new_mol = sanitize(new_mol) #We assume this is not None return new_mol

The line is 'smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True)'

image


TypeError Traceback (most recent call last)

in () ----> 1 new_mol2 = chu.get_clique_mol(mol,atoms) /DATA3_DB7/data/msli/graph_net/MolGAN/chemutils.pyc in get_clique_mol(mol, atoms) 67 def get_clique_mol(mol, atoms): 68 ---> 69 smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True) 70 new_mol = Chem.MolFromSmiles(smiles, sanitize=False) 71 new_mol = copy_edit_mol(new_mol).GetMol() TypeError: No registered converter was able to produce a C++ rvalue of type int from this Python object of type Atom. -------------------------------------------------------------------------------------------- I believe that it is not your mistake, but I am a new learner of RDkit, please forgive me and help me. Thank you very much!