Navvye commited on
Commit
c1ebc87
·
verified ·
1 Parent(s): 04579ee

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +154 -3
README.md CHANGED
@@ -1,3 +1,154 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # **PLAPT: Protein-Ligand Binding Affinity Prediction Using Pretrained Transformers**
2
+
3
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/plapt-protein-ligand-binding-affinity/protein-ligand-affinity-prediction-on-csar)](https://paperswithcode.com/sota/protein-ligand-affinity-prediction-on-csar?p=plapt-protein-ligand-binding-affinity)
4
+
5
+ [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/plapt-protein-ligand-binding-affinity/protein-ligand-affinity-prediction-on-pdbbind)](https://paperswithcode.com/sota/protein-ligand-affinity-prediction-on-pdbbind?p=plapt-protein-ligand-binding-affinity)
6
+
7
+ This is the official code repository for PLAPT, a state-of-the-art protein-ligand binding affinity predictor. [Preprint](https://doi.org/10.1101/2024.02.08.575577)
8
+
9
+
10
+
11
+
12
+ ### Abstract
13
+ Understanding protein-ligand binding affinity is crucial for drug discovery, enabling the identification of promising drug candidates efficiently. We introduce PLAPT, a novel model leveraging transfer learning from pre-trained transformers like ProtBERT and ChemBERTa to predict binding affinities with high accuracy. Our method processes one-dimensional protein and ligand sequences, leveraging a branching neural network architecture for feature integration and affinity estimation. We demonstrate PLAPT's superior performance through validation on multiple datasets, achieving state-of-the-art results while requiring significantly less computational resources for training compared to existing models. Our findings indicate that PLAPT offers a highly effective and accessible approach for accelerating drug discovery efforts.
14
+
15
+ ![PLAPT Architecture](https://github.com/trrt-good/WELP-PLAPT/blob/main/Diagrams/PLAPT.png)
16
+
17
+ ---
18
+ # Usage
19
+ ---
20
+ ## Plapt CLI
21
+
22
+ Plapt CLI is a command-line interface for the Plapt Python package, designed for predicting affinities using sequences and SMILES strings. This tool is user-friendly and offers flexibility in output formats and file handling.
23
+
24
+ ### Prerequisites
25
+
26
+ Before using Plapt CLI, you need to have the following installed:
27
+ - Python (Download and install from [python.org](https://www.python.org/))
28
+ - Git (Download and install from [git-scm.com](https://git-scm.com/)) - Alternatively, you can download the repository as a ZIP file.
29
+
30
+ ### Installation
31
+
32
+ To install Plapt CLI, you can clone the repository from GitHub:
33
+
34
+ ```bash
35
+ git clone https://github.com/trrt-good/WELP-PLAPT.git
36
+ cd WELP-PLAPT
37
+ ```
38
+
39
+ If you prefer not to use Git, download the ZIP file of the repository and extract it to a desired location.
40
+
41
+ Once you have the repository on your local machine, install the required dependencies:
42
+
43
+ ```bash
44
+ pip install -r requirements.txt
45
+ ```
46
+
47
+ (Optional) If you are using a virtual environment, activate it before installing the dependencies:
48
+
49
+ ```bash
50
+ source /path/to/your/venv/bin/activate
51
+ ```
52
+
53
+ ### Running the Script
54
+
55
+ ```bash
56
+ python plapt_cli.py -s SEQ1 SEQ2 ... -m SMILES1 SMILES2 ... -o OUTPUT_FILE -f FORMAT
57
+ ```
58
+
59
+ - `-s`: Followed by one or more sequences.
60
+ - `-m`: Followed by one or more SMILES strings.
61
+ - `-o`: (Optional) Path to the output file. If omitted, results are printed to the console.
62
+ - `-f`: (Optional) Format of the output file (`json` or `csv`). Required if `-o` is used without specifying a file extension.
63
+
64
+ #### Examples
65
+
66
+ - To print results to the console:
67
+
68
+ ```bash
69
+ python plapt_cli.py -s SEQ1 SEQ2 -m SMILES1 SMILES2
70
+ ```
71
+
72
+ - To save results to a JSON file:
73
+
74
+ ```bash
75
+ python plapt_cli.py -s SEQ1 SEQ2 -m SMILES1 SMILES2 -o results.json
76
+ ```
77
+
78
+ - To save results to a CSV file:
79
+
80
+ ```bash
81
+ python plapt_cli.py -s SEQ1 SEQ2 -m SMILES1 SMILES2 -o results.csv
82
+ ```
83
+
84
+ - To specify the format explicitly:
85
+
86
+ ```bash
87
+ python plapt_cli.py -s SEQ1 SEQ2 -m SMILES1 SMILES2 -o results -f json
88
+ ```
89
+
90
+ - If `-o` is omitted, results are printed to the console.
91
+
92
+ ---
93
+
94
+ ## Using Plapt Directly in Python
95
+
96
+ Apart from the command-line interface, Plapt can also be used directly in Python scripts. This allows for more flexibility and integration into larger Python projects or workflows.
97
+
98
+ ### Installation
99
+
100
+ Ensure you have followed the installation steps mentioned in the earlier section to set up the Plapt environment and dependencies.
101
+
102
+ ### Basic Usage
103
+
104
+ To use Plapt in a Python script, you need to import the `Plapt` class and then create an instance of it. You can then call its methods to predict affinities.
105
+
106
+ #### Importing and Initializing Plapt
107
+
108
+ ``` python
109
+ # First, import the Plapt class from the package, making sure you are working in the same directory as the plapt.py file:
110
+ from plapt import Plapt
111
+
112
+ # create an instance of the Plapt class. For basic usage, no initialization parameters are needed:
113
+ plapt = Plapt()
114
+ ```
115
+
116
+ #### Running Predictions
117
+ After initializing the `Plapt` object, you can use it to predict affinities. Here's an example of how to do it:
118
+
119
+ ```python
120
+ sequences = ["APTAPSIDMYGSNNL", "PIFLNVLEAIEPGVVC"]
121
+ smiles = ["NC(=O)[C@H](CCC(=O)O)", "NC(=[NH2+])c1ccccc1"]
122
+
123
+ results = plapt.predict_affinity(sequences, smiles)
124
+ print(results)
125
+ ```
126
+ output:
127
+ ```
128
+ [{'neg_log10_affinity_M': 4.38891527161495, 'affinity_uM': 40.839905489541835}, {'neg_log10_affinity_M': 4.196127195169673, 'affinity_uM': 63.66090450080189}]
129
+ ```
130
+ The outputted json can subsequently used for other tasks.
131
+
132
+ ### Advanced Usage
133
+
134
+ Plapt can be initialized with specialized parameters, such as the prediction module used, caching, or the inference device. Example below:
135
+ ``` python
136
+ from plapt import Plapt
137
+
138
+ # create an instance of the Plapt class with other parameters:
139
+ plapt = Plapt(
140
+ prediction_module_path="models/predictionModule.onnx", # For using a different prediction module. This is set to "models/predictionModule.onnx" by default.
141
+ caching=True, # Enable or disable caching. Enabled by default.
142
+ device="cuda" # Set the computation device ("cuda" for GPU or "cpu" for CPU). If cuda isn't available on your system, it will fallback to "cpu" automatically.
143
+ )
144
+ ```
145
+ Each option can be specified seperately (e.g., `plapt = Plapt(caching=False)` if you would like to disable caching.
146
+
147
+ ---
148
+
149
+
150
+ #### Data Preparation and Encoding
151
+ We source protein-ligand pairs and their corresponding affinity values from an open-source binding affinity dataset on hugginface, [binding_affinity](https://huggingface.co/datasets/jglaser/binding_affinity). We then used ProtBERT and ChemBERTa for encoding proteins and ligands respectively, giving us high quality vector-space representations. The encoding process is detailed in the `encoding.ipynb` notebook. The dataset, already encoded, is available on our [Google Drive](https://drive.google.com/drive/folders/1e-ujgHx5bW0JKxSZY5u34As77o4-IIFs?usp=sharing) for ease of access and use.
152
+
153
+ #### Importing Encoders and Running the Notebook
154
+ For users to import the encoders and run the Wolfram notebook (`WL Notebooks/FinalEssay.nb`), we provide the `encoders_to_onnx.ipynb` notebook. This ensures that users can replicate our encoding process and utilize the full capabilities of PLAPT.