Collections:
Refresh Molecule in JSME Editor
How to refresh (read and reset) molecule created in JSME editor with the Web server?
✍: FYIcenter.com
If you want refresh molecule properties displayed in the JSME editor,
you can use a PHP script on the Web server to read and reset the molecule
structure in the JSME editor.
1. Create an HTML form with an input field for submitting the molecule structure to the server.
<form id="jmeForm" action="update-molecule.php" method="post"> <input id="jmeVar" type="hidden" name="JME"/> <button type="button" onclick="jsmeOnClick();">Update"</button> </form>
2. Create a JavaScript function jsmeOnClick(), which will be called when the "Update" button is clicked. It reads the molecule structure in JME format from the JSME editor and submit the structure to the server using the HTML form.
<script> function jsmeOnClick() { var jme = jsmeObj.jmeFile(); document.getElementById("jmeVar").value = jme; document.getElementById("jmeForm").submit(); } </script>
3. Retrieve the molecule structure on the server side in the PHP script, update-molecule.php.
$jme = _REQUEST["JME"]; # save the structure to database or to a file.
4. Generate HTML document with JavaScript code to load the molecule structure into the JSME editor.
$jme = _REQUEST["JME"]; $htm = <<< EndOfHtml <script> function jsmeOnLoad() { jsmeObj = new JSApplet.JSME("jsme_container", "380px", "340px"); jsmeObj.readMolecule($jme); } </script> EndOfHtml;
Note that you also use the jsmeObj.readGenericMolecularInput($jme) to load the molecule structure in JME format. But it will display the "ERROR: Invalid JME string" message on the JSME editor, for an empty structure.
So JSME has a bug in the readGenericMolecularInput() code for a given empty structure in JME format: "0 0".
⇒ JSME Molecule Editor Options
2023-04-13, 171👍, 0💬
Popular Posts:
Can I search for a molecule by its InChIKey? Yes. You can search for a molecule by its InChIKey usin...
What are tools that support the SDF/Mol V3000 file format? There are a number of online or standalon...
Atomic Number: 118, Element Symbol: Og, Element Name: Oganesson, Atomic Mass: 295.216 u.
Molecule Summary: ID: FYI-1000179 SMILES: CNC[C@H](O)C1=CC(O)=C(O) C=C1Received at FYIcenter.com on:...
Molecule Summary: ID: FYI-1002022 Names: InChIKey: TUZNCNKIMLFQLX-UHFFFAOYS A-NSMILES: COC(=O)c1coc(...