Skip to content
No description, website, or topics provided.
Python HTML CSS JavaScript Other
Branch: master
Clone or download
connorcoley Merge pull request #4 from mefortunato/feature/allow-avoid-ban-tree-b…

Feature/allow avoid ban tree builder
Latest commit 8c2b9d4 Aug 13, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
askcos allow authorized users to avoid chemical ban list for tree builder Aug 13, 2019
makeit Update banned_list.json Jun 26, 2019
rdchiral 'Initial' commit Jun 3, 2019
.dockerignore 'Initial' commit Jun 3, 2019
.gitattributes 'Initial' commit Jun 3, 2019
.gitignore 'Initial' commit Jun 3, 2019
LICENSE Update Jun 3, 2019
requirements.txt 'Initial' commit Jun 3, 2019


Software package for the prediction of feasible synthetic routes towards a desired compound and associated tasks related to synthesis planning. Originally developed under the DARPA Make-It program and now being developed under the MLPDS Consortium. The tools are deployed as a Django webapp. A version similar but not identical to this code is currently hosted at

Please note that the MPL 2.0 license for this repository does not apply to the data and trained models. The data and trained models are released under CC BY-NC-SA (i.e., are for noncommercial use only).

Contributors include Connor Coley, Mike Fortunato, Hanyu Gao, and Pieter Plehiers.

Quick start using Google Cloud

# (1) Create a Google Cloud instance 
#     - 8 vCPUs, 52 GB memory is the maximum for their free trial
#     - select Ubuntu 18.04 LTS Minimal
#     - upgrade to a 100 GB disk
#     - allow HTTP traffic

# (2) Install docker
#     -
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common -y
curl -fsSL | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli -y
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

# (3) Install docker-compose
#     -
sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

# (4) Install git lfs
#     -
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:git-core/ppa -y
curl -s | sudo bash
sudo apt-get install git-lfs -y
git lfs install

# (5) Pull
git clone ASKCOS
git lfs pull 

# (6) Build & run
cd deploy
docker build -t askcos .. # build
docker-compose up -d      # start containers (detached)
docker-compose logs -f    # start tailing logs (can CTRL+C to exit)

# (7) Navigate to your instance's external IP 
#     - note that it may take ~5 minutes for the retro transformer workers to start up
#     - you can check the status of their startup by looking at "server status"
#     - the first request to a website process may take ~10 seconds
#     - the first request to a retro transform worker may take ~5-10 seconds
#     - the first request to the forward predictor may take ~60 seconds

Installation with Docker


Building the ASKCOS Image

The askcos image itself can be built using the Dockerfile in this repository ASKCOS/Dockerfile.

$ git clone  
$ cd ASKCOS/makeit/data  
$ git lfs pull  
$ cd ../../  
$ docker build -t askcos .

Deploy with docker-compose

The Make-It/deploy/docker-compose.yml file contains the configuration to deploy the askcos stack with docker-compose. This requires that the askcos image is built (see previous step), and a few environment variables are set in the .env file. The default ENV values will work, but it is better to set CURRENT_HOST to the IP address of the machine you are deploying on, and to set the MongoDB credentials if you have access.

$ cd deploy  
$ docker-compose up -d

The services will start in a detached state. You can view logs with docker-compose logs [-f].

To stop the containers use docker-compose stop. To restart the containers use docker-compose start. To completely delete the containers and volumes use docker-compose down -v (this deletes user database and saves; read section about backing up data first).

Managing Django

If you'd like to manage the Django app (i.e. - run python ...), for example, to create an admin superuser, you can run commands in the running app service (do this after docker-compose up) as follows:

docker-compose exec app bash -c "python /usr/local/ASKCOS/askcos/ createsuperuser"

In this case you'll be presented an interactive prompt to create a superuser with your desired credentials.

Important Notes

Recommended hardward

We recommend running this code on a machine with at least 8 compute cores (16 preferred) and 64 GB RAM (128 GB preferred)

First startup

The celery worker will take a few minutes to start up (possibly up to 5 minutes; it reads a lot of data into memory from disk). The web app itself will be ready before this, however upon the first get request (only the first for each process) a few files will be read from disk, so expect a 10-15 second delay.

Scaling workers

Only 1 worker per queue is deployed by default with limited concurrency. This is not ideal for many-user demand. You can easily scale the number of celery workers you'd like to use with docker-compose up -d --scale tb_c_worker=N where N is the number of workers you want, for example. The above note applies to each worker you start, however, and each worker will consume RAM.


The code has primarily been developed for Python 2.7.6 on Ubuntu 16.04. However, we have made an effort to make it work on Python 3.6.1 as well (tested on macOS 10.13.3). It heavily relies on RDKit.

How to run individual modules

Many of the individual modules -- at least the ones that are the most interesting -- can be run "standalone". Examples of how to use them are often found in the if __name__ == '__main__' statement at the bottom of the script definitions. For example...

Using the learned synthetic complexity metric (SCScore)


Obtaining a single-step retrosynthetic suggestion with consideration of chirality


Finding recommended reaction conditions based on a trained neural network model


Using the template-free forward predictor


Using the coarse "fast filter" (binary classifier) for evaluating reaction plausibility


Using the tree builder to find full pathways


Integrated CASP tool

For the integrated synthesis planning tool at makeit/application/, there are several options available. The currently enabled options for the command-line tool can be found at makeit/utilities/io/ There are some options that are only available for the website and some that are only available for the command-line version. As an example of the former, the consideration of popular but non-buyable chemicals as suitable "leaf nodes" in the search. It is highly recommended to use the web interface when possible.

You can’t perform that action at this time.