Skip to main content

RDKit in the Bottle on Tornado

Project description


.. image::
:alt: Latest Version

.. image::
:alt: Downloads

.. image::
:alt: Supported Python versions

.. image::
:alt: Development Status

.. image::
:alt: License

.. image::
:alt: 'Stories in Ready'

What is Beaker?

This is chembl_beaker package developed at `ChEMBL <>`_ group, `EMBL-EBI <>`_, Cambridge, UK.

This is wrapper for `RDKit <>`_ and `OSRA <>`_, which exposes following methods:

* `Format convertion <>`_
* `Compound recognition <>`_
* `Raster image (PNG) generation <>`_
* `Vector image (SVG) generation <>`_
* `HTML5 ready compound representation <>`_
* `Fingerprints <>`_
* `Descriptors <>`_
* `Ring information <>`_
* `Maximum Common Substructure <>`_
* `Smiliarity maps <>`_
* `ChEMBL standardisation process <>`_, consisting of neutralisation, bond breaking, salt removal and applying various rules.
* `3D coordinates generation, using Universal Force Field <>`_
* `Various other calculations (for example kekulisation) <>`_
* Marvin 4 JS compilant `webservices <>`_

As a portable, lightweight, `CORS <>`_-ready, `REST <>`_-speaking, `SPORE <>`_-documented webserver. This particular implementation wraps RDKit in `Bottle <>`_ on `Tornado <>`_.

Where is it used?

Beaker is used in `Clippy <>`_ project but can be used as a standalone web server as well.

It can also be used as web service backend for `Marvin For Java Script <>`_ as it exposes methods compatible with it's webservice `specification <>`_.
To do this you need to configure marvin sketcher instance:


marvin.sketcherInstance = new marvin.Sketch("sketch");
'clean2dws' : <url of Beaker clean webservice>,
'molconvertws' : <url of Beaker molExport webservice>,
"stereoinfows" : <url of Beaker cipStereoInfo>

Beaker and myChEMBL
Beaker is installed on myChEMBL Virtual Machine (currently version 19) so if you want to see how to deploy it for Apache or use it on your laptop or LAN without having to install RDKit and OSRA you can just grab a copy of myChEMBL.
The easiest way to do so is to install `vagrant <>`_ and type::

vagrant init chembl/myChEMBL
vagrant up

Software dependencies

* `RDKit <>`_
* `OSRA <>`_
* `Bottle <>`_
* `Tornado <>`_

Additional dependencies

* `pycairo <>`_/`cairocffi <>`_ (for `SVG <>`_ format support)
* `lxml <>`_ (`mrv <>`_ file format)
* `matplotlib <>`_ (generating similarity maps)
* `standardiser <>`_ (Molecular standardisation tool used by Beaker standardisation app)


The best way to install beaker is to use `PIP`:

``pip install chembl_beaker``

This command will install latest stable version with Bottle and Tornado. RDKit and OSRA must be installed separately.
You can of course clone development version from github but it's not guaranteed to be working.
If you want to install github version using `PIP`, invoke this command:

``sudo pip install git+``

Full recipe for Mac users

So I want to test it, I have a Mac and I don't know what rdkit, tornado and bottle is - how do I start?

First, install XQuartz from, then::

ruby -e "$(curl -fsSL"
brew tap edc/homebrew-rdkit
brew install rdkit
export RDBASE=/usr/local/share/RDKit
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
sudo -E pip install cairocffi
sudo -E pip install Pillow
sudo -E pip install lxml
sudo pip install standardiser
sudo pip install chembl_beaker

Alternatively, you can use `this article <>`_ as an instllation guide.

By default configuration is stored in ``beaker.conf`` file, located in current directory. You can specify location of
configuration file using ``--config (-c)`` parameter when running beaker. Configuration file format is standard ``*.ini``.
Beaker is distributed with example configuration file named ``beaker.conf.sample``.

* **debug** - run bottle server in debug mode (True/False, default ``True``)
* **bottle_port** - number of port on which Bottle server is listening for connections (integer, default ``8080``)
* **bottle_host** - hostname of Bottle server (string, default ``localhost``)
* **server_middleware** - networking middleware library used by Bottle (string, default ``tornado``)
* **osra_binaries_location** - path to OSRA binary you want to use for compound recognition (string, default ``/usr/bin/osra``)
* **enable_cors** - enable CORS plugin and respect all header settings below (True/False, default ``True``)
* **access_control_allow_origin** - content of 'Access-Control-Allow-Origin' header send with every response (string, default ``*``)
* **access_control_allow_methods** - content of 'Access-Control-Allow-Methods' header send with every response (string, default ``GET, POST, PUT, OPTIONS``)
* **installed_apps** - apps installed in beaker, default to [

If you want to play with beaker, type ``run_beaker``
If you want to run beaker in production, read section below .

Deploying on Apache/Nginx
Beaker is a Bottle app so it's really easy to deploy it on Apache with mod_wsgi.
Only a few lines of code are required in your .wsgi file::

from bottle import debug
import json
from chembl_beaker.beaker import app, config, loadPlugins, loadApps

conf_path = "[path to config. file]"

apps = json.loads(config.get('installed_apps', '[]'))
plugins = json.loads(config.get('plugins', '[]'))

loadPlugins(app, plugins)


application = app

That's it! For details, refer to `this document <>`_.
Everything that can be deployed on Apache with mod_wsgi, can be deployed on Nginx with uWSGI, details `here <>`_.

Like every good software written in Python, beaker is self-documented. When you run beaker, open your browser and go to URL: ``BEAKER_ROOT/docs``. You will see live documentation genrated on the fly from all available webservices, exposed by beaker. You can immediately try them and see results return by the server. Every webservice should be documented - documentation is generated automatically as well, from docstring of every exposed webservice, interpreted as markdown.

.. image::
:alt: docs screenshot

Development - writing your own extentions
Developing new app should be easy. The only required file is ```` where you should define your botte ``routes``. Since your app is technically speaking a python module, ```` will be required as well.
You should wrap your module in ``PIP`` package and distribute via ``PyPi``. By doing so, a user who want to install your app has to install it via `PIP` and add it to ``installed_apps`` list.

More info and help

More information can be found in `web based presentation <>`_. You can always email the author:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for chembl_beaker, version 1.2.21
Filename, size File type Python version Upload date Hashes
Filename, size chembl-beaker-1.2.21.tar.gz (271.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page