papyrus-scripts 1.0.2__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- papyrus_scripts-2.0.0/PKG-INFO +245 -0
- papyrus_scripts-2.0.0/README.md +206 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/setup.cfg +1 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/__init__.py +6 -2
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/download.py +6 -3
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/modelling.py +53 -23
- papyrus_scripts-2.0.0/src/papyrus_scripts/oop.py +550 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/preprocess.py +169 -23
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/reader.py +16 -12
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/IO.py +124 -7
- papyrus_scripts-2.0.0/src/papyrus_scripts/utils/aliases.json +75 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/links.json +121 -23
- papyrus_scripts-2.0.0/src/papyrus_scripts.egg-info/PKG-INFO +245 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/SOURCES.txt +4 -1
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/requires.txt +1 -0
- papyrus_scripts-2.0.0/tests/test_oop.py +240 -0
- papyrus_scripts-1.0.2/PKG-INFO +0 -191
- papyrus_scripts-1.0.2/README.md +0 -169
- papyrus_scripts-1.0.2/src/papyrus_scripts.egg-info/PKG-INFO +0 -191
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/LICENSE +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/setup.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/__main__.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/cli.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/fingerprint.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/matchRCSB.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/neuralnet.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/subsim_search.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/UniprotMatch.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/__init__.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/mol_reader.py +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/dependency_links.txt +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/entry_points.txt +0 -0
- {papyrus_scripts-1.0.2 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: papyrus_scripts
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: A collection of scripts to handle the Papyrus bioactivity dataset
|
|
5
|
+
Home-page: https://github.com/OlivierBeq/Papyrus-scripts
|
|
6
|
+
Author: Olivier J. M. Béquignon - Brandon J. Bongers - Willem Jespers
|
|
7
|
+
Author-email: "olivier.bequignon.maintainer@gmail.com"
|
|
8
|
+
Maintainer: Olivier J. M. Béquignon
|
|
9
|
+
Maintainer-email: "olivier.bequignon.maintainer@gmail.com"
|
|
10
|
+
Keywords: bioactivity data,QSAR,proteochemometrics,cheminformatics,modelling,machine learning
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: pandas
|
|
22
|
+
Requires-Dist: rdkit
|
|
23
|
+
Requires-Dist: requests
|
|
24
|
+
Requires-Dist: joblib
|
|
25
|
+
Requires-Dist: tqdm
|
|
26
|
+
Requires-Dist: mordred
|
|
27
|
+
Requires-Dist: swifter
|
|
28
|
+
Requires-Dist: scikit-learn
|
|
29
|
+
Requires-Dist: xgboost
|
|
30
|
+
Requires-Dist: pystow
|
|
31
|
+
Requires-Dist: prodec
|
|
32
|
+
Provides-Extra: docs
|
|
33
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
34
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
35
|
+
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
|
36
|
+
Provides-Extra: testing
|
|
37
|
+
Requires-Dist: pytest; extra == "testing"
|
|
38
|
+
Requires-Dist: parameterized; extra == "testing"
|
|
39
|
+
|
|
40
|
+
# Papyrus-scripts
|
|
41
|
+
|
|
42
|
+
Collection of scripts to interact with the Papyrus bioactivity dataset.
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
<br/>
|
|
47
|
+
|
|
48
|
+
**Associated Article:** <a href="https://doi.org/10.1186/s13321-022-00672-x">10.1186/s13321-022-00672-x</a>
|
|
49
|
+
```
|
|
50
|
+
Béquignon OJM, Bongers BJ, Jespers W, IJzerman AP, van de Water B, van Westen GJP.
|
|
51
|
+
Papyrus - A large scale curated dataset aimed at bioactivity predictions.
|
|
52
|
+
J Cheminform 15, 3 (2023). https://doi.org/10.1186/s13321-022-00672-x
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Associated Preprint:** <a href="https://doi.org/10.33774/chemrxiv-2021-1rxhk">10.33774/chemrxiv-2021-1rxhk</a>
|
|
56
|
+
```
|
|
57
|
+
Béquignon OJM, Bongers BJ, Jespers W, IJzerman AP, van de Water B, van Westen GJP.
|
|
58
|
+
Papyrus - A large scale curated dataset aimed at bioactivity predictions.
|
|
59
|
+
ChemRxiv. Cambridge: Cambridge Open Engage; 2021;
|
|
60
|
+
This content is a preprint and has not been peer-reviewed.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install papyrus-scripts
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
:warning: If pip gives the following error and resolves in import errors
|
|
70
|
+
```bash
|
|
71
|
+
Defaulting to user installation because normal site-packages is not writeable
|
|
72
|
+
```
|
|
73
|
+
Then uninstall and reinstalling the library with the following commands:
|
|
74
|
+
```bash
|
|
75
|
+
pip uninstall -y papyrus-scripts
|
|
76
|
+
python -m pip install papyrus-scripts
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Additional dependencies can be installed to allow:
|
|
80
|
+
- similarity and substructure searches
|
|
81
|
+
```bash
|
|
82
|
+
conda install FPSim2 openbabel h5py cupy -c conda-forge
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- training DNN models:
|
|
86
|
+
```bash
|
|
87
|
+
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Getting started
|
|
91
|
+
|
|
92
|
+
### The new application programming interface (API)
|
|
93
|
+
This new object-oriented API is available since version 2.0.0.
|
|
94
|
+
|
|
95
|
+
It allows for easier filtering of the Papyrus data and ensures that any data being queried is downloaded.
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from papyrus_scripts import PapyrusDataset
|
|
99
|
+
|
|
100
|
+
data = (PapyrusDataset(version='05.7', plusplus=True) # Downloads the data if needed
|
|
101
|
+
.keep_source(['chembl', 'sharma']) # Keep specific sources
|
|
102
|
+
.keep_quality('high')
|
|
103
|
+
.proteins() # Get the corresponding protein targets
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Functional API (legacy)
|
|
108
|
+
|
|
109
|
+
The functional API requires the data to be downloaded beforehand.<br/>
|
|
110
|
+
One can donwload the dataset either with the functional API itself or the command line interface (CLI).
|
|
111
|
+
|
|
112
|
+
#### Donwloading with the command line interface (CLI)
|
|
113
|
+
The following command will download the Papyrus++ bioactivities and protein targets (high-quality Ki and KD data as well as IC50 and EC50 of reproducible assays) for the latest version.
|
|
114
|
+
```bash
|
|
115
|
+
papyrus download -V latest
|
|
116
|
+
```
|
|
117
|
+
The following command will donwload the entire set of high-, medium-, and low-quality bioactivities and protein targets along with all precomputed molecular and protein descriptors for version 05.5.
|
|
118
|
+
```bash
|
|
119
|
+
papyrus download -V 05.5 --more --d all
|
|
120
|
+
```
|
|
121
|
+
The following command will download Papyrus++ bioactivities, protein targets and compound structures for both version 05.4 and 05.5.
|
|
122
|
+
```bash
|
|
123
|
+
papyrus download -V 05.5 -V 05.4 -S
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
More options can be found using
|
|
127
|
+
```bash
|
|
128
|
+
papyrus download --help
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
By default, the data is downloaded to [pystow](https://github.com/cthoyt/pystow)'s default directory.<br/>
|
|
132
|
+
One can override the folder path by specifying the `-o` switch in the above commands.
|
|
133
|
+
|
|
134
|
+
#### Donwloading with the functional API
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
|
|
138
|
+
from papyrus_scripts import download_papyrus
|
|
139
|
+
|
|
140
|
+
# Donwload the latest version of the entire dataset with all precomputed descriptors
|
|
141
|
+
download_papyrus(version='latest', only_pp=False, structures=True, descriptors='all')
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Querying with the functional API
|
|
145
|
+
|
|
146
|
+
The query detailed above using the object-oriented API is reproduced below using the functional API.
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from papyrus_scripts import (read_papyrus, read_protein_set,
|
|
150
|
+
keep_quality, keep_source, keep_type,
|
|
151
|
+
keep_organism, keep_accession, keep_protein_class,
|
|
152
|
+
keep_match, keep_contains,
|
|
153
|
+
consume_chunks)
|
|
154
|
+
|
|
155
|
+
chunk_reader = read_papyrus(version='05.7', plusplus=True, is3d=False, chunksize=1_000_000)
|
|
156
|
+
protein_data = read_protein_set(version='05.7')
|
|
157
|
+
filter1 = keep_source(data=chunk_reader, source=['chembl', 'sharma'])
|
|
158
|
+
filter2 = keep_quality(data=filter1, min_quality='high')
|
|
159
|
+
data = consume_chunks(filter2, progress=False)
|
|
160
|
+
|
|
161
|
+
protein_data = protein_data.set_index('target_id').loc[data.target_id.unique()].reset_index()
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Versions of the Papyrus dataset
|
|
165
|
+
|
|
166
|
+
Different online servers host the Papyrus data based on release and ChEMBL version (table below).
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
| Papyrus version | ChEMBL version | Zenodo | 4TU |
|
|
170
|
+
|:---------------:|:--------------:|:---------------------------------------------------------:|:---------------------------------------------------------:|
|
|
171
|
+
| 05.4 | 29 | [:heavy_check_mark:](https://zenodo.org/records/10944245) | [:heavy_check_mark:](https://doi.org/10.4121/16896406.v2) |
|
|
172
|
+
| 05.5 | 30 | [:heavy_check_mark:](https://zenodo.org/records/10943207) | :x: |
|
|
173
|
+
| 05.6 | 31 | [:heavy_check_mark:](https://zenodo.org/records/7821775) | :x: |
|
|
174
|
+
| 05.7 | 34 | [:heavy_check_mark:](https://zenodo.org/records/13787634) | :x: |
|
|
175
|
+
|
|
176
|
+
Precomputed molecular and protein descriptors along with molecular structures (2D for default set and 3D for low quality set with stereochemistry) are not available for version 05.4 from 4TU but are from Google Drive.
|
|
177
|
+
|
|
178
|
+
As stated in the pre-print **we strongly encourage** the use of the dataset in which stereochemistry was not considered.
|
|
179
|
+
This corresponds to files containing the mention "2D" and/or "without_stereochemistry".
|
|
180
|
+
|
|
181
|
+
## Interconversion of the compressed files
|
|
182
|
+
|
|
183
|
+
The available LZMA-compressed files (*.xz*) may not be supported by some software (e.g. Pipeline Pilot).
|
|
184
|
+
<br/>**Decompressing the data is strongly discouraged!**<br/>
|
|
185
|
+
Though Gzip files were made available at 4TU for version 05.4, we now provide a CLI option to locally interconvert from LZMA to Gzip and vice-versa.
|
|
186
|
+
|
|
187
|
+
To convert from LZMA to Gzip (or vice-versa) use the following command:
|
|
188
|
+
```bash
|
|
189
|
+
papyrus convert -v latest
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Removal of the data
|
|
193
|
+
|
|
194
|
+
One can remove the Papyrus data using either the CLI or the API.
|
|
195
|
+
|
|
196
|
+
The following exerts exemplify the removal of all Papyrus data files, including all versions utility files.
|
|
197
|
+
```bash
|
|
198
|
+
papyrus clean --remove_root
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
from papyrus_scripts import remove_papyrus
|
|
203
|
+
|
|
204
|
+
remove_papyrus(papyrus_root=True)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
## Easy handling of the dataset
|
|
209
|
+
|
|
210
|
+
Once installed the Papyrus-scripts allow for the easy filtering of the data.<br/>
|
|
211
|
+
- Simple examples can be found in the <a href="https://github.com/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/simple_examples.ipynb">simple_examples.ipynb</a> notebook. [](https://colab.research.google.com/github/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/simple_examples.ipynb)
|
|
212
|
+
- An example on matching data with the Protein Data Bank can be found in the <a href="https://github.com/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/matchRCSB.ipynb">simple_examples.ipynb</a> notebook. [](https://colab.research.google.com/github/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/matchRCSB.ipynb)
|
|
213
|
+
- More advanced examples will be added to the <a href="https://github.com/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/advanced_querying.ipynb">advanced_querying.ipynb</a> notebook.
|
|
214
|
+
## Reproducing results of the pre-print
|
|
215
|
+
|
|
216
|
+
The scripts used to extract subsets, generate models and obtain visualizations can be found <a href="https://github.com/OlivierBeq/Papyrus-modelling">here</a>.
|
|
217
|
+
|
|
218
|
+
## Features to come
|
|
219
|
+
|
|
220
|
+
- [x] Substructure and similarity molecular searches
|
|
221
|
+
- [x] ability to use DNN models
|
|
222
|
+
- [x] ability to repeat model training over multiple seeds
|
|
223
|
+
- [x] y-scrambling
|
|
224
|
+
- [ ] adapt models to QSPRpred
|
|
225
|
+
|
|
226
|
+
## Examples to come
|
|
227
|
+
|
|
228
|
+
- Use of custom grouping schemes for training/test set splitting and cross-validation
|
|
229
|
+
- Use custom molecular and protein descriptors (either Python function or file on disk)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
## Logos
|
|
233
|
+
|
|
234
|
+
Logos can be found under <a href="https://github.com/OlivierBeq/Papyrus-scripts/tree/master/figures/logo">**figures/logo**</a>
|
|
235
|
+
Two version exist depending on the background used.
|
|
236
|
+
|
|
237
|
+
:warning: GitHub does not render the white logo properly in the table below but should not deter you from using it!
|
|
238
|
+
|
|
239
|
+
<div class="colored-table">
|
|
240
|
+
|
|
241
|
+
| On white background | On colored background |
|
|
242
|
+
|:--------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
243
|
+
| <img src="https://raw.githubusercontent.com/OlivierBeq/Papyrus-scripts/refs/heads/master/figures/logo/Papyrus_trnsp-bg.svg" width=200> | <img src="https://raw.githubusercontent.com/OlivierBeq/Papyrus-scripts/refs/heads/master/figures/logo/Papyrus_trnsp-bg-white.svg" width=200> |
|
|
244
|
+
|
|
245
|
+
</div>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Papyrus-scripts
|
|
2
|
+
|
|
3
|
+
Collection of scripts to interact with the Papyrus bioactivity dataset.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
<br/>
|
|
8
|
+
|
|
9
|
+
**Associated Article:** <a href="https://doi.org/10.1186/s13321-022-00672-x">10.1186/s13321-022-00672-x</a>
|
|
10
|
+
```
|
|
11
|
+
Béquignon OJM, Bongers BJ, Jespers W, IJzerman AP, van de Water B, van Westen GJP.
|
|
12
|
+
Papyrus - A large scale curated dataset aimed at bioactivity predictions.
|
|
13
|
+
J Cheminform 15, 3 (2023). https://doi.org/10.1186/s13321-022-00672-x
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Associated Preprint:** <a href="https://doi.org/10.33774/chemrxiv-2021-1rxhk">10.33774/chemrxiv-2021-1rxhk</a>
|
|
17
|
+
```
|
|
18
|
+
Béquignon OJM, Bongers BJ, Jespers W, IJzerman AP, van de Water B, van Westen GJP.
|
|
19
|
+
Papyrus - A large scale curated dataset aimed at bioactivity predictions.
|
|
20
|
+
ChemRxiv. Cambridge: Cambridge Open Engage; 2021;
|
|
21
|
+
This content is a preprint and has not been peer-reviewed.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install papyrus-scripts
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
:warning: If pip gives the following error and resolves in import errors
|
|
31
|
+
```bash
|
|
32
|
+
Defaulting to user installation because normal site-packages is not writeable
|
|
33
|
+
```
|
|
34
|
+
Then uninstall and reinstalling the library with the following commands:
|
|
35
|
+
```bash
|
|
36
|
+
pip uninstall -y papyrus-scripts
|
|
37
|
+
python -m pip install papyrus-scripts
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Additional dependencies can be installed to allow:
|
|
41
|
+
- similarity and substructure searches
|
|
42
|
+
```bash
|
|
43
|
+
conda install FPSim2 openbabel h5py cupy -c conda-forge
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- training DNN models:
|
|
47
|
+
```bash
|
|
48
|
+
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Getting started
|
|
52
|
+
|
|
53
|
+
### The new application programming interface (API)
|
|
54
|
+
This new object-oriented API is available since version 2.0.0.
|
|
55
|
+
|
|
56
|
+
It allows for easier filtering of the Papyrus data and ensures that any data being queried is downloaded.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from papyrus_scripts import PapyrusDataset
|
|
60
|
+
|
|
61
|
+
data = (PapyrusDataset(version='05.7', plusplus=True) # Downloads the data if needed
|
|
62
|
+
.keep_source(['chembl', 'sharma']) # Keep specific sources
|
|
63
|
+
.keep_quality('high')
|
|
64
|
+
.proteins() # Get the corresponding protein targets
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Functional API (legacy)
|
|
69
|
+
|
|
70
|
+
The functional API requires the data to be downloaded beforehand.<br/>
|
|
71
|
+
One can donwload the dataset either with the functional API itself or the command line interface (CLI).
|
|
72
|
+
|
|
73
|
+
#### Donwloading with the command line interface (CLI)
|
|
74
|
+
The following command will download the Papyrus++ bioactivities and protein targets (high-quality Ki and KD data as well as IC50 and EC50 of reproducible assays) for the latest version.
|
|
75
|
+
```bash
|
|
76
|
+
papyrus download -V latest
|
|
77
|
+
```
|
|
78
|
+
The following command will donwload the entire set of high-, medium-, and low-quality bioactivities and protein targets along with all precomputed molecular and protein descriptors for version 05.5.
|
|
79
|
+
```bash
|
|
80
|
+
papyrus download -V 05.5 --more --d all
|
|
81
|
+
```
|
|
82
|
+
The following command will download Papyrus++ bioactivities, protein targets and compound structures for both version 05.4 and 05.5.
|
|
83
|
+
```bash
|
|
84
|
+
papyrus download -V 05.5 -V 05.4 -S
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
More options can be found using
|
|
88
|
+
```bash
|
|
89
|
+
papyrus download --help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
By default, the data is downloaded to [pystow](https://github.com/cthoyt/pystow)'s default directory.<br/>
|
|
93
|
+
One can override the folder path by specifying the `-o` switch in the above commands.
|
|
94
|
+
|
|
95
|
+
#### Donwloading with the functional API
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
|
|
99
|
+
from papyrus_scripts import download_papyrus
|
|
100
|
+
|
|
101
|
+
# Donwload the latest version of the entire dataset with all precomputed descriptors
|
|
102
|
+
download_papyrus(version='latest', only_pp=False, structures=True, descriptors='all')
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Querying with the functional API
|
|
106
|
+
|
|
107
|
+
The query detailed above using the object-oriented API is reproduced below using the functional API.
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from papyrus_scripts import (read_papyrus, read_protein_set,
|
|
111
|
+
keep_quality, keep_source, keep_type,
|
|
112
|
+
keep_organism, keep_accession, keep_protein_class,
|
|
113
|
+
keep_match, keep_contains,
|
|
114
|
+
consume_chunks)
|
|
115
|
+
|
|
116
|
+
chunk_reader = read_papyrus(version='05.7', plusplus=True, is3d=False, chunksize=1_000_000)
|
|
117
|
+
protein_data = read_protein_set(version='05.7')
|
|
118
|
+
filter1 = keep_source(data=chunk_reader, source=['chembl', 'sharma'])
|
|
119
|
+
filter2 = keep_quality(data=filter1, min_quality='high')
|
|
120
|
+
data = consume_chunks(filter2, progress=False)
|
|
121
|
+
|
|
122
|
+
protein_data = protein_data.set_index('target_id').loc[data.target_id.unique()].reset_index()
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Versions of the Papyrus dataset
|
|
126
|
+
|
|
127
|
+
Different online servers host the Papyrus data based on release and ChEMBL version (table below).
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
| Papyrus version | ChEMBL version | Zenodo | 4TU |
|
|
131
|
+
|:---------------:|:--------------:|:---------------------------------------------------------:|:---------------------------------------------------------:|
|
|
132
|
+
| 05.4 | 29 | [:heavy_check_mark:](https://zenodo.org/records/10944245) | [:heavy_check_mark:](https://doi.org/10.4121/16896406.v2) |
|
|
133
|
+
| 05.5 | 30 | [:heavy_check_mark:](https://zenodo.org/records/10943207) | :x: |
|
|
134
|
+
| 05.6 | 31 | [:heavy_check_mark:](https://zenodo.org/records/7821775) | :x: |
|
|
135
|
+
| 05.7 | 34 | [:heavy_check_mark:](https://zenodo.org/records/13787634) | :x: |
|
|
136
|
+
|
|
137
|
+
Precomputed molecular and protein descriptors along with molecular structures (2D for default set and 3D for low quality set with stereochemistry) are not available for version 05.4 from 4TU but are from Google Drive.
|
|
138
|
+
|
|
139
|
+
As stated in the pre-print **we strongly encourage** the use of the dataset in which stereochemistry was not considered.
|
|
140
|
+
This corresponds to files containing the mention "2D" and/or "without_stereochemistry".
|
|
141
|
+
|
|
142
|
+
## Interconversion of the compressed files
|
|
143
|
+
|
|
144
|
+
The available LZMA-compressed files (*.xz*) may not be supported by some software (e.g. Pipeline Pilot).
|
|
145
|
+
<br/>**Decompressing the data is strongly discouraged!**<br/>
|
|
146
|
+
Though Gzip files were made available at 4TU for version 05.4, we now provide a CLI option to locally interconvert from LZMA to Gzip and vice-versa.
|
|
147
|
+
|
|
148
|
+
To convert from LZMA to Gzip (or vice-versa) use the following command:
|
|
149
|
+
```bash
|
|
150
|
+
papyrus convert -v latest
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Removal of the data
|
|
154
|
+
|
|
155
|
+
One can remove the Papyrus data using either the CLI or the API.
|
|
156
|
+
|
|
157
|
+
The following exerts exemplify the removal of all Papyrus data files, including all versions utility files.
|
|
158
|
+
```bash
|
|
159
|
+
papyrus clean --remove_root
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from papyrus_scripts import remove_papyrus
|
|
164
|
+
|
|
165
|
+
remove_papyrus(papyrus_root=True)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
## Easy handling of the dataset
|
|
170
|
+
|
|
171
|
+
Once installed the Papyrus-scripts allow for the easy filtering of the data.<br/>
|
|
172
|
+
- Simple examples can be found in the <a href="https://github.com/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/simple_examples.ipynb">simple_examples.ipynb</a> notebook. [](https://colab.research.google.com/github/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/simple_examples.ipynb)
|
|
173
|
+
- An example on matching data with the Protein Data Bank can be found in the <a href="https://github.com/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/matchRCSB.ipynb">simple_examples.ipynb</a> notebook. [](https://colab.research.google.com/github/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/matchRCSB.ipynb)
|
|
174
|
+
- More advanced examples will be added to the <a href="https://github.com/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/advanced_querying.ipynb">advanced_querying.ipynb</a> notebook.
|
|
175
|
+
## Reproducing results of the pre-print
|
|
176
|
+
|
|
177
|
+
The scripts used to extract subsets, generate models and obtain visualizations can be found <a href="https://github.com/OlivierBeq/Papyrus-modelling">here</a>.
|
|
178
|
+
|
|
179
|
+
## Features to come
|
|
180
|
+
|
|
181
|
+
- [x] Substructure and similarity molecular searches
|
|
182
|
+
- [x] ability to use DNN models
|
|
183
|
+
- [x] ability to repeat model training over multiple seeds
|
|
184
|
+
- [x] y-scrambling
|
|
185
|
+
- [ ] adapt models to QSPRpred
|
|
186
|
+
|
|
187
|
+
## Examples to come
|
|
188
|
+
|
|
189
|
+
- Use of custom grouping schemes for training/test set splitting and cross-validation
|
|
190
|
+
- Use custom molecular and protein descriptors (either Python function or file on disk)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## Logos
|
|
194
|
+
|
|
195
|
+
Logos can be found under <a href="https://github.com/OlivierBeq/Papyrus-scripts/tree/master/figures/logo">**figures/logo**</a>
|
|
196
|
+
Two version exist depending on the background used.
|
|
197
|
+
|
|
198
|
+
:warning: GitHub does not render the white logo properly in the table below but should not deter you from using it!
|
|
199
|
+
|
|
200
|
+
<div class="colored-table">
|
|
201
|
+
|
|
202
|
+
| On white background | On colored background |
|
|
203
|
+
|:--------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
204
|
+
| <img src="https://raw.githubusercontent.com/OlivierBeq/Papyrus-scripts/refs/heads/master/figures/logo/Papyrus_trnsp-bg.svg" width=200> | <img src="https://raw.githubusercontent.com/OlivierBeq/Papyrus-scripts/refs/heads/master/figures/logo/Papyrus_trnsp-bg-white.svg" width=200> |
|
|
205
|
+
|
|
206
|
+
</div>
|
|
@@ -9,11 +9,15 @@ from .reader import (read_papyrus, read_protein_set, read_protein_descriptors,
|
|
|
9
9
|
from .matchRCSB import update_rcsb_data, get_matches
|
|
10
10
|
from .preprocess import (keep_organism, keep_accession, keep_type, keep_source,
|
|
11
11
|
keep_protein_class, keep_quality, keep_contains, keep_match,
|
|
12
|
-
keep_similar, keep_substructure,
|
|
12
|
+
keep_similar, keep_substructure, keep_not_contains, keep_not_match,
|
|
13
|
+
keep_dissimilar, keep_not_substructure, consume_chunks, yscrambling)
|
|
13
14
|
|
|
14
15
|
from .modelling import qsar, pcm
|
|
15
16
|
|
|
16
17
|
from .utils.mol_reader import MolSupplier
|
|
17
18
|
from .utils import IO, UniprotMatch
|
|
19
|
+
from .utils.IO import PapyrusVersion
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
from .oop import PapyrusDataset
|
|
22
|
+
|
|
23
|
+
__version__ = '2.0.0'
|
|
@@ -23,9 +23,10 @@ def download_papyrus(outdir: Optional[str] = None,
|
|
|
23
23
|
structures: bool = False,
|
|
24
24
|
descriptors: Optional[Union[str, List[str]]] = 'all',
|
|
25
25
|
progress: bool = True,
|
|
26
|
-
disk_margin: float = 0.10
|
|
26
|
+
disk_margin: float = 0.10,
|
|
27
|
+
update_links: bool = True) -> None:
|
|
27
28
|
"""Download the Papyrus data.
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
:param outdir: directory where Papyrus data is stored (default: pystow's directory)
|
|
30
31
|
:param version: version of the dataset to be downloaded
|
|
31
32
|
:param nostereo: should 2D data be downloaded
|
|
@@ -35,13 +36,14 @@ def download_papyrus(outdir: Optional[str] = None,
|
|
|
35
36
|
:param descriptors: should molecular and protein descriptors be downloaded
|
|
36
37
|
:param progress: should progress be displayed
|
|
37
38
|
:param disk_margin: percent of free disk space to keep
|
|
39
|
+
:param update_links: Should links be updated (allows new versions to be fetched)
|
|
38
40
|
"""
|
|
39
41
|
|
|
40
42
|
# Determine download parameters
|
|
41
43
|
CHUNKSIZE = 1048576 # 1 MB
|
|
42
44
|
RETRIES = 3
|
|
43
45
|
# Obtain links to files
|
|
44
|
-
files = get_papyrus_links()
|
|
46
|
+
files = get_papyrus_links(offline=not update_links)
|
|
45
47
|
available_versions = list(files.keys())
|
|
46
48
|
if isinstance(version, list):
|
|
47
49
|
for _version in version:
|
|
@@ -74,6 +76,7 @@ def download_papyrus(outdir: Optional[str] = None,
|
|
|
74
76
|
papyrus_version_root = pystow.module('papyrus', _version)
|
|
75
77
|
# Prepare files to be downloaded
|
|
76
78
|
downloads = set()
|
|
79
|
+
downloads.add('readme')
|
|
77
80
|
downloads.add('requirements')
|
|
78
81
|
downloads.add('proteins')
|
|
79
82
|
if nostereo:
|