[Rdkit-discuss] Draw.MolsToGridImage error: got multiple values for keyword argument
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Konrad K. <kon...@ic...> - 2020-02-25 16:02:26
|
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.
|