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'

Theliteral_eval function <https://stackoverflow.com/questions/8494514/converting-string-to-tuple>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 <https://stackoverflow.com/questions/18950054/class-method-generates-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