Timing out an export to InChI calculation

User 0cd5667845

23-07-2015 00:31:45

Hi,


In converting a large number of SMILES to InChI, I found that the InChI calculation for the complex SMILES given below never ends. I have tried leaving it running for several hours and it does not end.


Because I am regularly processing files containing a large number of SMILES to InChI, I would like to be able to either terminate each InChI calculation after a certain amount of time and move on with my main code, or alternatively provide a time limit each time I call the export function. However, I can't find any capability to do this in the documentation. I also tried spawning a separate thread for my InChI calculation, and then terminating the thread after my time has expired. However, the InChI calculation is not responding to my thread interruption; my main code proceeds, but my spawned thread will not terminate.


Is there any way that I can implement or request a time out of the InChI calculation?


 


More detail:


String preferredInchiFormat = "inchi:SAbs,AuxNone";


String smiles = "PPS(PP(S(PP)(=PP)=PP)S(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)P(P(P(P=S)P(S(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)P(P(S(PP)(=PP)=PP)S(PP)(=PP)=PP)S(PP)(=PP)=PP)S(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)P(P(S(PP)(=PP)=PP)S(PP)(=PP)=PP)S(PP)(=PP)=PP)P(S(PP)(=PP)=PP)S(PP)(=PP)=PP)S(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)(=PP(S(PP)(=PP)=PP)S(PP)(=PP)=PP)P(P(S(PP)(=PP)=PP)S(PP)(=PP)=PP)S(PP)(=PP)=PP)(=PP)=PP";


Molecule mol = MolImporter.importMol(smiles, "smiles");


String inchi = MolExporter.exportToFormat(smiles, preferredInchiFormat); //never ends for the SMILES provided above

ChemAxon e49cf225c6

24-07-2015 12:00:08

Hi,


Unfortunately there is no reliable way to stop an InChI thread because it runs native code outside the JVM.


However the InChI library provides an option to specify timeout (e.g. /W0 for none and /W60 for 60 secs), but it looks like the JNI InChI library on which we rely implements it badly. For this bug I file a report for the relevant team.


 


For the moment one much less convenient solution would be to download the InChI executables (http://www.iupac.org/home/publications/e-resources/inchi/download.html)  and call it directly from your code. This way you can use the /W... timeout option. In this case your structures have to be converted to MOL or CML format as an input to the InChI executable.

User 0cd5667845

24-07-2015 22:46:15

Hi,


Thank you for reporting this issue with the JNI. I look forward to hearing an update ... in the meantime we may try the executables but as you said, it's not tremendously convenient for very high-throughput processing.