Difference between revisions of "Jmol JavaScript Object/JME"

From Jmol
Jump to navigation Jump to search
(update of descriptions (mostly, Java left behind))
(update of descriptions (mostly, Java left behind))
Line 1: Line 1:
 
= Integration of JSME into JSmol =
 
= Integration of JSME into JSmol =
JSME, the JavaScript Molecular Editor by Peter Ertl, evolved from the former [http://www.molinspiration.com/jme/ JME applet].  
+
'''JSME, the JavaScript Molecule Editor''' by Peter Ertl, evolved from the former [http://www.molinspiration.com/jme/ JME applet].  
 
It allows the user to draw a molecular structure in 2D. The '''JSmol object library''' includes the capability to pass information back and forth between JSME and JSmol in a seamless manner. The "information panel" that JSmol library implements can be set up to also hold the JSME object, allowing tight integration. Alternatively, JSME and JSmol objects can be set side-by-side on a web page, and communication between both objects can be handled by the page developer.  
 
It allows the user to draw a molecular structure in 2D. The '''JSmol object library''' includes the capability to pass information back and forth between JSME and JSmol in a seamless manner. The "information panel" that JSmol library implements can be set up to also hold the JSME object, allowing tight integration. Alternatively, JSME and JSmol objects can be set side-by-side on a web page, and communication between both objects can be handled by the page developer.  
  
Line 15: Line 15:
 
* '''j2sPath''' <code>"j2s"</code>
 
* '''j2sPath''' <code>"j2s"</code>
 
* '''options''' <code>"autoez"</code>
 
* '''options''' <code>"autoez"</code>
** rbutton, norbutton - show / hide R button
+
** <code>rbutton</code>, <code>norbutton</code> - show / hide R button
** hydrogens, nohydrogens - display / hide hydrogens
+
** <code>hydrogens</code>, <code>nohydrogens</code> - display / hide hydrogens
** query, noquery - enable / disable query features
+
** <code>query</code>, <code>noquery</code> - enable / disable query features
** autoez, noautoez - automatic generation of SMILES with E,Z stereochemistry
+
** <code>autoez</code>, <code>noautoez</code> - automatic generation of SMILES with E,Z stereochemistry
** nocanonize - SMILES canonicalization and detection of aromaticity supressed
+
** <code>nocanonize</code> - SMILES canonicalization and detection of aromaticity supressed
** nostereo - stereochemistry not considered when creating SMILES
+
** <code>nostereo</code> - stereochemistry not considered when creating SMILES
** reaction, noreaction - enable / disable reaction input
+
** <code>reaction</code>, <code>noreaction</code> - enable / disable reaction input
** multipart - possibility to enter multipart structures
+
** <code>multipart</code> - possibility to enter multipart structures
** number - possibility to number (mark) atoms
+
** <code>number</code> - possibility to number (mark) atoms
** depict - the applet will appear without editing butons,this is used for structure display only
+
** <code>depict</code> - the applet will appear without editing butons,this is used for structure display only
** Documented at [http://www2.chemie.uni-erlangen.de/services/fragment/editor/jme_functions.html]
+
** ...and more, documented at [https://peter-ertl.com/jsme/ Peter Ertl's site]
  
 
== JSME-specific methods ==
 
== JSME-specific methods ==

Revision as of 19:09, 27 October 2019

Integration of JSME into JSmol

JSME, the JavaScript Molecule Editor by Peter Ertl, evolved from the former JME applet. It allows the user to draw a molecular structure in 2D. The JSmol object library includes the capability to pass information back and forth between JSME and JSmol in a seamless manner. The "information panel" that JSmol library implements can be set up to also hold the JSME object, allowing tight integration. Alternatively, JSME and JSmol objects can be set side-by-side on a web page, and communication between both objects can be handled by the page developer.

Creating and inserting JSME

To create a JSME object, use for example:

var myJME = Jmol.getJMEApplet("myJME", Info, myJmol);

(Note that although the syntax is reminiscent of the former Java applets, no Java is currently involved here)

The 3rd argument, if provided, is a pointer to a JSmol object that will contain this JSME drawing panel as a 2D input option inside its Info panel.

Parameters making the Info variable (with default values shown):

  • height 300
  • width 300
  • j2sPath "j2s"
  • options "autoez"
    • rbutton, norbutton - show / hide R button
    • hydrogens, nohydrogens - display / hide hydrogens
    • query, noquery - enable / disable query features
    • autoez, noautoez - automatic generation of SMILES with E,Z stereochemistry
    • nocanonize - SMILES canonicalization and detection of aromaticity supressed
    • nostereo - stereochemistry not considered when creating SMILES
    • reaction, noreaction - enable / disable reaction input
    • multipart - possibility to enter multipart structures
    • number - possibility to number (mark) atoms
    • depict - the applet will appear without editing butons,this is used for structure display only
    • ...and more, documented at Peter Ertl's site

JSME-specific methods

All these functions must be applied to the unique Jmol object (this name is literal, cannot be changed):

Jmol.jmeGetFile(myJME, asJME) 
Jmol.jmeOptions(myJME, options)
Jmol.jmeReadMolecule(myJME, jmeOrMolData)
Jmol.jmeReset(myJME) 
Jmol.jmeSmiles(myJME, withStereoChemistry)

Contributors

AngelHerraez