GithubHelp home page GithubHelp logo

chenxingqiang / molecule-chef Goto Github PK

View Code? Open in Web Editor NEW

This project forked from john-bradshaw/molecule-chef

0.0 1.0 0.0 52.77 MB

Code for our paper "A Model to Search for Synthesizable Molecules" (https://arxiv.org/abs/1906.05221)

License: GNU General Public License v3.0

Python 97.50% Makefile 2.25% Shell 0.25%

molecule-chef's Introduction

A Model to Search for Synthesizable Molecules

Core code for the paper "A Model to Search for Synthesizable Molecules" (https://arxiv.org/abs/1906.05221) by John Bradshaw, Brooks Paige, Matt J. Kusner, Marwin H. S. Segler, José Miguel Hernández-Lobato. Updated to now run on PyTorch 1.2.

Installation

  1. Install the requirements (listed in requirements.txt). We're using Python 3.6.
  2. Get the submodules, i.e. git submodule init then git submodule update
  3. Unzip the data folder: data.zip -- this zip folder of processed USPTO data comes from https://github.com/wengong-jin/nips17-rexgen ^*^
  4. Add the correct modules to the PYTHONPATH, e.g. this can be done by source set_up.sh

PyTorch
We have updated the code such that it is using version 1.2 (or 1.3).

RDKit
We recommend installing rdkit through Anaconda, see e.g. https://anaconda.org/rdkit/rdkit:
conda install -c rdkit rdkit

pytest Is used for running tests.

rdfilters The quality filters are computed using the rd_filters library. This can be found here, and can be installed using: pip install git+https://github.com/PatWalters/rd_filters.git.

^*^ The code for the paper: Jin, W., Coley, C., Barzilay, R. and Jaakkola, T., 2017. Predicting organic reaction outcomes with Weisfeiler-Lehman network. In Advances in Neural Information Processing Systems (pp. 2607-2616).

Dockerfile

We have also provided a dockerfile. This can be used to build a Docker image using eg docker build . -t molecule-chef if you have the Molecular Transformer weights downloaded into this folder. It can then be run by docker run -it molecule-chef. An uploaded Docker image lives on Docker Hub here.

Molecular Transformer

As mentioned in our paper we use the Molecular Transformer^†^ for reaction prediction. For this task we use the authors' official implementation for running this model. The weights that we use can be found on Google Drive here.

shasum -a 256 molecular_transformer_weights.pt
## returns 93199b61da0a0f864e1d37a8a80a44f0ca9455645e291692e89d5405e786b450  molecular_transformer_weights.pt

^†^ Schwaller, P., Laino, T., Gaudin, T., Bolgar, P., Hunter, C.A., Bekas, C. and Lee, A.A., 2019. Molecular Transformer: A Model for Uncertainty-Calibrated Chemical Reaction Prediction. ACS Central Science.

Running the Code

Model Code

As shown below, Molecule Chef consists of an encoder and a decoder. The decoder samples a reactant bag, which can be be fed into a reaction predictor (as discussed above we use the Molecular Transformer) to generate output molecules. The code for the encoder and the decoder can be found in molecule_chef/model.

Image of Molecule Chef

Scripts

The various scripts in the scripts folder train the model and run experiments:

  • scripts/prepare_data/prepare_datasets.py: prepares the unzipped USPTO data and extracts reactant bags for training.
  • scripts/train/train_molecule_chef_qed.py: is used for training Molecule Chef with the property predictor regressing from latent space to QED score.
  • scripts/evaluate: this folder contains scripts to evaluate the learnt model. See the respective readmes on generation, local optimization and retrosynthesis for further details.

molecule-chef's People

Contributors

john-bradshaw avatar

Watchers

paper2code - bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.