Collections:
JSApplet.Inchi.computeInchi() - Generate InChI
How to generate InChI and InChIKey with the JSApplet.Inchi.computeInchi() method?
✍: FYIcenter.com
The latest version of JSME allows you to generate InChI and InChIKey from a given molecule in SDF format. Here are the steps you can follow to do this in JavaScript code:
1. Create an empty object called "JSApplet" and add a property called "Inchi" with an other empty object.
<script> var JSApplet = {}; JSApplet.Inchi = {}; </script>
2. Load the 96E40B969193BD74B8A621486920E79C.cache.js file, which will populate JavaScript code to "JSApplet.Inchi", including the JSApplet.Inchi.computeInchi() method.
<script type="text/javascript" src="/jsme/96E40B969193BD74B8A621486920E79C.cache.js"></script>
3. Add a callback function to catch the result object generated by the JSApplet.Inchi.computeInchi() method.
<script> var result; JSApplet.Inchi.__resultHandler = function (inchi_result) { result = inchi_result }; ...
4. Invoke the JSApplet.Inchi.computeInchi() method and remove the callback function.
... var sdf = document.getElementById("sdf").value; JSApplet.Inchi.computeInchi(sdf, "JSApplet.Inchi.__resultHandler"); delete JSApplet.Inchi.__resultHandler; ...
5. Process the result object, which contains 5 properties: inchi, auxinfo, warning, error, and key.
... var text = ""; Object.keys(result).forEach(function (k) { text += k + ": " + result[k] + "\n" }); document.getElementById("inchi").value = text;
The following HTML document example, generate-inchi.html, shows you how to apply those steps:
<html> <!-- generate-inchi.html Copyright (c) FYIcenter.com. All rights reserved. --> <head> <body> <p>Input Mol/SDF:<br/> <textarea id="sdf" rows="10" cols="60"> JME 2022-09-26 Wed Jan 04 16:10:11 GMT-500 2023 6 6 0 0 0 0 0 0 0 0999 V2000 2.4249 0.7000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 2.4249 2.1000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 1.2124 2.8000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 2.1000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.7000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 1.2124 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 2 3 2 0 0 0 0 3 4 1 0 0 0 0 4 5 2 0 0 0 0 5 6 1 0 0 0 0 6 1 2 0 0 0 0 M END </textarea> </p> <p>Output InChI and InChIKey:<br/> <textarea id="inchi" rows="10" cols="60"></textarea> </p> <script> var JSApplet = {}; JSApplet.Inchi = {}; </script> <script type="text/javascript" src="/jsme/96E40B969193BD74B8A621486920E79C.cache.js"></script> <script> var result; JSApplet.Inchi.__resultHandler = function (inchi_result) { result = inchi_result }; var sdf = document.getElementById("sdf").value; JSApplet.Inchi.computeInchi(sdf, "JSApplet.Inchi.__resultHandler"); delete JSApplet.Inchi.__resultHandler; var text = ""; Object.keys(result).forEach(function (k) { text += k + ": " + result[k] + "\n" }); document.getElementById("inchi").value = text; </script> </body> </html>
2023-01-18, 363🔥, 0💬
Popular Posts:
What are the differences between "babel" and "obabel" commands? "babel" and "obabel" commands are tw...
Molecule Summary: ID: FYI-1002949 Names: ELAFIBRANOR; InChIKey: AFLFKFHDSCQHOL-IZZDOVSWS A-NSMILES: ...
How to use the auc() function in PK R Package? auc() function in the PK R package provides you estim...
Molecule Summary: ID: FYI-1000996 SMILES: c1(OCC)ccc(CC(N)CNCCN)cc 1ClClReceived at FYIcenter.com on...
Molecule Summary: ID: FYI-1002062 Names: GLEEVEC; InChIKey: YLMAHDNUQAMNNX-UHFFFAOYS A-NSMILES: CC1=...