Skip to content

LanqingLi1993/ImDrug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

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.

About

Source code for ImDrug Benchmark

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published