Update rdkit/shape-it #RDKit #shape-it #cheminformatics

Today I tried to build rdkit/shape-it because I could not build shape-it with current version of rdkit. So I struggled error message to fix the issue.(I’m not so good at C++ ;P)

There are two issues in the current code.
1. Version of c++ in the CMakeLists.txt is old, so I changed it from c++14 to c++17
2. Version of Catch2 is old too. Recent version of catch2 is 3.x. Old version of catch2 cause problem during the make process, so I update CMakeLists.txt and some cpp files.

After the modification, build process worked well and I could call shape-it from python.

Here is an install process.

$ gh repo clone rdkit/shape-it
$ cd shape-it
$ cmake -DCMAKE_INSTALL_PREFIX=/home/iwatobipen/src/shape-it -DBUILD_RDKIT_SUPPORT=ON -DBUILD_PYTHON_SUPPORT=ON -DRDKIT_INCLUDE_DIR=$CONDA_PREFIX/include/rdkit -DPYTHON_INSTDIR=$CONDA_PREFIX/lib/python3.10/site-packages ..
$ make j8
$ make install

After the process descrived avobe, I can call pyshape it from python.

import os
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import RDConfig
import py3Dmol
from pyshapeit import cpyshapeit
mols = [m for m in Chem.SDMolSupplier(os.path.join(RDConfig.RDDocsDir,'Book/data/cdk2.sdf'))]

ref = Chem.Mol(mols[0])
probe = mols[1]
temp = Chem.Mol(mols[1])
# draw molecules before alignment
p = py3Dmol.view(width=400,height=400)
p.addModel(Chem.MolToMolBlock(ref), 'sdf')
p.addModel(Chem.MolToMolBlock(probe), 'sdf')
p.setStyle({'stick':{}})
p.setBackgroundColor('0xeeeeee')
p.show()
score = cpyshapeit.AlignMol(ref, temp)
print(score)
# draw molecules after alignment
p = py3Dmol.view(width=400,height=400)
p.addModel(Chem.MolToMolBlock(ref), 'sdf')
p.addModel(Chem.MolToMolBlock(temp), 'sdf')
p.setStyle({'stick':{}})
p.setBackgroundColor('0xeeeeee')
p.show()

Pyshapeit seems work well.

And there are still some issues in rdkit/shape-it. I would like to try fix it.

https://github.com/rdkit/shape-it

Published by iwatobipen

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

Leave a comment

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