Re: [Rdkit-discuss] generate conformes with a restrained core
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Luan C. M. <lua...@gm...> - 2018-03-23 19:20:00
|
When you used AllChem.UFFOptimizeMolecule(newMol3D,confId=cid) the minimization proceeded without constraints, therefore, the core embedding was lost. Read the source of ConstrainedEmbed [ http://www.rdkit.org/Python_Docs/rdkit.Chem.AllChem-pysrc.html#ConstrainedEmbed]. This function does a restricted minimization using AddDistanceConstraint. Sincerely, Luan Carvalho. Atenciosamente, Luan Carvalho Martins lua...@gm... On Fri, Mar 23, 2018 at 3:56 PM, Felipe Trajtenberg <fel...@gm...> wrote: > Hi Paolo > > great! it was a very simple thing. Now the sdf file with the conformers is > generated but the conformers were not constraints at the core of the > ligand...as I was trying? can you tell me why? > > thanks a lot! > > felipet > > 2018-03-23 15:37 GMT-03:00 Paolo Tosco <pao...@un...>: > >> Dear Felipe, >> >> cids is a list of conformer ids, i.e. integer numbers. Therefore >> >> prbMol = cids[prbNum] >> >> sets prbMol to the integer value of the prbNum element of the cids list. >> >> The reason of the error message you are getting: >> Boost.Python.ArgumentError: Python argument types in >> SDWriter.write(SDWriter, int) >> did not match C++ signature: >> write(RDKit::SDWriter {lvalue} self, RDKit::ROMol {lvalue} mol, int >> confId=-1) >> >> is that you are passing only an int to SDWriter.write(), rather than a >> mol and an int as the function expects. >> What you need is: >> >> nMol = len(cids) >> w = Chem.SDWriter('conf_output.sdf') >> >> for prbNum in range(0, nMol): >> prbMol = cids[prbNum] >> w.write(newMol3D, prbMol) >> w.close() >> >> or, more simply: >> >> w = Chem.SDWriter('conf_output.sdf') >> >> for cid in cids: >> w.write(newMol3D, cid) >> w.close() >> >> Cheers, >> p. >> >> On 03/23/18 18:04, Felipe Trajtenberg wrote: >> >> Dear all, >> >> sorry but I am really new at using RDkit. By looking at the scripts and >> tutorial available I wrote the following script. The idea is to generate a >> number of conformers for a big and flexible ligand, but with constraints. >> This script generate a set of conformers but I can't write a SDF file with >> all of them. The error I get is: >> >> Traceback (most recent call last): >> File "<stdin>", line 3, in <module> >> Boost.Python.ArgumentError: Python argument types in >> SDWriter.write(SDWriter, int) >> did not match C++ signature: >> write(RDKit::SDWriter {lvalue} self, RDKit::ROMol {lvalue} mol, int >> confId=-1) >> >> Thanks in advance for any help >> >> felipet >> >> The script is: >> >> from rdkit import Chem >> from rdkit.Chem import AllChem >> import os >> >> mols = [x for x in Chem.SDMolSupplier('out.CRC.sdf',removeHs=False) if x >> is not None] >> core = Chem.MolFromSmarts('CCCCCCCCCCCCCCC(O)=O') >> >> >> em = Chem.EditableMol(mols[0]) >> match = mols[0].GetSubstructMatch(core) >> for idx in range(mols[0].GetNumAtoms()-1,-1,-1): >> if idx not in match: >> em.RemoveAtom(idx) >> >> coreMol = em.GetMol() >> Chem.SanitizeMol(coreMol) >> >> newMol = Chem.MolFromSmiles('CCCCCCCCCCCCCCCCCCCCCCCCCC(O)=O') >> >> newMol=Chem.AddHs(newMol) >> newMol3D=AllChem.ConstrainedEmbed(newMol,coreMol) >> >> cids=AllChem.EmbedMultipleConfs(newMol3D,numConfs=100,pruneRmsThresh=1.0, >> enforceChirality=True) >> for cid in cids: AllChem.UFFOptimizeMolecule(newMol3D,confId=cid) >> >> nMol = len(cids) >> w = Chem.SDWriter('conf_output.sdf') >> >> for prbNum in range(0, nMol): >> prbMol = cids[prbNum] >> w.write(prbMol) >> w.close() >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> >> >> >> _______________________________________________ >> Rdkit-discuss mailing lis...@li...://lists.sourceforge.net/lists/listinfo/rdkit-discuss >> >> >> > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Rdkit-discuss mailing list > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > |