Molecule 2D

Display chemical structure as 2D image by ChemSpider ID, InChi os SMILES strings.

Simple demo application available here.

Summary
Molecule 2DDisplay chemical structure as 2D image by ChemSpider ID, InChi os SMILES strings.
Functions
molecule2dConvert DIV panel into Molecule2D widget.
Types
Options
Functions
setCSIDSet ChemSpider ID and load molecule’s image from the compound.
setSMILESSet SMILES and convert it to image.
setInchiSet InChi and convert it to image.
setOptionsSet new options to update the widget’s view
toggleSpinPlaceholder function

Functions

molecule2d

Convert DIV panel into Molecule2D widget.

Parameters

optionsInitialization Options
var mol2d = $("#molecule2d").molecule2d({
    width: 200,
    height: 200,
    csid: 2157
});

Types

Options

Properties

csidChemSpider ID of compound that image should be presented
inchiInChi string of the molecule that should be presented
smilesSMILES string of the molecule that should be presented
widthWidth of the widget in pixels.  Default value - 200
heightHeight of the widget in pixels.  Default value - 200
allowZoomEnable or disable image zoom.  Enabled by default.
zoomWidthWidth of zoomed image in pixels.  Default value - 500
zoomHeightHeight of zoomed image in pixels.  Default value - 500
molstring containing contents of mol connection file of the molecule to be displayed (with each new line delimited by \n) e.g. mol:”” +”\n” +”\n” +”\n 2 1 0 0000 0 0 0 0 0999 V2000” +”\n 2.4000 -0.4625 0.0000 C 0 0 0 0 0 0 0 0 0 0 0” +”\n 3.7167 -0.4667 0.0000 C 0 0 0 0 0 0 0 0 0 0 0” +”\n 2 1 2 0” +”\nM END” +”\n” +”\n$$$$\n”

Functions

setCSID

setCSID: function (csid)

Set ChemSpider ID and load molecule’s image from the compound.

Parameters

csidChemSpider ID
mol2d.setCSID(10368587);

setSMILES

setSMILES: function (smiles)

Set SMILES and convert it to image.

Parameters

smilesSMILES string
mol2d.setSMILES('CC(=O)Oc1ccccc1C(=O)O');

setInchi

setInchi: function (inchi)

Set InChi and convert it to image.

Parameters

inchiInChi string
mol2d.setInchi('InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)');

setOptions

setOptions: function (options)

Set new options to update the widget’s view

mol2d.setOptions({
    bondWidth: 2,
    spinRateX: 0.1,
    spinRateY: 0.1
});

toggleSpin

toggleSpin: function ()

Placeholder function

mol2d.toggleSpin();
setCSID: function (csid)
Set ChemSpider ID and load molecule’s image from the compound.
setSMILES: function (smiles)
Set SMILES and convert it to image.
setInchi: function (inchi)
Set InChi and convert it to image.
setOptions: function (options)
Set new options to update the widget’s view
toggleSpin: function ()
Placeholder function