Giter Club home page Giter Club logo

imdrug's Introduction

Installation

Using conda

conda env create -f environment.yml
conda activate ImDrug
pip install git+https://github.com/bp-kelley/descriptastorus

Configuration

A task can be completely specified with an individual JSON file shown below. It updates the default configuration in /lib/config/default.py. Sample JSON files for producing the results in the paper can be found in /configs/.

{
    "dataset": {
        "drug_encoding": "DGL_GCN", 
        "protein_encoding": "Transformer", 
        "tier1_task": "multi_pred", 
        "tier2_task": "DTI", 
        "dataset_name": "SBAP",
        "split":{
            "method": "random",
            "by_class": true
        }
    },
    "baseline": "Remix_cls",
    "test": {
        "exp_id": "sbap_DGL_GCN_CrossEntropy_0_MLP_2022-06-09-00-10-53-662280"
    },
    "setting": {
        "type": "LT Classification", 
    },
    "use_gpu": true,
    "save_step": 5,
    "show_step": 5,
    "valid_step": 1
}

Data Processing

The 'dataset' entry in the JSON file specifies the dataset to be used, as well as the correponding data processing method with specifications such as featurization and data split. The configuration can be choosen as follows:

  • 'drug_encoding' determines how the drugs/small-molecule compounds (if any) in the dataset will be featurized.
    'drug_encoding': ["Morgan", "Pubchem’, "Daylight", "rdkit_2d_normalized", "ESPF", "CNN", "CNN_RNN", "Transformer", "MPNN", "ErG", "DGL_GCN", "DGL_NeuralFP", "DGL_AttentiveFP" "DGL_GIN_AttrMasking", "DGL_GIN_ContextPred"]

  • 'protein_encoding' determines how the proteins/large-molecules (if any) in the dataset will be featurized.
    'protein_encoding': ["AAC", "PseudoAAC", "Conjoint_triad", "Quasi-seq", "ESPF", "CNN", "CNN_RNN", "Transformer"]

  • 'tier1_task' specifies the type of prediction problems.
    'tier1_task': ["single_pred", "multi_pred"], both are applicable for hybrid prediction.

  • 'tier2_task' specifies the type of dataset and the prediction label.
    'tier2_task': ["ADME", "TOX", "QM", "BioAct", "Yields", "DTI", "DDI", "Catalyst", "ReactType"]

  • 'dataset_name' specifies the dataset name.
    'dataset_name': ["BBB_Martins", "Tox21", "HIV", "QM9", "USPTO-50K", "USPTO-Catalyst", "USPTO-1K-TPL", "USPTO-500-MT", "USPTO-Yields", "SBAP", "DrugBank"]

    • WARNING: Note that we keep the original format of "USPTO-500-MT" from Lu et al., for which we have confirmed with the authors that class 334 is missing. To use the dataset properly, one would need to make the class labels consecutive.
    • WARNING: note that in principle, the yield of "USPTO-Yields" ranges from 0-1. However, the original copy of "USPTO-Yields" from TDC contains samples with negative yields or yields above 1, which we exclude in the current version.
  • 'split.method' specifies the way to split the data, some of which rely on specific domain annotations such as scaffold and time splits.
    'split.method': ["standard", "random", "scaffold", "time", "combination", "group", "open-random", "open-scaffold", "open-time", "open-combination", "open-group"], methods starting with "open-" are reserved for Open LT setting only.

Imbalanced Learning Algorithms

The configuration of algorithms for imbalanced learning can be choosen as follows:

  • For LT Classification and Imbalanced Classification:
    'baseline': ["Default_cls", "BalancedSoftmax", "ClassBalanced", "CostSensitive", "InfluenceBalanced", "Mixup_cls", "Remix", "BBN_cls", "CDT", "Decoupling", "DiVE"]
  • For Imbalanced Regression:
    'baseline': ["Default_reg", "Mixup_reg", "Remix_reg", "BBN_reg", "Focal-R", "FDS", "LDS"]
  • For Open LT:
    'baseline': ["Default_cls", "BalancedSoftmax", "ClassBalanced", "InfluenceBalanced", "Remix", "BBN_cls", "OLTR", "IEM"]
    Note that the suffix "cls" and "reg" indicate that the algorithm can be applied for both classification and regression tasks, respectively.

Running Examples

LT Classifcation on single_pred.HIV (num_class = 2):

Baseline (CrossEntropy)

python3 script/train.py --config ./configs/single_pred/LT_Classification/baseline/HIV.json
python3 script/test.py --config ./configs/single_pred/LT_Classification/baseline/HIV.json

Remix

python3 script/train.py --config ./configs/single_pred/LT_Classification/information_augmentation/Remix/HIV.json
python3 script/test.py --config ./configs/single_pred/LT_Classification/information_augmentation/Remix/HIV.json

LT Classifcation on multi_pred.SBAP (num_class = 2):

Baseline (CrossEntropy)

python3 script/train.py --config ./configs/single_pred/LT_Classification/baseline/SBAP.json
python3 script/test.py --config ./configs/single_pred/LT_Classification/baseline/SBAP.json

BBN

python3 script/train.py --config ./configs/single_pred/LT_Classification/module_improvement/BBN/SBAP.json
python3 script/test.py --config ./configs/single_pred/LT_Classification/module_improvement/BBN/SBAP.json

LT Classification on single_pred.UPSTO-50k (num_class = 10):

Baseline (CrossEntropy)

python3 script/train.py --config ./configs/single_pred/LT_Classification/baseline/USPTO-50k.json
python3 script/test.py --config ./configs/single_pred/LT_Classification/baseline/USPTO-50k.json

BalancedSoftmaxCE

python3 script/train.py --config ./configs/single_pred/LT_Classification/class-re-balancing/BalancedSoftmaxCE/USPTO-50k.json
python3 script/test.py --config ./configs/single_pred/LT_Classification/class-re-balancing/BalancedSoftmaxCE/USPTO-50k.json

LT Classification on multi_pred.UPSTO-50k (num_class = 10):

Baseline (CrossEntropy)

python3 script/train.py --config ./configs/multi_pred/LT_Classification/baseline/USPTO-50k.json
python3 script/test.py --config ./configs/multi_pred/LT_Classification/baseline/USPTO-50k.json

Decoupling

python3 script/train.py --config ./configs/multi_pred/LT_Classification/module_improvement/BalancedSoftmaxCE/USPTO-50k.json
python3 script/test.py --config ./configs/multi_pred/LT_Classification/module_improvement/BalancedSoftmaxCE/USPTO-50k.json

LT Regression on single_pred.QM9

Baseline (MSE)

python3 script/train.py --config ./configs/single_pred/LT_Regression/baseline/QM9.json
python3 script/test.py --config ./configs/single_pred/LT_Regression/baseline/QM9.json

LDS

python3 script/train.py --config ./configs/single_pred/LT_Regression/LDS/QM9.json
python3 script/test.py --config ./configs/single_pred/LT_Regression/LDS/QM9.json

LT Regression on multi_pred.SBAP

Baseline (MSE)

python3 script/train.py --config ./configs/multi_pred/LT_Regression/baseline/SBAP.json
python3 script/test.py --config ./configs/multi_pred/LT_Regression/baseline/SBAP.json

FDS

python3 script/train.py --config ./configs/multi_pred/LT_Regression/FDS/QM9.json
python3 script/test.py --config ./configs/multi_pred/LT_Regression/FDS/QM9.json

Open LT on multi_pred.Drugbank

Baseline (CrossEntropy)

python3 script/train.py --config ./configs/multi_pred/LT_Regression/baseline/Drugbank.json
python3 script/test.py --config ./configs/multi_pred/LT_Regression/baseline/Drugbank.json

OLTR

python3 script/train.py --config ./configs/multi_pred/LT_Regression/OLTR/Drugbank.json
python3 script/test.py --config ./configs/multi_pred/LT_Regression/OLTR/Drugbank.json

Training output

Each training process will generate a log (e.g., BBB_Martins_DGL_GCN_Transformer_MLP_2022-04-28-20-30.log) in ./output/${DATASET_NAME}/logs, and the models in ./output/${DATASET_NAME}/models/${EXP_ID}.

Testing output

Note that before testing, you need to specify the training experiment id in cfg['test']['exp_id']. Each testing process will generate a log and a .pdf image of confusion matrix (e.g., BBB_Martins_Transformer_Transformer_MLP_2022-05-09-11-55.pdf) in ./output/${DATASET_NAME}/test.

Benchmarks

LT Classification

Dataset

ImDrug is hosted on Google Cloud, each of the data can be accessed via https://storage.googleapis.com/imdrug_data/{$DATASET_NAME}.

Complete list of dataset_names:

  • bbb_martins.tab
  • hiv.tab
  • tox21.tab
  • qm9.csv
  • sbap.csv
  • drugbank.csv
  • uspto_1k_TPL.csv
  • uspto_500_MT.csv
  • uspto_50k.csv
  • uspto_catalyst.csv
  • uspto_yields.csv

Cite Us

Coming soon.

License

ImDrug codebase is under GPL-3.0 license. For individual dataset usage, the dataset license will come up soon.

Contact

Reach us at [email protected] or open a GitHub issue.

imdrug's People

Contributors

lanqingli1993 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.