InChI Demo
In our compiled InChI library, a wrapper C function, molToInchiJson is provided to convert MDL MOL format molecule data into InChI. Firstly, you should call cwrap function to wrap this function into JavaScript one:
var inchiModule = InChIModule(); // Get root module of InChI lib inchiModule.onRuntimeInitialized = function() // a callback function indicating that the InChI is ready { var molToInchiJson = inchiModule.cwrap('molToInchiJson', 'string', ['string', 'string']); // wrap function }
Then use it to get InChI information from MDL MOL format data:
var molData = '...'; // Set input MDL MOL format data here var options = ''; // InChI conversion option string, same as the one in C API var resultStr = molToInchiJson(molData, options); // return a JSON format string var details = JSON.parse(resultStr); // parse the JSON console.log('InChI: ' + details.inchi, 'AuxInfo' + details.auxInfo); // output
Live demo: