GithubHelp home page GithubHelp logo

ieee820 / graphdta Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thinng/graphdta

1.0 0.0 0.0 68.88 MB

GraphDTA: Predicting drug-target binding affinity with graph neural networks

Home Page: https://doi.org/10.1101/684662

Python 100.00%

graphdta's Introduction

Resources:

  • README.md: this file.
  • data/davis/folds/test_fold_setting1.txt,train_fold_setting1.txt; data/davis/Y,ligands_can.txt,proteins.txt data/kiba/folds/test_fold_setting1.txt,train_fold_setting1.txt; data/kiba/Y,ligands_can.txt,proteins.txt These file were downloaded from https://github.com/hkmztrk/DeepDTA/tree/master/data
  • pretrained: models trained by the proposed framework

Source codes:

  • create_data.py: create data in pytorch format
  • utils.py: include TestbedDataset used by create_data.py to create data, and performance measures.
  • predict_with_pretrained_model.py: run this to predict affinity for testing data using models already trained stored at folder pretrained/
  • training.py: train a GraphDTA model.
  • models/ginconv.py, gat.py, gat_gcn.py, and gcn.py: proposed models GINConvNet, GATNet, GAT_GCN, and GCNNet receiving graphs as input for drugs.

Step-by-step running:

0. Install Python libaries needed

  • Install pytorch_geometric following instruction at https://github.com/rusty1s/pytorch_geometric
  • Install rdkit: conda install -y -c conda-forge rdkit
  • Or run the following commands to install both pytorch_geometric and rdkit:
conda create -n geometric python=3
conda activate geometric
conda install -y -c conda-forge rdkit
conda install pytorch torchvision cudatoolkit -c pytorch
pip install torch-scatter==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-sparse==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-cluster==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-spline-conv==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.4.0.html
pip install torch-geometric

1. Create data in pytorch format

Running

conda activate geometric
python create_data.py

This returns kiba_train.csv, kiba_test.csv, davis_train.csv, and davis_test.csv, saved in data/ folder. These files are in turn input to create data in pytorch format, stored at data/processed/, consisting of kiba_train.pt, kiba_test.pt, davis_train.pt, and davis_test.pt.

2. Predict affinity with pretrained models

To predict affinity for testing data using models already trained stored at folder pretrained/. Running

conda activate geometric
python predict_with_pretrained_model.py

This returns result.csv, containing the performance of the proposed models on the two datasets. The measures include rmse, mse, pearson, spearman, and ci. The models include GINConvNet, GATNet, GAT_GCN, and GCNNet.

3. Train a prediction model

To train a model using training data. The model is chosen if it gains the best MSE for testing data.
Running

conda activate geometric
python training.py 0 0 0

where the first argument is for the index of the datasets, 0/1 for 'davis' or 'kiba', respectively; the second argument is for the index of the models, 0/1/2/3 for GINConvNet, GATNet, GAT_GCN, or GCNNet, respectively; and the third argument is for the index of the cuda, 0/1 for 'cuda:0' or 'cuda:1', respectively. Note that your actual CUDA name may vary from these, so please change the following code accordingly:

cuda_name = "cuda:0"
if len(sys.argv)>3:
    cuda_name = "cuda:" + str(int(sys.argv[3])) 

This returns the model and result files for the modelling achieving the best MSE for testing data throughout the training. For example, it returns two files model_GATNet_davis.model and result_GATNet_davis.csv when running GATNet on Davis data.

4. Train a prediction model with validation

In "3. Train a prediction model", a model is trained on training data and chosen when it gains the best MSE for testing data. This follows how a model was chosen in https://github.com/hkmztrk/DeepDTA. The result by two ways of training is comparable though.

In this section, a model is trained on 80% of training data and chosen if it gains the best MSE for validation data, which is 20% of training data. Then the model is used to predict affinity for testing data.

Same arguments as in "3. Train a prediction model" are used. E.g., running

python training_validation.py 0 0 0

This returns the model achieving the best MSE for validation data throughout the training and performance results of the model on testing data. For example, it returns two files model_GATNet_davis.model and result_GATNet_davis.csv when running GATNet on Davis data.

graphdta's People

Contributors

thinng avatar

Stargazers

 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.