Developing webapps with RDKit

During my whole (but still short) career as a software scientist, I always have worked with proprietary tools when it came down to cheminformatics, especially BIOVIA ones. And although they are good (and even excellent for some of them), I always wondered if free, open source software could do the same, or better, or different.

At the same time, I have been hearing more and more about RDKit, and python, and Django - so I decided to get my hands dirty and look at the potential of these technologies for myself.

The first step has been to put in place a development environment, linking all the different blocks together. We created it with a friend of mine over a weekend, inspired by existing work, and the result can be found in this repository.

The idea is to have a container for the database (PostgreSQL), including the RDKit cartridge and another one for Django, including the django-rdkit application. Both containers are based on the miniconda3 docker image for easiness of configuration of the different parts - it’s a development environment, right? But this comes with a downside: it doesn’t run out of the box on ARM - at least, I couldn’t make it work on my RPI2.

To have this development environment running, you need docker and docker-compose installed obviously. You can set the password of the database in the docker-postgres-rdkit/dbpassword file. All data of the database is stored in a volume called pgdata, to allow for turning the containers on and off. Code of the Djando application needs to be put in the docker-django-rdkit/code folder - this folder is mounted in the Django container, meaning that all changes made by Django will be available for you to version.

docker-compose up, and voilà !

The Django application can be accessed at http://localhost:8000/. To have terminal access to the Django server, run docker exec -it django /bin/bash.

The database IP address can be found by running docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db. The port is 5432, the user to connect is postgres and the password is the one set in the docker-postgres-rdkit/dbpassword file.

With this, we should be able to start working on a real application now!