1
|
|
|
""" |
|
|
|
|
2
|
|
|
Run searches and write files. |
3
|
|
|
""" |
4
|
|
|
|
5
|
|
|
from __future__ import annotations |
6
|
|
|
|
7
|
|
|
import abc |
8
|
|
|
from pathlib import Path |
9
|
|
|
from typing import Optional, TypeVar |
10
|
|
|
|
11
|
|
|
from mandos import logger |
12
|
|
|
from mandos.entry._entry_args import EntryArgs |
13
|
|
|
from mandos.entry._entry_utils import EntryUtils |
14
|
|
|
from mandos.entry.abstract_entries import Entry |
15
|
|
|
from mandos.entry.api_singletons import Apis |
16
|
|
|
from mandos.entry._common_args import CommonArgs |
17
|
|
|
from mandos.entry.searchers import Searcher |
18
|
|
|
from mandos.model.utils.reflection_utils import InjectionError |
19
|
|
|
from mandos.model.utils.reflection_utils import ReflectionUtils |
20
|
|
|
from mandos.model.apis.chembl_api import ChemblApi |
21
|
|
|
from mandos.model.apis.pubchem_support.pubchem_models import CoOccurrenceType, DrugbankTargetType |
22
|
|
|
from mandos.search.chembl.atc_search import AtcSearch |
23
|
|
|
from mandos.search.chembl.binding_search import BindingSearch |
24
|
|
|
from mandos.search.chembl.go_search import GoSearch |
25
|
|
|
from mandos.model.concrete_hits import GoType |
26
|
|
|
from mandos.search.chembl.indication_search import IndicationSearch |
27
|
|
|
from mandos.search.chembl.mechanism_search import MechanismSearch |
28
|
|
|
from mandos.search.chembl.target_prediction_search import TargetPredictionSearch |
29
|
|
|
from mandos.search.g2p.g2p_interaction_search import G2pInteractionSearch |
30
|
|
|
from mandos.search.pubchem.acute_effects_search import AcuteEffectSearch, Ld50Search |
31
|
|
|
from mandos.search.pubchem.bioactivity_search import BioactivitySearch |
32
|
|
|
from mandos.search.pubchem.computed_property_search import ComputedPropertySearch |
33
|
|
|
from mandos.search.pubchem.cooccurrence_search import ( |
34
|
|
|
ChemicalCoOccurrenceSearch, |
35
|
|
|
CoOccurrenceSearch, |
36
|
|
|
DiseaseCoOccurrenceSearch, |
37
|
|
|
GeneCoOccurrenceSearch, |
38
|
|
|
) |
39
|
|
|
from mandos.search.pubchem.ctd_gene_search import CtdGeneSearch |
40
|
|
|
from mandos.search.pubchem.dgidb_search import DgiSearch |
41
|
|
|
from mandos.search.pubchem.disease_search import DiseaseSearch |
42
|
|
|
from mandos.search.pubchem.drugbank_ddi_search import DrugbankDdiSearch |
43
|
|
|
from mandos.search.pubchem.drugbank_interaction_search import ( |
44
|
|
|
DrugbankGeneralFunctionSearch, |
45
|
|
|
DrugbankTargetSearch, |
46
|
|
|
) |
47
|
|
|
|
48
|
|
|
U = TypeVar("U", covariant=True, bound=CoOccurrenceSearch) |
|
|
|
|
49
|
|
|
|
50
|
|
|
|
51
|
|
|
class EntryChemblBinding(Entry[BindingSearch]): |
|
|
|
|
52
|
|
|
@classmethod |
53
|
|
|
def run( |
|
|
|
|
54
|
|
|
cls, |
|
|
|
|
55
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
56
|
|
|
key: str = EntryArgs.key("chembl:binding"), |
|
|
|
|
57
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
58
|
|
|
taxa: str = CommonArgs.taxa, |
|
|
|
|
59
|
|
|
traversal: str = EntryArgs.traversal_strategy, |
|
|
|
|
60
|
|
|
target_types: str = EntryArgs.target_types, |
|
|
|
|
61
|
|
|
confidence: int = EntryArgs.min_confidence, |
|
|
|
|
62
|
|
|
binding: float = EntryArgs.binds_cutoff, |
|
|
|
|
63
|
|
|
nonbinding: float = EntryArgs.does_not_bind_cutoff, |
|
|
|
|
64
|
|
|
relations: str = EntryArgs.relations, |
|
|
|
|
65
|
|
|
min_pchembl: float = EntryArgs.min_pchembl, |
|
|
|
|
66
|
|
|
banned_flags: str = EntryArgs.banned_flags, |
|
|
|
|
67
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
68
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
69
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
70
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
71
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
72
|
|
|
) -> Searcher: |
73
|
|
|
""" |
74
|
|
|
Binding data from ChEMBL. |
75
|
|
|
|
76
|
|
|
These are 'activity' annotations of the type 'B' that have a pCHEMBL value. |
77
|
|
|
https://mandos-chem.readthedocs.io/en/latest/binding.html |
78
|
|
|
|
79
|
|
|
OBJECT: The target name |
80
|
|
|
|
81
|
|
|
WEIGHT: The PCHEMBL value |
82
|
|
|
""" |
83
|
|
|
built = BindingSearch( |
84
|
|
|
key=key, |
85
|
|
|
api=Apis.Chembl, |
86
|
|
|
taxa=EntryUtils.get_taxa(taxa), |
87
|
|
|
traversal=traversal, |
88
|
|
|
target_types=EntryUtils.get_target_types(target_types), |
89
|
|
|
min_conf_score=confidence, |
90
|
|
|
allowed_relations=EntryUtils.split(relations), |
91
|
|
|
min_pchembl=min_pchembl, |
92
|
|
|
banned_flags=EntryUtils.get_flags(banned_flags), |
93
|
|
|
binds_cutoff=binding, |
94
|
|
|
does_not_bind_cutoff=nonbinding, |
95
|
|
|
) |
96
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
class EntryChemblMechanism(Entry[MechanismSearch]): |
|
|
|
|
100
|
|
|
@classmethod |
101
|
|
|
def run( |
|
|
|
|
102
|
|
|
cls, |
|
|
|
|
103
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
104
|
|
|
key: str = EntryArgs.key("chembl:mechanism"), |
|
|
|
|
105
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
106
|
|
|
taxa: Optional[str] = CommonArgs.taxa, |
|
|
|
|
107
|
|
|
traversal: str = EntryArgs.traversal_strategy, |
|
|
|
|
108
|
|
|
target_types: str = EntryArgs.target_types, |
|
|
|
|
109
|
|
|
min_confidence: Optional[int] = EntryArgs.min_confidence, |
|
|
|
|
110
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
111
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
112
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
113
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
114
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
115
|
|
|
) -> Searcher: |
116
|
|
|
""" |
117
|
|
|
Mechanism of action (MoA) data from ChEMBL. |
118
|
|
|
|
119
|
|
|
OBJECT: The target name |
120
|
|
|
|
121
|
|
|
PREDICATE: The target action (e.g. "agonist") |
122
|
|
|
""" |
123
|
|
|
built = MechanismSearch( |
124
|
|
|
key=key, |
125
|
|
|
api=Apis.Chembl, |
126
|
|
|
taxa=EntryUtils.get_taxa(taxa), |
127
|
|
|
traversal_strategy=traversal, |
128
|
|
|
allowed_target_types=EntryUtils.get_target_types(target_types), |
129
|
|
|
min_confidence_score=min_confidence, |
130
|
|
|
) |
131
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
132
|
|
|
|
133
|
|
|
|
134
|
|
|
class ChemblQsarPredictions(Entry[TargetPredictionSearch]): |
|
|
|
|
135
|
|
|
@classmethod |
136
|
|
|
def run( |
|
|
|
|
137
|
|
|
cls, |
|
|
|
|
138
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
139
|
|
|
key: str = EntryArgs.key("chembl:predictions"), |
|
|
|
|
140
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
141
|
|
|
taxa: str = CommonArgs.taxa, |
|
|
|
|
142
|
|
|
traversal: str = EntryArgs.traversal_strategy, |
|
|
|
|
143
|
|
|
target_types: str = EntryArgs.target_types, |
|
|
|
|
144
|
|
|
min_threshold: float = EntryArgs.min_threshold, |
|
|
|
|
145
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
146
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
147
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
148
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
149
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
150
|
|
|
) -> Searcher: |
151
|
|
|
""" |
152
|
|
|
Predicted target binding from ChEMBL. |
153
|
|
|
|
154
|
|
|
https://mandos-chem.readthedocs.io/en/latest/binding.html |
155
|
|
|
These are from a QSAR model by ChEMBL. |
156
|
|
|
|
157
|
|
|
OBJECT: The target name |
158
|
|
|
|
159
|
|
|
WEIGHT: The square root of the PCHEMBL threshold |
160
|
|
|
multiplied by a prediction odds-ratio, normalized |
161
|
|
|
""" |
162
|
|
|
built = TargetPredictionSearch( |
163
|
|
|
key=key, |
164
|
|
|
api=Apis.Chembl, |
165
|
|
|
scrape=Apis.ChemblScrape, |
166
|
|
|
taxa=EntryUtils.get_taxa(taxa), |
167
|
|
|
traversal=traversal, |
168
|
|
|
target_types=EntryUtils.get_target_types(target_types), |
169
|
|
|
min_threshold=min_threshold, |
170
|
|
|
) |
171
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
172
|
|
|
|
173
|
|
|
|
174
|
|
|
class EntryChemblTrials(Entry[IndicationSearch]): |
|
|
|
|
175
|
|
|
@classmethod |
176
|
|
|
def run( |
|
|
|
|
177
|
|
|
cls, |
|
|
|
|
178
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
179
|
|
|
key: str = EntryArgs.key("chembl:trial"), |
|
|
|
|
180
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
181
|
|
|
min_phase: Optional[int] = EntryArgs.chembl_trial, |
|
|
|
|
182
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
183
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
184
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
185
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
186
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
187
|
|
|
) -> Searcher: |
188
|
|
|
""" |
189
|
|
|
Diseases from clinical trials listed in ChEMBL. |
190
|
|
|
|
191
|
|
|
OBJECT: The name of the disease (in MeSH) |
192
|
|
|
""" |
193
|
|
|
built = IndicationSearch(key=key, api=Apis.Chembl, min_phase=min_phase) |
194
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
195
|
|
|
|
196
|
|
|
|
197
|
|
|
class EntryChemblAtc(Entry[AtcSearch]): |
|
|
|
|
198
|
|
|
@classmethod |
199
|
|
|
def run( |
|
|
|
|
200
|
|
|
cls, |
|
|
|
|
201
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
202
|
|
|
key: str = EntryArgs.key("chembl:atc"), |
|
|
|
|
203
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
204
|
|
|
levels: str = EntryArgs.atc_level, |
|
|
|
|
205
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
206
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
207
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
208
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
209
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
210
|
|
|
) -> Searcher: |
211
|
|
|
""" |
212
|
|
|
ATC codes from ChEMBL. |
213
|
|
|
|
214
|
|
|
OBJECT: The ATC code name |
215
|
|
|
""" |
216
|
|
|
built = AtcSearch( |
217
|
|
|
key=key, api=Apis.Chembl, levels={int(x.strip()) for x in levels.split(",")} |
218
|
|
|
) |
219
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
220
|
|
|
|
221
|
|
|
|
222
|
|
|
class _EntryChemblGo(Entry[GoSearch], metaclass=abc.ABCMeta): |
223
|
|
|
@classmethod |
224
|
|
|
def go_type(cls) -> GoType: |
|
|
|
|
225
|
|
|
raise NotImplementedError() |
226
|
|
|
|
227
|
|
|
@classmethod |
228
|
|
|
def cmd(cls) -> str: |
|
|
|
|
229
|
|
|
me = str(cls.go_type().name) |
|
|
|
|
230
|
|
|
return f"chembl:go.{me.lower()}" |
231
|
|
|
|
232
|
|
|
@classmethod |
233
|
|
|
def run( |
|
|
|
|
234
|
|
|
cls, |
|
|
|
|
235
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
236
|
|
|
key: str = EntryArgs.key("<see above>"), |
|
|
|
|
237
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
238
|
|
|
taxa: Optional[str] = CommonArgs.taxa, |
|
|
|
|
239
|
|
|
traversal_strategy: str = EntryArgs.traversal_strategy, |
|
|
|
|
240
|
|
|
target_types: str = EntryArgs.target_types, |
|
|
|
|
241
|
|
|
confidence: Optional[int] = EntryArgs.min_confidence, |
|
|
|
|
242
|
|
|
relations: str = EntryArgs.relations, |
|
|
|
|
243
|
|
|
min_pchembl: float = EntryArgs.min_pchembl, |
|
|
|
|
244
|
|
|
banned_flags: Optional[str] = EntryArgs.banned_flags, |
|
|
|
|
245
|
|
|
binding_search: Optional[str] = EntryArgs.binding_search_name, |
|
|
|
|
246
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
247
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
248
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
249
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
250
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
251
|
|
|
) -> Searcher: |
252
|
|
|
""" |
253
|
|
|
See the docs for the specific entries. |
254
|
|
|
""" |
255
|
|
|
if key is None or key == "<see above>": |
256
|
|
|
key = cls.cmd() |
257
|
|
|
api = ChemblApi.wrap(Apis.Chembl) |
258
|
|
|
if binding_search is None: |
259
|
|
|
binding_clazz = BindingSearch |
260
|
|
|
else: |
261
|
|
|
binding_clazz = ReflectionUtils.injection(binding_search, BindingSearch) |
262
|
|
|
logger.info(f"Passing parameters to {binding_clazz.__qualname__}") |
263
|
|
|
try: |
264
|
|
|
binding_search = binding_clazz( |
265
|
|
|
key=key, |
266
|
|
|
api=Apis.Chembl, |
267
|
|
|
taxa=EntryUtils.get_taxa(taxa), |
268
|
|
|
traversal=traversal_strategy, |
269
|
|
|
target_types=EntryUtils.get_target_types(target_types), |
270
|
|
|
min_conf_score=confidence, |
271
|
|
|
allowed_relations=EntryUtils.split(relations), |
272
|
|
|
min_pchembl=min_pchembl, |
273
|
|
|
banned_flags=EntryUtils.get_flags(banned_flags), |
274
|
|
|
) |
275
|
|
|
except (TypeError, ValueError): |
276
|
|
|
raise InjectionError(f"Failed to build {binding_clazz.__qualname__}") |
277
|
|
|
built = GoSearch(key, api, cls.go_type(), binding_search) |
278
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
279
|
|
|
|
280
|
|
|
|
281
|
|
View Code Duplication |
class EntryGoFunction(_EntryChemblGo): |
|
|
|
|
282
|
|
|
@classmethod |
283
|
|
|
def go_type(cls) -> GoType: |
284
|
|
|
return GoType.function |
285
|
|
|
|
286
|
|
|
@classmethod |
287
|
|
|
def run( |
|
|
|
|
288
|
|
|
cls, |
|
|
|
|
289
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
290
|
|
|
key: str = EntryArgs.key("chembl:go.function"), |
|
|
|
|
291
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
292
|
|
|
taxa: Optional[str] = CommonArgs.taxa, |
|
|
|
|
293
|
|
|
traversal_strategy: str = EntryArgs.traversal_strategy, |
|
|
|
|
294
|
|
|
target_types: str = EntryArgs.target_types, |
|
|
|
|
295
|
|
|
confidence: Optional[int] = EntryArgs.min_confidence, |
|
|
|
|
296
|
|
|
relations: str = EntryArgs.relations, |
|
|
|
|
297
|
|
|
min_pchembl: float = EntryArgs.min_pchembl, |
|
|
|
|
298
|
|
|
banned_flags: Optional[str] = EntryArgs.banned_flags, |
|
|
|
|
299
|
|
|
binding_search: Optional[str] = EntryArgs.binding_search_name, |
|
|
|
|
300
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
301
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
302
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
303
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
304
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
305
|
|
|
) -> Searcher: |
306
|
|
|
""" |
307
|
|
|
GO Function terms associated with ChEMBL binding targets. |
308
|
|
|
|
309
|
|
|
OBJECT: The GO Function term name |
310
|
|
|
|
311
|
|
|
WEIGHT: The sum of the PCHEMBL values |
312
|
|
|
""" |
313
|
|
|
return super().run( |
314
|
|
|
path=path, |
315
|
|
|
key=key, |
316
|
|
|
to=to, |
317
|
|
|
taxa=taxa, |
318
|
|
|
traversal_strategy=traversal_strategy, |
319
|
|
|
target_types=target_types, |
320
|
|
|
confidence=confidence, |
321
|
|
|
relations=relations, |
322
|
|
|
min_pchembl=min_pchembl, |
323
|
|
|
banned_flags=banned_flags, |
324
|
|
|
binding_search=binding_search, |
325
|
|
|
as_of=as_of, |
326
|
|
|
check=check, |
327
|
|
|
log=log, |
328
|
|
|
stderr=stderr, |
329
|
|
|
) |
330
|
|
|
|
331
|
|
|
|
332
|
|
View Code Duplication |
class EntryGoProcess(_EntryChemblGo): |
|
|
|
|
333
|
|
|
@classmethod |
334
|
|
|
def go_type(cls) -> GoType: |
335
|
|
|
return GoType.process |
336
|
|
|
|
337
|
|
|
@classmethod |
338
|
|
|
def run( |
|
|
|
|
339
|
|
|
cls, |
|
|
|
|
340
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
341
|
|
|
key: str = EntryArgs.key("chembl:go.process"), |
|
|
|
|
342
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
343
|
|
|
taxa: Optional[str] = CommonArgs.taxa, |
|
|
|
|
344
|
|
|
traversal_strategy: str = EntryArgs.traversal_strategy, |
|
|
|
|
345
|
|
|
target_types: str = EntryArgs.target_types, |
|
|
|
|
346
|
|
|
confidence: Optional[int] = EntryArgs.min_confidence, |
|
|
|
|
347
|
|
|
relations: str = EntryArgs.relations, |
|
|
|
|
348
|
|
|
min_pchembl: float = EntryArgs.min_pchembl, |
|
|
|
|
349
|
|
|
banned_flags: Optional[str] = EntryArgs.banned_flags, |
|
|
|
|
350
|
|
|
binding_search: Optional[str] = EntryArgs.binding_search_name, |
|
|
|
|
351
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
352
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
353
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
354
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
355
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
356
|
|
|
) -> Searcher: |
357
|
|
|
""" |
358
|
|
|
GO Process terms associated with ChEMBL binding targets. |
359
|
|
|
|
360
|
|
|
OBJECT: The GO Process term name |
361
|
|
|
|
362
|
|
|
WEIGHT: The sum of the PCHEMBL values |
363
|
|
|
""" |
364
|
|
|
return super().run( |
365
|
|
|
path=path, |
366
|
|
|
key=key, |
367
|
|
|
to=to, |
368
|
|
|
taxa=taxa, |
369
|
|
|
traversal_strategy=traversal_strategy, |
370
|
|
|
target_types=target_types, |
371
|
|
|
confidence=confidence, |
372
|
|
|
relations=relations, |
373
|
|
|
min_pchembl=min_pchembl, |
374
|
|
|
banned_flags=banned_flags, |
375
|
|
|
binding_search=binding_search, |
376
|
|
|
as_of=as_of, |
377
|
|
|
check=check, |
378
|
|
|
log=log, |
379
|
|
|
stderr=stderr, |
380
|
|
|
) |
381
|
|
|
|
382
|
|
|
|
383
|
|
View Code Duplication |
class EntryGoComponent(_EntryChemblGo): |
|
|
|
|
384
|
|
|
@classmethod |
385
|
|
|
def go_type(cls) -> GoType: |
386
|
|
|
return GoType.component |
387
|
|
|
|
388
|
|
|
@classmethod |
389
|
|
|
def run( |
|
|
|
|
390
|
|
|
cls, |
|
|
|
|
391
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
392
|
|
|
key: str = EntryArgs.key("chembl:go.component"), |
|
|
|
|
393
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
394
|
|
|
taxa: Optional[str] = CommonArgs.taxa, |
|
|
|
|
395
|
|
|
traversal_strategy: str = EntryArgs.traversal_strategy, |
|
|
|
|
396
|
|
|
target_types: str = EntryArgs.target_types, |
|
|
|
|
397
|
|
|
confidence: Optional[int] = EntryArgs.min_confidence, |
|
|
|
|
398
|
|
|
relations: str = EntryArgs.relations, |
|
|
|
|
399
|
|
|
min_pchembl: float = EntryArgs.min_pchembl, |
|
|
|
|
400
|
|
|
banned_flags: Optional[str] = EntryArgs.banned_flags, |
|
|
|
|
401
|
|
|
binding_search: Optional[str] = EntryArgs.binding_search_name, |
|
|
|
|
402
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
403
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
404
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
405
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
406
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
407
|
|
|
) -> Searcher: |
408
|
|
|
""" |
409
|
|
|
GO Component terms associated with ChEMBL binding targets. |
410
|
|
|
|
411
|
|
|
OBJECT: The GO Component term name |
412
|
|
|
|
413
|
|
|
WEIGHT: The sum of the PCHEMBL values |
414
|
|
|
""" |
415
|
|
|
return super().run( |
416
|
|
|
path=path, |
417
|
|
|
key=key, |
418
|
|
|
to=to, |
419
|
|
|
taxa=taxa, |
420
|
|
|
traversal_strategy=traversal_strategy, |
421
|
|
|
target_types=target_types, |
422
|
|
|
confidence=confidence, |
423
|
|
|
relations=relations, |
424
|
|
|
min_pchembl=min_pchembl, |
425
|
|
|
banned_flags=banned_flags, |
426
|
|
|
binding_search=binding_search, |
427
|
|
|
as_of=as_of, |
428
|
|
|
check=check, |
429
|
|
|
log=log, |
430
|
|
|
stderr=stderr, |
431
|
|
|
) |
432
|
|
|
|
433
|
|
|
|
434
|
|
|
class EntryPubchemDisease(Entry[DiseaseSearch]): |
|
|
|
|
435
|
|
View Code Duplication |
@classmethod |
|
|
|
|
436
|
|
|
def run( |
|
|
|
|
437
|
|
|
cls, |
|
|
|
|
438
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
439
|
|
|
key: str = EntryArgs.key("disease.ctd:mesh"), |
|
|
|
|
440
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
441
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
442
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
443
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
444
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
445
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
446
|
|
|
) -> Searcher: |
447
|
|
|
""" |
448
|
|
|
Diseases in the CTD. |
449
|
|
|
|
450
|
|
|
(Comparative Toxicogenomics Database.) |
451
|
|
|
|
452
|
|
|
OBJECT: The MeSH code of the disease |
453
|
|
|
|
454
|
|
|
""" |
455
|
|
|
built = DiseaseSearch(key, Apis.Pubchem) |
456
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
457
|
|
|
|
458
|
|
|
|
459
|
|
|
class _EntryPubchemCoOccurrence(Entry[U], metaclass=abc.ABCMeta): |
460
|
|
|
@classmethod |
461
|
|
|
def cmd(cls) -> str: |
|
|
|
|
462
|
|
|
me = str(cls.get_cooccurrence_type().name) |
|
|
|
|
463
|
|
|
return f"lit.pubchem:{me.lower()}" |
464
|
|
|
|
465
|
|
|
@classmethod |
466
|
|
|
def get_cooccurrence_type(cls) -> CoOccurrenceType: |
|
|
|
|
467
|
|
|
s: CoOccurrenceSearch = cls.get_search_type() |
|
|
|
|
468
|
|
|
return s.cooccurrence_type() |
469
|
|
|
|
470
|
|
|
@classmethod |
471
|
|
|
def run( |
|
|
|
|
472
|
|
|
cls, |
|
|
|
|
473
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
474
|
|
|
key: str = EntryArgs.key("<see above>"), |
|
|
|
|
475
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
476
|
|
|
min_score: float = EntryArgs.min_cooccurrence_score, |
|
|
|
|
477
|
|
|
min_articles: int = EntryArgs.min_cooccurring_articles, |
|
|
|
|
478
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
479
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
480
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
481
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
482
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
483
|
|
|
) -> Searcher: |
484
|
|
|
"""See the docstrings for the individual entries.""" |
485
|
|
|
clazz = cls.get_search_type() |
486
|
|
|
built = clazz(key, Apis.Pubchem, min_score=min_score, min_articles=min_articles) |
487
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
488
|
|
|
|
489
|
|
|
|
490
|
|
View Code Duplication |
class EntryPubchemGeneCoOccurrence(_EntryPubchemCoOccurrence[GeneCoOccurrenceSearch]): |
|
|
|
|
491
|
|
|
@classmethod |
492
|
|
|
def run( |
|
|
|
|
493
|
|
|
cls, |
|
|
|
|
494
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
495
|
|
|
key: str = EntryArgs.key(f"lit.pubchem:{CoOccurrenceType.gene.name.lower()}"), |
|
|
|
|
496
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
497
|
|
|
min_score: float = EntryArgs.min_cooccurrence_score, |
|
|
|
|
498
|
|
|
min_articles: int = EntryArgs.min_cooccurring_articles, |
|
|
|
|
499
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
500
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
501
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
502
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
503
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
504
|
|
|
) -> Searcher: |
505
|
|
|
""" |
506
|
|
|
Co-occurrences of genes from PubMed articles. |
507
|
|
|
|
508
|
|
|
https://mandos-chem.readthedocs.io/en/latest/co-occurrences.html |
509
|
|
|
|
510
|
|
|
OBJECT: The name of the gene |
511
|
|
|
|
512
|
|
|
WEIGHT: The co-occurrence score (refer to the docs) |
513
|
|
|
""" |
514
|
|
|
return super().run( |
515
|
|
|
path=path, |
516
|
|
|
key=key, |
517
|
|
|
to=to, |
518
|
|
|
min_score=min_score, |
519
|
|
|
min_articles=min_articles, |
520
|
|
|
as_of=as_of, |
521
|
|
|
log=log, |
522
|
|
|
check=check, |
523
|
|
|
stderr=stderr, |
524
|
|
|
no_setup=no_setup, |
525
|
|
|
) |
526
|
|
|
|
527
|
|
|
|
528
|
|
View Code Duplication |
class EntryPubchemDiseaseCoOccurrence(_EntryPubchemCoOccurrence[DiseaseCoOccurrenceSearch]): |
|
|
|
|
529
|
|
|
@classmethod |
530
|
|
|
def run( |
|
|
|
|
531
|
|
|
cls, |
|
|
|
|
532
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
533
|
|
|
key: str = EntryArgs.key(f"lit.pubchem:{CoOccurrenceType.disease.name.lower()}"), |
|
|
|
|
534
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
535
|
|
|
min_score: float = EntryArgs.min_cooccurrence_score, |
|
|
|
|
536
|
|
|
min_articles: int = EntryArgs.min_cooccurring_articles, |
|
|
|
|
537
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
538
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
539
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
540
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
541
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
542
|
|
|
) -> Searcher: |
543
|
|
|
""" |
544
|
|
|
Co-occurrences of diseases from PubMed articles. |
545
|
|
|
|
546
|
|
|
https://mandos-chem.readthedocs.io/en/latest/co-occurrences.html |
547
|
|
|
|
548
|
|
|
OBJECT: The name of the disease |
549
|
|
|
|
550
|
|
|
WEIGHT: The co-occurrence score (refer to the docs) |
551
|
|
|
""" |
552
|
|
|
return super().run( |
553
|
|
|
path=path, |
554
|
|
|
key=key, |
555
|
|
|
to=to, |
556
|
|
|
min_score=min_score, |
557
|
|
|
min_articles=min_articles, |
558
|
|
|
as_of=as_of, |
559
|
|
|
log=log, |
560
|
|
|
check=check, |
561
|
|
|
stderr=stderr, |
562
|
|
|
no_setup=no_setup, |
563
|
|
|
) |
564
|
|
|
|
565
|
|
|
|
566
|
|
View Code Duplication |
class EntryPubchemChemicalCoOccurrence(_EntryPubchemCoOccurrence[ChemicalCoOccurrenceSearch]): |
|
|
|
|
567
|
|
|
@classmethod |
568
|
|
|
def run( |
|
|
|
|
569
|
|
|
cls, |
|
|
|
|
570
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
571
|
|
|
key: str = EntryArgs.key(f"lit.pubchem:{CoOccurrenceType.chemical.name.lower()}"), |
|
|
|
|
572
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
573
|
|
|
min_score: float = EntryArgs.min_cooccurrence_score, |
|
|
|
|
574
|
|
|
min_articles: int = EntryArgs.min_cooccurring_articles, |
|
|
|
|
575
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
576
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
577
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
578
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
579
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
580
|
|
|
) -> Searcher: |
581
|
|
|
""" |
582
|
|
|
Co-occurrences of chemicals from PubMed articles. |
583
|
|
|
|
584
|
|
|
https://mandos-chem.readthedocs.io/en/latest/co-occurrences.html |
585
|
|
|
|
586
|
|
|
OBJECT: The name of the chemical (e.g. "cocaine") |
587
|
|
|
|
588
|
|
|
WEIGHT: The co-occurrence score (refer to the docs) |
589
|
|
|
""" |
590
|
|
|
return super().run( |
591
|
|
|
path=path, |
592
|
|
|
key=key, |
593
|
|
|
to=to, |
594
|
|
|
min_score=min_score, |
595
|
|
|
min_articles=min_articles, |
596
|
|
|
as_of=as_of, |
597
|
|
|
log=log, |
598
|
|
|
check=check, |
599
|
|
|
stderr=stderr, |
600
|
|
|
no_setup=no_setup, |
601
|
|
|
) |
602
|
|
|
|
603
|
|
|
|
604
|
|
|
class EntryPubchemDgi(Entry[DgiSearch]): |
|
|
|
|
605
|
|
View Code Duplication |
@classmethod |
|
|
|
|
606
|
|
|
def run( |
|
|
|
|
607
|
|
|
cls, |
|
|
|
|
608
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
609
|
|
|
key: str = EntryArgs.key("inter.dgidb:gene"), |
|
|
|
|
610
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
611
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
612
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
613
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
614
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
615
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
616
|
|
|
) -> Searcher: |
617
|
|
|
""" |
618
|
|
|
Drug/gene interactions in the DGIDB. |
619
|
|
|
|
620
|
|
|
Drug Gene Interaction Database. |
621
|
|
|
Also see disease.dgidb:int. |
622
|
|
|
|
623
|
|
|
OBJECT: The name of the gene |
624
|
|
|
|
625
|
|
|
PREDICATE: "interaction:generic" or "interaction:<type>" |
626
|
|
|
""" |
627
|
|
|
built = DgiSearch(key, Apis.Pubchem) |
628
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
629
|
|
|
|
630
|
|
|
|
631
|
|
|
class EntryPubchemCgi(Entry[CtdGeneSearch]): |
|
|
|
|
632
|
|
View Code Duplication |
@classmethod |
|
|
|
|
633
|
|
|
def run( |
|
|
|
|
634
|
|
|
cls, |
|
|
|
|
635
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
636
|
|
|
key: str = EntryArgs.key("inter.ctd:gene"), |
|
|
|
|
637
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
638
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
639
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
640
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
641
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
642
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
643
|
|
|
) -> Searcher: |
644
|
|
|
""" |
645
|
|
|
Compound/gene interactions in the DGIDB. |
646
|
|
|
|
647
|
|
|
Drug Gene Interaction Database. |
648
|
|
|
Also see ``interact.dgidb:int``. |
649
|
|
|
|
650
|
|
|
OBJECT: The name of the gene |
651
|
|
|
|
652
|
|
|
PREDICATE: derived from the interaction type (e.g. "downregulation") |
653
|
|
|
""" |
654
|
|
|
built = CtdGeneSearch(key, Apis.Pubchem) |
655
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
656
|
|
|
|
657
|
|
|
|
658
|
|
|
class EntryDrugbankTarget(Entry[DrugbankTargetSearch]): |
|
|
|
|
659
|
|
View Code Duplication |
@classmethod |
|
|
|
|
660
|
|
|
def run( |
|
|
|
|
661
|
|
|
cls, |
|
|
|
|
662
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
663
|
|
|
key: str = EntryArgs.key("inter.drugbank:targ"), |
|
|
|
|
664
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
665
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
666
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
667
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
668
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
669
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
670
|
|
|
) -> Searcher: |
671
|
|
|
""" |
672
|
|
|
Protein targets from DrugBank. |
673
|
|
|
|
674
|
|
|
OBJECT: The target name (e.g. "Solute carrier family 22 member 11") |
675
|
|
|
|
676
|
|
|
PREDICATE: "<target_type>:<action>" |
677
|
|
|
""" |
678
|
|
|
built = DrugbankTargetSearch(key, Apis.Pubchem, {DrugbankTargetType.target}) |
679
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
680
|
|
|
|
681
|
|
|
|
682
|
|
|
class EntryGeneralFunction(Entry[DrugbankGeneralFunctionSearch]): |
|
|
|
|
683
|
|
View Code Duplication |
@classmethod |
|
|
|
|
684
|
|
|
def run( |
|
|
|
|
685
|
|
|
cls, |
|
|
|
|
686
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
687
|
|
|
key: str = EntryArgs.key("inter.drugbank:targ-fn"), |
|
|
|
|
688
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
689
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
690
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
691
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
692
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
693
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
694
|
|
|
) -> Searcher: |
695
|
|
|
""" |
696
|
|
|
General functions from DrugBank targets. |
697
|
|
|
|
698
|
|
|
OBJECT: The name of the "general function" (e.g. "Toxic substance binding") |
699
|
|
|
|
700
|
|
|
PREDICATE: "<target_type>:<action>" |
701
|
|
|
""" |
702
|
|
|
built = DrugbankGeneralFunctionSearch(key, Apis.Pubchem, {DrugbankTargetType.target}) |
703
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
704
|
|
|
|
705
|
|
|
|
706
|
|
View Code Duplication |
class EntryDrugbankTransporter(Entry[DrugbankTargetSearch]): |
|
|
|
|
707
|
|
|
@classmethod |
708
|
|
|
def run( |
|
|
|
|
709
|
|
|
cls, |
|
|
|
|
710
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
711
|
|
|
key: str = EntryArgs.key("inter.drugbank:pk"), |
|
|
|
|
712
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
713
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
714
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
715
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
716
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
717
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
718
|
|
|
) -> Searcher: |
719
|
|
|
""" |
720
|
|
|
PK-related proteins from DrugBank. |
721
|
|
|
|
722
|
|
|
OBJECT: The transporter name (e.g. "Solute carrier family 22 member 11") |
723
|
|
|
|
724
|
|
|
PREDICATE: "<target_type>:<action>" (e.g. metabolized, transported, etc.) |
725
|
|
|
""" |
726
|
|
|
target_types = { |
727
|
|
|
DrugbankTargetType.transporter, |
728
|
|
|
DrugbankTargetType.carrier, |
729
|
|
|
DrugbankTargetType.enzyme, |
730
|
|
|
} |
731
|
|
|
built = DrugbankTargetSearch(key, Apis.Pubchem, target_types) |
732
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
733
|
|
|
|
734
|
|
|
|
735
|
|
View Code Duplication |
class EntryTransporterGeneralFunction(Entry[DrugbankGeneralFunctionSearch]): |
|
|
|
|
736
|
|
|
@classmethod |
737
|
|
|
def run( |
|
|
|
|
738
|
|
|
cls, |
|
|
|
|
739
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
740
|
|
|
key: str = EntryArgs.key("inter.drugbank:pk-fn"), |
|
|
|
|
741
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
742
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
743
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
744
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
745
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
746
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
747
|
|
|
) -> Searcher: |
748
|
|
|
""" |
749
|
|
|
DrugBank PK-related protein functions. |
750
|
|
|
|
751
|
|
|
OBJECT: The name of the general function (e.g. "Toxic substance binding") |
752
|
|
|
|
753
|
|
|
PREDICATE: "<target_type>:<action>" (e.g. metabolized, transported, etc.) |
754
|
|
|
""" |
755
|
|
|
target_types = { |
756
|
|
|
DrugbankTargetType.transporter, |
757
|
|
|
DrugbankTargetType.carrier, |
758
|
|
|
DrugbankTargetType.enzyme, |
759
|
|
|
} |
760
|
|
|
built = DrugbankGeneralFunctionSearch(key, Apis.Pubchem, target_types) |
761
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
762
|
|
|
|
763
|
|
|
|
764
|
|
|
class EntryDrugbankDdi(Entry[DrugbankDdiSearch]): |
|
|
|
|
765
|
|
View Code Duplication |
@classmethod |
|
|
|
|
766
|
|
|
def run( |
|
|
|
|
767
|
|
|
cls, |
|
|
|
|
768
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
769
|
|
|
key: str = EntryArgs.key("inter.drugbank:ddi"), |
|
|
|
|
770
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
771
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
772
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
773
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
774
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
775
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
776
|
|
|
) -> Searcher: |
777
|
|
|
""" |
778
|
|
|
Drug/drug interactions listed by DrugBank. |
779
|
|
|
|
780
|
|
|
The "description" column includes useful information about the interaction, |
781
|
|
|
such as diseases and whether a risk is increased or decreased. |
782
|
|
|
|
783
|
|
|
OBJECT: The name of the drug (e.g. "ibuprofen") |
784
|
|
|
|
785
|
|
|
PREDICATE: typically increase/decrease/change followed by risk/activity/etc. |
786
|
|
|
""" |
787
|
|
|
built = DrugbankDdiSearch(key, Apis.Pubchem) |
788
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
789
|
|
|
|
790
|
|
|
|
791
|
|
|
class EntryPubchemAssay(Entry[BioactivitySearch]): |
|
|
|
|
792
|
|
|
@classmethod |
793
|
|
|
def run( |
|
|
|
|
794
|
|
|
cls, |
|
|
|
|
795
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
796
|
|
|
key: str = EntryArgs.key("assay.pubchem:act"), |
|
|
|
|
797
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
798
|
|
|
name_must_match: bool = EntryArgs.name_must_match, |
|
|
|
|
799
|
|
|
ban_sources: Optional[str] = EntryArgs.banned_sources, |
|
|
|
|
800
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
801
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
802
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
803
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
804
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
805
|
|
|
) -> Searcher: |
806
|
|
|
""" |
807
|
|
|
PubChem bioactivity results. |
808
|
|
|
|
809
|
|
|
Note: The species name, if present, is taken from the target name. |
810
|
|
|
The taxon ID is what was curated in PubChem. |
811
|
|
|
|
812
|
|
|
OBJECT: The name of the target without species suffix |
813
|
|
|
(e.g. "Slc6a3 - solute carrier family 6 member 3") |
814
|
|
|
|
815
|
|
|
PREDICATE: "active", "inactive", "inconclusive", or "undetermined" |
816
|
|
|
|
817
|
|
|
WEIGHT: 2 for confirmatory; 1 otherwise |
818
|
|
|
""" |
819
|
|
|
built = BioactivitySearch(key, Apis.Pubchem, compound_name_must_match=name_must_match) |
820
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
821
|
|
|
|
822
|
|
|
|
823
|
|
|
class EntryDeaSchedule(Entry[BioactivitySearch]): |
|
|
|
|
824
|
|
|
@classmethod |
825
|
|
|
def run( |
|
|
|
|
826
|
|
|
cls, |
|
|
|
|
827
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
828
|
|
|
key: str = EntryArgs.key("drug.dea:schedule"), |
|
|
|
|
829
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
830
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
831
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
832
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
833
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
834
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
835
|
|
|
) -> Searcher: |
836
|
|
|
""" |
837
|
|
|
DEA schedules (PENDING). |
838
|
|
|
|
839
|
|
|
OBJECT: The DEA schedule (1 to 4, or "unscheduled") |
840
|
|
|
""" |
841
|
|
|
pass |
|
|
|
|
842
|
|
|
|
843
|
|
|
|
844
|
|
|
class EntryDeaClass(Entry[BioactivitySearch]): |
|
|
|
|
845
|
|
|
@classmethod |
846
|
|
|
def run( |
|
|
|
|
847
|
|
|
cls, |
|
|
|
|
848
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
849
|
|
|
key: str = EntryArgs.key("drug.dea:class"), |
|
|
|
|
850
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
851
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
852
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
853
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
854
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
855
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
856
|
|
|
) -> Searcher: |
857
|
|
|
""" |
858
|
|
|
DEA classes (PENDING). |
859
|
|
|
|
860
|
|
|
OBJECT: The DEA class name (e.g. "hallucinogen") |
861
|
|
|
""" |
862
|
|
|
pass |
|
|
|
|
863
|
|
|
|
864
|
|
|
|
865
|
|
|
class EntryChemidPlusAcute(Entry[AcuteEffectSearch]): |
|
|
|
|
866
|
|
|
@classmethod |
867
|
|
|
def run( |
|
|
|
|
868
|
|
|
cls, |
|
|
|
|
869
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
870
|
|
|
key: str = EntryArgs.key("tox.chemidplus:acute"), |
|
|
|
|
871
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
872
|
|
|
level: int = EntryArgs.acute_effect_level, |
|
|
|
|
873
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
874
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
875
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
876
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
877
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
878
|
|
|
) -> Searcher: |
879
|
|
|
""" |
880
|
|
|
Acute effect codes from ChemIDPlus. |
881
|
|
|
|
882
|
|
|
OBJECT: The code name (e.g. "behavioral: excitement") |
883
|
|
|
""" |
884
|
|
|
built = AcuteEffectSearch( |
885
|
|
|
key, |
886
|
|
|
Apis.Pubchem, |
887
|
|
|
top_level=level == 1, |
888
|
|
|
) |
889
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
890
|
|
|
|
891
|
|
|
|
892
|
|
|
class EntryChemidPlusLd50(Entry[Ld50Search]): |
|
|
|
|
893
|
|
View Code Duplication |
@classmethod |
|
|
|
|
894
|
|
|
def run( |
|
|
|
|
895
|
|
|
cls, |
|
|
|
|
896
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
897
|
|
|
key: str = EntryArgs.key("tox.chemidplus:ld50"), |
|
|
|
|
898
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
899
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
900
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
901
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
902
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
903
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
904
|
|
|
) -> Searcher: |
905
|
|
|
""" |
906
|
|
|
LD50 acute effects from ChemIDPlus. |
907
|
|
|
|
908
|
|
|
OBJECT: The negative log10 of the dose in mg/kg |
909
|
|
|
|
910
|
|
|
PREDICATE: "LD50:<route>" (e.g. "LD50:intravenous") |
911
|
|
|
""" |
912
|
|
|
built = Ld50Search(key, Apis.Pubchem) |
913
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
914
|
|
|
|
915
|
|
|
|
916
|
|
|
class EntryG2pInteractions(Entry[G2pInteractionSearch]): |
|
|
|
|
917
|
|
|
@classmethod |
918
|
|
|
def run( |
|
|
|
|
919
|
|
|
cls, |
|
|
|
|
920
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
921
|
|
|
key: str = EntryArgs.key("g2p:interactions"), |
|
|
|
|
922
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
923
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
924
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
925
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
926
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
927
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
928
|
|
|
) -> Searcher: |
929
|
|
|
""" |
930
|
|
|
Target interactions with affinities from Guide to Pharmacology. |
931
|
|
|
|
932
|
|
|
OBJECT: A molecular target |
933
|
|
|
|
934
|
|
|
PREDICATE: "interaction:agonism", etc. |
935
|
|
|
|
936
|
|
|
WEIGHT: 1.0 |
937
|
|
|
""" |
938
|
|
|
built = G2pInteractionSearch(key, Apis.G2p) |
939
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
940
|
|
|
|
941
|
|
|
|
942
|
|
|
class EntryHmdbTissue(Entry[BioactivitySearch]): |
|
|
|
|
943
|
|
|
@classmethod |
944
|
|
|
def run( |
|
|
|
|
945
|
|
|
cls, |
|
|
|
|
946
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
947
|
|
|
key: str = EntryArgs.key("hmdb:tissue"), |
|
|
|
|
948
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
949
|
|
|
min_nanomolar: Optional[float] = EntryArgs.min_nanomolar, |
|
|
|
|
950
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
951
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
952
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
953
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
954
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
955
|
|
|
) -> Searcher: |
956
|
|
|
""" |
957
|
|
|
Tissue concentrations from HMDB (PENDING). |
958
|
|
|
|
959
|
|
|
OBJECT: |
960
|
|
|
|
961
|
|
|
PREDICATE: "tissue:..." |
962
|
|
|
""" |
963
|
|
|
pass |
|
|
|
|
964
|
|
|
|
965
|
|
|
|
966
|
|
|
class EntryHmdbComputed(Entry[BioactivitySearch]): |
|
|
|
|
967
|
|
|
@classmethod |
968
|
|
|
def run( |
|
|
|
|
969
|
|
|
cls, |
|
|
|
|
970
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
971
|
|
|
key: str = EntryArgs.key("hmdb:computed"), |
|
|
|
|
972
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
973
|
|
|
min_nanomolar: Optional[float] = None, |
|
|
|
|
974
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
975
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
976
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
977
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
978
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
979
|
|
|
) -> Searcher: |
980
|
|
|
""" |
981
|
|
|
Computed properties from HMDB (PENDING). |
982
|
|
|
|
983
|
|
|
Keys include pKa, logP, logS, etc. |
984
|
|
|
|
985
|
|
|
OBJECT: A number; booleans are converted to 0/1 |
986
|
|
|
|
987
|
|
|
PREDICATE: The name of the property |
988
|
|
|
""" |
989
|
|
|
pass |
|
|
|
|
990
|
|
|
|
991
|
|
|
|
992
|
|
|
class EntryPubchemComputed(Entry[ComputedPropertySearch]): |
|
|
|
|
993
|
|
|
@classmethod |
994
|
|
|
def run( |
|
|
|
|
995
|
|
|
cls, |
|
|
|
|
996
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
997
|
|
|
key: str = EntryArgs.key("chem.pubchem:computed"), |
|
|
|
|
998
|
|
|
keys: str = EntryArgs.pubchem_computed_keys, |
|
|
|
|
999
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
1000
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
1001
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
1002
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
1003
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
1004
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
1005
|
|
|
) -> Searcher: |
1006
|
|
|
""" |
1007
|
|
|
Computed properties from PubChem. |
1008
|
|
|
|
1009
|
|
|
OBJECT: Number |
1010
|
|
|
|
1011
|
|
|
PREDICATE: e.g. "complexity" |
1012
|
|
|
""" |
1013
|
|
|
# replace acronyms, etc. |
1014
|
|
|
# ComputedPropertySearch standardizes punctuation and casing |
1015
|
|
|
known = { |
1016
|
|
|
k: v |
1017
|
|
|
for k, v in { |
1018
|
|
|
**EntryArgs.KNOWN_USEFUL_KEYS, |
1019
|
|
|
**EntryArgs.KNOWN_USELESS_KEYS, |
1020
|
|
|
}.items() |
1021
|
|
|
if v is not None |
1022
|
|
|
} |
1023
|
|
|
keys = {known.get(s.strip(), s) for s in keys.split(",")} |
1024
|
|
|
built = ComputedPropertySearch(key, Apis.Pubchem, descriptors=keys) |
1025
|
|
|
return cls._run(built, path, to, check, log, stderr, no_setup) |
1026
|
|
|
|
1027
|
|
|
|
1028
|
|
|
class EntryDrugbankAdmet(Entry[DrugbankTargetSearch]): |
|
|
|
|
1029
|
|
|
@classmethod |
1030
|
|
|
def run( |
|
|
|
|
1031
|
|
|
cls, |
|
|
|
|
1032
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
1033
|
|
|
key: str = EntryArgs.key("drugbank.admet:properties"), |
|
|
|
|
1034
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
1035
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
1036
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
1037
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
1038
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
1039
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
1040
|
|
|
) -> Searcher: |
1041
|
|
|
""" |
1042
|
|
|
Enzyme predictions from DrugBank (PENDING). |
1043
|
|
|
|
1044
|
|
|
OBJECT: Enzyme name |
1045
|
|
|
|
1046
|
|
|
PREDICATE: Action |
1047
|
|
|
""" |
1048
|
|
|
|
1049
|
|
|
|
1050
|
|
|
class EntryDrugbankMetabolites(Entry[DrugbankTargetSearch]): |
|
|
|
|
1051
|
|
|
@classmethod |
1052
|
|
|
def run( |
|
|
|
|
1053
|
|
|
cls, |
|
|
|
|
1054
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
1055
|
|
|
key: str = EntryArgs.key("drugbank.admet:metabolites"), |
|
|
|
|
1056
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
1057
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
1058
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
1059
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
1060
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
1061
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
1062
|
|
|
) -> Searcher: |
1063
|
|
|
""" |
1064
|
|
|
Metabolites from DrugBank (PENDING). |
1065
|
|
|
|
1066
|
|
|
OBJECT: Compound name (e.g. "norcocaine"). |
1067
|
|
|
|
1068
|
|
|
PREDICATE: "metabolized to" |
1069
|
|
|
""" |
1070
|
|
|
|
1071
|
|
|
|
1072
|
|
|
class EntryDrugbankDosage(Entry[DrugbankTargetSearch]): |
|
|
|
|
1073
|
|
|
@classmethod |
1074
|
|
|
def run( |
|
|
|
|
1075
|
|
|
cls, |
|
|
|
|
1076
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
1077
|
|
|
key: str = EntryArgs.key("drugbank.admet:dosage"), |
|
|
|
|
1078
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
1079
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
1080
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
1081
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
1082
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
1083
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
1084
|
|
|
) -> Searcher: |
1085
|
|
|
""" |
1086
|
|
|
Dosage from DrugBank (PENDING). |
1087
|
|
|
|
1088
|
|
|
OBJECT: concentration in mg/mL |
1089
|
|
|
|
1090
|
|
|
PREDICATE: "dosage :: <route>" |
1091
|
|
|
|
1092
|
|
|
OTHER COLUMNS: |
1093
|
|
|
|
1094
|
|
|
- form (e.g. liquid) |
1095
|
|
|
""" |
1096
|
|
|
|
1097
|
|
|
|
1098
|
|
|
class EntryMetaRandom(Entry[BioactivitySearch]): |
|
|
|
|
1099
|
|
|
@classmethod |
1100
|
|
|
def run( |
|
|
|
|
1101
|
|
|
cls, |
|
|
|
|
1102
|
|
|
path: Path = CommonArgs.in_compound_table, |
|
|
|
|
1103
|
|
|
key: str = EntryArgs.key("meta:random"), |
|
|
|
|
1104
|
|
|
to: Optional[Path] = CommonArgs.out_annotations_file, |
|
|
|
|
1105
|
|
|
as_of: Optional[str] = CommonArgs.as_of, |
|
|
|
|
1106
|
|
|
check: bool = EntryArgs.check, |
|
|
|
|
1107
|
|
|
log: Optional[Path] = CommonArgs.log, |
|
|
|
|
1108
|
|
|
stderr: str = CommonArgs.stderr, |
|
|
|
|
1109
|
|
|
no_setup: bool = CommonArgs.no_setup, |
|
|
|
|
1110
|
|
|
) -> Searcher: |
1111
|
|
|
""" |
1112
|
|
|
Random class assignment (PENDING). |
1113
|
|
|
|
1114
|
|
|
OBJECT: 1 thru n-compounds |
1115
|
|
|
|
1116
|
|
|
PREDICATE: "random" |
1117
|
|
|
""" |
1118
|
|
|
pass |
|
|
|
|
1119
|
|
|
|
1120
|
|
|
|
1121
|
|
|
Entries = [ |
1122
|
|
|
EntryChemblBinding, |
1123
|
|
|
EntryChemblMechanism, |
1124
|
|
|
EntryChemblAtc, |
1125
|
|
|
EntryChemblTrials, |
1126
|
|
|
EntryGoFunction, |
1127
|
|
|
EntryGoProcess, |
1128
|
|
|
EntryGoComponent, |
1129
|
|
|
EntryPubchemComputed, |
1130
|
|
|
EntryPubchemDisease, |
1131
|
|
|
EntryPubchemGeneCoOccurrence, |
1132
|
|
|
EntryPubchemDiseaseCoOccurrence, |
1133
|
|
|
EntryPubchemChemicalCoOccurrence, |
1134
|
|
|
EntryPubchemDgi, |
1135
|
|
|
EntryPubchemCgi, |
1136
|
|
|
EntryDrugbankTarget, |
1137
|
|
|
EntryGeneralFunction, |
1138
|
|
|
EntryDrugbankTransporter, |
1139
|
|
|
EntryTransporterGeneralFunction, |
1140
|
|
|
EntryDrugbankDdi, |
1141
|
|
|
EntryPubchemAssay, |
1142
|
|
|
EntryDeaSchedule, |
1143
|
|
|
EntryDeaClass, |
1144
|
|
|
EntryChemidPlusAcute, |
1145
|
|
|
EntryChemidPlusLd50, |
1146
|
|
|
EntryHmdbTissue, |
1147
|
|
|
EntryMetaRandom, |
1148
|
|
|
] |
1149
|
|
|
|