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 print(sys.path) import reinvent_models.reinvent_core.models.model as reinvent batchsize = 124 #model path where user would like to use modelpath = '/hogehoge/ReinventCommunity/notebooks/models/random.prior.new' 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.
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 ;)