Giter VIP home page Giter VIP logo

deepcoy's Introduction

DeepCoy - Generating Property-Matched Decoy Molecules Using Deep Learning

This repository contains our implementation of Generating Property-Matched Decoy Molecules Using Deep Learning (DeepCoy).

If you found DeepCoy useful, please cite our paper:

Imrie F, Bradley AR, Deane CM. Generating property-matched decoy molecules using deep learning. Bioinformatics. 2021

@article{Imrie2021DeepCoy,
    author = {Imrie, Fergus and Bradley, Anthony R and Deane, Charlotte M},
    title = "{Generating property-matched decoy molecules using deep learning}",
    journal = {Bioinformatics},
    year = {2021},
    month = {02},
    issn = {1367-4803},
    doi = {10.1093/bioinformatics/btab080},
    url = {https://doi.org/10.1093/bioinformatics/btab080},
    eprint = {https://academic.oup.com/bioinformatics/advance-article-pdf/doi/10.1093/bioinformatics/btab080/36297301/btab080.pdf},
}

Acknowledgements

We thank the authors of Constrained Graph Variational Autoencoders for Molecule Design for releasing their code. The code in this repository is based on their source code release (link). If you find this code useful, please consider citing their work.

Requirements

This code was tested in Python 3.6 with Tensorflow 1.10.

A yaml file containing all install requirements is provided. This can be readily setup using conda.

conda env create -f DeepCoy-env.yml
conda activate DeepCoy-env

To run our model using subgraph reweighted loss function, you need to download the subgraph frequency data from http://opig.stats.ox.ac.uk/resources. Note this is not required for generating molecules using pretrained models but is advised for training new models.

Data Extraction

We have prepared two training datasets based on different physicochemical properties. Both were created from a subset of the ZINC dataset.

To preprocess these datasets, please go to data directory and run prepare_data.py.

python prepare_data.py

Running DeepCoy

To train and generate molecules using DeepCoy, use:

python DeepCoy.py --dataset zinc --config '{"number_of_generation_per_valid": 100, "num_epochs": 10, "epoch_to_generate": 10, "train_file": "data/molecules_zinc_dekois_train.json", "valid_file": "data/molecules_zinc_dekois_valid.json", "subgraph_freq_file": "./freq_dict_zinc_250k_smarts.pkl"}'

To train and generate molecules using DeepCoy without the subgraph reweighted loss function, use:

python DeepCoy.py --dataset zinc --config '{"number_of_generation_per_valid": 100, "num_epochs": 10, "epoch_to_generate": 10, "train_file": "data/molecules_zinc_dekois_train.json", "valid_file": "data/molecules_zinc_dekois_valid.json", "use_subgraph_freq": false}'

To generate molecules with a pretrained model, use

python DeepCoy.py --restore models/DeepCoy_DUDE_model_e09.pickle --dataset zinc --config '{"generation": true, "number_of_generation_per_valid": 1000, "batch_size": 1, "train_file": "data/molecules_zinc_dekois_valid.json", "valid_file": "data/molecules_zinc_dekois_valid.json", "output_name": "output/DeepCoy_generated_decoys_zinc_dekois_valid.txt"}'

The output is of the following format:

Input molecule (SMILES) Generated molecule (SMILES)

More configurations can be found at function default_params in DeepCoy.py.

Evaluation

A script to evaluate the generated molecules and prepare a set of decoys is provided in evaluation directory. You can either specify a one file or a directory containing multiple files to process.

python select_and_evaluate_decoys.py --data_path PATH_TO_INPUT_FILE/DIRECTORY --output_path PATH_TO_OUTPUT --dataset_name dude --num_decoys_per_active 50 >> decoy_selection_log.txt

The input format should be of the following format:

Active molecule (SMILES) Possible decoy molecule (SMILES)

Pretrained Models and Generated Molecules

We provide two pretrained models based on different physicochemical properties (as described in our paper).

Due to GitHub file size constraints, these need to be downloaded from http://opig.stats.ox.ac.uk/resources:

models/DeepCoy_DUDE_model_e09.pickle
models/DeepCoy_DEKOIS_model_e10.pickle

Generated molecules can be obtained upon request.

Examples

An example Jupyter notbook demonstrating the use of DeepCoy to generate and select decoy molecule can be found in the examples directory.

Contact (Questions/Bugs/Requests)

Please submit a Github issue or contact Fergus Imrie [email protected].

deepcoy's People

Contributors

fimrie avatar sahikat 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.