Giter Club home page Giter Club logo

scrop's Introduction

Self-Corrected Retrosynthetic Reaction Predictor

This is the code for the "Predicting Retrosynthetic Reaction using Self-Corrected Transformer Neural Networks" paper found on Journal of Chemical Information and Modeling

To implement our models we were based on OpenNMT-py (v0.4.1).

Install requirements

Create a new conda environment:

conda create -n SCRP_transformer python=3.5
source activate SCRP_transformer
conda install rdkit -c rdkit
conda install future six tqdm pandas

The code was tested for pytorch 0.4.1, to install it go on Pytorch. Select the right operating system and CUDA version and run the command, e.g.:

conda install pytorch=0.4.1 torchvision -c pytorch

Then,

pip install torchtext==0.3.1
pip install -e . 

Pre-processing

In the experiments we use an open-source datasets (and train/valid/test splits).

The tokenized datasets can be found on the data/ folder.

For Input file generation, we the preprocess.sh script:

We use a shared vocabulary. The vocab_size and seq_length are chosen to include the whole datasets.

Training

The data has already been preprocessed for training the Self-Corrected Retrosynthetic Reaction Predictor

Model training can be started by running the training.sh script

To achieve the best results with single models, we average the last 10 checkpoints.

Testing

To generate the predictions use the translate.py script:

greedy search

Model testing of greedy search can be started by running the testing_greedy_search.sh script

beam search

Model testing of greedy search can be started by running the testing_beam_search.sh script

Evaluate predictions

Run the the score_predictions.sh script to get the top-10 accuracy.

Molecular syntax corrector

  1. use a fully trained model to generate the top ten candidate precursors given a set of target compounds in the training set and validation set.
  2. construct a training library that consists of a set of input-output pairs, where the inputs are predicted invalid reactants, and the outputs are the ground truth reactants.
  3. get the top-1 candidate produced by the syntax corrector and replace the original invalid smiles.
  • run the the self_corrected.sh script to get the top-10 accuracy of the syntax corrector.

Citation

If you find this work useful in your research, please consider citing the paper: "Predicting Retrosynthetic Reaction using Self-Corrected Transformer Neural Networks".

scrop's People

Contributors

jh-sysu 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.