mojaie / MolecularGraph.jl

Graph-based molecule modeling toolkit for cheminformatics
MIT License
189 stars 27 forks source link

Erroneous catching of diasteromers #91

Closed Boxylmer closed 1 year ago

Boxylmer commented 1 year ago

Hi Mojaie!

First and foremost, thank you for putting so much effort into this package, I'm excited to try out some fragmentation ideas we have with the new api and we're finding the changes made to be a lot more intuitive.

When parsing some smiles, we're getting catches with certain molecules that weren't causing errors in 0.13. For example, 1,3-Butadiene, 1,2-dichloro:

> smilestomol("C=C/C(=C/Cl)/Cl")

ERROR: Invalid diastereomer representation

I'm unsure if this is a real problem as other parsers seem to not complain about it: image

Any ideas what might have changed to cause this?

Best, Will.

mojaie commented 1 year ago

Thank you very much for catching. Yes, it looks simply failure in stereobond recognition.

https://github.com/mojaie/MolecularGraph.jl/blob/a99c4ae7496b267fe418e8a87d97c0b274dc7d6d/src/stereo.jl#L298-L306

up/down bond consistency check seems to be done before flipping stereobonds in the parenthesis. I will fix it in the next patch.