Generate molecules with REINVENT and make interactive plot #RDKit #Knime #REINVENT

I introduced to use user defined condaenv in Knime. It’s really useful I think.

Make chemoinformatics workflow by Kinme with user defined conda envrionment #Knime #Chemoinforamtics #memo

And as you know, REINVENT is the one of famous compound generation tool for drug discovery. Its community provides lots of example codes as jupyternotebook. After building some model, I run sampling steps with configration file for sampling which is generated by the notebook. Today, I tried to generate molecules with python and process them with Knime. And I surprized that the process is really easy!

At first, I made simple workflow shown below.

To run the workflow, I used reinvent.v3.2 env. And next python script node defines compound generation process. The code is below.

from pandas import DataFrame
# Create empty table
output_table = DataFrame()
from rdkit import Chem
import sys
import reinvent_models.reinvent_core.models.model as reinvent
batchsize = 124
#model path where user would like to use
modelpath = '/hogehoge/ReinventCommunity/notebooks/models/'

model = reinvent.Model.load_from_file(modelpath, sampling_mode=True)
sampled_smi, likelyhood = model.sample_smiles(batchsize)
output_table['sampled_smi'] = sampled_smi
output_table['likelyhood'] = likelyhood
output_table['ROMol'] = output_table['sampled_smi'] .apply(Chem.MolFromSmiles)

To generate molecule from model, reinvent_models package is used. After loading the model, call sample_smiles is used for compound generation.

Post process is very simple. Calculate molecular fingerprint, run PCA and calculate molecular descirptors and convet molecule to PNG.

Finally, make javascript component with scatterplot and tile view.

I added interactive view for Tile view. So I could get tile view when I select plots ;)

This is a simple example to integrate KNIME and REINVENT. But I think it’s interesting that to use the approach, we can add lots of postprocess after generating molecules not only LBDD approach but also SBDD approach.

If readers who have interest knime and REINVENT, let’s make your ouwn work flow ;)


Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

One thought on “Generate molecules with REINVENT and make interactive plot #RDKit #Knime #REINVENT

  1. Hi, this is very interesting. Could you share your KNIME workflow, maybe by uploading to the KNIME hub? Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: