Hi Paolo,

 

Your solution works perfectly.  Thank you! 

 

- Konrad

 

From: Paolo Tosco <paolo.tosco.m...@gmail.com>
Date: Tuesday, February 25, 2020 at 6:34 PM
To: Konrad Koehler <konrad.koeh...@icloud.com>, RDKit Discuss 
<rdkit-discuss@lists.sourceforge.net>
Subject: Re: [Rdkit-discuss] Draw.MolsToGridImage error: got multiple values 
for keyword argument

 

Hi Konrad,

you should use the highlightAtomLists parameter rather than highlightAtoms, 
then your example will work.

Cheers,
p.

On 25/02/2020 16:02, Konrad Koehler via Rdkit-discuss wrote:

Hi everyone,

 

I am having trouble using a mol property value to define highlighted atoms when 
generating an image.

 

Starting from the beginning, I have defined a variable highlight_atom_numbers 
as a tuple:

>>> type(highlight_atom_numbers)

>>> <class 'tuple'>

 

And set a mol property to this value:

mol.SetProp("highlight_atom_numbers",str(highlight_atom_numbers))

 

I then tried to create a 2D image of the molecule with the 
“highlight_atom_numbers” highlighted:

 

img=Draw.MolsToGridImage(

act_mols,

molsPerRow=4,

subImgSize=(200,200),

legends=[x.GetProp("_Name") for x in act_mols],

highlightAtoms=[literal_eval(x.GetProp("highlight_atom_numbers")) for x in 
act_mols] 

)

 

Which generates the following error message:

 

TypeError: Boost.Python.function() got multiple values for keyword argument 
'highlightAtoms'

 

The literal_eval function should return a single tuple and not multiple values.

 

Anyone have any ideas for getting this to work?  Thanks.

 

- Konrad

 

PS: I have tried googling for a solution, for example:

 

Stack Overflow: TypeError got multiple values for keyword argument

 

and tried the suggestions there, but that did not help.

 




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

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

Reply via email to