Hi Rafael, thanks for the tip. For some cases filtering out the small fragments would work. The problem is that sometimes the small fragment is making interactions with the binding pocket that I want to keep. Like in the example below, Chem.FragmentOnBRICSBonds will generate nine fragments. Among these are the tetrazole and chlorophenyl groups.
mol="""1sl3 3D Schrodinger Suite 2020-3. 37 40 0 0 1 0 999 V2000 19.8850 -14.4930 26.0920 C 0 0 0 0 0 0 19.8090 -15.8920 25.7160 C 0 0 0 0 0 0 20.8840 -16.4990 25.0550 N 0 3 0 0 0 0 22.0630 -15.8640 24.6980 C 0 0 0 0 0 0 22.1840 -14.4770 25.0450 C 0 0 0 0 0 0 21.0990 -13.8170 25.7440 C 0 0 0 0 0 0 18.5420 -16.7220 25.9220 C 0 0 0 0 0 0 17.9270 -17.1560 24.6050 C 0 0 0 0 0 0 17.2390 -16.0490 23.9180 N 0 0 0 0 0 0 17.9430 -15.3750 22.8840 C 0 0 0 0 0 0 17.4220 -14.1380 22.2760 C 0 0 0 0 0 0 18.1450 -13.5090 21.2900 N 0 0 0 0 0 0 19.4450 -13.9240 20.8140 C 0 0 0 0 0 0 19.9520 -15.0780 21.4460 C 0 0 0 0 0 0 19.2190 -15.7850 22.3930 N 0 0 0 0 0 0 16.3470 -13.6760 22.6470 O 0 0 0 0 0 0 20.2940 -13.0680 19.6270 Cl 0 0 0 0 0 0 17.6120 -12.2700 20.6890 C 0 0 0 0 0 0 16.1360 -12.4120 20.3520 C 0 0 0 0 0 0 15.3990 -11.3120 20.5550 N 0 0 0 0 0 0 15.6960 -13.4630 19.8970 O 0 0 0 0 0 0 13.9620 -11.3520 20.2480 C 0 0 0 0 0 0 13.1050 -11.3550 21.5070 C 0 0 0 0 0 0 13.0960 -10.1610 22.3090 C 0 0 0 0 0 0 12.2840 -10.1950 23.4950 C 0 0 0 0 0 0 11.5040 -11.3370 23.8990 C 0 0 0 0 0 0 12.3340 -12.4970 21.9000 C 0 0 0 0 0 0 11.5100 -12.5220 23.0980 C 0 0 0 0 0 0 18.8320 -17.8780 26.5420 F 0 0 0 0 0 0 17.6180 -16.0780 26.6550 F 0 0 0 0 0 0 12.2380 -8.7570 24.4850 Cl 0 0 0 0 0 0 20.7720 -17.8030 24.7230 O 0 5 0 0 0 0 13.2350 -15.7030 20.5450 N 0 0 0 0 0 0 12.3840 -15.2320 19.8030 N 0 0 0 0 0 0 11.9670 -14.1020 20.2010 N 0 0 0 0 0 0 12.4750 -13.6680 21.2150 N 0 0 0 0 0 0 13.3510 -14.7260 21.5840 C 0 0 0 0 0 0 1 2 1 0 0 0 1 6 2 0 0 0 2 3 2 0 0 0 2 7 1 0 0 0 3 4 1 0 0 0 3 32 1 0 0 0 4 5 2 0 0 0 5 6 1 0 0 0 7 8 1 0 0 0 7 29 1 0 0 0 7 30 1 0 0 0 8 9 1 0 0 0 9 10 1 0 0 0 10 11 1 0 0 0 10 15 2 0 0 0 11 12 1 0 0 0 11 16 2 0 0 0 12 13 1 0 0 0 12 18 1 0 0 0 13 14 2 0 0 0 13 17 1 0 0 0 14 15 1 0 0 0 18 19 1 0 0 0 19 20 1 0 0 0 19 21 2 0 0 0 20 22 1 0 0 0 22 23 1 0 0 0 23 24 2 0 0 0 23 27 1 0 0 0 24 25 1 0 0 0 25 26 2 0 0 0 25 31 1 0 0 0 26 28 1 0 0 0 27 28 2 0 0 0 27 36 1 0 0 0 33 34 1 0 0 0 33 37 2 0 0 0 34 35 2 0 0 0 35 36 1 0 0 0 36 37 1 0 0 0 M CHG 2 3 1 32 -1 M END""" m2 = Chem.MolFromMolBlock(mol) newmol2=Chem.FragmentOnBRICSBonds(m2) mfl=Chem.GetMolFrags(newmol2,asMols=True,sanitizeFrags=True) Draw.MolsToGridImage(mfl,molsPerRow=4) I would like to keep these two fragments connected, and I can do this with the code below using BRICS.BRICSDecompose frag = [Chem.MolFromSmiles(x) for x in sorted (BRICS.BRICSDecompose(m3,minFragmentSize=6))] Draw.MolsToGridImage(frag,molsPerRow=4) What I didn't figure out yet is how to preserve the 3D coordinates when I use BRICS.BRICSDecompose or how to make Chem.FragmentOnBRICSBonds generate larger fragments Best, Renato On Thu, Jul 14, 2022 at 9:39 AM Rafael L <rafael.lame...@usp.br> wrote: > Renato, it seems that FragmentOnBRICSBonds and BRICS.BRICSDecompose work > differently. The first returns a mol object from which you can get the > fragments using GetMolFrags (as you did), while the second returns a list > of strings containing the fragments. I'm not sure if you can recover 3D > info from these strings. > If you want to get the fragments from BRICS.BRICSDecompose, use: > > l = BRICS.BRICSDecompose(m2,minFragmentSize=9) > fr2 = [Chem.MolFromSmiles(x) for x in l] > Draw.MolsToGridImage(fr2,molsPerRow=4) > > > Alternatively, if you want to remove the small fragments obtained from > FragmentOnBRICSBonds, you can filter by using the atom count: > > newmol2=Chem.FragmentOnBRICSBonds(m2) > frags=Chem.GetMolFrags(newmol2,asMols=True,sanitizeFrags=True) > frags = [x for x in frags if len(x.GetAtoms()) > 3] > Draw.MolsToGridImage(frags,molsPerRow=4) > > > On Wed, Jul 13, 2022 at 8:01 PM Renato Freitas <renato...@gmail.com> > wrote: > >> 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 >> > > > -- > *Rafael da Fonseca Lameiro * > PhD Student - Medicinal and Biological Chemistry Group (NEQUIMED) > São Carlos Institute of Chemistry - University of São Paulo - Brazil > [image: orcid logo 16px] https://orcid.org/0000-0003-4466-2682 >
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss