papyrus-scripts 1.0.3__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-1.0.3 → papyrus_scripts-2.0.0}/PKG-INFO +77 -30
- papyrus_scripts-2.0.0/README.md +206 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/setup.cfg +1 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/__init__.py +6 -2
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/download.py +6 -3
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/modelling.py +5 -5
- papyrus_scripts-2.0.0/src/papyrus_scripts/oop.py +550 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/preprocess.py +167 -22
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/reader.py +16 -12
- {papyrus_scripts-1.0.3 → 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.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/links.json +121 -23
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/PKG-INFO +78 -31
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/SOURCES.txt +4 -1
- {papyrus_scripts-1.0.3 → 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.3/README.md +0 -176
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/LICENSE +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/setup.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/__main__.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/cli.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/fingerprint.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/matchRCSB.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/neuralnet.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/subsim_search.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/UniprotMatch.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/__init__.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts/utils/mol_reader.py +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/dependency_links.txt +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/entry_points.txt +0 -0
- {papyrus_scripts-1.0.3 → papyrus_scripts-2.0.0}/src/papyrus_scripts.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: papyrus_scripts
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: A collection of scripts to handle the Papyrus bioactivity dataset
|
|
5
5
|
Home-page: https://github.com/OlivierBeq/Papyrus-scripts
|
|
6
6
|
Author: Olivier J. M. Béquignon - Brandon J. Bongers - Willem Jespers
|
|
@@ -16,15 +16,32 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.7
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.6
|
|
18
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
|
|
19
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"
|
|
20
36
|
Provides-Extra: testing
|
|
21
|
-
|
|
37
|
+
Requires-Dist: pytest; extra == "testing"
|
|
38
|
+
Requires-Dist: parameterized; extra == "testing"
|
|
22
39
|
|
|
23
40
|
# Papyrus-scripts
|
|
24
41
|
|
|
25
42
|
Collection of scripts to interact with the Papyrus bioactivity dataset.
|
|
26
43
|
|
|
27
|
-

|
|
44
|
+

|
|
28
45
|
|
|
29
46
|
<br/>
|
|
30
47
|
|
|
@@ -70,27 +87,38 @@ Additional dependencies can be installed to allow:
|
|
|
70
87
|
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
|
|
71
88
|
```
|
|
72
89
|
|
|
73
|
-
##
|
|
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.
|
|
74
96
|
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
```
|
|
77
106
|
|
|
78
|
-
###
|
|
107
|
+
### Functional API (legacy)
|
|
79
108
|
|
|
80
|
-
|
|
81
|
-
|
|
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).
|
|
82
111
|
|
|
83
|
-
|
|
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.
|
|
84
114
|
```bash
|
|
85
115
|
papyrus download -V latest
|
|
86
116
|
```
|
|
87
|
-
|
|
88
|
-
- 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.
|
|
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.
|
|
89
118
|
```bash
|
|
90
119
|
papyrus download -V 05.5 --more --d all
|
|
91
120
|
```
|
|
92
|
-
|
|
93
|
-
- The following command will download Papyrus++ bioactivities, protein targets and compound structures for both version 05.4 and 05.5.
|
|
121
|
+
The following command will download Papyrus++ bioactivities, protein targets and compound structures for both version 05.4 and 05.5.
|
|
94
122
|
```bash
|
|
95
123
|
papyrus download -V 05.5 -V 05.4 -S
|
|
96
124
|
```
|
|
@@ -103,7 +131,7 @@ papyrus download --help
|
|
|
103
131
|
By default, the data is downloaded to [pystow](https://github.com/cthoyt/pystow)'s default directory.<br/>
|
|
104
132
|
One can override the folder path by specifying the `-o` switch in the above commands.
|
|
105
133
|
|
|
106
|
-
|
|
134
|
+
#### Donwloading with the functional API
|
|
107
135
|
|
|
108
136
|
```python
|
|
109
137
|
|
|
@@ -113,16 +141,37 @@ from papyrus_scripts import download_papyrus
|
|
|
113
141
|
download_papyrus(version='latest', only_pp=False, structures=True, descriptors='all')
|
|
114
142
|
```
|
|
115
143
|
|
|
116
|
-
|
|
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
|
|
117
165
|
|
|
118
166
|
Different online servers host the Papyrus data based on release and ChEMBL version (table below).
|
|
119
167
|
|
|
120
168
|
|
|
121
|
-
| Papyrus version | ChEMBL version |
|
|
122
|
-
|
|
123
|
-
| 05.4 | 29 |
|
|
124
|
-
| 05.5 | 30 | [:heavy_check_mark:](https://zenodo.org/
|
|
125
|
-
| 05.6 | 31 | [:heavy_check_mark:](https://zenodo.org/
|
|
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: |
|
|
126
175
|
|
|
127
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.
|
|
128
177
|
|
|
@@ -159,9 +208,9 @@ remove_papyrus(papyrus_root=True)
|
|
|
159
208
|
## Easy handling of the dataset
|
|
160
209
|
|
|
161
210
|
Once installed the Papyrus-scripts allow for the easy filtering of the data.<br/>
|
|
162
|
-
- Simple examples can be found in the <a href="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)
|
|
163
|
-
- An example on matching data with the Protein Data Bank can be found in the <a href="notebook_examples/matchRCSB.ipynb">simple_examples.ipynb</a> notebook. [](https://colab.research.google.com/github/OlivierBeq/Papyrus-scripts/blob/master/notebook_examples/matchRCSB.ipynb)
|
|
164
|
-
- More advanced examples will be added to the <a href="notebook_examples/advanced_querying.ipynb">advanced_querying.ipynb</a> notebook.
|
|
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.
|
|
165
214
|
## Reproducing results of the pre-print
|
|
166
215
|
|
|
167
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>.
|
|
@@ -182,17 +231,15 @@ The scripts used to extract subsets, generate models and obtain visualizations c
|
|
|
182
231
|
|
|
183
232
|
## Logos
|
|
184
233
|
|
|
185
|
-
Logos can be found under <a href="figures/logo">**figures/logo**</a>
|
|
234
|
+
Logos can be found under <a href="https://github.com/OlivierBeq/Papyrus-scripts/tree/master/figures/logo">**figures/logo**</a>
|
|
186
235
|
Two version exist depending on the background used.
|
|
187
236
|
|
|
188
237
|
:warning: GitHub does not render the white logo properly in the table below but should not deter you from using it!
|
|
189
238
|
|
|
190
239
|
<div class="colored-table">
|
|
191
240
|
|
|
192
|
-
|
|
|
193
|
-
|
|
194
|
-
|
|
|
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> |
|
|
195
244
|
|
|
196
245
|
</div>
|
|
197
|
-
|
|
198
|
-
|
|
@@ -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:
|
|
@@ -150,7 +150,7 @@ def model_metrics(model, y_true, x_test) -> dict:
|
|
|
150
150
|
values['F1'] = 2 * values['Sensitivity'] * values['PPV'] / (values['Sensitivity'] + values['PPV']) \
|
|
151
151
|
if (values['Sensitivity'] + values['PPV']) != 0 \
|
|
152
152
|
else 0
|
|
153
|
-
if hasattr(model, "predict_proba"):
|
|
153
|
+
if hasattr(model, "predict_proba"): # able to predict probability
|
|
154
154
|
y_probas = model.predict_proba(x_test)
|
|
155
155
|
if y_probas.shape[1] == 1:
|
|
156
156
|
y_proba = y_probas.ravel()
|
|
@@ -191,7 +191,7 @@ def model_metrics(model, y_true, x_test) -> dict:
|
|
|
191
191
|
if (values['%s|Sensitivity' % model.classes_[i]] + values['%s|PPV' % model.classes_[i]]) != 0 \
|
|
192
192
|
else 0
|
|
193
193
|
i += 1
|
|
194
|
-
if hasattr(model, "predict_proba"):
|
|
194
|
+
if hasattr(model, "predict_proba"): # able to predict probability
|
|
195
195
|
y_probas = model.predict_proba(x_test)
|
|
196
196
|
try:
|
|
197
197
|
values['AUC 1 vs 1'] = ROCAUC(y_true, y_probas, average="macro", multi_class="ovo")
|
|
@@ -238,7 +238,7 @@ def crossvalidate_model(data: pd.DataFrame,
|
|
|
238
238
|
# Organize result in a dataframe
|
|
239
239
|
performance = pd.DataFrame(performance)
|
|
240
240
|
performance.index = [f'Fold {i + 1}' for i in range(folds.n_splits)]
|
|
241
|
-
# Add average and sd of
|
|
241
|
+
# Add average and sd of performance
|
|
242
242
|
performance.loc['Mean'] = [np.mean(performance[col]) if ':' not in col else '-' for col in performance]
|
|
243
243
|
performance.loc['SD'] = [np.std(performance[col]) if ':' not in col else '-' for col in performance]
|
|
244
244
|
# Fit model on the entire dataset
|
|
@@ -349,7 +349,7 @@ def qsar(data: pd.DataFrame,
|
|
|
349
349
|
:return: both:
|
|
350
350
|
- a dataframe of the cross-validation results where each line is a fold of QSAR modelling of an accession
|
|
351
351
|
- a dictionary of the feature scaler (if used), label encoder (if mode is a classifier),
|
|
352
|
-
the data splitter for cross-validation,
|
|
352
|
+
the data splitter for cross-validation, and for each accession in the data:
|
|
353
353
|
the fitted models on each cross-validation fold and the model fitted on the complete training set.
|
|
354
354
|
"""
|
|
355
355
|
if split_by.lower() not in ['year', 'random', 'cluster', 'custom-cluster', 'custom']:
|
|
@@ -710,7 +710,7 @@ def pcm(data: pd.DataFrame,
|
|
|
710
710
|
"""
|
|
711
711
|
if split_by.lower() not in ['year', 'random', 'cluster', 'custom-cluster', 'custom']:
|
|
712
712
|
raise ValueError("split not supported, must be one of {'Year', 'random', 'cluster', "
|
|
713
|
-
"'custom-cluster',
|
|
713
|
+
"'custom-cluster', 'custom'}")
|
|
714
714
|
if not isinstance(model, (RegressorMixin, ClassifierMixin)):
|
|
715
715
|
raise ValueError('model type can only be a Scikit-Learn compliant regressor or classifier')
|
|
716
716
|
warnings.filterwarnings("ignore", category=RuntimeWarning)
|