Coder Social home page Coder Social logo

linjc16 / r2-ddi Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 1.0 20.86 MB

[BIB 2023] Official implementation of "R2-DDI: Relation-aware Feature Refinement for Drug-drug Interaction Prediction".

Dockerfile 0.08% Shell 0.84% Python 96.67% C++ 0.70% Cuda 1.27% Cython 0.43%

r2-ddi's Introduction

R2-DDI: Relation-aware Feature Refinement for Drug-drug Interaction Prediction

This repository is the official implementation of R2-DDI: Relation-aware Feature Refinement for Drug-drug Interaction Prediction. The code is originally forked from Fairseq and DVMP.

Requirements and Installation

  • PyTorch version == 1.8.0
  • PyTorch Geometric version == 1.6.3
  • RDKit version == 2020.09.5

You can build the Dockerfile or use the docker image teslazhu/pretrainmol36:latest.

To install the code from source, you should first install rdkit,

conda install -y -c conda-forge rdkit=2020.09.5

Then, install other dependencies, like

git clone https://github.com/linjc16/R2-DDI.git

pip install fairseq
pip uninstall -y fairseq 

pip install ninja
python setup.py build_ext --inplace

Getting Started

Dataset

The drugbank dataset can be seen in dataset folder. The twosides dataset can be download here.

Data Preprocessing

We evaluate our models on DrugBank and TwoSides benchmark sets. ddi_zoo/scripts/data_process and ddi_zoo/scripts/twosides/data_process are folders for preprocessing of DrugBank and TwoSides, respectively. To generate the binary data for fairseq, take the transductive setting for DrugBank as an example, run

python ddi_zoo/scripts/data_process/split_trans.py

python ddi_zoo/scripts/data_process/run_process_trans.py

bash ddi_zoo/scripts/data_process/run_binarize_trans.sh

Note that you need to change the file paths accordingly.

Training and Test

All traning and test scripts can be seen in ddi_zoo/scripts. For instance,

bash ddi_zoo/scripts/train_trans/run_gcn_feat_int_cons.sh new_build1 0.01 1e-4 256

bash ddi_zoo/scripts/train_trans/inf_gcn_feat_int_cons.sh new_build1 0.01 1e-4 256

Contact

Please feel free to submit a Github issue if you have any questions or find any bugs. We do not guarantee any support, but will do our best if we can help.

r2-ddi's People

Contributors

aitejiu avatar linjc16 avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

aitejiu

r2-ddi's Issues

KeyError: 'logits

Sorry, I met the same problem. It's that when I do a valid_step after starting the training, it returns an error.

Traceback (most recent call last):
  File "ddi_zoo/src/train.py", line 507, in <module>
    cli_main()
  File "ddi_zoo/src/train.py", line 500, in cli_main
    distributed_utils.call_main(cfg, main)
  File "/root/code/R2-DDI/fairseq/distributed/utils.py", line 369, in call_main
    main(cfg, **kwargs)
  File "ddi_zoo/src/train.py", line 172, in main
    valid_losses, should_stop = train(cfg, trainer, task, epoch_itr)
  File "/opt/conda/envs/pytorch/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "ddi_zoo/src/train.py", line 296, in train
    valid_losses, should_stop = validate_and_save(
  File "ddi_zoo/src/train.py", line 383, in validate_and_save
    valid_losses = validate(cfg, trainer, task, epoch_itr, valid_subsets)
  File "ddi_zoo/src/train.py", line 453, in validate
    trainer.valid_step(sample)
  File "/opt/conda/envs/pytorch/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/root/code/R2-DDI/fairseq/trainer.py", line 945, in valid_step
    logits = logging_output['logits']
KeyError: 'logits'

Also I would like to inquire. When I use docker, I git down a fairseq, and after I manipulate that fairseq, my pip environment says that my fairseq points to /root/code/fairseq, but in /root/code/R2-DDI (i.e., our project), there is also a fairseq that when I use python setup.py build_ext --inplace and then I execute the training bash ddi_zoo/scripts/train_trans/run_gcn_feat_int_cons.sh new_build2 0.01 1e-4 256, the error reported in the fairseq is instead calling the class in /root/code/R2-DDI/fairseq. I would like to ask if the target in our project calls /root/code/R2-DDI/fairseq or /root/code/fairseq.

Request the full dataset

Using instructions on your homepage, I open a link to look for the dataset, only to be told that the page is not available . So, could you provide me with the full data set? My email address is [email protected].

cannot find some functions

I have downloaded fairseq. Neither from the fairseq folder of your github code nor the latest fairseq GitHub I can't find the molecule.py and doublemodel.py. This means that I cannot find the functions shown in the figure below. If it is convenient, can you tell me how you obtained these functions?
git

Request cold start data file

Sorry to bother you, I'm reproducing the cold start task from your experiment, but I found that the following file is missing: 1.drugbank_id_smiles.csv 2.pair_pos_neg_triples-fold1-train.csv 3. pair_pos_neg_triples-fold1-s2.csv 4. pair_pos_neg_triples-fold1-s1.csv. And fold0,fold2.Could you send me if you can, I need these documents so much.

Find a data problem: can't find valid.a-b.a.node_attr.idx etc.

When I ran the code, I realized that I have a series of files for constructing the graphs that I can't find, and when I generate the data through the script, it doesn't work, can you please provide them to me? Or tell me how to construct these data, thank you!
The file name is: valid.a-b.a.{attrs}.idx The replacement characters in {attrs} are the following four
image

KeyError: 'logits

return func(*args, **kwds)
File "ddi_zoo/src/train.py", line 297, in train
cfg, trainer, task, epoch_itr, valid_subsets, end_of_epoch
File "ddi_zoo/src/train.py", line 383, in validate_and_save
valid_losses = validate(cfg, trainer, task, epoch_itr, valid_subsets)
File "ddi_zoo/src/train.py", line 453, in validate
trainer.valid_step(sample)
File "/.conda/envs/py37tor1_8pyg1_6/lib/python3.7/contextlib.py", line 74, in inner
return func(*args, **kwds)
File "/R2-DDI-main/R2-DDI/fairseq/trainer.py", line 945, in valid_step
logits = logging_output['logits']
KeyError: 'logits

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.