partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
250 stars 61 forks source link

incorrect view and export of polycyclic aromatic compounds #30

Open rmrmg opened 6 years ago

rmrmg commented 6 years ago

I selected benzene ring from menu and after two clicks I end up with structure presented in the picture below. naphtalene. Also SMILES obtained for this is incorrect ( C1=CC=2=C(C=C1)=CC=CC=2 ). Such a way (adding another benzene ring) is the most procedure to draw polycyclic aromatic hydrocarbons.

partridgejiang commented 6 years ago

Hi @rmrmg, it is a known issue in using the benzene button. Currently the editor simply add a benzene ring (always 3 single and 3 double bonds) regardless of its neighbor environment. To workaround it, you can use the cyclohexane button, then add essential double bond on it.

rmrmg commented 6 years ago

@partridgejiang: Yes, and other workaround is to remove unneeded double bonds. But both solutions are not very convenient for users, so I rather write a function to check and repair smiles obtained from the editor. Similar problem is with heteroatoms if you type any lower case symbol (o, n, ...) the editor places such symbol in smiles without any checking. When you fix it, please let me know.

partridgejiang commented 6 years ago

The lowcase symbol is now regarded as a pseudo atom in editor and in outputting the SMILES, it will be replaced with '[*]' (e.g. C1=C[*]C=C1 if input 'n' instead of 'N' in pyrrole). Could you send me a few test cases that cause the lowcase symbol to be outputed for debugging? Thanks.

rmrmg commented 6 years ago

@partridgejiang: You right, everywhere there are [*] not lower case letter. Sorry for my mistake.