{"id":16388272,"url":"https://github.com/nyxflower/tip","last_synced_at":"2025-03-23T04:31:36.154Z","repository":{"id":57910411,"uuid":"195271898","full_name":"NYXFLOWER/TIP","owner":"NYXFLOWER","description":"TIP: Tri-graph Interaction Propagation model for Polypharmacy Side Eﬀect Prediction (GRL@NeurIPS, 2019)","archived":false,"fork":false,"pushed_at":"2022-12-02T04:58:30.000Z","size":308424,"stargazers_count":24,"open_issues_count":4,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T17:44:21.697Z","etag":null,"topics":["biography","deep-learning","drug","gcn","graph-embedding","graph-neural-network","graph-representation-learning","knowledge-graph","link-prediction","multi-relational","nerual-network","polypharmacy","protein","pytorch","pytorch-implementation","side-effects","tensor-factorization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NYXFLOWER.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-04T16:18:12.000Z","updated_at":"2024-08-09T02:36:41.000Z","dependencies_parsed_at":"2023-01-23T06:01:15.091Z","dependency_job_id":null,"html_url":"https://github.com/NYXFLOWER/TIP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NYXFLOWER%2FTIP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NYXFLOWER%2FTIP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NYXFLOWER%2FTIP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NYXFLOWER%2FTIP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NYXFLOWER","download_url":"https://codeload.github.com/NYXFLOWER/TIP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["biography","deep-learning","drug","gcn","graph-embedding","graph-neural-network","graph-representation-learning","knowledge-graph","link-prediction","multi-relational","nerual-network","polypharmacy","protein","pytorch","pytorch-implementation","side-effects","tensor-factorization"],"created_at":"2024-10-11T04:28:44.648Z","updated_at":"2025-03-23T04:31:31.138Z","avatar_url":"https://github.com/NYXFLOWER.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tri-graph Information Propagation (TIP) model\n\nTIP 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](https://github.com/marinkaz/decagon) and [R-GCN](https://github.com/tkipf/relational-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)](https://grlearning.github.io/papers/94.pdf).\n\n## TIP for Polypharmacy Side Effect Prediction\n\nwe are particularly concerned about the safety of [polypharmacy](https://en.wikipedia.org/wiki/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.\n\n\u003cdiv align=center\u003e\n\u003cimg height=\"100\" src=\"img/pred_dd.png\" alt=\"\"hhh/\u003e\n\u003c/div\u003e\n\nWe 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): \n\n\u0026emsp; :cookie: \u0026ensp; D-D graph: drug-drug interactions with side effects as edge labels\n\n\u0026emsp; :cake: \u0026ensp; P-D graph: protein-drug interactions (with a fixed label)\n\n\u0026emsp; :ice_cream: \u0026ensp; P-P graph: protein-protein interactions (with a fixed label)\n\n\u003cdiv align=center\u003e\n\u003cimg width=\"500\" src=\"img/network.png\" alt=\"\"hhh/\u003e\n\u003c/div\u003e\n\nTIP 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.\n\n**TIP Encoder**:\n\n\u003cdiv align=center\u003e\n\u003cimg height=\"300\" src=\"img/encoder.png\"\u003e\n\u003c/div\u003e\n\n**TIP Decoder**:\n\n\u003cdiv align=center\u003e\n\u003cimg height=\"300\" src=\"img/decoder.png\"\u003e\n\u003c/div\u003e\n\n## Source Code\n\nTIP is implemented in [PyTorch]([`pytorch`](https://pytorch.org/)) with [PyG](https://github.com/rusty1s/pytorch_geometric) package. It is developed and tested under Python 3.  \n\n### Requirement\n\nYou 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:\n\n```shell\n$ conda create -n tip-gpu python==3.9\n$ conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch\n$ conda install pyg==2.0.1 -c pyg -c conda-forge\t\n```\n\n*(Optional)* If you are interested in monitoring GPU memory usage of the model, the `pytorch_memlab` package is helpful.\n```shell\n$ pip install pytorch_memlab\n```\n\n*(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.\n\n### Running\n\nThe processed data and the code for data processing are in the `./data/` folder. The raw datasets are available on the [BioSNAP](http://snap.stanford.edu/biodata/index.html). See `./data.ipynb` for the full polypharmacy datasets analysis and data preprocessing.\n\n**Step 1**: preparing data. Run it once to generate a `data_dict.pkl` file in `./data/` folder).\n```shell\npython prepare.py\t\t\t\n```\n\n**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'`. \n```shell\npython tip.py\n```\n\nBy 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)](https://grlearning.github.io/papers/94.pdf) can be reproduced.\n\n:new_moon_with_face::waxing_crescent_moon::first_quarter_moon::waxing_gibbous_moon: **Please browse/open issues should you have any questions or ideas**​ :waning_gibbous_moon::last_quarter_moon::waning_crescent_moon::new_moon_with_face:\n\n## Cite Us\nIf you found this work useful, please cite us:\n```\n@article{xu2019tip,\n\ttitle={Tri-graph Information Propagation for Polypharmacy Side Effect Prediction},\n\tauthor={Hao Xu and Shengqi Sang and Haiping Lu},\n\tjournal={NeurIPS Workshop on Graph Representation Learning},\n\tyear={2019}\n}\n```\n\n## License\n\nTIP is licensed under the MIT License.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/sangsq\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/16742808?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003esangsq\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/NYXFLOWER/TIP/commits?author=sangsq\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/NYXFLOWER/TIP/commits?author=sangsq\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#ideas-sangsq\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/NYXFLOWER/TIP/commits?author=sangsq\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://haipinglu.github.io/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/23463961?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eHaiping Lu\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/NYXFLOWER/TIP/commits?author=haipinglu\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#a11y-haipinglu\" title=\"Accessibility\"\u003e️️️️♿️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/shree970\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/41207097?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eShreeyash\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/NYXFLOWER/TIP/issues?q=author%3Ashree970\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/Chertoganov\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/40623363?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eChertoganov\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/NYXFLOWER/TIP/issues?q=author%3AChertoganov\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.jianshu.com/u/31c221f09d8a\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/25343084?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eZillaRU\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/NYXFLOWER/TIP/issues?q=author%3AZillaRU\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/gilgamsh\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/56181610?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJiaxi Jiang  \u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/NYXFLOWER/TIP/issues?q=author%3Agilgamsh\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyxflower%2Ftip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyxflower%2Ftip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyxflower%2Ftip/lists"}