Skip to content

mnowotka/chembl_beaker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chembl_beaker

Latest Version Downloads Supported Python versions Development Status License '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:

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");
marvin.sketcherInstance.setServices(getDefaultServices({
    '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

Additional dependencies

Installation

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+https://github.com/mnowotka/chembl_beaker.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 https://xquartz.macosforge.org/landing/, then:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
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
run_berker.py

Alternatively, you can use this article as an instllation guide.

Configuration

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 [
    "chembl_beaker.beaker", "chembl_beaker.beaker.core_apps.calculations", "chembl_beaker.beaker.core_apps.conversions", "chembl_beaker.beaker.core_apps.descriptors", "chembl_beaker.beaker.core_apps.fingerprints", "chembl_beaker.beaker.core_apps.marvin", "chembl_beaker.beaker.core_apps.mcs", "chembl_beaker.beaker.core_apps.osra", "chembl_beaker.beaker.core_apps.rasterImages", "chembl_beaker.beaker.core_apps.ringInfo", "chembl_beaker.beaker.core_apps.svgImages", "chembl_beaker.beaker.core_apps.jsonImages", "chembl_beaker.beaker.core_apps.autoDocs", ]

Running

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]"
config.load_config(conf_path)

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

loadApps(apps)
loadPlugins(app, plugins)

debug(True)

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.

Documentation

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.

docs screenshot

Development - writing your own extentions

Developing new app should be easy. The only required file is views.py where you should define your botte routes. Since your app is technically speaking a python module, __init__.py 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: mmmnow@gmail.com

About

RDKit and OSRA in the Bottle on Tornado

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 67.1%
  • JavaScript 24.9%
  • Shell 6.0%
  • CSS 1.5%
  • HTML 0.5%