When I run the python script, it shows the problem "SMILES Pass Error"imageimage2image3. Codes show as below.
def convert_vocab_to_smiles_fn(smi_vocab_coding_padded,
token_EOS=SmilesVocab.smi_vocab.index('<EOS>')):
index_eos = np.where(smi_vocab_coding_padded == token_EOS)[0]
f_counter = 0
if index_eos.size == 0:
f_counter += 1
return None, ''.join(
[SmilesVocab.smi_vocab[x] for x in smi_vocab_coding_padded])
elif index_eos[0] == 0:
f_counter += 1
return False, ''.join(
[SmilesVocab.smi_vocab[x] for x in smi_vocab_coding_padded])
else:
int_encoding = smi_vocab_coding_padded[:index_eos[0]]
smiles_encoding = ''.join(
[SmilesVocab.smi_vocab[x] for x in int_encoding])
try:
rdkit_mol_encoding = rdkit_chem.MolFromSmiles(smiles_encoding)
except:
rdkit_mol_encoding = None
return smiles_encoding, rdkit_mol_encoding
I search the solution on the Internet, but I find nothing