Hello all,
I just started using knime (version 5.1.0) with rdkit in Windows and I am having an issue I couldn’t figure out.
I wrote the following cutom python function using rdkit:
The function will cause knime to crash and exit after execution. However, if I add a line to convert the mol object back to string, it will execute successfully (see the example below).
I think this might be a bug, but I am still new to knime so I can’t be sure.
Lik
import knime.scripting.io as knio
from rdkit.Chem import rdDeprotect
from rdkit import Chem
input_table = knio.input_tables[0].to_pandas()
# deprotect molecules
mol=list(input_table['smiles (RDKit Mol)'])
mol_deprotect=[rdDeprotect.Deprotect(x) for x in mol] #this will fail when execute
# this will run successfully: mol_deprotect=[Chem.MolToSmiles(rdDeprotect.Deprotect(x)) for x in mol]
input_table['deprotected_mol']=mol_deprotect
# TODO: work with the pandas.DataFrame here...
output_table = input_table
# Populate the first output table of the node (use knio.output_tables[1] to populate the second one, etc.).
knio.output_tables[0] = knio.Table.from_pandas(output_table)