JSME#

class trident_chemwidgets.JSME(**kwargs: Any)[source]#

Bases: DOMWidget

Display the JSME editor and sync drawn molecule SMILES strings to Python.

The JSME interface will be displayed to the left of the cell output, with a molecule gallery displayed to the right. The molecule gallery can show the structures designed and input by the user.

Parameters

base_smiles (str) – Base smiles used to generate an initial molecule in the JSME input window.

Examples

>>> import trident_chemwidgets as tcw
>>> jsme = tcw.JSME()
>>> jsme

A depiction of the structure, and all others that have been added to the saved internal molecule list will be displayed in the gallery to the right. You can access the list of input smiles using the smiles property of the widget.

>>> jsme.smiles

You can specify a base_smiles that will allow you to quickly generate derivatives. At any point, you can reset the input window to this predefined base smiles value by clicking the RESET TO BASE SMILES button beneath the input window.

>>> jsme = tcw.JSME(base_smiles='CC(C)Cc1ccc(cc1)[C@@H](C)C(=O)O')
>>> jsme

Input#

The JSME widget uses the JSME editor to provide an interface for molecular input by drawing. For an explanation of the JSME interface, please see the JSME Help Page.

Interaction features#

JSME interface

Creating a list of SMILES strings#

Once you draw a structure in the JSME interface, you can add it to the internal list of SMILES strings by clicking the ADD TO SMILES LIST button.

Retrieving the list of SMILES strings#

To retrieve these stored smiles strings, you can use the smiles attribute of the widget, as shown below:

>>> import trident_chemwidgets as tcw
>>> jsme = tcw.JSME()
>>> jsme

# Edit within the window and save using the ADD TO SMILES LIST button
# Then retrieve the SMILES list by using

>>> jsme.smiles

Using a base_smiles to quickly generate derivatives#

If you want to generate a list of derivatives from a single molecule starting point, you can use the base_smiles argument to the JSME widget. This keyword will automatically generate the molecule with that SMILES string in the input window. From that base molecule, you can add atoms to create a derivative and add that derivative to the SMILES list.

If you want to reset your input window to the base SMILES value, click the RESET TO BASE SMILES button and continue generating derivatives. Note that the window does not automatically reset to the base SMILES when a new SMILES is added to the list. Additionally, if no base_smiles argument is provided, you can use the RESET TO BASE SMILES button to clear the input window.

Example#

See Using the JSME widget.