cbouy / mols2grid

Interactive molecule viewer for 2D structures
https://mols2grid.readthedocs.io
Apache License 2.0
206 stars 25 forks source link

Searching CAS numbers #34

Closed aarontj73 closed 1 year ago

aarontj73 commented 1 year ago

Hello,

I have a dataframe with two columns, 'SMILES', and 'CAS', with both containing their obvious entities. One issue I am having is that the search tool, when 'text' searching for CAS number, doesn't seem to work with the built in dashes in CAS numbers, (e.g., 50-00-0). For example, if I were to start typing in '50' it would find all the text with '50' somewhere in it, but as soon as i type '50-' it doesn't find anything.

Obviously I could just remove all the dashes from the CAS numbers and just instruct users of my app to do the same, but I'd like to keep the original number present if possible.

I'm surprised this issue hasn't come up before. Any suggestions?

cbouy commented 1 year ago

It's a known problem in the underlying library that I use to create the paginated grid, but there hasn't been any answer from the maintainer of the lib in a while now. Basically if you have a regex character ([-[\]{}()*+?.,\\^$|#) in your search it will fail.

I'll see if I can somehow patch it, but apart from removing the dashes as you suggested I don't see any other quick workaround at the moment...