Skip to main content

myChEMBL + docker










In addition to the myChEMBL 20 VM images released earlier, today we are very happy to release myChEMBL Docker images.

What's docker?

 

Docker is a new open-source project that automates the deployment of distributed applications. It takes advantage of some new cool features of modern Linux kernel in order to run virtual containers, avoiding the overhead of starting and maintaining virtual machines [from Wikipedia].

In contrast to virtual machines, which emulate virtual hardware, docker containers employ the kernel of the host machine so they don't require or include the whole operating system. While still separated from the host, they only add a very thin level of abstraction [ZDNet article].

Why docker?

 

Docker is an emerging technology; it has become extremely popular over the last year and been adopted and used by the largest IT companies, such as RedHat, Canonical and Microsoft. Basically, using this platform you can do three things:
  1. Build
  2. Ship
  3. Run
an arbitrary complex piece of software in a very convenient way.

But why docker and myChEMBL?

 

For myChEMBL in particular, using docker means three things:

  1. Less data to download so less time to wait. VM-based Ubuntu and Centos images available from our FTP have 8.5 and 6.5 GB of size respectively (after compression). Compressed myChEMBL docker containers are both about 5.7 GB.
  2. No waiting to boot up. Normally, when you attach a disk image containing myChEMBL to your virtual machine or use vagrant to do it for you, you still have to wait a few minutes for the machine to start. With docker containers there is no booting so everything runs immediately.
  3. This is a future plan - layers. The whole concept of docker images is based on the fact, that they are build on top of other containers. Since this is our first release of myChEMBL which supports docker, we put everything into a single layer that is build on top of Ubuntu or CentOS, depending on the flavour you choose. However, in future we plan to divide our software into several layers so you can mix and match layers, for example download an image containing database without webservices or webservices layer but no interface and so on.

How do I install docker?

 

This is the tricky part. The easiest way is to have a clean 64-bit Linux machine (yes, a physical machine) with modern Linux kernel, such as Ubuntu (versions 14.04, 12.04 and 13.10 are officially supported). Many other Linux distributions can work as well, but the most important thing is that the minimal version of the Linux kernel is 3.10 and it has to be a 64-bit machine. In Ubuntu case, all you have to do is to run:

wget -qO- https://get.docker.com/ | sh
 
Installation on OS X is much more complicated. This is because the standard OS X installation downloads and configures VirtualBox and runs a very lightweight 64-bit Linux with docker installed. Now the problem is, that it won't work in case of myChEMBL. This is because this Virtual Machine has only 20GB of available disk space and our myChEMBL container is 23GB after decompressing. So in order to use it, you first have to resize the volume, which is explained here: https://docs.docker.com/articles/b2d_volume_resize/. The same instructions apply to Windows.

How to get myChEMBL running on docker?

 

The steps are very simple:
  1. Download the image from the FTP.
  2. Uncompress
  3. Load image into docker
  4. Run it
You may wonder why you have to download the image from ChEMBL FTP website when docker is providing Docker Hub - a place where you can upload and share docker images? Well, this is due to a bug in docker, which prevents some images from pushing. This may be related to the big size of ChEMBL container but there is no easy way to reduce it given that the ChEMBL database itself has a size of 8GB.

So instead of pulling from the Docker Hub we retrieve the images from ChEMBL FTP. This is how it should look like:


  1. Download:
    wget http://ftp.ebi.ac.uk/pub/databases/chembl/VM/Docker/mychembl_20_ubuntu_docker.tar.gz
    or:
    wget http://ftp.ebi.ac.uk/pub/databases/chembl/VM/Docker/mychembl_20_centos_docker.tar.gz
  2. Uncompress:
    gunzip mychembl_20_ubuntu_docker.tar.gz
    or:
    gunzip mychembl_20_centos_docker.tar.gz
  3. Load:
    docker load < mychembl_20_ubuntu_docker.tar
    or:

    docker load < mychembl_20_centos_docker.tar
  4. Run:
    docker run -p 2222:22 -p 80:80 -p 9612:9612 -t -i chembl/mychembl_20_ubuntu /usr/local/bin/supervisord
    or:
    docker run -p 2222:22 -p 80:80 -p 9612:9612 -t -i chembl/mychembl_20_centos /usr/bin/supervisord


After successful completion of the steps above, you can open you browser and go to http://127.0.0.1/ if you are running docker locally or http://some_other_host/ if you are running docker on some other host. You should then be able to see myChEMBL launchpad page.

As you can see we expose three ports: 80 for myChEMBL launchad web page, 9612 for IPython notebook server and 22 (which is mapped to 2222 in our example) for ssh. This means that you can easily ssh into the container by executing:

ssh chembl@some_other_host -p 2222

The password is always chemblvm. As you see we've decided to remap the standard ssh 22 port into 22 because it can happen, that your machine is running sshd as well in which case there could be a clash. The same applies to ipython notebook, we've chosen 9612 port avoid clash if you are running Ipyhton on your machine already. The only exception here is port 80, which we kept as it is, so if you have some other server running on this port you have to remap as well, for example:

 docker run -p 2222:22 -p 8080:80 -p 9612:9612 -t -i chembl/mychembl_20_ubuntu /usr/local/bin/supervisord

If you would like to expose postgres as well, then enabling standard postgres 5432 port is required: 

docker run -p 5432:5432 -p 2222:22 -p 80:80 -p 9612:9612 -t -i chembl/mychembl_20_ubuntu /usr/local/bin/supervisord 

Future work

 

Working on docker support for myCHEMBL was great fun and an important lesson of DevOps. There are a number of things we would like to improve in future in myChEMBL itself and the docker related parts to make it even better:

  1. Use supervisor as a default process manager for myChEMBL.
    Docker is designed to run one (typically foreground) process per container. Moreover, Docker ignores initialization of OS-specific daemons such as upstart, systemd etc. This is where supervisor comes handy and it can be used as a default process manager instead of any OS-specific mechanisms even if docker is not used. Same as `pip` tool is better for installing python packages, instead of using 'apt-get' or 'yum', in the similar way using supervisor for managing python web applications is better than systemd or upstart.
  2. Provide a Dockerfile.
    Dockerfile is like a recipe, describing all steps, dependencies and settings necessary to repetitively build and use docker image. Having a dockerfile (or a set of dockerfiles) for myChEMBL would make a process of preparing a container more transparent and robust. We already have a script called bootstrap.sh used to build our VM images but because of subtle differences between docker containers and VMs (look point 1) it can't just be used as is.
  3. Implement layers.
    As mentioned above, having defined some logical components of myChEMBL and distributing them into separate layers would encourage combining different aspects of the system, leading to less time spent on downloading and installing the whole thing.


Comments

Unknown said…
I noted in your "future work" you're considering using supervisord as a process manager. We were using it for a long time, and you might want to take a look at a process manager designed specifically for Docker: Chaperone Documentation.

Disclaimer: We built this ourselves and open-sourced it, but it really has solved boaloads of problems for us and a few of our clients. Always very very interested in feedback.

Popular posts from this blog

Here's a nice Christmas gift - ChEMBL 35 is out!

Use your well-deserved Christmas holidays to spend time with your loved ones and explore the new release of ChEMBL 35!            This fresh release comes with a wealth of new data sets and some new data sources as well. Examples include a total of 14 datasets deposited by by the ASAP ( AI-driven Structure-enabled Antiviral Platform) project, a new NTD data se t by Aberystwyth University on anti-schistosome activity, nine new chemical probe data sets, and seven new data sets for the Chemogenomic library of the EUbOPEN project. We also inlcuded a few new fields that do impr ove the provenance and FAIRness of the data we host in ChEMBL:  1) A CONTACT field has been added to the DOCs table which should contain a contact profile of someone willing to be contacted about details of the dataset (ideally an ORCID ID; up to 3 contacts can be provided). 2) In an effort to provide more detailed information about the source of a deposited dat...

Improvements in SureChEMBL's chemistry search and adoption of RDKit

    Dear SureChEMBL users, If you frequently rely on our "chemistry search" feature, today brings great news! We’ve recently implemented a major update that makes your search experience faster than ever. What's New? Last week, we upgraded our structure search engine by aligning it with the core code base used in ChEMBL . This update allows SureChEMBL to leverage our FPSim2 Python package , returning results in approximately one second. The similarity search relies on 256-bit RDKit -calculated ECFP4 fingerprints, and a single instance requires approximately 1 GB of RAM to run. SureChEMBL’s FPSim2 file is not currently available for download, but we are considering generating it periodicaly and have created it once for you to try in Google Colab ! For substructure searches, we now also use an RDKit -based solution via SubstructLibrary , which returns results several times faster than our previous implementation. Additionally, structure search results are now sorted by...

ChEMBL 34 is out!

We are delighted to announce the release of ChEMBL 34, which includes a full update to drug and clinical candidate drug data. This version of the database, prepared on 28/03/2024 contains:         2,431,025 compounds (of which 2,409,270 have mol files)         3,106,257 compound records (non-unique compounds)         20,772,701 activities         1,644,390 assays         15,598 targets         89,892 documents Data can be downloaded from the ChEMBL FTP site:  https://ftp.ebi.ac.uk/pub/databases/chembl/ChEMBLdb/releases/chembl_34/ Please see ChEMBL_34 release notes for full details of all changes in this release:  https://ftp.ebi.ac.uk/pub/databases/chembl/ChEMBLdb/releases/chembl_34/chembl_34_release_notes.txt New Data Sources European Medicines Agency (src_id = 66): European Medicines Agency's data correspond to EMA drugs prior to 20 January 2023 (excluding ...

Improved querying for SureChEMBL

    Dear SureChEMBL users, Earlier this year we ran a survey to identify what you, the users, would like to see next in SureChEMBL. Thank you for offering your feedback! This gave us the opportunity to have some interesting discussions both internally and externally. While we can't publicly reveal precisely our plans for the coming months (everything will be delivered at the right time), we can at least say that improving the compound structure extraction quality is a priority. Unfortunately, the change won't happen overnight as reprocessing 167 millions patents takes a while. However, the good news is that the new generation of optical chemical structure recognition shows good performance, even for patent images! We hope we can share our results with you soon. So in the meantime, what are we doing? You may have noticed a few changes on the SureChEMBL main page. No more "Beta" flag since we consider the system to be stable enough (it does not mean that you will never ...

ChEMBL brings drug bioactivity data to the Protein Data Bank in Europe

In the quest to develop new drugs, understanding the 3D structure of molecules is crucial. Resources like the Protein Data Bank in Europe (PDBe) and the Cambridge Structural Database (CSD) provide these 3D blueprints for many biological molecules. However, researchers also need to know how these molecules interact with their biological target – their bioactivity. ChEMBL is a treasure trove of bioactivity data for countless drug-like molecules. It tells us how strongly a molecule binds to a target, how it affects a biological process, and even how it might be metabolized. But here's the catch: while ChEMBL provides extensive information on a molecule's activity and cross references to other data sources, it doesn't always tell us if a 3D structure is available for a specific drug-target complex. This can be a roadblock for researchers who need that structural information to design effective drugs. Therefore, connecting ChEMBL data with resources like PDBe and CSD is essen...