This repository is the source code of our paper "HetDDI: a pre-trained heterogeneous graph neural network model for drug-drug interaction prediction".
This code is based on Pytorch and dgl-cuda. You need prepare your virtual enviroment early.
You can run the following command to run our work:
python main.py
There are several parameters can be customized:
- batch_size
- label_type, you can choose one of "multi_class", "binary_class" or "multi_label". 
 "multi_class" and "binary_class" is only available at ddi_name = "DrugBank".
 "multi_label" is only available at ddi_name = "TWOSIDES"
- condition, you can choose one of scenarios s1, s2, s3 defined in our paper, default is "s1"
- mode, you can choose one of variants "HetDDI-mol", "HetDDI-kg" or "HetDDI" by "only_mol", "only_kg", "concat". Default is "HetDDI" by "concat".
- ddi_name, the dataset you want to run, "DrugBank" or "TWOSIDES". Default is "DrugBank"
The dataset used in paper is available at /HetDDI/data/DRKG+DrugBank and /HetDDI/data/DRKG+TWOSIDES
If you want to use yourself dataset, you need to follow these format.
the form is look like:
1618 Compound::DB09499 0
- node id
- node name
- node type id
the form is look like:
318 14 30460
- head node id
- relation id
- tail node id
the form is look like:
9 CN+(C)CCO
- node(drug) id
- smiles string
the form is look like:
78 1616 59
- node(drug) id
- node(drug) id
- interaction type
The weight files for the model can be obtained from the following link.
The path for the weight files should be the root directory of project.
https://drive.google.com/drive/folders/1VKbVVzAcv_e3UgxId-Jrpac2SKqnCWeN