Chemical-Curation / chemcurator_django

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

Name2Structure conversion service #303

Open cmgrulke opened 3 years ago

cmgrulke commented 3 years ago

As a developer I want a Name2Structure conversion microservice So that I can use it to complete ticket #154

OPSIN is a nice java package that will perform name to structure conversions. I currently use it in old ChemReg. https://opsin.ch.cam.ac.uk/. However, it is a java package and won't place nice with our python flask code. Therefore, we need to wrap it in a simple RESTful API and call it.

GET https://api.chemreg.epa.gov/name2Structure?name=$$$$$$$

Acceptance Criteria:

Test:

cmgrulke commented 3 years ago

This code snippet might help.

                for(String name : names){ //for each gsid we need to get the cas and print
            count++;

            OpsinResult opsR = nts.parseChemicalName(name);
            Molecule mol = new Molecule();
            if(opsR.getSmiles()!=null){
                mol = MolImporter.importMol(opsR.getSmiles());
            }
            mol.setProperty("Input_Name",name);
            mol.setProperty("Message",opsR.getMessage());
            molExp.write(mol);

            completePercent =  (int) (100*Float.valueOf(count)/Float.valueOf(size));
        }
jtumkur commented 3 years ago
jtumkur commented 3 years ago