rdkit / mmpdb

A package to identify matched molecular pairs and use them to predict property changes.
Other
214 stars 58 forks source link

Fix _smilesAtomOutputOrder parsing for RDKit 2024.03.6 or newer (Issue #7749) #66

Closed ricrogz closed 2 weeks ago

ricrogz commented 1 month ago

Fixes #65

RDKit's https://github.com/rdkit/rdkit/pull/7749 fixed an issue with the formatting of _smilesAtomOutputOrder: before this bugfix, the code added an extra comma at the end of the list of atom indexes, which required some custom parsing code such as the one in get_atom_order_in_smiles().

Once that patch was merged, the parsing code broke, as it expects the comma to be there.

After the patch, _smilesAtomOutputOrder can be parsed as json, or using ast.literal_eval(), which is what I'm adding here. For backwards compatibility with RDKit builds that do not include that patch, I added a couple of lines that remove the extra comma before using ast.literal_eval() to parse the list.

ricrogz commented 1 month ago

Please note the only real changes here are in get_atom_order_in_smiles(). The rest are just changes due to format on save.

chem-bio commented 2 weeks ago

Dear Ricardo,

Thank you for identifying the problem and contributing a solution. We merged the commit.

Best, Jerome.