Dear Rdkit team,

I want to fragment a ligand from PDB and keep the 3D coordinates of the
resulting fragments. I was able to do that using the code below

###################
import rdkit
import py3Dmol
from rdkit import Chem
from rdkit.Chem import rdmolops
from rdkit import RDLogger
from rdkit.Chem import BRICS
from rdkit.Chem import Recap
from rdkit.Chem import Draw
from rdkit.Chem import AllChem
from rdkit.Chem.Draw import IPythonConsole
from rdkit import Chem, RDConfig
from rdkit.Chem import AllChem, rdMolAlign

mol ="""rot-1A5H-A
     RDKit          3D

 28 30  0  0  1  0  0  0  0  0999 V2000
    0.5600   -9.3330  -12.4470 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5220  -11.6860  -13.9640 C   0  0  2  0  0  0  0  0  0  0  0  0
   -1.3890  -10.8900  -13.0130 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.9370   -9.5080  -12.5700 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.3380   -9.3820  -13.7780 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.5150   -9.5890  -15.0480 C   0  0  2  0  0  0  0  0  0  0  0  0
    0.0420  -10.9860  -15.1910 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.2540  -11.5680  -16.2200 O   0  0  0  0  0  0  0  0  0  0  0  0
   -0.9330  -12.9740  -14.0030 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.2340  -13.7900  -15.1940 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.7960  -15.1430  -15.2380 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.0610  -15.9350  -16.4000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.7450  -15.3930  -17.5400 C   0  0  0  0  0  0  0  0  0  0  0  0
   -2.1670  -14.0630  -17.4730 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.9260  -13.2750  -16.3360 C   0  0  0  0  0  0  0  0  0  0  0  0
   -2.0200  -16.1830  -18.7390 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.3190  -17.2890  -19.0360 N   0  0  0  0  0  0  0  0  0  0  0  0
   -2.9740  -15.7940  -19.5590 N   0  0  0  0  0  0  0  0  0  0  0  0
    0.8600   -8.8970  -16.1880 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.1700   -8.8390  -16.9320 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.1750   -8.5140  -18.3280 C   0  0  0  0  0  0  0  0  0  0  0  0
    3.3880   -8.4510  -19.0560 C   0  0  0  0  0  0  0  0  0  0  0  0
    4.6500   -8.7150  -18.4280 C   0  0  0  0  0  0  0  0  0  0  0  0
    4.6430   -9.0360  -17.0580 C   0  0  0  0  0  0  0  0  0  0  0  0
    3.4350   -9.0920  -16.3220 C   0  0  0  0  0  0  0  0  0  0  0  0
    5.9450   -8.6500  -19.1820 C   0  0  0  0  0  0  0  0  0  0  0  0
    6.9230   -9.5390  -18.9420 N   0  0  0  0  0  0  0  0  0  0  0  0
    6.1630   -7.7040  -20.1250 N   0  0  0  0  0  0  0  0  0  0  0  0
  1  4  1  0
  1  5  1  0
  2  3  1  0
  2  7  1  0
  2  9  1  6
  3  4  1  0
  5  6  1  0
  6  7  1  0
  6 19  1  6
  7  8  2  0
  9 10  1  0
 10 11  2  0
 10 15  1  0
 11 12  1  0
 12 13  2  0
 13 14  1  0
 13 16  1  0
 14 15  2  0
 16 17  2  0
 16 18  1  0
 19 20  1  0
 20 21  2  0
 20 25  1  0
 21 22  1  0
 22 23  2  0
 23 24  1  0
 23 26  1  0
 24 25  2  0
 26 27  2  0
 26 28  1  0
M  END
"""

m2 = Chem.MolFromMolBlock(mol)

newmol2=Chem.FragmentOnBRICSBonds(m2)
frags=Chem.GetMolFrags(newmol2,asMols=True,sanitizeFrags=True)
Draw.MolsToGridImage(frags,molsPerRow=4)
##########################################

However, some of the fragments are very small. I found that using
"BRICS.BRICSDecompose" I can set the minimum size of the fragments with
"minFragmentSize". So I tried the following code

frag = [Chem.GetMolFrags(x) for x in sorted
(BRICS.BRICSDecompose(m2,minFragmentSize=9))]


which didn't work, and I got the following error:


###########################################################################

ArgumentError Traceback (most recent call last)

<ipython-input-35-657d531b48a2> <https://localhost:8080/#> in <module>()
----> 1 frag = [Chem.GetMolFrags(x) for x in
sorted(BRICS.BRICSDecompose(m2,minFragmentSize=9))]


<ipython-input-35-657d531b48a2> <https://localhost:8080/#> in <listcomp>(.0)
----> 1 frag = [Chem.GetMolFrags(x) for x in
sorted(BRICS.BRICSDecompose(m2,minFragmentSize=9))]


ArgumentError: Python argument types in
    rdkit.Chem.rdmolops.GetMolFrags(str)
did not match C++ signature:

GetMolFrags(RDKit::ROMol mol, bool asMols=False, bool sanitizeFrags=True,
boost::python::api::object frags=None, boost::python::api::object
fragsMolAtomMapping=None)
###########################################################################

I am still learning RDkit (and Python) I am stuck at this. Can someone give
me any tips on how to solve this problem or point me in right direction?

Best regards,

Renato
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to