PyTorch implementation of PaccMann
Project description
paccmann_predictor
Drug interaction prediction with PaccMann.
paccmann_predictor
is a package for drug interaction prediction, with examples of
anticancer drug sensitivity prediction and drug target affinity prediction. Please see our papers:
- Toward explainable anticancer compound sensitivity prediction via multimodal attention-based convolutional encoders (Molecular Pharmaceutics, 2019). This is the original paper on IC50 prediction using drug properties and tissue-specific cell line information (gene expression profiles). While the original code was written in
tensorflow
and is available here, this is thepytorch
implementation of the best PaccMann architecture (multiscale convolutional encoder).
PaccMann for affinity prediction:
- Data-driven molecular design for discovery and synthesis of novel ligands: a case study on SARS-CoV-2 (Machine Learning: Science and Technology, 2021). In there, we propose a slightly modified version to predict drug-target binding affinities based on protein sequences and SMILES
Installation
The library itself has few dependencies (see setup.py) with loose requirements. First, set up the environment as follows:
conda env create -f examples/IC50/conda.yml
conda activate paccmann_predictor
pip install -e .
Evaluate pretrained drug sensitivty model on your own data
First, please consider using our public PaccMann webservice as described in the NAR paper.
To use our pretrained model, please download the model from: https://ibm.biz/paccmann-data (just download models/single_pytorch_model
).
For example, assuming that you:
- Set up your conda environment as described above;
- Downloaded the model linked above in a directory called
single_pytorch_model
and - Downloaded the data from https://ibm.box.com/v/paccmann-pytoda-data in folders
data
andsplitted_data
; then, the following command should work:
(paccmann_predictor) $ python examples/IC50/test_paccmann.py \
splitted_data/gdsc_cell_line_ic50_test_fraction_0.1_id_997_seed_42.csv \
data/gene_expression/gdsc-rnaseq_gene-expression.csv \
data/smiles/gdsc.smi \
data/2128_genes.pkl \
single_pytorch_model/smiles_language \
single_pytorch_model/weights/best_mse_paccmann_v2.pt \
results \
single_pytorch_model/model_params.json
NOTE: If you bring your own data, please make sure to provide the omic data for the 2128 genes specified in data/2128_genes.pkl
. Your omic data (here it is data/gene_expression/gdsc-rnaseq_gene-expression.csv
) can contain more columns and it does not need to follow the order of the pickled gene list. But please dont change this pickle file. Also note that this is PaccMannV2 which is slightly improved compared to the paper version (context attention on both modalities).
Finetuning on your own data
You can also finetune our pretrained model on your data instead of training a model from scratch. For that, please follow the instruction below for training on scratch and just set:
model_path
--> directory where thesingle_pytorch_model
is storedtraining_name
--> this should besingle_pytorch_model
params_filepath
-->base_path/single_pytorch_model/model_params.json
Training a model from scratch
To run the example training script we provide environment files under examples/IC50/
.
In the examples
directory is a training script train_paccmann.py that makes use
of paccmann_predictor
.
(paccmann_predictor) $ python examples/IC50/train_paccmann.py -h
usage: train_paccmann.py [-h]
train_sensitivity_filepath test_sensitivity_filepath
gep_filepath smi_filepath gene_filepath
smiles_language_filepath model_path params_filepath
training_name
positional arguments:
train_sensitivity_filepath
Path to the drug sensitivity (IC50) data.
test_sensitivity_filepath
Path to the drug sensitivity (IC50) data.
gep_filepath Path to the gene expression profile data.
smi_filepath Path to the SMILES data.
gene_filepath Path to a pickle object containing list of genes.
smiles_language_filepath
Path to a pickle object a SMILES language object.
model_path Directory where the model will be stored.
params_filepath Path to the parameter file.
training_name Name for the training.
optional arguments:
-h, --help show this help message and exit
params_filepath
could point to examples/IC50/example_params.json, examples for other files can be downloaded from here.
References
If you use paccmann_predictor
in your projects, please cite the following:
@article{manica2019paccmann,
title={Toward explainable anticancer compound sensitivity prediction via multimodal attention-based convolutional encoders},
author={Manica, Matteo and Oskooei, Ali and Born, Jannis and Subramanian, Vigneshwari and S{\'a}ez-Rodr{\'\i}guez, Julio and Mart{\'\i}nez, Mar{\'\i}a Rodr{\'\i}guez},
journal={Molecular pharmaceutics},
volume={16},
number={12},
pages={4797--4806},
year={2019},
publisher={ACS Publications},
doi = {10.1021/acs.molpharmaceut.9b00520},
note = {PMID: 31618586}
}
@article{born2021datadriven,
author = {Born, Jannis and Manica, Matteo and Cadow, Joris and Markert, Greta and Mill, Nil Adell and Filipavicius, Modestas and Janakarajan, Nikita and Cardinale, Antonio and Laino, Teodoro and {Rodr{\'{i}}guez Mart{\'{i}}nez}, Mar{\'{i}}a},
doi = {10.1088/2632-2153/abe808},
issn = {2632-2153},
journal = {Machine Learning: Science and Technology},
number = {2},
pages = {025024},
title = {{Data-driven molecular design for discovery and synthesis of novel ligands: a case study on SARS-CoV-2}},
url = {https://iopscience.iop.org/article/10.1088/2632-2153/abe808},
volume = {2},
year = {2021}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file paccmann_predictor-1.0.0.tar.gz
.
File metadata
- Download URL: paccmann_predictor-1.0.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d3a0a32f41ba5948ba7d59a2cb212a970503ac09367bcadbb4039622bc3e6d1 |
|
MD5 | ce90f4dca887a70c1d9fb175069948cf |
|
BLAKE2b-256 | 0d3f1d9d89c8a75cf91c522218d3aefa69863f371b4e2943e2f4a3b37b126745 |
File details
Details for the file paccmann_predictor-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: paccmann_predictor-1.0.0-py3-none-any.whl
- Upload date:
- Size: 29.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64822e1861dcf70e75749348a5ca83b069c02538c33fb0765a982b5d0caa9f30 |
|
MD5 | 667d171f7233b672a33c69239217bbfb |
|
BLAKE2b-256 | 9f108d911dfd0cbbcfa8651b154a925f06dafb7448848ea0705566723421625f |