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, 169👍, 0💬
Popular Posts:
What Is the PKNCA R Package? The PKNCA R Package is designed to perform all Non-Compartmental Analys...
Where to find FAQ (Frequently Asked Questions) in understanding what is SDF/Mol V3000 file format? H...
Molecule Summary: ID: FYI-1000210 SMILES: CC1=CN(C=N1)C2=CC(=CC(NC (=O)C3=CC=C(C)C(NC4=NC=C C(=N4)C5=C...
Where to find FAQ (Frequently Asked Questions) in understanding PK/PD (Pharmacokinetic/Pharmac odynam...
How to use "babel -o fpt ..." command to do similarity search? You can use the "fpt" output file for...