Indigo

Editor mode

Installation

Installation package contains all sources required for work. Extract files and place where you need remaining internal structure of a ketcher directory.

Ketcher object

To access Ketcher from JavaScript you should obtain ketcher object:

var ketcher = ketcherWindow.ketcher;

where ketcherWindow is a separate Ketcher window or

var ketcherFrame = document.getElementById('ifKetcher');
var ketcher = null;

if ('contentDocument' in ketcherFrame)
    ketcher = ketcherFrame.contentWindow.ketcher;
else // IE7
    ketcher = document.frames['ifKetcher'].window.ketcher;

where ifKetcher is an Ketcher IFrame.

ketcher.setMolecule()

This method updates current structure in the editor. You can pass to it either SMILES string or Molfile, for example:

ketcher.setMolecule('c1ccccc1');

Note: SMILES loading doesn't work in the standalone mode.

ketcher.getSmiles()

Get a SMILES string of the current structure. Return value is a string.

ketcher.getMolfile()

Get Molfile of the current structure. Return value is a string.

Ketcher server

Current version of Ketcher has a sample implementation of the server side. It's a simple Python script ketcher-server.py which listens to the port 8080 and has four interfaces:

Query Action Type Parameters
/knocknock Server availability check GET -
/open Query for loading files from disk POST filedata
/save Query for saving files to disk POST filedata
/layout Query for converting SMILES to Molfile GET smiles

Server requires the Python wrappers of Indigo used to perform automatic layout. Another version of the Python server, intended to run under WSGI, is provided under the name of ketcher-server-wsgi.py.