Cause of Molecule "exportToFormat" exceptions

User 0261d34ad7

28-10-2011 10:26:52

Hi,


I'm currently generating names from Molecules in ChemAxon (java) using mol.exportToFormat("name:i"). I've noticed that the interface to this method throws MolExportException, however it isn't clear under what circumstances this would be thrown when generating a name.


I've noticed that the exception can be generated when exporting to SMILES, for example when a feature of the chemical cannot be represented as SMILES, but could this happen with name generation? The key question is whether this exception will actually be thrown for names, and how it should be intepreted if thrown...


On a related note, does anyone know what 'traditional' means when exporting names?


Thanks :)


James Siddle

ChemAxon e7b9408ca1

31-10-2011 11:35:51

Hi James,


MolExportException can indeed be thrown when generating names. One reason can be that the molecule object contains query features (for instance R groups or atom lists), in which case generating a name does not make sense. For non-query molecules, this is indeed rare (i.e. less than 0.1% of cases on typical datasets), but can still happen for very large molecules, very specific cases that are not handled yet, etc. Therefore I would advise to prepare for the occasional exception as well. Feel free to report any failure that you think should not happen.


The "traditional" option does two things. First, it will use common names when possible. For instance, it will generate 'aspirin' instead of '2-(acetyloxy)benzoic acid' for input 'CC(=O)OC1=CC=CC=C1C(O)=O'. Second, in some cases, when a systematic name is generated, it will be sligthly simpler/shorter, by using traditionally used conventions instead of strictly applying IUPAC rules.


By the way, I would recommend using just "name" instead of "name:i" for the IUPAC (non-traditional) mode, though they currently have the same behaviour. I was thinking to deprecate "name:i" to replace it with something more explicit. Is "name:i" documented somewhere?


Best regards,


Daniel

User 0261d34ad7

09-11-2011 13:31:57

Hi Daniel,


Thanks for the reply - very helpful, we'll prepare for potential exceptions when generating names.


BTW I seem to remember seeing the "name:i" option documented on one of the pages linked from here:


http://www.chemaxon.com/marvin/help/formats/formats.html


However now that I look I can't find anything...but I definitely saw the option documented somewhere :)


Thanks,


Jim