kekule

Open source JavaScript toolkit for chemoinformatics

Usage no npm install needed!

<script type="module">
  import kekule from 'https://cdn.skypack.dev/kekule';
</script>

README

Kekule.js

Kekule.js is an open source JavaScript toolkit for chemoinformatics released under MIT license. It can be used in both web applications and node applications to read, write, display and edit chemical objects (e.g. molecules) and to perform some chemical algorithms (e.g. molecule structure comparing, searching, aromatic detection).

More details about this project can be found in Kekule.js website.

Installation

For web applications, Kekule.js can be simply included in HTML page by <script> tag:

<script src="kekule.js?module=io,chemWidget,algorithm"></script>

Note the module param after "?". In the example above, module io, chemWidget and algorithm, as well as other prerequisite modules will be loaded.

If widget or chem widget modules are used, additional style sheet file also need to be linked in HTML page:

<link rel="stylesheet" type="text/css" href="themes/default/kekule.css" />

For node applications, the whole package can be installed by npm install command:

$ npm install kekule

Then Kekule namespace should be imported into the application:

var Kekule = require('kekule').Kekule;

After installation (in web or in node.js environment), you can run a small test to ensure that the toolkit works properly:

// Create a simple CO2 molecule
var mol = new Kekule.Molecule();
var atomC = mol.appendAtom('C');
var atomO1 = mol.appendAtom('O');
var atomO2 = mol.appendAtom('O');
mol.appendBond([atomC, atomO1], 2);
mol.appendBond([atomC, atomO2], 2);

// Get formula
var formula = mol.calcFormula();
console.log('Formula: ', formula.getText());

// Output SMILES (IO module should be loaded in web application)
var smiles = Kekule.IO.saveFormatData(mol, 'smi');
console.log('SMILES: ', smiles);

// Output MOL2k (IO module should be loaded in web application)
var mol2k = Kekule.IO.saveFormatData(mol, 'mol');
console.log('MOL 2000: \n', mol2k);

Documentations and Demos

A set of tutorials and demos are built to explain the basic operations in Kekule.js (e.g. creating molecule, loading and saving chemical objects, getting molecule information and usage of chem widgets).

The full API documents can be found here.

License

The toolkit is released under MIT license.