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 list
Rdkit-discuss@lists.sourceforge.net
https://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
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss