Passed
Push — dependabot/pip/flake8-bugbear-... ( 16d864...b4f9fc )
by
unknown
01:45
created

mandos.entries.entries.EntryDrugbankDosage.run()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nop 6
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
"""
0 ignored issues
show
coding-style introduced by
Too many lines in module (1256/1000)
Loading history...
2
Run searches and write files.
3
"""
4
5
from __future__ import annotations
6
7
import abc
8
import typing
0 ignored issues
show
Unused Code introduced by
The import typing seems to be unused.
Loading history...
9
from inspect import cleandoc as doc
10
from pathlib import Path
11
from typing import TypeVar, Generic, Union, Mapping, Set, Sequence, Type, Optional
12
13
import typer
0 ignored issues
show
introduced by
Unable to import 'typer'
Loading history...
14
15
from mandos.model import ReflectionUtils, InjectionError
16
from mandos.model.chembl_api import ChemblApi
17
from mandos.model.chembl_support import DataValidityComment
18
from mandos.model.chembl_support.chembl_targets import TargetType, ConfidenceLevel
19
from mandos.model.pubchem_support.pubchem_models import (
20
    ClinicalTrialsGovUtils,
21
    CoOccurrenceType,
22
    AssayType,
23
    DrugbankTargetType,
24
)
25
from mandos.model.searches import Search
26
from mandos.model.settings import MANDOS_SETTINGS
27
from mandos.model.taxonomy import Taxonomy
28
from mandos.model.taxonomy_caches import TaxonomyFactories
29
from mandos.entries.api_singletons import Apis
30
from mandos.search.chembl.target_traversal import TargetTraversalStrategies
31
from mandos.search.pubchem.acute_effects_search import AcuteEffectSearch, Ld50Search
32
from mandos.search.pubchem.bioactivity_search import BioactivitySearch
33
from mandos.search.pubchem.computed_property_search import (
0 ignored issues
show
Unused Code introduced by
Unused ComputedPropertyHit imported from mandos.search.pubchem.computed_property_search
Loading history...
34
    ComputedPropertySearch,
35
    ComputedPropertyHit,
36
)
37
from mandos.search.pubchem.dgidb_search import DgiSearch
38
from mandos.search.pubchem.ctd_gene_search import CtdGeneSearch
39
from mandos.entries.searcher import Searcher
40
from mandos.search.pubchem.drugbank_ddi_search import DrugbankDdiSearch
41
from mandos.search.pubchem.drugbank_interaction_search import (
42
    DrugbankTargetSearch,
43
    DrugbankGeneralFunctionSearch,
44
)
45
46
from mandos import logger
47
from mandos.search.chembl.binding_search import BindingSearch
48
from mandos.search.chembl.atc_search import AtcSearch
49
from mandos.search.chembl.go_search import GoType, GoSearch
50
from mandos.search.chembl.indication_search import IndicationSearch
51
from mandos.search.chembl.mechanism_search import MechanismSearch
52
from mandos.search.pubchem.cooccurrence_search import (
53
    GeneCoOccurrenceSearch,
54
    ChemicalCoOccurrenceSearch,
55
    CoOccurrenceSearch,
56
    DiseaseCoOccurrenceSearch,
57
)
58
from mandos.search.pubchem.disease_search import DiseaseSearch
59
60
S = TypeVar("S", bound=Search, covariant=True)
0 ignored issues
show
Coding Style Naming introduced by
Class name "S" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
61
U = TypeVar("U", covariant=True, bound=CoOccurrenceSearch)
0 ignored issues
show
Coding Style Naming introduced by
Class name "U" doesn't conform to PascalCase naming style ('[^\\W\\da-z][^\\W_]+$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
62
63
64
class Utils:
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
65
    """"""
66
67
    @staticmethod
68
    def split(st: str) -> Set[str]:
0 ignored issues
show
Coding Style Naming introduced by
Argument name "st" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
69
        return {s.strip() for s in st.split(",")}
70
71
    @staticmethod
72
    def get_taxa(taxa: str) -> Sequence[Taxonomy]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
73
        return [
74
            TaxonomyFactories.from_uniprot(MANDOS_SETTINGS.taxonomy_cache_path).load(int(taxon))
75
            for taxon in taxa.split(",")
76
        ]
77
78
    @staticmethod
79
    def get_trial_statuses(st: str) -> Set[str]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Coding Style Naming introduced by
Argument name "st" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
80
        return ClinicalTrialsGovUtils.resolve_statuses(st)
81
82
    @staticmethod
83
    def get_target_types(st: str) -> Set[str]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Coding Style Naming introduced by
Argument name "st" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
84
        return {s.name for s in TargetType.resolve(st)}
85
86
    @staticmethod
87
    def get_flags(st: str) -> Set[str]:
0 ignored issues
show
Coding Style Naming introduced by
Argument name "st" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
88
        return {s.name for s in DataValidityComment.resolve(st)}
89
90
91
class _Typer:
92
93
    path = typer.Argument(
94
        ...,
95
        exists=True,
96
        dir_okay=False,
97
        readable=True,
98
        help=doc(
99
            """
100
            The path to the input file.
101
            One of:
102
103
              (A) *.txt or *.lines with one InChI Key per line;
104
105
              (B) A *.csv, *.tsv, *.tab file (or .gzip variant) with a column called 'inchikey'; OR
106
107
              (C) An Apache Arrow *.feather file with a column called 'inchikey'
108
        """
109
        ),
110
    )
111
112
    to = typer.Option(
113
        None,
114
        show_default=False,
115
        help=doc(
116
            """
117
            The path to the output file.
118
            If not set, chooses <input-path>-<search>.csv.gz
119
            The filename extension should be one of: .csv, .tsv, .tab, .json (with optional .gz/.bz2);
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (102/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
120
            .feather; .snappy (or .parquet); or .h5.
121
            Feather (.feather), Parquet (.snappy), and tab-delimited (.tsv.gz) are recommended.
122
            JSON and HDF5 (.h5) are not recommended. If H5, will add a new dataset named <key> to the archive.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (110/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
123
            Will fail if the file exists unless the `--overwrite` flag is set.
124
125
            If only the filename extension is provided (e.g. --to '.feather'), will only change the output format
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (113/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
126
            (and filename extension).
127
        """
128
        ),
129
    )
130
131
    replace: bool = typer.Option(False, help="Replace output file if they exist. See also: --skip")
132
133
    skip: bool = typer.Option(
134
        False, help="Skip any search if the output file exists (only warns). See also: --replace"
135
    )
136
137
    in_cache: bool = typer.Option(
138
        False,
139
        help="Do not download any data. Fails if the needed data is not cached.",
140
        hidden=True,
141
    )
142
143
    verbose: int = typer.Option(
144
        0,
145
        "--verbose",
146
        "-v",
147
        count=True,
148
        help="Configure logger to output INFO (use `--verbose --verbose` or `-vv` for DEBUG output)",
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (101/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
149
    )
150
151
    @staticmethod
152
    def key(name: str) -> typer.Option:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
153
        return typer.Option(
154
            name,
155
            min=1,
156
            max=120,
157
            help="""
158
            A free-text unique key for the search.
159
            Should be a short, <60-character name that describes the search and any parameters.
160
            The output file will be named according to a 'sanitized' variant of this value.
161
            """,
162
        )
163
164
    test = typer.Option(
165
        False,
166
        "--check",
167
        help="Do not run searches; just check that the parameters are ok.",
168
    )
169
170
    taxa = typer.Option(
171
        "7742",
172
        show_default=False,
173
        help=doc(
174
            """
175
        The IDs or names of UniProt taxa, comma-separated.
176
        Taxon names and common names can be used for vertebrate species (where available).
177
178
        This can have a significant effect on the search. See the docs fore more info.
179
180
        [default: 7742] (Euteleostomi)
181
        """
182
        ),
183
    )
184
185
    traversal_strategy = typer.Option(
186
        "@null",
187
        "--traversal",
188
        show_default=False,
189
        help=doc(
190
            """
191
        Target traversal strategy name, file, or class.
192
        Dictates the way the network of ChEMBL targets is traversed (from the annotated target as a source).
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (108/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
193
        Specifies the network links that are followed and which targets are 'accepted' for final annotations.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (109/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
194
        This option has a dramatic effect on the search. See the docs for more info.
195
196
        Can be one of:
197
        (A) A standard strategy name, starting with @;
198
        (B) The path to a ``*.strat`` file; OR
199
        (C) The fully qualified name of a ``TargetTraversal``
200
201
        The standard traversal strategies are: {}
202
203
        [default: @null] (No traversal; targets as-is)
204
        """.format(
205
                "; ".join(TargetTraversalStrategies.standard_strategies())
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
206
            )
207
        ),
208
    )
209
210
    target_types = typer.Option(
211
        "@molecular",
212
        "--targets",
213
        show_default=False,
214
        help=doc(
215
            """
216
        The accepted target types, comma-separated.
217
218
        NOTE: This affects only the types are are accepted after traversal,
219
        and the types must be included in the traversal.
220
        This means that this must be AT LEAST as restrictive as the traversal strategy.
221
222
        The ChEMBL-defined types are:
223
224
          {}
225
226
        These special names are also accepted:
227
228
          - {}
229
230
        [default: @molecular]
231
        """.format(
232
                "; ".join([s.name for s in TargetType.all_types()]),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
233
                "\n\n          - ".join(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
234
                    [f"{k} ({v})" for k, v in TargetType.special_type_names().items()]
235
                ),
236
            )
237
        ),
238
    )
239
240
    min_confidence = typer.Option(
241
        3,
242
        "--confidence",
243
        min=0,
244
        max=9,
245
        show_default=False,
246
        help=doc(
247
            """
248
        Minimum target confidence score, inclusive.
249
        This is useful to modify in only some cases. More important options are min_pchembl and taxa.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (101/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
250
251
        Values are: {}
252
253
        [default: 3]
254
        """.format(
255
                "; ".join([f"{s.value} ({s.name})" for s in ConfidenceLevel])
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
256
            )
257
        ),
258
    )
259
260
    relations = typer.Option(
261
        "<,<=,=",
262
        "--relations",
263
        show_default=False,
264
        help=doc(
265
            """
266
        Assay activity relations allowed, comma-separated.
267
        If post-processing yourself, consider including all.
268
        Values are: <, <=, =, >, >=, ~.
269
        [default: <,<=,=]
270
        """
271
        ),
272
    )
273
274
    min_pchembl = typer.Option(
275
        6.0,
276
        "--pchembl",
277
        min=0.0,
278
        show_default=False,
279
        help=doc(
280
            """
281
        Minimum pCHEMBL value, inclusive.
282
        If post-processing yourself, consider setting to 0.0.
283
        [default: 6.0]
284
        """
285
        ),
286
    )
287
288
    banned_flags = typer.Option(
289
        "@negative",
290
        show_default=False,
291
        help=doc(
292
            """
293
        Exclude activity annotations with data validity flags, comma-separated.
294
        It is rare to need to change this.
295
296
        Values are: {}.
297
298
        Special sets are:
299
300
          - @all (all flags are banned)
301
302
          - @negative ({})
303
304
          - @positive ({})
305
306
        [default: @negative]
307
        """.format(
308
                "; ".join([s.name for s in DataValidityComment]),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
309
                ", ".join([s.name for s in DataValidityComment.negative_comments()]),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
310
                ", ".join([s.name for s in DataValidityComment.positive_comments()]),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
311
            ),
312
        ),
313
    )
314
315
    chembl_trial = typer.Option(
316
        0,
317
        "--phase",
318
        show_default=False,
319
        help=doc(
320
            """
321
        Minimum phase of a clinical trial, inclusive.
322
        Values are: 0, 1, 2, 3.
323
        [default: 0]
324
        """
325
        ),
326
        min=0,
327
        max=3,
328
    )
329
330
331
class Entry(Generic[S], metaclass=abc.ABCMeta):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
332
    @classmethod
333
    def cmd(cls) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
334
        key = cls._get_default_key()
335
        if isinstance(key, typer.models.OptionInfo):
336
            key = key.default
337
        if key is None or not isinstance(key, str):
338
            raise AssertionError(f"Key for {cls.__name__} is {key}")
339
        return key
340
341
    @classmethod
342
    def run(cls, path: Path, **params) -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
343
        raise NotImplementedError()
344
345
    @classmethod
346
    def get_search_type(cls) -> Type[S]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
347
        # noinspection PyTypeChecker
348
        return ReflectionUtils.get_generic_arg(cls, Search)
349
350
    @classmethod
351
    def test(cls, path: Path, **params) -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
The argument path seems to be unused.
Loading history...
352
        params = dict(params)
353
        params["test"] = True
354
        cls.run(**params)
355
356
    @classmethod
357
    def _run(cls, built: S, path: Path, to: Optional[Path], check: bool):
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
358
        searcher = Searcher([built], [to], path)
359
        if not check:
360
            searcher.search()
361
        return searcher
362
363
    # @classmethod
364
    # def build(cls, path: Path, **params: Mapping[str, Union[int, float, str]]) -> Search:
365
    #    raise NotImplementedError()
366
367
    @classmethod
368
    def default_param_values(cls) -> Mapping[str, Union[str, float, int]]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
369
        return {
370
            param: value
371
            for param, value in ReflectionUtils.default_arg_values(cls.run).items()
372
            if param not in {"key", "path"}
373
        }
374
375
    @classmethod
376
    def _get_default_key(cls) -> str:
377
        vals = ReflectionUtils.default_arg_values(cls.run)
378
        try:
379
            return vals["key"]
380
        except KeyError:
381
            logger.error(f"key not in {vals.keys()} for {cls.__name__}")
382
            raise
383
384
385
class EntryChemblBinding(Entry[BindingSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
386
    @classmethod
387
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (12/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
388
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
389
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
390
        key: str = _Typer.key("chembl:binding"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
391
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
392
        taxa: Optional[str] = _Typer.taxa,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
393
        traversal=_Typer.traversal_strategy,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
394
        target_types=_Typer.target_types,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
395
        confidence=_Typer.min_confidence,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
396
        relations=_Typer.relations,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
397
        min_pchembl=_Typer.min_pchembl,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
398
        banned_flags=_Typer.banned_flags,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
399
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
400
    ) -> Searcher:
401
        """
402
        Binding data from ChEMBL.
403
        These are 'activity' annotations of the type 'B' that have a pCHEMBL value.
404
        There is extended documentation on this search; see:
405
406
        https://mandos-chem.readthedocs.io/en/latest/binding.html
407
408
        OBJECT: ChEMBL preferred target name
409
410
        PREDICATE: "binds to"
411
412
        OTHER COLUMNS:
413
414
        - taxon_id: From UniProt
415
416
        - taxon_name: From Uniprot (scientific name)
417
418
        - pchembl: Negative base-10 log of activity value (see docs on ChEMBL)
419
420
        - standard_relation: One of '<', '<=', '=', '>=', '>', '~'. Consider using <, <=, and = to indicate hits.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (113/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
421
422
        - std_type: e.g. EC50, Kd
423
        """
424
        built = BindingSearch(
425
            key=key,
426
            api=Apis.Chembl,
427
            taxa=Utils.get_taxa(taxa),
428
            traversal_strategy=traversal,
429
            allowed_target_types=Utils.get_target_types(target_types),
430
            min_confidence_score=confidence,
431
            allowed_relations=Utils.split(relations),
432
            min_pchembl=min_pchembl,
433
            banned_flags=Utils.get_flags(banned_flags),
434
        )
435
        return cls._run(built, path, to, check)
436
437
438
class EntryChemblMechanism(Entry[MechanismSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
439
    @classmethod
440
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (10/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
441
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
442
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
443
        key: str = _Typer.key("chembl:mechanism"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
444
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
445
        taxa: Optional[str] = _Typer.taxa,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
446
        traversal: str = _Typer.traversal_strategy,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
447
        target_types: str = _Typer.target_types,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
448
        min_confidence: Optional[int] = _Typer.min_confidence,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
449
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
450
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
451
    ) -> Searcher:
452
        """
453
        Mechanism of action (MoA) data from ChEMBL.
454
455
        OBJECT: ChEMBL preferred target name
456
457
        PREDICATE: Target action; e.g. "agonist of" or "positive allosteric modulator of"
458
459
        OTHER COLUMNS:
460
461
        - direct_interaction: true or false
462
463
        - description: From ChEMBL
464
465
        - exact_target_id: the specifically annotated target, before traversal
466
        """
467
        built = MechanismSearch(
468
            key=key,
469
            api=Apis.Chembl,
470
            taxa=Utils.get_taxa(taxa),
471
            traversal_strategy=traversal,
472
            allowed_target_types=Utils.get_target_types(target_types),
473
            min_confidence_score=min_confidence,
474
        )
475
        return cls._run(built, path, to, check)
476
477
478
class EntryChemblTrials(Entry[IndicationSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
479
    @classmethod
480
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (7/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
481
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
482
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
483
        key: str = _Typer.key("chembl.trial"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
484
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
485
        min_phase: Optional[int] = _Typer.chembl_trial,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
486
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
487
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
488
    ) -> Searcher:
489
        """
490
        Diseases from clinical trials listed in ChEMBL.
491
492
        OBJECT: MeSH code
493
494
        PREDICATE: "phase <level> trial"
495
        """
496
        built = IndicationSearch(key=key, api=Apis.Chembl, min_phase=min_phase)
497
        return cls._run(built, path, to, check)
498
499
500
class EntryChemblAtc(Entry[AtcSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
501
    @classmethod
502
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (7/5)
Loading history...
503
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
504
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
505
        key: str = _Typer.key("chembl.atc"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
506
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
507
        levels: str = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
508
            "1,2,3,4,5", min=1, max=5, help="""List of ATC levels, comma-separated."""
509
        ),
510
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
511
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
512
    ) -> Searcher:
513
        """
514
        ATC codes from ChEMBL.
515
516
        OBJECT: ATC Code
517
518
        PREDICATE: "ATC L<leveL> code"
519
        """
520
        built = AtcSearch(
521
            key=key, api=Apis.Chembl, levels={int(x.strip()) for x in levels.split(",")}
522
        )
523
        return cls._run(built, path, to, check)
524
525
526
class _EntryChemblGo(Entry[GoSearch], metaclass=abc.ABCMeta):
527
    @classmethod
528
    def go_type(cls) -> GoType:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
529
        raise NotImplementedError()
530
531
    @classmethod
532
    def cmd(cls) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
533
        me = str(cls.go_type().name)
0 ignored issues
show
Coding Style Naming introduced by
Variable name "me" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
534
        return f"chembl:go.{me.lower()}"
535
536
    @classmethod
537
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (14/5)
Loading history...
Comprehensibility introduced by
This function exceeds the maximum number of variables (17/15).
Loading history...
538
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
539
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
540
        key: str = _Typer.key("<see above>"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
541
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
542
        taxa: Optional[str] = _Typer.taxa,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
543
        traversal_strategy: str = _Typer.traversal_strategy,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
544
        target_types: str = _Typer.target_types,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
545
        confidence: Optional[int] = _Typer.min_confidence,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
546
        relations: str = _Typer.relations,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
547
        min_pchembl: float = _Typer.min_pchembl,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
548
        banned_flags: Optional[str] = _Typer.banned_flags,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
549
        binding_search: Optional[str] = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
550
            None,
551
            help="""
552
            The fully qualified name of a class inheriting ``BindingSearch``.
553
            If specified, all parameters above are passed to its constructor.
554
            """,
555
        ),
556
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
557
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
558
    ) -> Searcher:
559
        """
560
        GO terms associated with ChEMBL binding targets.
561
562
        OBJECT: GO Term name
563
564
        PREDICATE: "associated with ""Function"|"Process"|"Component"" term"
565
566
        OTHER COLUMNS:
567
            See the docs for ``mandos chembl:binding``
568
569
        Note:
570
571
            By default, the key is the "chembl:go.function", "chembl:go.process", or "chembl:go.component".
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (107/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
572
573
        """
574
        if key is None or key == "<see above>":
575
            key = cls.cmd()
576
        api = ChemblApi.wrap(Apis.Chembl)
577
        if binding_search is None:
578
            binding_clazz = BindingSearch
579
        else:
580
            binding_clazz = ReflectionUtils.injection(binding_search, BindingSearch)
581
            logger.info(f"NOTICE: Passing parameters to {binding_clazz.__qualname__}")
582
        try:
583
            binding_search = binding_clazz(
584
                key=key,
585
                api=Apis.Chembl,
586
                taxa=Utils.get_taxa(taxa),
587
                traversal_strategy=traversal_strategy,
588
                allowed_target_types=Utils.get_target_types(target_types),
589
                min_confidence_score=confidence,
590
                allowed_relations=Utils.split(relations),
591
                min_pchembl=min_pchembl,
592
                banned_flags=Utils.get_flags(banned_flags),
593
            )
594
        except (TypeError, ValueError):
595
            raise InjectionError(f"Failed to build {binding_clazz.__qualname__}")
596
        built = GoSearch(key, api, cls.go_type(), binding_search)
597
        return cls._run(built, path, to, check)
598
599
600
class EntryGoFunction(_EntryChemblGo):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
601
    @classmethod
602
    def go_type(cls) -> GoType:
603
        return GoType.function
604
605
606
class EntryGoProcess(_EntryChemblGo):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
607
    @classmethod
608
    def go_type(cls) -> GoType:
609
        return GoType.process
610
611
612
class EntryGoComponent(_EntryChemblGo):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
613
    @classmethod
614
    def go_type(cls) -> GoType:
615
        return GoType.component
616
617
618
class EntryPubchemDisease(Entry[DiseaseSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
619
    @classmethod
620
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
621
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
622
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
623
        key: str = _Typer.key("disease.ctd:mesh"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
624
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
625
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
626
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
627
    ) -> Searcher:
628
        """
629
        Diseases in the Comparative Toxicogenomics Database (CTD).
630
631
        OBJECT: MeSH code of disease
632
633
        PREDICATE: "marker/mechanism evidence for" or "disease evidence for"
634
        """
635
        built = DiseaseSearch(key, Apis.Pubchem)
636
        return cls._run(built, path, to, check)
637
638
639
class _EntryPubchemCoOccurrence(Entry[U], metaclass=abc.ABCMeta):
640
    @classmethod
641
    def cmd(cls) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
642
        me = str(cls.get_cooccurrence_type().name)
0 ignored issues
show
Coding Style Naming introduced by
Variable name "me" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
643
        return f"lit.pubchem:{me.lower()}"
644
645
    @classmethod
646
    def get_cooccurrence_type(cls) -> CoOccurrenceType:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
647
        s: CoOccurrenceSearch = cls.get_search_type()
0 ignored issues
show
Coding Style Naming introduced by
Variable name "s" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
648
        return s.cooccurrence_type()
649
650
    @classmethod
651
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (8/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
652
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
653
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
654
        key: str = _Typer.key("<see above>"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
655
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
656
        min_score: float = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
657
            0.0,
658
            help="Minimum enrichment score, inclusive. See docs for more info.",
659
            min=0.0,
660
        ),
661
        min_articles: int = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
662
            0,
663
            help="Minimum number of articles for both the compound and object, inclusive.",
664
            min=0,
665
        ),
666
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
667
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
668
    ) -> Searcher:
669
        """
670
        Co-occurrences from PubMed articles.
671
        There is extended documentation on this search.
672
        Also refer to https://pubchemdocs.ncbi.nlm.nih.gov/knowledge-panels
673
674
        OBJECT: Name of gene/chemical/disease
675
676
        PREDICATE: "co-occurs with <gene/chemical/disease>"
677
678
        OTHER COLUMNS:
679
680
        - score: enrichment score; see PubChem docs
681
682
        - intersect_count: Number of articles co-occurring
683
684
        - query_count: Total number of articles for query compound
685
686
        - neighbor_count: Total number of articles for target (co-occurring) compound
687
        """
688
        if key is None or key == "<see above>":
689
            key = cls.cmd()
690
        clazz = cls.get_search_type()
691
        built = clazz(key, Apis.Pubchem, min_score=min_score, min_articles=min_articles)
692
        return cls._run(built, path, to, check)
693
694
695
class EntryPubchemGeneCoOccurrence(_EntryPubchemCoOccurrence[GeneCoOccurrenceSearch]):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
696
    """"""
697
698
699
class EntryPubchemDiseaseCoOccurrence(_EntryPubchemCoOccurrence[DiseaseCoOccurrenceSearch]):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
700
    """"""
701
702
703
class EntryPubchemChemicalCoOccurrence(_EntryPubchemCoOccurrence[ChemicalCoOccurrenceSearch]):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
704
    """"""
705
706
707
class EntryPubchemDgi(Entry[DgiSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
708
    @classmethod
709
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
710
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
711
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
712
        key: str = _Typer.key("interact.dgidb:gene"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
713
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
714
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
715
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
716
    ) -> Searcher:
717
        """
718
        Drug/gene interactions in the Drug Gene Interaction Database (DGIDB).
719
        Also see ``disease.dgidb:int``.
720
721
        OBJECT: Name of the gene
722
723
        PREDICATE: "interacts with gene"
724
        """
725
        built = DgiSearch(key, Apis.Pubchem)
726
        return cls._run(built, path, to, check)
727
728
729
class EntryPubchemCgi(Entry[CtdGeneSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
730
    @classmethod
731
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
732
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
733
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
734
        key: str = _Typer.key("interact.ctd:gene"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
735
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
736
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
737
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
738
    ) -> Searcher:
739
        """
740
        Compound/gene interactions in the Drug Gene Interaction Database (DGIDB).
741
        Also see ``interact.dgidb:int``.
742
743
        OBJECT: Name of the gene
744
745
        PREDICATE: "compound/gene interaction"
746
747
        """
748
        built = CtdGeneSearch(key, Apis.Pubchem)
749
        return cls._run(built, path, to, check)
750
751
752
class EntryDrugbankTarget(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
753
    @classmethod
754
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
755
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
756
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
757
        key: str = _Typer.key("interact.drugbank:target"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
758
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
759
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
760
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
761
    ) -> Searcher:
762
        """
763
        Protein targets from DrugBank.
764
765
        OBJECT: Target name (e.g. "Solute carrier family 22 member 11") from DrugBank
766
767
        PREDICATE: Action (e.g. "binder", "downregulator", or "agonist")
768
        """
769
        built = DrugbankTargetSearch(key, Apis.Pubchem, {DrugbankTargetType.target})
770
        return cls._run(built, path, to, check)
771
772
773 View Code Duplication
class EntryGeneralFunction(Entry[DrugbankGeneralFunctionSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
774
    @classmethod
775
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (6/5)
Loading history...
776
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
777
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
778
        key: str = _Typer.key("interact.drugbank:target-function"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
779
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
780
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
781
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
782
    ) -> Searcher:
783
        """
784
        General functions from DrugBank targets.
785
786
        OBJECT: Name of the general function (e.g. "Toxic substance binding")
787
788
        PREDICATE: against on target (e.g. "binder", "downregulator", or "agonist").
789
        """
790
        built = DrugbankGeneralFunctionSearch(key, Apis.Pubchem, {DrugbankTargetType.target})
791
        return cls._run(built, path, to, check)
792
793
794
class EntryDrugbankTransporter(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
795
    @classmethod
796
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (6/5)
Loading history...
797
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
798
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
799
        key: str = _Typer.key("interact.drugbank:pk"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
800
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
801
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
802
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
803
    ) -> Searcher:
804
        """
805
        Protein transporters, carriers, and enzymes from DrugBank.
806
807
        OBJECT: Transporter name (e.g. "Solute carrier family 22 member 11") from DrugBank
808
809
        PREDICATE: "transported by", "carried by", or "metabolized by"
810
        """
811
        target_types = {
812
            DrugbankTargetType.transporter,
813
            DrugbankTargetType.carrier,
814
            DrugbankTargetType.enzyme,
815
        }
816
        built = DrugbankTargetSearch(key, Apis.Pubchem, target_types)
817
        return cls._run(built, path, to, check)
818
819
820 View Code Duplication
class EntryTransporterGeneralFunction(Entry[DrugbankGeneralFunctionSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
821
    @classmethod
822
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
823
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
824
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
825
        key: str = _Typer.key("interact.drugbank:pk-function"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
826
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
827
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
828
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
829
    ) -> Searcher:
830
        """
831
        General functions from DrugBank transporters, carriers, and enzymes.
832
833
        OBJECT: Name of the general function (e.g. "Toxic substance binding")
834
835
        PREDICATE: "transported by", "carried by", or "metabolized by"
836
        """
837
        built = DrugbankGeneralFunctionSearch(key, Apis.Pubchem, {DrugbankTargetType.target})
838
        return cls._run(built, path, to, check)
839
840
841
class EntryDrugbankDdi(Entry[DrugbankDdiSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
842
    @classmethod
843
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
844
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
845
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
846
        key: str = _Typer.key("interact.drugbank:ddi"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
847
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
848
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
849
        verbose: int = _Typer.verbose,
0 ignored issues
show
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
850
    ) -> Searcher:
851
        """
852
        Drug/drug interactions listed by DrugBank.
853
854
        The 'description' column includes useful information about the interaction,
855
        such as diseases and whether a risk is increased or decreased.
856
857
        OBJECT: name of the drug (e.g. "ibuprofen")
858
859
        PREDICATE: "ddi"
860
        """
861
        built = DrugbankDdiSearch(key, Apis.Pubchem)
862
        return cls._run(built, path, to, check)
863
864
865
class EntryPubchemAssay(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
866
    @classmethod
867
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (8/5)
Loading history...
868
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
869
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
870
        key: str = _Typer.key("assay.pubchem:activity"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
871
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
872
        name_must_match: bool = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
873
            False,
874
            help=doc(
875
                """
876
            Require that the name of the compound(s) exactly matches the compound name on PubChem (case-insensitive)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (116/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
877
        """
878
            ),
879
        ),
880
        ban_sources: Optional[str] = None,
0 ignored issues
show
Unused Code introduced by
The argument ban_sources seems to be unused.
Loading history...
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
881
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
882
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
883
    ) -> Searcher:
884
        """
885
        PubChem bioactivity results.
886
887
        Note: The species name, if present, is taken from the target name.
888
        The taxon ID is what was curated in PubChem.
889
890
        OBJECT: Name of the target without species suffix (e.g. "Slc6a3 - solute carrier family 6 member 3")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (108/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
891
892
        PREDICATE: "active"|"inactive"|"inconclusive"|"undetermined"
893
894
        SOURCE: "PubChem: <referrer> "(""confirmatory"|"literature"|"other"")"
895
        """
896
        built = BioactivitySearch(
897
            key, Apis.Pubchem, assay_types=set(AssayType), compound_name_must_match=name_must_match
898
        )
899
        return cls._run(built, path, to, check)
900
901
902
class EntryDeaSchedule(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
903
    @classmethod
904
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (6/5)
Loading history...
905
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
906
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
907
        key: str = _Typer.key("drug.dea:schedule"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
908
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
909
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
910
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
911
    ) -> Searcher:
912
        """
913
        DEA schedules (UNDER CONSTRUCTION).
914
915
        OBJECT: (1 to 4, or "unscheduled")
916
917
        PREDICATE: "has DEA schedule"
918
        """
919
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
920
921
922
class EntryDeaClass(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
923
    @classmethod
924
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
925
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
926
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
927
        key: str = _Typer.key("drug.dea:class"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
928
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
929
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
930
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
931
    ) -> Searcher:
932
        """
933
        DEA classes (UNDER CONSTRUCTION).
934
935
        OBJECT: e.g. "hallucinogen"
936
937
        PREDICATE: "is in DEA class"
938
        """
939
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
940
941
942
class EntryChemidPlusAcute(Entry[AcuteEffectSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
943
    @classmethod
944
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (7/5)
Loading history...
945
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
946
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
947
        key: str = _Typer.key("tox.chemidplus:acute"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
948
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
949
        level: int = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
950
            2,
951
            min=1,
952
            max=2,
953
            help="""
954
          The level in the ChemIDPlus hierarchy of effect names.
955
          Level 1: e.g. 'behavioral'
956
          Level 2: 'behavioral: excitement'
957
          """,
958
        ),
959
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
960
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
961
    ) -> Searcher:
962
        """
963
        Acute effect codes from ChemIDPlus.
964
965
        OBJECT: E.g. "behavioral: excitement"
966
967
        PREDICATE: "causes acute effect"
968
969
        OTHER COLUMNS:
970
971
            - organism: e.g. 'women', 'infant', 'men', 'human', 'dog', 'domestic animals - sheep and goats'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (107/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
972
            - human: true or false
973
            - test_type: e.g. 'TDLo'
974
            - route: e.g. 'skin'
975
            - mg_per_kg: e.g. 17.5
976
        """
977
        built = AcuteEffectSearch(
978
            key,
979
            Apis.Pubchem,
980
            top_level=level == 1,
981
        )
982
        return cls._run(built, path, to, check)
983
984
985
class EntryChemidPlusLd50(Entry[Ld50Search]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
986
    @classmethod
987
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
988
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
989
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
990
        key: str = _Typer.key("tox.chemidplus:ld50"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
991
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
992
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
993
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
994
    ) -> Searcher:
995
        """
996
        LD50 acute effects from ChemIDPlus.
997
998
        OBJECT: A dose in mg/kg (e.g. 3100)
999
1000
        PREDICATE: "LD50 :: <route>" (e.g. "LD50 :: intravenous)
1001
1002
        OTHER COLUMNS:
1003
1004
            - organism: e.g. 'women', 'infant', 'men', 'human', 'dog', 'domestic animals - sheep and goats'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (107/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
1005
            - human: true or false
1006
        """
1007
        built = Ld50Search(key, Apis.Pubchem)
1008
        return cls._run(built, path, to, check)
1009
1010
1011
class EntryHmdbTissue(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1012
    @classmethod
1013
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (7/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1014
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1015
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1016
        key: str = _Typer.key("hmdb:tissue"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1017
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1018
        min_nanomolar: Optional[float] = None,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1019
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1020
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1021
    ) -> Searcher:
1022
        """
1023
        Tissue concentrations from HMDB (**UNDER CONSTRUCTION**).
1024
1025
        OBJECT:
1026
1027
        PREDICATE: "tissue"
1028
        """
1029
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1030
1031
1032
class EntryHmdbComputed(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
1033
    @classmethod
1034
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (7/5)
Loading history...
1035
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1036
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1037
        key: str = _Typer.key("hmdb:computed"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1038
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1039
        min_nanomolar: Optional[float] = None,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1040
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1041
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1042
    ) -> Searcher:
1043
        """
1044
        Computed molecular properties from HMDB (**UNDER CONSTRUCTION**).
1045
1046
        Keys include pKa, logP, logS, etc.
1047
1048
        OBJECT: A number; booleans are converted to 0/1
1049
1050
        PREDICATE: The name of the property
1051
        """
1052
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1053
1054
1055
class EntryPubchemReact(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1056
    @classmethod
1057
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (6/5)
Loading history...
1058
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1059
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1060
        key: str = _Typer.key("interact.pubchem:react"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1061
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1062
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1063
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1064
    ) -> Searcher:
1065
        """
1066
        Metabolic reactions (**UNDER CONSTRUCTION**).
1067
1068
        OBJECT: Equation
1069
1070
        PREDICATE: "<pathway>"
1071
        """
1072
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1073
1074
1075
class EntryPubchemComputed(Entry[ComputedPropertySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
1076
1077
    KNOWN_USEFUL_KEYS: Mapping[str, str] = {
1078
        "weight": "Molecular Weight",
1079
        "xlogp3": None,
1080
        "hydrogen-bond-donors": "Hydrogen Bond Donor Count",
1081
        "hydrogen-bond-acceptors": "Hydrogen Bond Acceptor Count",
1082
        "rotatable-bonds": "Rotatable Bond Count",
1083
        "exact-mass": None,
1084
        "monoisotopic-mass": None,
1085
        "tpsa": "Topological Polar Surface Area",
1086
        "heavy-atoms": "Heavy Atom Count",
1087
        "charge": "Formal Charge",
1088
        "complexity": None,
1089
    }
1090
    KNOWN_USELESS_KEYS: Mapping[str, str] = {
1091
        "components": "Covalently-Bonded Unit Count",
1092
        "isotope-atoms": "Isotope Atom Count",
1093
        "defined-atom-stereocenter-count": None,
1094
        "undefined-atom-stereocenter-count": None,
1095
        "defined-bond-stereocenter-count": None,
1096
        "undefined-bond-stereocenter-count": None,
1097
        "compound-is-canonicalized": None,
1098
    }
1099
1100
    @staticmethod
1101
    def __stringify(keys: Mapping[str, str]):
1102
        return ", ".join((k if v is None else f"{k} ({v.lower()})" for k, v in keys.items()))
1103
1104
    @classmethod
1105
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (7/5)
Loading history...
1106
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1107
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1108
        key: str = _Typer.key("chem.pubchem:computed"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1109
        keys: str = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1110
            "weight,xlogp3,tpsa,complexity,exact-mass,heavy-atom-count,charge",
1111
            help="""
1112
                The keys of the computed properties, comma-separated.
1113
                Key names are case-insensitive and ignore punctuation like underscores and hyphens.
1114
1115
                Known keys are: {}
1116
1117
                Known, less-useful (metadata-like) keys are: {}
1118
            """.format(
1119
                __stringify(KNOWN_USEFUL_KEYS), __stringify(KNOWN_USELESS_KEYS)
1120
            ),
1121
        ),
1122
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1123
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1124
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument verbose seems to be unused.
Loading history...
1125
    ) -> Searcher:
1126
        """
1127
        Computed properties from PubChem.
1128
1129
        OBJECT: Number
1130
1131
        PREDICATE: e.g. "complexity"
1132
        """
1133
        # replace acronyms, etc.
1134
        # ComputedPropertySearch standardizes punctuation and casing
1135
        known = {
1136
            k: v
1137
            for k, v in {
1138
                **EntryPubchemComputed.KNOWN_USEFUL_KEYS,
1139
                **EntryPubchemComputed.KNOWN_USELESS_KEYS,
1140
            }
1141
            if v is not None
1142
        }
1143
        keys = {known.get(s.strip(), s) for s in keys.split(",")}
1144
        built = ComputedPropertySearch(key, Apis.Pubchem, descriptors=keys, source="PubChem")
1145
        return cls._run(built, path, to, check)
1146
1147
1148
class EntryDrugbankAdmet(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1149
    @classmethod
1150
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (6/5)
Loading history...
1151
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1152
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1153
        key: str = _Typer.key("drugbank.admet:properties"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1154
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1155
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1156
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1157
    ) -> Searcher:
1158
        """
1159
        Enzyme predictions from DrugBank (UNDER CONSTRUCTION).
1160
1161
        OBJECT: Enzyme name
1162
1163
        PREDICATE: Action
1164
        """
1165
1166
1167
class EntryDrugbankMetabolites(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1168
    @classmethod
1169
    def run(
0 ignored issues
show
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
best-practice introduced by
Too many arguments (6/5)
Loading history...
1170
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1171
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1172
        key: str = _Typer.key("drugbank.admet:metabolites"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1173
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1174
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1175
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1176
    ) -> Searcher:
1177
        """
1178
        Metabolites from DrugBank (UNDER CONSTRUCTION).
1179
1180
        OBJECT: Compound name (e.g. "norcocaine").
1181
1182
        PREDICATE: "metabolized to"
1183
        """
1184
1185
1186
class EntryDrugbankDosage(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1187
    @classmethod
1188
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1189
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1190
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1191
        key: str = _Typer.key("drugbank.admet:dosage"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1192
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1193
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1194
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1195
    ) -> Searcher:
1196
        """
1197
        Dosage from DrugBank (UNDER CONSTRUCTION).
1198
1199
        OBJECT: concentration in mg/mL
1200
1201
        PREDICATE: "dosage :: <route>"
1202
1203
        OTHER COLUMNS:
1204
1205
        - form (e.g. liquid)
1206
        """
1207
1208
1209
class EntryMetaRandom(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
1210
    @classmethod
1211
    def run(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
Coding Style Naming introduced by
Argument name "to" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
1212
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1213
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1214
        key: str = _Typer.key("meta:random"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1215
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1216
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1217
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1218
    ) -> Searcher:
1219
        """
1220
        Random class assignment with replacement (**UNDER CONSTRUCTION**).
1221
1222
        OBJECT: 1 thru n-compounds
1223
1224
        PREDICATE: "random"
1225
        """
1226
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1227
1228
1229
Entries = [
1230
    EntryChemblBinding,
1231
    EntryChemblMechanism,
1232
    EntryChemblAtc,
1233
    EntryChemblTrials,
1234
    EntryGoFunction,
1235
    EntryGoProcess,
1236
    EntryGoComponent,
1237
    EntryPubchemDisease,
1238
    EntryPubchemGeneCoOccurrence,
1239
    EntryPubchemDiseaseCoOccurrence,
1240
    EntryPubchemChemicalCoOccurrence,
1241
    EntryPubchemDgi,
1242
    EntryPubchemCgi,
1243
    EntryDrugbankTarget,
1244
    EntryGeneralFunction,
1245
    EntryDrugbankTransporter,
1246
    EntryTransporterGeneralFunction,
1247
    EntryDrugbankDdi,
1248
    EntryPubchemAssay,
1249
    EntryDeaSchedule,
1250
    EntryDeaClass,
1251
    EntryChemidPlusAcute,
1252
    EntryChemidPlusLd50,
1253
    EntryHmdbTissue,
1254
    EntryPubchemReact,
1255
    EntryMetaRandom,
1256
]
1257