Giter Club home page Giter Club logo

autosynroute's Introduction

AutoSynRoute

Code for "Automatic Retrosynthetic Route Planning Using Template-Free Models" paper in Chemical Science

url: https://pubs.rsc.org/en/Content/ArticleLanding/2020/SC/C9SC03666K#!divAbstract

Requirements

  • python 3.6
  • tensorflow 1.12.0
  • tensor2tensor 1.12

Model training

The data has already been preprocessed for training.

cd directory model/model_USPTO_50K

  1. Creating generator.
bash data_gen.sh t2t_data_class_char/ my_reaction_token dataset_50k_class_char/
  1. Starting Traning.
bash data_trainer.sh t2t_data_class_char/ my_reaction_token 500000
  1. Averaging checkpoints
t2t-avg-all --model_dir=t2t_data_class_char/train --output_dir=final_model/output_avg35000_class_char-n10-cp --n=10

Model inference

The weights of trained model are available on:

model_USPTO_50K: url: https://pan.baidu.com/s/1XJg5Dh9zHnoXg1m_R6sJrA&shfl=shareset code: 28ng

model_USPTO_MIT: url: https://pan.baidu.com/s/1CabKTpU-jtdHKJfGTbdBrQ&shfl=shareset code: aiym

Copy the files into model/model_USPTO_50K/final_model and model/model_USPTO_MIT/final_model_class_char, respectively.

cd directory model/model_USPTO_50K

data_decoder_avg-beam-10.sh will perform inference with beam search, which will output a text file in model_USPTO_50K/t2t_data_class_char/train

bash data_decoder_avg-beam-10.sh t2t_data_class_char/ my_reaction_token dataset_50k_class_char/ test_sources output_avg35000-top10_cp2.txt 80 final_model/output_avg35000_class_char-n10-cp/model.ckpt-35000

Model evaluation

cd directory scripts

The two python scripts "evaluation.py evaluation_class.py" will evaluate the total accuracy and accuracy by class, respectively.

python evaluation.py -o ../data/USPTO/output_avg35000-top10_cp2.txt -t ../data/USPTO/test_targets_50K -c 12 -n 10 -d USPTO_50K

The result file can be found in results folder

python evaluation_class.py -o ../data/USPTO/output_avg35000-top10_cp2.txt -t ../data/USPTO/test_targets_50K -c 12 -n 10 -d USPTO_50K

The result file can be found in class_results folder

Demo evaluation

cd directory scripts

The demo_evaluation.py will evaluate the four demo cases mentioned in our paper.

python demo_evaluation.py -o ../data/demo/output_avg35000-top10_cp2_demo1_rufinamide.txt -t ../data/demo/demo1_rufinamide_cano_char_targets.txt -d 1

The result file can be found in demo_results folder

Route Analysis

cd directory route_analysis

  1. Preparing tensor2tensor serving.

    Please refer to this url "https://github.com/tensorflow/tensor2tensor/tree/master/tensor2tensor/serving".

  2. Run MCTS

python mcts_retrosyn_fast.py --input_dir demo_a

The predicted pathways can be found in demo_a/route_output folder

autosynroute's People

Contributors

pkumdl-ai avatar clinuxmdl avatar lkjoutlook 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.