convert rdkit mol object to schrodinger’s mol object #RDKit #Chemoinformatics

I posted a memo about how to read maestro file format from RDKit. It means that rdkitter can use “mae” format from RDKit. ;-)
BTW, schrodinger’s site provides API for python. I would like to know the way to communicate rdkit from schrodinger python API.
https://www.schrodinger.com/pythonapi

I read the API in lunch break and tested some methods. Fortunately it worked well.
Example is below.
“rdkit_adapter” method provides a tool to connect rdkit-schrodinger’s python.

At first read sample sdf from rdkit.

from schrodinger.thirdparty import rdkit_adapter
from rdkit import Chem
mols = [ mol for mol in Chem.SDMolSupplier("solubility.sdf") if mol != None]

Then sanitize mol and convert rdkit mol object to schrodinger mol object. It can do with rdkit_adapter.from_rdkit method like this.

for mol in mols:
    Chem.SanitizeMol(mol)
schromols = []
for mol in mols:
    try:
        shmol = rdkit_adapter.from_rdkit(mol)
        schromols.append(shmol)
    except:
        pass

Now I could convert rdkit mol objects to schrodinger mol objects. Next I tried conversion from schrodinger mol objects to rdkit mol objects. I used rdkit_adapter.to_rdkit method.

rdmols = []
for mol in schromols:
    try:
        rdmol = rdkit_adapter.to_rdkit(mol)
        rdmols.append(rdmol)
    except:
        pass

I could not show output because I wrote this blog post from my personal computer. But above code worked.
And there are many methods are provided to schrodinger mol obj. Hmm it seems exciting for me. I check the API more deeply!

Advertisements