papyrus-scripts 2.1.0__tar.gz → 2.1.1__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.
Files changed (32) hide show
  1. {papyrus_scripts-2.1.0/src/papyrus_scripts.egg-info → papyrus_scripts-2.1.1}/PKG-INFO +1 -1
  2. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/__init__.py +1 -1
  3. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/oop.py +247 -23
  4. papyrus_scripts-2.1.1/src/papyrus_scripts/utils/links2.json +408 -0
  5. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1/src/papyrus_scripts.egg-info}/PKG-INFO +1 -1
  6. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts.egg-info/SOURCES.txt +2 -0
  7. papyrus_scripts-2.1.1/tests/test.py +31 -0
  8. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/LICENSE +0 -0
  9. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/README.md +0 -0
  10. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/setup.cfg +0 -0
  11. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/setup.py +0 -0
  12. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/__main__.py +0 -0
  13. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/cli.py +0 -0
  14. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/download.py +0 -0
  15. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/fingerprint.py +0 -0
  16. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/matchRCSB.py +0 -0
  17. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/modelling.py +0 -0
  18. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/neuralnet.py +0 -0
  19. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/preprocess.py +0 -0
  20. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/reader.py +0 -0
  21. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/subsim_search.py +0 -0
  22. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/utils/IO.py +0 -0
  23. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/utils/UniprotMatch.py +0 -0
  24. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/utils/__init__.py +0 -0
  25. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/utils/aliases.json +0 -0
  26. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/utils/links.json +0 -0
  27. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts/utils/mol_reader.py +0 -0
  28. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts.egg-info/dependency_links.txt +0 -0
  29. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts.egg-info/entry_points.txt +0 -0
  30. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts.egg-info/requires.txt +0 -0
  31. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/src/papyrus_scripts.egg-info/top_level.txt +0 -0
  32. {papyrus_scripts-2.1.0 → papyrus_scripts-2.1.1}/tests/test_oop.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: papyrus_scripts
3
- Version: 2.1.0
3
+ Version: 2.1.1
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
@@ -20,4 +20,4 @@ from .utils.IO import PapyrusVersion
20
20
 
21
21
  from .oop import PapyrusDataset
22
22
 
23
- __version__ = '2.1.0'
23
+ __version__ = '2.1.1'
@@ -5,6 +5,7 @@
5
5
  from __future__ import annotations
6
6
 
7
7
  import os
8
+ from abc import ABC
8
9
  from typing import Any, Dict, Iterator, List, Union, Optional
9
10
 
10
11
  import pystow
@@ -26,6 +27,15 @@ class PapyrusDataset:
26
27
  def __init__(self, version: str | IO.PapyrusVersion = 'latest', is3d: bool = False, plusplus: bool = True,
27
28
  chunksize: Optional[int] = 1_000_000, source_path: Optional[str] = None,
28
29
  download_progress: bool = False):
30
+ """Read, filter and aggregate data from a release of the Papyrus dataset.
31
+
32
+ :param version: version to be used. Either a `PapyrusVersion` or a `str` object to be passed to `PapyrusVersion` (default : 'latest')
33
+ :param is3d: should the lower-quality data with stereochemistry be read (default: False)
34
+ :param plusplus: read the Papyrus++ curated subset of even higher quality (defulat: True)
35
+ :param chunksize: number of lines per chunk. To read without chunks (not recommended) set to None (default: 1_000_000)
36
+ :param source_path: folder containing the bioactivity dataset (default: pystow's home folder)
37
+ :param download_progress: if the data not be on disk, should progress of the download be shown
38
+ """
29
39
  version = IO.PapyrusVersion(version=version)
30
40
  if not IO.is_local_version_available(version=version.version_old_fmt, root_folder=source_path):
31
41
  download.download_papyrus(outdir=source_path, version=version.version_old_fmt, nostereo=True, stereo=True,
@@ -50,6 +60,16 @@ class PapyrusDataset:
50
60
  source_path: Optional[str] = None,
51
61
  download_progress: bool = False
52
62
  ) -> PapyrusDataset:
63
+ """Create a PapyrusDataset from a pandas DataFrame.
64
+
65
+ :param df: pandas DataFrame containing filtered Papyrus data samples (must preserve all default columns)
66
+ :param is3d: are the samples derived from the lower-quality data with stereochemistry
67
+ :param version: version of the dataset the samples were obtained from
68
+ :param plusplus: whether the samples were derived from Papyrus++
69
+ :param source_path: folder containing the original bioactivity dataset (default: pystow's home folder)
70
+ :param download_progress: if the data was not on disk, was progress of the download shown
71
+ :return: the `PapyrusDataset` object corresponding to the given samples
72
+ """
53
73
  dataset = PapyrusDataset.__new__(PapyrusDataset)
54
74
  dataset.papyrus_bioactivity_data = df
55
75
  dataset.papyrus_protein_data = reader.read_protein_set(source_path=source_path, version=version)
@@ -64,6 +84,14 @@ class PapyrusDataset:
64
84
  papyrus_protein_data: pd.DataFrame,
65
85
  papyrus_params: Dict
66
86
  ) -> PapyrusDataset:
87
+ """Create a PapyrusDataset from a bioactivities, proteins and initial parameters.
88
+
89
+ :param papyrus_bioactivity_data: bioactivity information obtained from a PapyrusDataset object
90
+ :param papyrus_protein_data: protein information obtained from a PapyrusDataset object
91
+ :param papyrus_params: parameters of the PapyrusDataset object `papyrus_bioactivity_data` and
92
+ `papyrus_protein_data` were obtained from
93
+ :return: the `PapyrusDataset` object corresponding to the given data
94
+ """
67
95
  dataset = PapyrusDataset.__new__(PapyrusDataset)
68
96
  dataset.papyrus_bioactivity_data = papyrus_bioactivity_data
69
97
  dataset.papyrus_protein_data = papyrus_protein_data
@@ -73,12 +101,14 @@ class PapyrusDataset:
73
101
 
74
102
  @property
75
103
  def _filter(self) -> PapyrusDataFilter:
104
+ """Create a PapyrusDataFilter object around the current dataset."""
76
105
  return PapyrusDataFilter(papyrus_bioactivity_data=self.papyrus_bioactivity_data,
77
106
  papyrus_protein_data=self.papyrus_protein_data,
78
107
  papyrus_params=self.papyrus_params)
79
108
 
80
109
  @property
81
110
  def _fpsubsim2(self) -> FPSubSim2Engine:
111
+ """Obtain the FPSubSim2Engine for substructure and similarity searches."""
82
112
  if self._fpsubsim2_ is None:
83
113
  self._fpsubsim2_ = FPSubSim2Engine(self.papyrus_params)
84
114
  self._fpsubsim2_._set_data(papyrus_bioactivity_data=self.papyrus_bioactivity_data,
@@ -86,56 +116,121 @@ class PapyrusDataset:
86
116
  return self._fpsubsim2_
87
117
 
88
118
  def keep_quality(self, min_quality: str) -> PapyrusDataset:
119
+ """Keep samples whose quality is at least the one supplied (e.g. 'medium' for both medium and high-quality)."""
89
120
  return self._filter.keep_quality(min_quality=min_quality)
90
121
 
91
122
  def keep_source(self, source: Union[List[str], str]) -> PapyrusDataset:
123
+ """Keep samples of specific data source(s) (e.g. 'chembl' or ['chembl', 'klaeger'])."""
92
124
  return self._filter.keep_source(source=source)
93
125
 
94
126
  def keep_activity_type(self, activity_types: Union[List[str], str]) -> PapyrusDataset:
127
+ """Keep samples of specific activity type(s) (e.g. 'ic50' or ['ki', 'ec50'])."""
95
128
  return self._filter.keep_activity_type(activity_types=activity_types)
96
129
 
97
130
  def keep_accession(self, accession: Union[List[str], str] = 'all') -> PapyrusDataset:
131
+ """Keep samples of specific accession(s) (e.g. 'P00533' or ['P11362', 'P35968'])."""
98
132
  return self._filter.keep_accession(accession=accession)
99
133
 
100
134
  def keep_protein_class(self, classes: Optional[Union[dict, List[dict]]],
101
135
  generic_regex: bool = False) -> PapyrusDataset:
136
+ """Keep samples whose protein targets belong to a specific protein class(es).
137
+
138
+ :param classes: protein class(es) (e.g. {'l2': 'Kinase'} or [{'l2': 'Kinase'}, {'l1': 'Membrane receptor'}]).
139
+ :param generic_regex: should the generic pattern 'l?' be considered as a regex, allowing for partial matching.
140
+ """
102
141
  return self._filter.keep_protein_class(classes=classes, generic_regex=generic_regex)
103
142
 
104
143
  def keep_organism(self, organism: Optional[Union[str, List[str]]],
105
144
  generic_regex: bool = False) -> PapyrusDataset:
145
+ """Keep samples whose protein targets belong to specific organisms.
146
+
147
+ :param organism: organism (e.g. 'Homo sapiens (Human)' or ['Bos taurus (Bovine)', 'Rattus norvegicus (Rat)'])
148
+ :param generic_regex: should partial matching be considered (e.g. 'human' or 'Pig')
149
+ """
106
150
  return self._filter.keep_organism(organism=organism, generic_regex=generic_regex)
107
151
 
108
152
  def contains(self, column: str, value: str, case: bool = True, regex: bool = False) -> PapyrusDataset:
153
+ """Keep samples with the specified field corresponding to the given value.
154
+
155
+ :param column: column to be checked for `value` in order for samples to be included
156
+ :param value: value the column must match
157
+ :param case: should the value matching be case-sensitive (default: True)
158
+ :param regex: should the given `value` be interpreted as a regular expression
159
+ """
109
160
  return self._filter.contains(column=column, value=value, case=case, regex=regex)
110
161
 
111
162
  def not_contains(self, column: str, value: str, case: bool = True, regex: bool = False) -> PapyrusDataset:
163
+ """Keep samples whose specified field not corresponding to the given value (opposite of the `contains` method).
164
+
165
+ :param column: column to be checked for `value` in order for samples to be included
166
+ :param value: value the column must match
167
+ :param case: should the value matching be case-sensitive (default: True)
168
+ :param regex: should the given `value` be interpreted as a regular expression
169
+ """
112
170
  return self._filter.not_contains(column=column, value=value, case=case, regex=regex)
113
171
 
114
172
  def isin(self, column: str, values: Union[Any, List[Any]]) -> PapyrusDataset:
173
+ """Keep samples whose value of the specified field is in the given options.
174
+
175
+ :param column: column to be checked for `values` in order for samples to be included
176
+ :param values: values the column must contain
177
+ """
115
178
  return self._filter.isin(column=column, values=values)
116
179
 
117
180
  def not_isin(self, column: str, values: Union[Any, List[Any]]) -> PapyrusDataset:
181
+ """Keep samples whose value of the specified field is not in the given options.
182
+
183
+ :param column: column to be checked for `values` in order for samples to be included
184
+ :param values: values the column must not contain
185
+ """
118
186
  return self._filter.not_isin(column=column, values=values)
119
187
 
120
188
  def keep_similar_molecules(self, smiles: Union[str, List[str]],
121
189
  fingerprint: fingerprint.Fingerprint = fingerprint.MorganFingerprint(),
122
190
  threshold: float = 0.7, cuda: bool = False) -> PapyrusDataset:
191
+ """Keep samples whose molecular structures are similar to any of the given SMILES.
192
+
193
+ :param smiles: SMILES the molecular structures must be similar to
194
+ :param fingerprint: type of fingerprint (subclass of `papyrus_scripts.fingerprint.Fingerprint`; default: `papyrus_scripts.fingerprint.MorganFingerprint`)
195
+ :param threshold: threshold of similarity to one of the given SMILES for a molecule to be considered a hit (default: 0.7)
196
+ :param cuda: should CUDA acceleration be used (default: False)
197
+ """
123
198
  return self._fpsubsim2.keep_similar_molecules(smiles=smiles, fingerprint=fingerprint, threshold=threshold,
124
199
  cuda=cuda)
125
200
 
126
201
  def keep_dissimilar_molecules(self, smiles: Union[str, List[str]],
127
202
  fingerprint: fingerprint.Fingerprint = fingerprint.MorganFingerprint(),
128
203
  threshold: float = 0.7, cuda: bool = False) -> PapyrusDataset:
204
+ """Keep samples whose molecular structures are not similar to any of the given SMILES.
205
+
206
+ :param smiles: SMILES the molecular structures must not be similar to
207
+ :param fingerprint: type of fingerprint (subclass of `papyrus_scripts.fingerprint.Fingerprint`; default: `papyrus_scripts.fingerprint.MorganFingerprint`)
208
+ :param threshold: threshold of similarity to one of the given SMILES for a molecule to be considered a hit (default: 0.7)
209
+ :param cuda: should CUDA acceleration be used (default: False)
210
+ """
129
211
  return self._fpsubsim2.keep_dissimilar_molecules(smiles=smiles, fingerprint=fingerprint, threshold=threshold,
130
212
  cuda=cuda)
131
213
 
132
214
  def keep_substructure_molecules(self, smiles: Union[str, List[str]]) -> PapyrusDataset:
215
+ """Keep samples whose molecular structures are substructures of any of the provided SMILES.
216
+
217
+ :param smiles: SMILES the molecular structures must not be substructures of
218
+ """
133
219
  return self._fpsubsim2.keep_substructure_molecules(smiles=smiles)
134
220
 
135
221
  def keep_not_substructure_molecules(self, smiles: Union[str, List[str]]) -> PapyrusDataset:
222
+ """Keep samples whose molecular structures are not substructures of any of the provided SMILES.
223
+
224
+ :param smiles: SMILES the molecular structures must not be substructures of
225
+ """
136
226
  return self._fpsubsim2.keep_not_substructure_molecules(smiles=smiles)
137
227
 
138
228
  def aggregate(self, progress: bool = False) -> pd.DataFrame:
229
+ """Aggregate the data in a PapyrusDataset to a pandas DataFrame.
230
+
231
+ :param progress: should filtering progress be shown
232
+ :return: a pandas DataFrame of the filtered data.
233
+ """
139
234
  total = (-(-self.papyrus_params['num_rows'] // self.papyrus_params['chunksize'])
140
235
  if self.papyrus_params['chunksize'] is not None
141
236
  else None)
@@ -145,15 +240,35 @@ class PapyrusDataset:
145
240
  progress=progress, total=total)
146
241
 
147
242
  def agg(self, progress: bool = False) -> pd.DataFrame:
243
+ """Aggregate the data in a PapyrusDataset to a pandas DataFrame (synonym of PapyrusDataset.aggregate).
244
+
245
+ :param progress: should filtering progress be shown
246
+ :return: a pandas DataFrame of the filtered data.
247
+ """
148
248
  return self.aggregate(progress=progress)
149
249
 
150
250
  def consume_chunks(self, progress: bool = False) -> pd.DataFrame:
251
+ """Aggregate the data in a PapyrusDataset to a pandas DataFrame (synonym of PapyrusDataset.aggregate).
252
+
253
+ :param progress: should filtering progress be shown
254
+ :return: a pandas DataFrame of the filtered data.
255
+ """
151
256
  return self.aggregate(progress=progress)
152
257
 
153
258
  def to_dataframe(self, progress: bool = False) -> pd.DataFrame:
259
+ """Aggregate the data in a PapyrusDataset to a pandas DataFrame (synonym of PapyrusDataset.aggregate).
260
+
261
+ :param progress: should filtering progress be shown
262
+ :return: a pandas DataFrame of the filtered data.
263
+ """
154
264
  return self.aggregate(progress=progress)
155
265
 
156
266
  def molecules(self, chunksize: Optional[int] = 1_000_000, progress: bool = False) -> PapyrusMoleculeSet:
267
+ """Get the structures of the molecules corresponding to the samples in the current PapyrusDataset.
268
+
269
+ :param chunksize: number of molecules to be loaded at once. To read without chunks (not recommended) set to None (default: 1_000_000).
270
+ :param progress: should progress of molecule aggregation be shown.
271
+ """
157
272
  ids = self.aggregate(progress=progress)['connectivity' if not self.papyrus_params['is3d'] else 'InChIKey'].unique()
158
273
  molecules = reader.read_molecular_structures(is3d=self.papyrus_params['is3d'],
159
274
  version=self.papyrus_params['version'],
@@ -163,12 +278,24 @@ class PapyrusDataset:
163
278
  return PapyrusMoleculeSet(molecules, {**self.papyrus_params, 'chunksize': chunksize})
164
279
 
165
280
  def proteins(self, progress: bool = False) -> PapyrusProteinSet:
281
+ """Get the protein targets corresponding to the samples in the current PapyrusDataset.
282
+
283
+ :param progress: should progress of molecule aggregation be shown.
284
+ """
166
285
  ids = self.aggregate(progress=progress)['target_id'].unique()
167
286
  proteins = self.papyrus_protein_data[self.papyrus_protein_data.target_id.isin(ids)]
168
287
  return PapyrusProteinSet(proteins, self.papyrus_params,
169
288
  len(proteins))
170
289
 
171
290
  def match_rcsb_pdb(self, update: bool = True, progress: bool = False) -> PapyrusPDBProteinSet:
291
+ """Get the protein 3D structures from the RCSB Protein Data Bank of both protein targets and molecules
292
+ corresponding to the samples in the current PapyrusDataset .
293
+
294
+
295
+ :param update: should the local cache of PDB identifiers be updated (default: False).
296
+ :param progress: should progress of molecule aggregation be shown
297
+ :return: should progress of 3D structure aggregation be shown.
298
+ """
172
299
  total = (-(-self.papyrus_params['num_rows'] // self.papyrus_params['chunksize'])
173
300
  if self.papyrus_params['chunksize'] is not None
174
301
  else None)
@@ -206,6 +333,23 @@ class PapyrusDataset:
206
333
  force: bool = False,
207
334
  progress: bool = True,
208
335
  source_path: Optional[str] = None) -> None:
336
+ """Remove the data of the Papyrus dataset with multiple levels of deletion.
337
+
338
+ :param version: version to delete
339
+ :param remove_papyruspp: should Papyrus++ be removed
340
+ :param remove_bioactivities: should bioactivity data be removed
341
+ :param remove_proteins: should protein data be removed
342
+ :param remove_nostereo: should the stereochemistry-agnostic data be removed
343
+ :param remove_stereo: should the stereochemistry-aware data be removed
344
+ :param remove_structures: should molecular structures be removed
345
+ :param remove_descriptors: should molecular descriptors be removed
346
+ :param remove_other_files: should any additional file be removed
347
+ :param remove_version_root: should all the data of that version be removed
348
+ :param remove_papyrus_root: should all data all versions combined be removed
349
+ :param force: avoid asking for confirmation
350
+ :param progress: should deletion progress
351
+ :param source_path: folder containing the bioactivity dataset (default: pystow's home folder)
352
+ """
209
353
  download.remove_papyrus(outdir=source_path, version=version, papyruspp=remove_papyruspp,
210
354
  bioactivities=remove_bioactivities, proteins=remove_proteins,
211
355
  nostereo=remove_nostereo, stereo=remove_stereo, structures=remove_structures,
@@ -426,6 +570,11 @@ class PapyrusMoleculeSet:
426
570
  root_folder=self.papyrus_params['source_path'])
427
571
 
428
572
  def to_dataframe(self, progress: bool = False):
573
+ """Aggregate the data in a PapyrusMoleculeSet to a pandas DataFrame (synonym of `PapyrusMoleculeSet.aggregate`).
574
+
575
+ :param progress: should aggregation progress be shown
576
+ :return: a pandas DataFrame of the molecules.
577
+ """
429
578
  if isinstance(self.data, Iterator):
430
579
  return self.aggregate(progress=progress)
431
580
  return self.data
@@ -436,6 +585,12 @@ class PapyrusMoleculeSet:
436
585
  return f'{type(self).__name__}<{len(self.data)} molecules>'
437
586
 
438
587
  def molecular_descriptors(self, desc_type: str, progress: bool = False) -> pd.DataFrame:
588
+ """Obtain the molecular descriptors of the molecules in the current PapyrusMoleculeSet.
589
+
590
+ :param desc_type: type of descriptor to be obtained. One of {'mold2', 'mordred', 'cddd', 'fingerprint', 'moe', 'all'}
591
+ :param progress: should aggregation progress be shown
592
+ :return: a pandas DataFrame of the molecular descriptors.
593
+ """
439
594
  ids = self.aggregate(progress)['connectivity' if self.papyrus_params['is3d'] else 'InChIKey'].unique()
440
595
  # Handle descriptors not yet downloaded
441
596
  try:
@@ -456,6 +611,11 @@ class PapyrusMoleculeSet:
456
611
  return self.molecular_descriptors(desc_type, progress)
457
612
 
458
613
  def aggregate(self, progress: bool = False) -> pd.DataFrame:
614
+ """Aggregate the data in a PapyrusMoleculeSet to a pandas DataFrame.
615
+
616
+ :param progress: should aggregation progress be shown
617
+ :return: a pandas DataFrame of the molecules.
618
+ """
459
619
  total = (-(-self.num_rows // self.papyrus_params['chunksize'])
460
620
  if self.papyrus_params['chunksize'] is not None
461
621
  else None)
@@ -465,12 +625,56 @@ class PapyrusMoleculeSet:
465
625
  progress=progress, total=total)
466
626
 
467
627
  def agg(self, progress: bool = False) -> pd.DataFrame:
628
+ """Aggregate the data in a PapyrusMoleculeSet to a pandas DataFrame (synonym of `PapyrusMoleculeSet.aggregate`).
629
+
630
+ :param progress: should aggregation progress be shown
631
+ :return: a pandas DataFrame of the molecules.
632
+ """
468
633
  return self.aggregate(progress=progress)
469
634
 
470
635
  def consume_chunks(self, progress: bool = False) -> pd.DataFrame:
636
+ """Aggregate the data in a PapyrusMoleculeSet to a pandas DataFrame (synonym of `PapyrusMoleculeSet.aggregate`).
637
+
638
+ :param progress: should aggregation progress be shown
639
+ :return: a pandas DataFrame of the molecules.
640
+ """
471
641
  return self.aggregate(progress=progress)
472
642
 
473
- class PapyrusProteinSet:
643
+
644
+ class ProteinSet(ABC):
645
+ """Abstract class."""
646
+
647
+ def protein_descriptors(self,
648
+ desc_type: Union[str, prodec.Descriptor, prodec.Transform],
649
+ progress: bool = False
650
+ ) -> pd.DataFrame:
651
+ """Obtain the protein descriptors of the protein targets in the current PapyrusPDBProteinSet.
652
+
653
+ :param desc_type: type of protein descriptor to be obtained. Either 'unirep' or a `ProDEC.Descriptor` or `ProDEC.Transform`.
654
+ :param progress: should aggregation progress be shown
655
+ :return: a pandas DataFrame of the protein descriptors.
656
+ """
657
+ self.data = self.aggregate(progress)
658
+ ids = self.data['target_id'].unique()
659
+ try:
660
+ return reader.read_protein_descriptors(desc_type=desc_type,
661
+ is3d=self.papyrus_params['is3d'],
662
+ version=self.papyrus_params['version'],
663
+ chunksize=self.papyrus_params['chunksize'],
664
+ source_path=self.papyrus_params['source_path'],
665
+ ids=ids,
666
+ verbose=progress)
667
+ except FileNotFoundError:
668
+ download.download_papyrus(outdir=self.papyrus_params['source_path'],
669
+ version=self.papyrus_params['version'],
670
+ nostereo=not self.papyrus_params['is3d'], stereo=self.papyrus_params['is3d'],
671
+ only_pp=self.papyrus_params['plusplus'], structures=False,
672
+ descriptors=desc_type, progress=self.papyrus_params['download_progress'],
673
+ disk_margin=0.0)
674
+ return self.protein_descriptors(desc_type, progress)
675
+
676
+
677
+ class PapyrusProteinSet(ProteinSet):
474
678
  def __init__(self, df: Union[pd.DataFrame, Iterator], papyrus_params: Dict, num_proteins: int):
475
679
  self.data = df
476
680
  self.papyrus_params = papyrus_params
@@ -482,6 +686,11 @@ class PapyrusProteinSet:
482
686
  return f'{type(self).__name__}<{len(self.data)} proteins>'
483
687
 
484
688
  def to_dataframe(self, progress: bool = False) -> pd.DataFrame:
689
+ """Aggregate the data in a PapyrusProteinSet to a pandas DataFrame (synonym of `PapyrusProteinSet.aggregate`).
690
+
691
+ :param progress: should aggregation progress be shown
692
+ :return: a pandas DataFrame of the proteins.
693
+ """
485
694
  if isinstance(self.data, Iterator):
486
695
  total = (-(-self.num_rows // self.papyrus_params['chunksize'])
487
696
  if self.papyrus_params['chunksize'] is not None
@@ -490,15 +699,31 @@ class PapyrusProteinSet:
490
699
  return self.data
491
700
 
492
701
  def aggregate(self, progress: bool = False) -> pd.DataFrame:
702
+ """Aggregate the data in a PapyrusProteinSet to a pandas DataFrame.
703
+
704
+ :param progress: should aggregation progress be shown
705
+ :return: a pandas DataFrame of the proteins.
706
+ """
493
707
  return self.to_dataframe(progress)
494
708
 
495
709
  def agg(self, progress: bool = False) -> pd.DataFrame:
710
+ """Aggregate the data in a PapyrusProteinSet to a pandas DataFrame.
711
+
712
+ :param progress: should aggregation progress be shown
713
+ :return: a pandas DataFrame of the proteins.
714
+ """
496
715
  return self.to_dataframe(progress=progress)
497
716
 
498
717
  def consume_chunks(self, progress: bool = False) -> pd.DataFrame:
718
+ """Aggregate the data in a PapyrusProteinSet to a pandas DataFrame.
719
+
720
+ :param progress: should aggregation progress be shown
721
+ :return: a pandas DataFrame of the proteins.
722
+ """
499
723
  return self.to_dataframe(progress=progress)
500
724
 
501
- class PapyrusPDBProteinSet:
725
+
726
+ class PapyrusPDBProteinSet(ProteinSet):
502
727
 
503
728
  def __init__(self, df: Union[pd.DataFrame, Iterator], papyrus_params: Dict, num_proteins: int):
504
729
  self.data = df
@@ -506,6 +731,11 @@ class PapyrusPDBProteinSet:
506
731
  self.num_rows = num_proteins
507
732
 
508
733
  def to_dataframe(self, progress: bool = False) -> pd.DataFrame:
734
+ """Aggregate the data in a PapyrusPDBProteinSet to a pandas DataFrame.
735
+
736
+ :param progress: should aggregation progress be shown
737
+ :return: a pandas DataFrame of the RCSB Protein Data Bank protein 3D structures.
738
+ """
509
739
  if isinstance(self.data, Iterator):
510
740
  total = (-(-self.num_rows // self.papyrus_params['chunksize'])
511
741
  if self.papyrus_params['chunksize'] is not None
@@ -518,33 +748,27 @@ class PapyrusPDBProteinSet:
518
748
  return f'{type(self).__name__}<iterator of proteins structures>'
519
749
  return f'{type(self).__name__}<{len(self.data)} proteins structures>'
520
750
 
521
- def protein_descriptors(self,
522
- desc_type: Union[str, prodec.Descriptor, prodec.Transform],
523
- progress: bool = False
524
- ) -> pd.DataFrame:
525
- ids = self.aggregate(progress)['target_id'].unique()
526
- try:
527
- return reader.read_protein_descriptors(desc_type=desc_type,
528
- is3d=self.papyrus_params['is3d'],
529
- version=self.papyrus_params['version'],
530
- chunksize=self.papyrus_params['chunksize'],
531
- source_path=self.papyrus_params['source_path'],
532
- ids=ids,
533
- verbose=progress)
534
- except FileNotFoundError:
535
- download.download_papyrus(outdir=self.papyrus_params['source_path'],
536
- version=self.papyrus_params['version'],
537
- nostereo=not self.papyrus_params['is3d'], stereo=self.papyrus_params['is3d'],
538
- only_pp=self.papyrus_params['plusplus'], structures=False,
539
- descriptors=desc_type, progress=self.papyrus_params['download_progress'],
540
- disk_margin=0.0)
541
- return self.protein_descriptors(desc_type, progress)
542
751
 
543
752
  def aggregate(self, progress: bool = False) -> pd.DataFrame:
753
+ """Aggregate the data in a PapyrusPDBProteinSet to a pandas DataFrame.
754
+
755
+ :param progress: should aggregation progress be shown
756
+ :return: a pandas DataFrame of the RCSB Protein Data Bank protein 3D structures.
757
+ """
544
758
  return self.to_dataframe(progress)
545
759
 
546
760
  def agg(self, progress: bool = False) -> pd.DataFrame:
761
+ """Aggregate the data in a PapyrusPDBProteinSet to a pandas DataFrame.
762
+
763
+ :param progress: should aggregation progress be shown
764
+ :return: a pandas DataFrame of the RCSB Protein Data Bank protein 3D structures.
765
+ """
547
766
  return self.to_dataframe(progress=progress)
548
767
 
549
768
  def consume_chunks(self, progress: bool = False) -> pd.DataFrame:
769
+ """Aggregate the data in a PapyrusPDBProteinSet to a pandas DataFrame.
770
+
771
+ :param progress: should aggregation progress be shown
772
+ :return: a pandas DataFrame of the RCSB Protein Data Bank protein 3D structures.
773
+ """
550
774
  return self.to_dataframe(progress=progress)
@@ -0,0 +1,408 @@
1
+ {
2
+ "05.4": {
3
+ "readme": {
4
+ "name": "README.txt",
5
+ "url": "https://zenodo.org/records/10944245/files/README.txt?download=1",
6
+ "size": 8743,
7
+ "sha256": "f552ae0b58121b20c9aefcce0737e5f31240d72676dc9ec559f97585aceb33ad"
8
+ },
9
+ "requirements": [
10
+ {
11
+ "name": "LICENSE.txt",
12
+ "url": "https://zenodo.org/records/10944245/files/LICENSE.txt?download=1",
13
+ "size": 20138,
14
+ "sha256": "3b2890eacd851373001c4a14623458e3adaf1b1967939aa9c38a318e28d61c00"
15
+ },
16
+ {
17
+ "name": "data_types.json",
18
+ "url": "https://zenodo.org/records/10944245/files/data_types.json?download=1",
19
+ "size": 450559,
20
+ "sha256": "d80a5810d99b62680ee1a214df5d5a30f505ec335a0c221194efb91d1c23913e"
21
+ },
22
+ {
23
+ "name": "data_size.json",
24
+ "url": "https://zenodo.org/records/10944245/files/data_size.json?download=1",
25
+ "size": 324,
26
+ "sha256": "decbe66e14eaeccf5e0f657bb33065600b503e2902503aa59f5ffa81b7126775"
27
+ }
28
+ ],
29
+ "papyrus++": {
30
+ "name": "05.4++_combined_set_without_stereochemistry.tsv.xz",
31
+ "url": "https://zenodo.org/records/10944245/files/05.4++_combined_set_without_stereochemistry.tsv.xz?download=1",
32
+ "size": 40278204,
33
+ "sha256": "42dcbe76b33ad541f6c54673eccffa15af64785cf844938c0f73518dfdf4404b"
34
+ },
35
+ "2D_papyrus": {
36
+ "name": "05.4_combined_set_without_stereochemistry.tsv.xz",
37
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_set_without_stereochemistry.tsv.xz?download=1",
38
+ "size": 742110788,
39
+ "sha256": "1a1c946917f77d9a250a181c8ef19bea4d04871915e9e75a615893a2c514684e"
40
+ },
41
+ "2D_structures": {
42
+ "name": "05.4_combined_2D_set_without_stereochemistry.sd.xz",
43
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_2D_set_without_stereochemistry.sd.xz?download=1",
44
+ "size": 416640448,
45
+ "sha256": "4595f726daf12a784049f20e9f9464ed0287af3a22a27f2a919399c535f633fc"
46
+ },
47
+ "3D_papyrus": {
48
+ "name": "05.4_combined_set_with_stereochemistry.tsv.xz",
49
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_set_with_stereochemistry.tsv.xz?download=1",
50
+ "size": 777395668,
51
+ "sha256": "56cf389030246d4525bb31cd3dfc9e5ab3afa9613535d1540c71f0f7426c778f"
52
+ },
53
+ "3D_structures": {
54
+ "name": "05.4_combined_3D_set_with_stereochemistry.sd.xz",
55
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_3D_set_with_stereochemistry.sd.xz?download=1",
56
+ "size": 446702556,
57
+ "sha256": "b0f04e066b7ac6b1e1f2a868ff0258b13bd8d3433023ff59c3af58317bfeb3e9"
58
+ },
59
+ "2D_fingerprint": {
60
+ "name": "05.4_combined_2D_moldescs_ECFP6.tsv.xz",
61
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_2D_moldescs_ECFP6.tsv.xz?download=1",
62
+ "size": 141318356,
63
+ "sha256": "4ab781cc238107f7c48f1d866eea0e2114068b6512acf74932a5b21958c9ffe0"
64
+ },
65
+ "3D_fingerprint": {
66
+ "name": "05.4_combined_3D_moldescs_E3FP.tsv.xz",
67
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_3D_moldescs_E3FP.tsv.xz?download=1",
68
+ "size": 146751352,
69
+ "sha256": "2b89027dad8f4e59f007dd082664a7d2a491f4f79d112fb29f14565acedfe4d0"
70
+ },
71
+ "2D_mordred": {
72
+ "name": "05.4_combined_2D_moldescs_mordred2D.tsv.xz",
73
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_2D_moldescs_mordred2D.tsv.xz?download=1",
74
+ "size": 3085232504,
75
+ "sha256": "d15bca59f542a6c46528e4f131cb44d8bd6b21440ab139f4175f4327c15c39c6"
76
+ },
77
+ "3D_mordred": {
78
+ "name": "05.4_combined_3D_moldescs_mordred3D.tsv.xz",
79
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_3D_moldescs_mordred3D.tsv.xz?download=1",
80
+ "size": 2996851908,
81
+ "sha256": "80fc4f9b2d0b89e68c289c44e9f4df78f4c08e5867cd414d6169a4e1344aead8"
82
+ },
83
+ "2D_cddd": {
84
+ "name": "05.4_combined_2D_moldescs_CDDDs.tsv.xz",
85
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_2D_moldescs_CDDDs.tsv.xz?download=1",
86
+ "size": 3770082588,
87
+ "sha256": "9bb0d9adba1b812aa05b6391ecbc3f0148f6ed37972a004b13772d08790a9bda"
88
+ },
89
+ "2D_mold2": {
90
+ "name": "05.4_combined_2D_moldescs_mold2.tsv.xz",
91
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_2D_moldescs_mold2.tsv.xz?download=1",
92
+ "size": 1552425452,
93
+ "sha256": "bdfb0cbb6e9a3d1b62065808fa0e6ce238e04760df62e34ce4f15046810efd82"
94
+ },
95
+ "proteins": {
96
+ "name": "05.4_combined_set_protein_targets.tsv.xz",
97
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_set_protein_targets.tsv.xz?download=1",
98
+ "size": 1701316,
99
+ "sha256": "5f49030509ce188a119910f16054558e1cdd1c70a22d2a1458ec4189f5d1a08e"
100
+ },
101
+ "proteins_unirep": {
102
+ "name": "05.4_combined_prot_embeddings_unirep.tsv.xz",
103
+ "url": "https://zenodo.org/records/10944245/files/05.4_combined_prot_embeddings_unirep.tsv.xz?download=1",
104
+ "size": 138392528,
105
+ "sha256": "19aa0562c3b695883c5aa8c05ad0934c4b9b851a26550345940d92ed17f36b93"
106
+ }
107
+ },
108
+ "05.5": {
109
+ "readme": {
110
+ "name": "README.txt",
111
+ "url": "https://zenodo.org/record/7019874/files/README.txt?download=1",
112
+ "size": 11092,
113
+ "sha256": "0af036c1d02b150f6402a53960a6e995611e66ee7724b61a21f58d3366ec8eda"
114
+ },
115
+ "requirements": [{
116
+ "name": "LICENSE.txt",
117
+ "url": "https://zenodo.org/records/10943207/files/LICENSE.txt?download=1",
118
+ "size": 20138,
119
+ "sha256": "3b2890eacd851373001c4a14623458e3adaf1b1967939aa9c38a318e28d61c00"
120
+ },
121
+ {
122
+ "name": "data_types.json",
123
+ "url": "https://zenodo.org/records/10943207/files/data_types.json?download=1",
124
+ "size": 450678,
125
+ "sha256": "d38f0b6b53f0450c5530b5bf44d8a7d0bb85417f22b7c818237e3346fe68149c"
126
+ },
127
+ {
128
+ "name": "data_size.json",
129
+ "url": "https://zenodo.org/records/10943207/files/data_size.json?download=1",
130
+ "size": 324,
131
+ "sha256": "513307863c4acc779789340e900821ff8f38c845865aa078edc649caa1559dcc"
132
+ }],
133
+ "papyrus++": {
134
+ "name": "05.5++_combined_set_without_stereochemistry.tsv.xz",
135
+ "url": "https://zenodo.org/records/10943207/files/05.5++_combined_set_without_stereochemistry.tsv.xz?download=1",
136
+ "size": 41357608,
137
+ "sha256": "8ecaea9533f3c475dca6d335f30dd1b4abb259fa77b7441548dd15879e1afa58"
138
+ },
139
+ "2D_papyrus": {
140
+ "name": "05.5_combined_set_without_stereochemistry.tsv.xz",
141
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_set_without_stereochemistry.tsv.xz?download=1",
142
+ "size": 718601992,
143
+ "sha256": "04ecaea97c09d02dbde809ad99ea2127fc3997a4e3b200b56dee85c30801890a"
144
+ },
145
+ "2D_structures": {
146
+ "name": "05.5_combined_2D_set_without_stereochemistry.sd.xz",
147
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_2D_set_without_stereochemistry.sd.xz?download=1",
148
+ "size": 399767580,
149
+ "sha256": "2e088ca662c5c33c5fc018c42c9c21e918ec167f1129a0a11fbf9c72888e8be6"
150
+ },
151
+ "3D_papyrus": {
152
+ "name": "05.5_combined_set_with_stereochemistry.tsv.xz",
153
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_set_with_stereochemistry.tsv.xz?download=1",
154
+ "size": 690498416,
155
+ "sha256": "822aca70ccf4c19879ae45dfa16de5fc29c3ee08b25739e7a087899652af7dd9"
156
+ },
157
+ "3D_structures": {
158
+ "name": "05.5_combined_3D_set_with_stereochemistry.sd.xz",
159
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_3D_set_with_stereochemistry.sd.xz?download=1",
160
+ "size": 492426264,
161
+ "sha256": "a4a5355ffc56de8d914c2ad281d10c227171c27e4d6c250daad14a16280cf136"
162
+ },
163
+ "2D_fingerprint": {
164
+ "name": "05.5_combined_2D_moldescs_ECFP6.tsv.xz",
165
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_2D_moldescs_ECFP6.tsv.xz?download=1",
166
+ "size": 97818228,
167
+ "sha256": "3d626b4295cfbe73877157d8eea84b911a3cb60bf9571165d88c00cc0b0880d2"
168
+ },
169
+ "3D_fingerprint": {
170
+ "name": "05.5_combined_3D_moldescs_E3FP.tsv.xz",
171
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_3D_moldescs_E3FP.tsv.xz?download=1",
172
+ "size": 114052016,
173
+ "sha256": "446fe36d50487f29a2d7402a53cc661097e884dc0df8ffd278646dba6708cb65"
174
+ },
175
+ "2D_mordred": {
176
+ "name": "05.5_combined_2D_moldescs_mordred2D.tsv.xz",
177
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_2D_moldescs_mordred2D.tsv.xz?download=1",
178
+ "size": 2936434876,
179
+ "sha256": "bcef94b1c04a1e7d8f9da11ad87e598e19932548a8ea4f00029c2f3a89672ff4"
180
+ },
181
+ "3D_mordred": {
182
+ "name": "05.5_combined_3D_moldescs_mordred3D.tsv.xz",
183
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_3D_moldescs_mordred3D.tsv.xz?download=1",
184
+ "size": 3206020732,
185
+ "sha256": "e6ffd0858f85217b57c4a88619e5f41d7f6bae16a9948612872162e54d3231dc"
186
+ },
187
+ "2D_cddd": {
188
+ "name": "05.5_combined_2D_moldescs_CDDDs.tsv.xz",
189
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_2D_moldescs_CDDDs.tsv.xz?download=1",
190
+ "size": 3775676256,
191
+ "sha256": "8421d973b4eb119f0739506a0b20ba9508356df97d4673e1c170e871cd134983"
192
+ },
193
+ "2D_mold2": {
194
+ "name": "05.5_combined_2D_moldescs_mold2.tsv.xz",
195
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_2D_moldescs_mold2.tsv.xz?download=1",
196
+ "size": 1553510028,
197
+ "sha256": "0fd1c2b3869c5fa749c21ddd70c5dff621974eccafb8e04fd6f95f3b37242058"
198
+ },
199
+ "proteins": {
200
+ "name": "05.5_combined_set_protein_targets.tsv.xz",
201
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_set_protein_targets.tsv.xz?download=1",
202
+ "size": 1710756,
203
+ "sha256": "d8f2cbee8b9849f7c3664fe7e8165c5abf785d374c36a8f151a6ec38fd582d80"
204
+ },
205
+ "proteins_unirep": {
206
+ "name": "05.5_combined_prot_embeddings_unirep.tsv.xz",
207
+ "url": "https://zenodo.org/record/7019874/files/05.5_combined_prot_embeddings_unirep.tsv.xz?download=1",
208
+ "size": 128869632,
209
+ "sha256": "9f1fce00e77563481eafc44405f9dc8188d5669ed93cafaee256c0208ca135b8"
210
+ }
211
+ },
212
+ "05.6": {
213
+ "readme": {
214
+ "name": "README.txt",
215
+ "url": "https://zenodo.org/record/7377161/files/README.txt?download=1",
216
+ "size": 12170,
217
+ "sha256": "b6a1977aed99e84c4ab560a04006a86264c9ff83ca67ed14e395e855c2543613"
218
+ },
219
+ "requirements": {
220
+ "name": "05.6_additional_files.zip",
221
+ "url": "https://zenodo.org/record/7377161/files/05.6_additional_files.zip?download=1",
222
+ "size": 51310,
223
+ "sha256": "c1d8df814ba54e17619f3740ff82577898a85a07acd220822403874159e26d8a"
224
+ },
225
+ "papyrus++": {
226
+ "name": "05.6++_combined_set_without_stereochemistry.tsv.xz",
227
+ "url": "https://zenodo.org/records/7821775/files/05.6++_combined_set_without_stereochemistry.tsv.xz?download=1",
228
+ "size": 31085780,
229
+ "sha256": "7518019c3ba287cd4cd0ff29425fe9da8a4760d891d22ed1abb33da4920cf96a"
230
+ },
231
+ "2D_papyrus": {
232
+ "name": "05.6_combined_set_without_stereochemistry.tsv.xz",
233
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_set_without_stereochemistry.tsv.xz?download=1",
234
+ "size": 744449364,
235
+ "sha256": "82a36ed7bb2f80846bb46e4c3e38905895bd1a2cfddd471d32091cb59dcf9437"
236
+ },
237
+ "2D_structures": {
238
+ "name": "05.6_combined_2D_set_without_stereochemistry.sd.xz",
239
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_2D_set_without_stereochemistry.sd.xz?download=1",
240
+ "size": 439758444,
241
+ "sha256": "1ec001964aca301494ea05fc24529120f01bc6952dcf4276dcd03625dfec460d"
242
+ },
243
+ "3D_papyrus": {
244
+ "name": "05.6_combined_set_with_stereochemistry.tsv.xz",
245
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_set_with_stereochemistry.tsv.xz?download=1",
246
+ "size": 711529352,
247
+ "sha256": "62068d500986b78fc90fe82b9e224555f8ca85319cd19f9df8bc73549e8a3e31"
248
+ },
249
+ "3D_structures": {
250
+ "name": "05.6_combined_3D_set_with_stereochemistry.sd.xz",
251
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_3D_set_with_stereochemistry.sd.xz?download=1",
252
+ "size": 500108592,
253
+ "sha256": "38e39963cd79845b4adca9dea871ffba18576ea742677471fc46a73a7dabbf38"
254
+ },
255
+ "2D_fingerprint": {
256
+ "name": "05.6_combined_2D_moldescs_ECFP6.tsv.xz",
257
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_2D_moldescs_ECFP6.tsv.xz?download=1",
258
+ "size": 96612972,
259
+ "sha256": "01c7366ee2ca7353d3a9f76601702b6d2eb312e71f02ea8ef48e2f90870c266c"
260
+ },
261
+ "3D_fingerprint": {
262
+ "name": "05.6_combined_3D_moldescs_E3FP.tsv.xz",
263
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_3D_moldescs_E3FP.tsv.xz?download=1",
264
+ "size": 117065432,
265
+ "sha256": "0d15baa4a9425daf63a0066511e9e96cbd5d7dab223bdaf48803536ab2484dc2"
266
+ },
267
+ "2D_mordred": {
268
+ "name": "05.6_combined_2D_moldescs_mordred2D.tsv.xz",
269
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_2D_moldescs_mordred2D.tsv.xz?download=1",
270
+ "size": 3055443236,
271
+ "sha256": "c497db85e97542f59b5252e2b1d3bdd93604e5c4d2ea131088a87d79ea6954c3"
272
+ },
273
+ "3D_mordred": {
274
+ "name": "05.6_combined_3D_moldescs_mordred3D.tsv.xz",
275
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_3D_moldescs_mordred3D.tsv.xz?download=1",
276
+ "size": 3324119256,
277
+ "sha256": "6b022acb6a0bec8bfc1ae7585014ae0b812a12ddcbed7be4ac7ec073c662192f"
278
+ },
279
+ "2D_cddd": {
280
+ "name": "05.6_combined_2D_moldescs_CDDDs.tsv.xz",
281
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_2D_moldescs_CDDDs.tsv.xz?download=1",
282
+ "size": 2103289016,
283
+ "sha256": "fbb54e5ca9a28ff022dc5baddf87cb6601169a2d86f3b55db4d183fd3885642a"
284
+ },
285
+ "2D_mold2": {
286
+ "name": "05.6_combined_2D_moldescs_mold2.tsv.xz",
287
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_2D_moldescs_mold2.tsv.xz?download=1",
288
+ "size": 1487710808,
289
+ "sha256": "cd46ce9841a1f956840b4fe7c56310eaa32c5e957a6ffaca62fbc55f820aad99"
290
+ },
291
+ "proteins": {
292
+ "name": "05.6_combined_set_protein_targets.tsv.xz",
293
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_set_protein_targets.tsv.xz?download=1",
294
+ "size": 1850764,
295
+ "sha256": "f443a2f8c74b8eb3f2c9d1bd7bfbddc86cbcc3fd5e8e505b7057b78a4ad17ee1"
296
+ },
297
+ "proteins_unirep": {
298
+ "name": "05.6_combined_protdescs_unirep.tsv.xz",
299
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_protdescs_unirep.tsv.xz?download=1",
300
+ "size": 207122632,
301
+ "sha256": "47f37c1f1efcb9d6f002d5a096853975c27ddcc767d7903a8af12bac0439181c"
302
+ },
303
+ "proteins_prodec": {
304
+ "name": "05.6_combined_protdescs_ProDEC.tsv.xz",
305
+ "url": "https://zenodo.org/record/7377161/files/05.6_combined_protdescs_ProDEC.tsv.xz?download=1",
306
+ "size": 447818916,
307
+ "sha256": "3211a62f18ccb7ccc13f885374c1462efeb83ab0e98ed62d2645723f7dc9f1a1"
308
+ }
309
+ },
310
+ "05.7": {
311
+ "readme": {
312
+ "name": "README.txt",
313
+ "url": "https://drive.google.com/uc?id=16ak1O1v70O72_UzFldGzZY_b6Ntd0eZm&confirm=t",
314
+ "size": 0,
315
+ "sha256": ""
316
+ },
317
+ "requirements": {
318
+ "name": "05.7_additional_files.zip",
319
+ "url": "https://drive.google.com/uc?id=18IGeQ4tTW6b7VO8nb7EYJqGSLNdXHEgD&confirm=t",
320
+ "size": 114037,
321
+ "sha256": "e8a0b5f65bd79c21b979b69d2b19fe6f51611fbc5a988ff3c0caa738ab0bca73"
322
+ },
323
+ "papyrus++": {
324
+ "name": "05.7++_combined_set_without_stereochemistry.tsv.xz",
325
+ "url": "https://drive.google.com/uc?id=1lI_B8MKehKOcstQYpS_IQRTkbsaXovNf&confirm=t",
326
+ "size": 57295028,
327
+ "sha256": "a4819cd45f10b973a7bde75e5de58dff47980fc1347f2e552a1ac39f520b780f"
328
+ },
329
+ "2D_papyrus": {
330
+ "name": "05.7_combined_set_without_stereochemistry.tsv.xz",
331
+ "url": "https://drive.google.com/uc?id=1Jc1Zj43aORhOiLOZX4CE5tYlUPc5zoBK&confirm=t",
332
+ "size": 749503448,
333
+ "sha256": "42c1d175e617909701f5baf8175fee18b6be986274c628ef209612a8240368f7"
334
+ },
335
+ "2D_structures": {
336
+ "name": "05.7_combined_2D_set_without_stereochemistry.sd.xz",
337
+ "url": "https://drive.google.com/uc?id=1yTSKlTyT2rud8_6J0TgiVAnSnswaeL09&confirm=t",
338
+ "size": 457158128,
339
+ "sha256": "5ea668a099ff2422accccadb378a50ae570044881d20c017742f53dc8f421680"
340
+ },
341
+ "3D_papyrus": {
342
+ "name": "05.7_combined_set_with_stereochemistry.tsv.xz",
343
+ "url": "https://drive.google.com/uc?id=14tsxNwjqpKjeJSRyZy5kG_i7Pg0gQPS_&confirm=t",
344
+ "size": 715818916,
345
+ "sha256": "0ee09ceace168ec25b0619349b7b41d754a7ad75a4cb82c2d887ab11d7ceb03c"
346
+ },
347
+ "3D_structures": {
348
+ "name": "05.7_combined_3D_set_with_stereochemistry.sd.xz",
349
+ "url": "https://drive.google.com/uc?id=1rkOz5QxWVMiQUWsNX0fzfb94doGy-FSI&confirm=t",
350
+ "size": 519810936,
351
+ "sha256": "fc5a9fd3ca68dba3f1f9b3217d85ecbb31bebb07798ea008d70b5e92caea2c1d"
352
+ },
353
+ "2D_fingerprint": {
354
+ "name": "05.7_combined_2D_moldescs_ECFP6.tsv.xz",
355
+ "url": "https://drive.google.com/uc?id=1TtJ2iUKVoo-_32cdFbFACSclv6CyeYNI&confirm=t",
356
+ "size": 100340752,
357
+ "sha256": "491a8dbc93364718de87b6c1ef3779b9ecdd3ec5af4dadc4dbddaf261a9d254f"
358
+ },
359
+ "3D_fingerprint": {
360
+ "name": "05.7_combined_3D_moldescs_E3FP.tsv.xz",
361
+ "url": "https://drive.google.com/uc?id=1KKOujpCm31za_i12SKhjxbwg4ywwDbjU&confirm=t",
362
+ "size": 121328636,
363
+ "sha256": "4e08240587757adbf6ca481b3998751b09c48fc1cb58068609f54b1a76275c11"
364
+ },
365
+ "2D_mordred": {
366
+ "name": "05.7_combined_2D_moldescs_mordred2D.tsv.xz",
367
+ "url": "https://drive.google.com/uc?id=1cTJLBz82VShJYrMMcQLOYiCS4IFmiOjk&confirm=t",
368
+ "size": 3166511800,
369
+ "sha256": "e9f841c7233f21c7db406f973cb89ec90db9caa7e99a6618dea94ad1fc72cdac"
370
+ },
371
+ "3D_mordred": {
372
+ "name": "05.7_combined_3D_moldescs_mordred3D.tsv.xz",
373
+ "url": "https://drive.google.com/uc?id=1w-SwQohL60_QsOoqVmlxwz3LLbxC50YX&confirm=t",
374
+ "size": 3443038656,
375
+ "sha256": "1e480c48c8eb86c57def26331ea2447e43f60d6fd73a2c33e76a6338abd5d132"
376
+ },
377
+ "2D_cddd": {
378
+ "name": "05.7_combined_2D_moldescs_CDDDs.tsv.xz",
379
+ "url": "https://drive.google.com/uc?id=18ERbYiqLg7WkXpZ3DyjNCHLr495_stik&confirm=t",
380
+ "size": 2179141716,
381
+ "sha256": "c227b3b8e4ea0ff53cb358a765ff89ffdfc7f83b2f3e71142e31fca74be28e3b"
382
+ },
383
+ "2D_mold2": {
384
+ "name": "05.7_combined_2D_moldescs_mold2.tsv.xz",
385
+ "url": "https://drive.google.com/uc?id=1VJJHcCkfQeRNCL8gYpQ5pToUFfP87ZaA&confirm=t",
386
+ "size": 1548906976,
387
+ "sha256": "95be36ae2e883053b8b275f26238fe292c34133e3cb527a40fe9bfaece057d49"
388
+ },
389
+ "proteins": {
390
+ "name": "05.7_combined_set_protein_targets.tsv.xz",
391
+ "url": "https://drive.google.com/uc?id=1mZYpQm5gMGw1Z8xdq-seqYE4diD81dc-&confirm=t",
392
+ "size": 1779284,
393
+ "sha256": "1226453794df7552aa56375d3ec0a045008586f5ab6612cb3a06942dfac4dbac"
394
+ },
395
+ "proteins_unirep": {
396
+ "name": "05.7_combined_protdescs_unirep.tsv.xz",
397
+ "url": "https://drive.google.com/uc?id=1cFbo402ofPP5YP_JpUKHZle3XjVARc6S&confirm=t",
398
+ "size": 209760216,
399
+ "sha256": "cfd8b9e3ea9b95713bd23c69b2db7ae7dfd0c019b5f610912e7d557537c4305c"
400
+ },
401
+ "proteins_prodec": {
402
+ "name": "05.7_combined_protdescs_ProDEC.tsv.xz",
403
+ "url": "https://drive.google.com/uc?id=1FX7vVUmvtVd4fVk22n4yGRTR0kM_XTQt&confirm=t",
404
+ "size": 434668804,
405
+ "sha256": "9011ff21dcb3acb73af40b37d2a587c0aa0060d803b9cee165f8131a2933f80d"
406
+ }
407
+ }
408
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: papyrus_scripts
3
- Version: 2.1.0
3
+ Version: 2.1.1
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
@@ -25,5 +25,7 @@ src/papyrus_scripts/utils/UniprotMatch.py
25
25
  src/papyrus_scripts/utils/__init__.py
26
26
  src/papyrus_scripts/utils/aliases.json
27
27
  src/papyrus_scripts/utils/links.json
28
+ src/papyrus_scripts/utils/links2.json
28
29
  src/papyrus_scripts/utils/mol_reader.py
30
+ tests/test.py
29
31
  tests/test_oop.py
@@ -0,0 +1,31 @@
1
+ from papyrus_scripts import PapyrusDataset, preprocess, reader
2
+
3
+ # data2 = (PapyrusDataset(is3d=False, version='latest', plusplus=False, chunksize=int(1e6))
4
+ # .keep_organism('Mus musculus (Mouse)')
5
+ # .keep_source('chembl')
6
+ # .keep_protein_class({'l5': 'CC chemokine receptor'})
7
+ # .not_isin('accession', ['P13500', 'P13501'])
8
+ # .keep_activity_type(['ki', 'kd'])
9
+ # .aggregate(progress=True))
10
+ #
11
+ # #print(data2.organism.value_counts())
12
+ # print(data2.source.value_counts())
13
+ # print(data2.Classification.value_counts())
14
+ # print(data2.accession.value_counts())
15
+ # print(data2[['type_IC50', 'type_EC50', 'type_KD', 'type_Ki', 'type_other']].value_counts())
16
+
17
+
18
+ fn_data = reader.read_papyrus(is3d=False, version='latest', plusplus=True, chunksize=int(1e6))
19
+ fn_protein_data = reader.read_protein_set(version='latest')
20
+ fn_filter1 = preprocess.keep_organism(fn_data, fn_protein_data, organism='Homo sapiens (Human)')
21
+ fn_filter2 = preprocess.keep_protein_class(fn_filter1, fn_protein_data, classes={'l5': 'Adenosine receptor'})
22
+ fn_filter3 = preprocess.keep_type(fn_filter2, activity_types='ic50')
23
+ fn_data_agg = preprocess.consume_chunks(fn_filter3, progress=True)
24
+ oop_data_agg = (PapyrusDataset(is3d=False, version='latest', plusplus=True, chunksize=int(1e6))
25
+ .keep_organism('Homo sapiens (Human)')
26
+ .keep_protein_class({'l5': 'Adenosine receptor'})
27
+ .keep_activity_type('ic50')
28
+ .aggregate(progress=True))
29
+
30
+ print(fn_data_agg)
31
+ print(oop_data_agg)
File without changes