Giter Site home page Giter Site logo

nyxflower / tip Goto Github PK

View Code? Open in Web Editor NEW
24.0 5.0 15.0 301.2 MB

TIP: Tri-graph Interaction Propagation model for Polypharmacy Side Effect Prediction (GRL@NeurIPS, 2019)

License: MIT License

Python 100.00%
gcn side-effects pytorch-implementation polypharmacy protein drug biography multi-relational link-prediction graph-embedding

tip's Introduction

Tri-graph Information Propagation (TIP) model

TIP is an efficient general approach for multi-relational link prediction in any multi-modal (i.e. heterogeneous and multi-relational) network with two types of nodes. It can also be applied to the Knowledge Graph Completion and Recommendation task. TIP model is inspired by the Decagon and R-GCN models, motivated by their limitations of high computational cost and memory demand when graph goes really complex. TIP improves their link prediction accuracy, and time and space efficiency of node representation learning. See details on the algorithm in our paper (Xu, Sang, and Lu, 2019).

TIP for Polypharmacy Side Effect Prediction

we are particularly concerned about the safety of polypharmacy, which is the concurrent use of multiple medications by a patient. Given a pair of drugs (:pill:,:pill:), the TIP model will predict how many polypharmacy side effects the drug pair will have, and what are the possibilities.

We use POSE clinical records and pharmacological information to construct a multi-modal biomedical graph with two types of nodes: Drug (D) and Protein (P). The graph contains three types of interaction (refer to three subgraphs):

  🍪   D-D graph: drug-drug interactions with side effects as edge labels

  🍰   P-D graph: protein-drug interactions (with a fixed label)

  🍨   P-P graph: protein-protein interactions (with a fixed label)

TIP model embeds proteins and drugs into different spaces of possibly different dimensions in the encoder, and predict side effects of drug combinations in the decoder. As shown below, TIP learns the protein embedding firstly on the P-P graph, and passes it to D-D graph via D-P graph. On D-D graph, TIP learns drug embedding and predicts relationships between drugs.

TIP Encoder:

TIP Decoder:

Source Code

TIP is implemented in PyTorch with PyG package. It is developed and tested under Python 3.

Requirement

You can install the pytorch and pyg packages with the versions that matches your hardware, or use the same environment as mine using the following commands:

$ conda create -n tip-gpu python==3.9
$ conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch
$ conda install pyg==2.0.1 -c pyg -c conda-forge	

(Optional) If you are interested in monitoring GPU memory usage of the model, the pytorch_memlab package is helpful.

$ pip install pytorch_memlab

(Optional) TIP is trained and tested on a single GPU. If you are interested in training TIP using multiple GPUs, pytorch_lightning would be helpful.

Running

The processed data and the code for data processing are in the ./data/ folder. The raw datasets are available on the BioSNAP. See ./data.ipynb for the full polypharmacy datasets analysis and data preprocessing.

Step 1: preparing data. Run it once to generate a data_dict.pkl file in ./data/ folder).

python prepare.py			

Step 2: training and testing model. The default model is TIP-cat. If you want to train and test a TIP-add model, change the value of variable MOD from 'cat' to 'add'.

python tip.py

By following the above steps and using the default hyper-parameter settings, the results that are shown in the TIP paper (Xu, Sang, and Lu, 2019) can be reproduced.

🌚🌒🌓🌔 Please browse/open issues should you have any questions or ideas​ 🌖🌗🌘🌚

Cite Us

If you found this work useful, please cite us:

@article{xu2019tip,
	title={Tri-graph Information Propagation for Polypharmacy Side Effect Prediction},
	author={Hao Xu and Shengqi Sang and Haiping Lu},
	journal={NeurIPS Workshop on Graph Representation Learning},
	year={2019}
}

License

TIP is licensed under the MIT License.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


sangsq

💻 ⚠️ 🤔 📖

Haiping Lu

📖 ️️️️♿️

Shreeyash

🐛

Chertoganov

🐛

ZillaRU

🐛

Jiaxi Jiang

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

tip's People

Contributors

allcontributors[bot] avatar nyxflower avatar sangsq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tip's Issues

assertion error

Hello!
I am trying to reproduce the results of the TIP paper in the framework of my graduate thesis.
I run prepare.py to completion as described in readme. But when I run the tip.py script I get an assertion error telling me that the edge_index is not of the torch.long type (I attach the full error). Any ideas on why this might be the case?

tip_error.txt

代码没法调通

您好,为啥我按照您的代码,没法跑通,报没有edge_index错误。

How to solve dependency error? GPU

ERROR: Could not find a version that satisfies the requirement anaconda-navigator==1.9.7 (from -r requirements_gpu.txt (line 4)) (from versions: none)
ERROR: No matching distribution found for anaconda-navigator==1.9.7 (from -r requirements_gpu.txt (line 4))

P.S. Can you write clear code please without dependency error, please use virtualenv ?

How to solve library error? CPU

ERROR: Could not find a version that satisfies the requirement mkl-fft==1.0.13 (from -r requirements_cpu.txt (line 29)) (from versions: none)
ERROR: No matching distribution found for mkl-fft==1.0.13 (from -r requirements_cpu.txt (line 29))

P.S. Can you write clear code please without dependency error, please use virtualenv ?

FMEncoderAdd is not defined.

Hello, Hao Xu! I am working on identifying polypharmacy side effects and need to compare my approach with yours. But, I got a little confused since I could not organize your code to make it work.
Here, FMEncoderAdd is not defined. And, is the file tip-add.py for training your proposed model TIP-sum?

TIP/tip-add.py

Line 162 in c2924d0

encoder = FMEncoderAdd(device, data.n_drug_feat, data.n_dd_et, data.n_prot, data.n_prot, data.n_drug)

Any help? 😆Thank you in advance~

About drug's CID

I recently read your article on Tri-graph Information Propagation for Polypharmacy Side Effect Prediction. I am very interested in this point. I am now confused. What are the CIDs you are constructing for 645 drugs. That is, I don't know what CID corresponds to the serial number between 0-644. I would appreciate it if you could provide it.

Use model for making predictions for all drug combinations +protein info

Hello,

I want to use the trained models to make predictions for all the possible drug combinations and the side effects, exactly as described also in the Decagon paper. From the files that I see on github this is not straightforward for me. I was wondering if you could provide some instructions on how this can be done.

Moreover, since I am interested in seeing the predicted side effects of the drug combinations of specific drugs and some of them don't exist in the dataset I wanted to add some of these drugs to the dataset and re-train the models with them.
To my understanding this is needed in order to make it possible to have predictions for these drugs (I think that we need at least some drug-protein information for them in order to make them part of the multimodal graph). My question is the following, is there a file where we can find the correspondance of protein and protein names, or some kind of protein info like the id in a database? Do you have any other suggestion on how to add new drugs to the dataset?

Thank you in advance,
Athina

batch processing

Do you have any plane to implement the batch processing via dataloader?

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.