Chemical-Curation / chemcurator_django

Backend services for chemical curation
https://api.chemreg.epa.gov
MIT License
1 stars 0 forks source link

Simple standardization of Chemicals on Creation #33

Open cmgrulke opened 4 years ago

cmgrulke commented 4 years ago

As a researcher I want structures to be stored in kekulized form with implicit Hydrogens So that the structures returned by the API will be usable in all chemical toolkits and not be bloated by explicit hydrogen storage

Request Example POST https://api.chemreg.epa.gov/defined-compounds/

Acceptance Criteria: When I post a structure to the API, the structure is always dearomatized and explicit hydrogens are removed. If either fails, the following error messages are returned: "Dearomatization failed for your structure." or "Removal of hydrogens failed for your structure"

Test:

debboutr commented 3 years ago

@cmgrulke would you be able to pass along molfile's that would show a compound un-kekulized (dearomatized) and then it's kekulized form? Also, could you send one that should fail kekulization?

This is really going to wreak havoc on the way that we have setup the saving of compounds on the frontend. Right now if the user draws a compound and a matching molfile is found we don't allow for a reloading of the drawing but now it seems as though we will? What will happen if the user draws the kekulized vs. unkekulized compound? This seems like it will be pretty straight forward on the django side, but the above concerns will be tricky to implement in vue.

cmgrulke commented 3 years ago

So, I still don't want to reload the drawing if the inchikey matches with one that is in the database. It is just that any save should always result in storing the kekule form rather than the aromatized form. So if I come back and search for the substance later, it will display the kekule form. If after a save of the compound, we refreshed the molfile to match with what the API has stored, that would be appropriate, but not during drawing.

I added two molfiles (".mol" changed to ".txt" so they would attached) for kekule vs aromatic benzene.

I can't send you an example of a dearomatization error because they are rare and toolkit specific. It generally happens when someone aromatizes a chemical in one toolkit and loads it into a different toolkit and tries to kekulize it. Each toolkit has their own aromatization models, so attempting to kekulize an aromatic structure generated in a different tool can cause failure. I just want there to be something that could catch that type of exception if it were to happen (since I have had it happen many times when attempting to kekulize structures in jchem that were provided as aromatic structure out of indigo).

aromatic_benzene.txt kekule_benzene.txt