Passed
Push — main ( 4e4203...cdf0f7 )
by Douglas
01:39
created

mandos.entries.entries._stringify()   A

Complexity

Conditions 2

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
"""
0 ignored issues
show
coding-style introduced by
Too many lines in module (1261/1000)
Loading history...
2
Run searches and write files.
3
"""
4
5
from __future__ import annotations
6
7
import abc
8
from inspect import cleandoc as doc
9
from pathlib import Path
10
from typing import TypeVar, Generic, Union, Mapping, Set, Sequence, Type, Optional
11
12
import typer
0 ignored issues
show
introduced by
Unable to import 'typer'
Loading history...
13
14
from mandos.model import ReflectionUtils, InjectionError
15
from mandos.model.chembl_api import ChemblApi
16
from mandos.model.chembl_support import DataValidityComment
17
from mandos.model.chembl_support.chembl_targets import TargetType, ConfidenceLevel
18
from mandos.model.pubchem_support.pubchem_models import (
19
    ClinicalTrialsGovUtils,
20
    CoOccurrenceType,
21
    AssayType,
22
    DrugbankTargetType,
23
)
24
from mandos.model.searches import Search
25
from mandos.model.settings import MANDOS_SETTINGS
26
from mandos.model.taxonomy import Taxonomy
27
from mandos.model.taxonomy_caches import TaxonomyFactories
28
from mandos.entries.api_singletons import Apis
29
from mandos.search.chembl.target_traversal import TargetTraversalStrategies
30
from mandos.search.pubchem.acute_effects_search import AcuteEffectSearch, Ld50Search
31
from mandos.search.pubchem.bioactivity_search import BioactivitySearch
32
from mandos.search.pubchem.computed_property_search import (
0 ignored issues
show
Unused Code introduced by
Unused ComputedPropertyHit imported from mandos.search.pubchem.computed_property_search
Loading history...
33
    ComputedPropertySearch,
34
    ComputedPropertyHit,
35
)
36
from mandos.search.pubchem.dgidb_search import DgiSearch
37
from mandos.search.pubchem.ctd_gene_search import CtdGeneSearch
38
from mandos.entries.searcher import Searcher
39
from mandos.search.pubchem.drugbank_ddi_search import DrugbankDdiSearch
40
from mandos.search.pubchem.drugbank_interaction_search import (
41
    DrugbankTargetSearch,
42
    DrugbankGeneralFunctionSearch,
43
)
44
45
from mandos import logger
46
from mandos.search.chembl.binding_search import BindingSearch
47
from mandos.search.chembl.atc_search import AtcSearch
48
from mandos.search.chembl.go_search import GoType, GoSearch
49
from mandos.search.chembl.indication_search import IndicationSearch
50
from mandos.search.chembl.mechanism_search import MechanismSearch
51
from mandos.search.pubchem.cooccurrence_search import (
52
    GeneCoOccurrenceSearch,
53
    ChemicalCoOccurrenceSearch,
54
    CoOccurrenceSearch,
55
    DiseaseCoOccurrenceSearch,
56
)
57
from mandos.search.pubchem.disease_search import DiseaseSearch
58
59
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...
60
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...
61
62
63
class Utils:
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
64
    """"""
65
66
    @staticmethod
67
    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...
68
        return {s.strip() for s in st.split(",")}
69
70
    @staticmethod
71
    def get_taxa(taxa: str) -> Sequence[Taxonomy]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
72
        return [
73
            TaxonomyFactories.from_uniprot(MANDOS_SETTINGS.taxonomy_cache_path).load(int(taxon))
74
            for taxon in taxa.split(",")
75
        ]
76
77
    @staticmethod
78
    def get_trial_statuses(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...
79
        return ClinicalTrialsGovUtils.resolve_statuses(st)
80
81
    @staticmethod
82
    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...
83
        return {s.name for s in TargetType.resolve(st)}
84
85
    @staticmethod
86
    def get_flags(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...
87
        return {s.name for s in DataValidityComment.resolve(st)}
88
89
90
class _Typer:
91
92
    path = typer.Argument(
93
        ...,
94
        exists=True,
95
        dir_okay=False,
96
        readable=True,
97
        help=doc(
98
            """
99
            The path to the input file.
100
            One of:
101
102
              (A) *.txt or *.lines with one InChI Key per line;
103
104
              (B) A *.csv, *.tsv, *.tab file (or .gzip variant) with a column called 'inchikey'; OR
105
106
              (C) An Apache Arrow *.feather file with a column called 'inchikey'
107
        """
108
        ),
109
    )
110
111
    to = typer.Option(
112
        None,
113
        show_default=False,
114
        help=doc(
115
            """
116
            The path to the output file.
117
            If not set, chooses <input-path>-<search>.csv.gz
118
            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...
119
            .feather; .snappy (or .parquet); or .h5.
120
            Feather (.feather), Parquet (.snappy), and tab-delimited (.tsv.gz) are recommended.
121
            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...
122
            Will fail if the file exists unless the `--overwrite` flag is set.
123
124
            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...
125
            (and filename extension).
126
        """
127
        ),
128
    )
129
130
    replace: bool = typer.Option(False, help="Replace output file if they exist. See also: --skip")
131
132
    skip: bool = typer.Option(
133
        False, help="Skip any search if the output file exists (only warns). See also: --replace"
134
    )
135
136
    in_cache: bool = typer.Option(
137
        False,
138
        help="Do not download any data. Fails if the needed data is not cached.",
139
        hidden=True,
140
    )
141
142
    verbose: int = typer.Option(
143
        0,
144
        "--verbose",
145
        "-v",
146
        count=True,
147
        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...
148
    )
149
150
    @staticmethod
151
    def key(name: str) -> typer.Option:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
152
        return typer.Option(
153
            name,
154
            min=1,
155
            max=120,
156
            help="""
157
            A free-text unique key for the search.
158
            Should be a short, <60-character name that describes the search and any parameters.
159
            The output file will be named according to a 'sanitized' variant of this value.
160
            """,
161
        )
162
163
    test = typer.Option(
164
        False,
165
        "--check",
166
        help="Do not run searches; just check that the parameters are ok.",
167
    )
168
169
    taxa = typer.Option(
170
        "7742",
171
        show_default=False,
172
        help=doc(
173
            """
174
        The IDs or names of UniProt taxa, comma-separated.
175
        Taxon names and common names can be used for vertebrate species (where available).
176
177
        This can have a significant effect on the search. See the docs fore more info.
178
179
        [default: 7742] (Euteleostomi)
180
        """
181
        ),
182
    )
183
184
    traversal_strategy = typer.Option(
185
        "@null",
186
        "--traversal",
187
        show_default=False,
188
        help=doc(
189
            """
190
        Target traversal strategy name, file, or class.
191
        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...
192
        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...
193
        This option has a dramatic effect on the search. See the docs for more info.
194
195
        Can be one of:
196
        (A) A standard strategy name, starting with @;
197
        (B) The path to a ``*.strat`` file; OR
198
        (C) The fully qualified name of a ``TargetTraversal``
199
200
        The standard traversal strategies are: {}
201
202
        [default: @null] (No traversal; targets as-is)
203
        """.format(
204
                "; ".join(TargetTraversalStrategies.standard_strategies())
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
205
            )
206
        ),
207
    )
208
209
    target_types = typer.Option(
210
        "@molecular",
211
        "--targets",
212
        show_default=False,
213
        help=doc(
214
            """
215
        The accepted target types, comma-separated.
216
217
        NOTE: This affects only the types are are accepted after traversal,
218
        and the types must be included in the traversal.
219
        This means that this must be AT LEAST as restrictive as the traversal strategy.
220
221
        The ChEMBL-defined types are:
222
223
          {}
224
225
        These special names are also accepted:
226
227
          - {}
228
229
        [default: @molecular]
230
        """.format(
231
                "; ".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...
232
                "\n\n          - ".join(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
233
                    [f"{k} ({v})" for k, v in TargetType.special_type_names().items()]
234
                ),
235
            )
236
        ),
237
    )
238
239
    min_confidence = typer.Option(
240
        3,
241
        "--confidence",
242
        min=0,
243
        max=9,
244
        show_default=False,
245
        help=doc(
246
            """
247
        Minimum target confidence score, inclusive.
248
        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...
249
250
        Values are: {}
251
252
        [default: 3]
253
        """.format(
254
                "; ".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...
255
            )
256
        ),
257
    )
258
259
    relations = typer.Option(
260
        "<,<=,=",
261
        "--relations",
262
        show_default=False,
263
        help=doc(
264
            """
265
        Assay activity relations allowed, comma-separated.
266
        If post-processing yourself, consider including all.
267
        Values are: <, <=, =, >, >=, ~.
268
        [default: <,<=,=]
269
        """
270
        ),
271
    )
272
273
    min_pchembl = typer.Option(
274
        6.0,
275
        "--pchembl",
276
        min=0.0,
277
        show_default=False,
278
        help=doc(
279
            """
280
        Minimum pCHEMBL value, inclusive.
281
        If post-processing yourself, consider setting to 0.0.
282
        [default: 6.0]
283
        """
284
        ),
285
    )
286
287
    banned_flags = typer.Option(
288
        "@negative",
289
        show_default=False,
290
        help=doc(
291
            """
292
        Exclude activity annotations with data validity flags, comma-separated.
293
        It is rare to need to change this.
294
295
        Values are: {}.
296
297
        Special sets are:
298
299
          - @all (all flags are banned)
300
301
          - @negative ({})
302
303
          - @positive ({})
304
305
        [default: @negative]
306
        """.format(
307
                "; ".join([s.name for s in DataValidityComment]),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
308
                ", ".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...
309
                ", ".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...
310
            ),
311
        ),
312
    )
313
314
    chembl_trial = typer.Option(
315
        0,
316
        "--phase",
317
        show_default=False,
318
        help=doc(
319
            """
320
        Minimum phase of a clinical trial, inclusive.
321
        Values are: 0, 1, 2, 3.
322
        [default: 0]
323
        """
324
        ),
325
        min=0,
326
        max=3,
327
    )
328
329
330
class Entry(Generic[S], metaclass=abc.ABCMeta):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
331
    @classmethod
332
    def cmd(cls) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
333
        key = cls._get_default_key()
334
        if isinstance(key, typer.models.OptionInfo):
335
            key = key.default
336
        if key is None or not isinstance(key, str):
337
            raise AssertionError(f"Key for {cls.__name__} is {key}")
338
        return key
339
340
    @classmethod
341
    def run(cls, path: Path, **params) -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
342
        raise NotImplementedError()
343
344
    @classmethod
345
    def get_search_type(cls) -> Type[S]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
346
        # noinspection PyTypeChecker
347
        return ReflectionUtils.get_generic_arg(cls, Search)
348
349
    @classmethod
350
    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...
351
        params = dict(params)
352
        params["test"] = True
353
        cls.run(**params)
354
355
    @classmethod
356
    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...
357
        searcher = Searcher([built], [to], path)
358
        if not check:
359
            searcher.search()
360
        return searcher
361
362
    # @classmethod
363
    # def build(cls, path: Path, **params: Mapping[str, Union[int, float, str]]) -> Search:
364
    #    raise NotImplementedError()
365
366
    @classmethod
367
    def default_param_values(cls) -> Mapping[str, Union[str, float, int]]:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
368
        return {
369
            param: value
370
            for param, value in ReflectionUtils.default_arg_values(cls.run).items()
371
            if param not in {"key", "path"}
372
        }
373
374
    @classmethod
375
    def _get_default_key(cls) -> str:
376
        vals = ReflectionUtils.default_arg_values(cls.run)
377
        try:
378
            return vals["key"]
379
        except KeyError:
380
            logger.error(f"key not in {vals.keys()} for {cls.__name__}")
381
            raise
382
383
384
class EntryChemblBinding(Entry[BindingSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
385
    @classmethod
386
    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 (12/5)
Loading history...
387
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
388
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
389
        key: str = _Typer.key("chembl:binding"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
390
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
391
        taxa: Optional[str] = _Typer.taxa,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
392
        traversal=_Typer.traversal_strategy,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
393
        target_types=_Typer.target_types,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
394
        confidence=_Typer.min_confidence,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
395
        relations=_Typer.relations,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
396
        min_pchembl=_Typer.min_pchembl,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
397
        banned_flags=_Typer.banned_flags,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
398
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
399
    ) -> Searcher:
400
        """
401
        Binding data from ChEMBL.
402
        These are 'activity' annotations of the type 'B' that have a pCHEMBL value.
403
        There is extended documentation on this search; see:
404
405
        https://mandos-chem.readthedocs.io/en/latest/binding.html
406
407
        OBJECT: ChEMBL preferred target name
408
409
        PREDICATE: "binds to"
410
411
        OTHER COLUMNS:
412
413
        - taxon_id: From UniProt
414
415
        - taxon_name: From Uniprot (scientific name)
416
417
        - pchembl: Negative base-10 log of activity value (see docs on ChEMBL)
418
419
        - 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...
420
421
        - std_type: e.g. EC50, Kd
422
        """
423
        built = BindingSearch(
424
            key=key,
425
            api=Apis.Chembl,
426
            taxa=Utils.get_taxa(taxa),
427
            traversal_strategy=traversal,
428
            allowed_target_types=Utils.get_target_types(target_types),
429
            min_confidence_score=confidence,
430
            allowed_relations=Utils.split(relations),
431
            min_pchembl=min_pchembl,
432
            banned_flags=Utils.get_flags(banned_flags),
433
        )
434
        return cls._run(built, path, to, check)
435
436
437
class EntryChemblMechanism(Entry[MechanismSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
438
    @classmethod
439
    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 (10/5)
Loading history...
440
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
441
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
442
        key: str = _Typer.key("chembl:mechanism"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
443
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
444
        taxa: Optional[str] = _Typer.taxa,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
445
        traversal: str = _Typer.traversal_strategy,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
446
        target_types: str = _Typer.target_types,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
447
        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...
448
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
449
        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...
450
    ) -> Searcher:
451
        """
452
        Mechanism of action (MoA) data from ChEMBL.
453
454
        OBJECT: ChEMBL preferred target name
455
456
        PREDICATE: Target action; e.g. "agonist of" or "positive allosteric modulator of"
457
458
        OTHER COLUMNS:
459
460
        - direct_interaction: true or false
461
462
        - description: From ChEMBL
463
464
        - exact_target_id: the specifically annotated target, before traversal
465
        """
466
        built = MechanismSearch(
467
            key=key,
468
            api=Apis.Chembl,
469
            taxa=Utils.get_taxa(taxa),
470
            traversal_strategy=traversal,
471
            allowed_target_types=Utils.get_target_types(target_types),
472
            min_confidence_score=min_confidence,
473
        )
474
        return cls._run(built, path, to, check)
475
476
477
class EntryChemblTrials(Entry[IndicationSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
478
    @classmethod
479
    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...
480
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
481
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
482
        key: str = _Typer.key("chembl:trial"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
483
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
484
        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...
485
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
486
        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...
487
    ) -> Searcher:
488
        """
489
        Diseases from clinical trials listed in ChEMBL.
490
491
        OBJECT: MeSH code
492
493
        PREDICATE: "phase <level> trial"
494
        """
495
        built = IndicationSearch(key=key, api=Apis.Chembl, min_phase=min_phase)
496
        return cls._run(built, path, to, check)
497
498
499
class EntryChemblAtc(Entry[AtcSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
500
    @classmethod
501
    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...
502
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
503
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
504
        key: str = _Typer.key("chembl:atc"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
505
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
506
        levels: str = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
507
            "1,2,3,4,5", min=1, max=5, help="""List of ATC levels, comma-separated."""
508
        ),
509
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
510
        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...
511
    ) -> Searcher:
512
        """
513
        ATC codes from ChEMBL.
514
515
        OBJECT: ATC Code
516
517
        PREDICATE: "ATC L<leveL> code"
518
        """
519
        built = AtcSearch(
520
            key=key, api=Apis.Chembl, levels={int(x.strip()) for x in levels.split(",")}
521
        )
522
        return cls._run(built, path, to, check)
523
524
525
class _EntryChemblGo(Entry[GoSearch], metaclass=abc.ABCMeta):
526
    @classmethod
527
    def go_type(cls) -> GoType:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
528
        raise NotImplementedError()
529
530
    @classmethod
531
    def cmd(cls) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
532
        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...
533
        return f"chembl:go.{me.lower()}"
534
535
    @classmethod
536
    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...
537
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
538
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
539
        key: str = _Typer.key("<see above>"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
540
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
541
        taxa: Optional[str] = _Typer.taxa,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
542
        traversal_strategy: str = _Typer.traversal_strategy,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
543
        target_types: str = _Typer.target_types,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
544
        confidence: Optional[int] = _Typer.min_confidence,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
545
        relations: str = _Typer.relations,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
546
        min_pchembl: float = _Typer.min_pchembl,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
547
        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...
548
        binding_search: Optional[str] = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
549
            None,
550
            help="""
551
            The fully qualified name of a class inheriting ``BindingSearch``.
552
            If specified, all parameters above are passed to its constructor.
553
            """,
554
        ),
555
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
556
        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...
557
    ) -> Searcher:
558
        """
559
        GO terms associated with ChEMBL binding targets.
560
561
        OBJECT: GO Term name
562
563
        PREDICATE: "associated with ""Function"|"Process"|"Component"" term"
564
565
        OTHER COLUMNS:
566
            See the docs for ``mandos chembl:binding``
567
568
        Note:
569
570
            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...
571
572
        """
573
        if key is None or key == "<see above>":
574
            key = cls.cmd()
575
        api = ChemblApi.wrap(Apis.Chembl)
576
        if binding_search is None:
577
            binding_clazz = BindingSearch
578
        else:
579
            binding_clazz = ReflectionUtils.injection(binding_search, BindingSearch)
580
            logger.info(f"NOTICE: Passing parameters to {binding_clazz.__qualname__}")
581
        try:
582
            binding_search = binding_clazz(
583
                key=key,
584
                api=Apis.Chembl,
585
                taxa=Utils.get_taxa(taxa),
586
                traversal_strategy=traversal_strategy,
587
                allowed_target_types=Utils.get_target_types(target_types),
588
                min_confidence_score=confidence,
589
                allowed_relations=Utils.split(relations),
590
                min_pchembl=min_pchembl,
591
                banned_flags=Utils.get_flags(banned_flags),
592
            )
593
        except (TypeError, ValueError):
594
            raise InjectionError(f"Failed to build {binding_clazz.__qualname__}")
595
        built = GoSearch(key, api, cls.go_type(), binding_search)
596
        return cls._run(built, path, to, check)
597
598
599
class EntryGoFunction(_EntryChemblGo):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
600
    @classmethod
601
    def go_type(cls) -> GoType:
602
        return GoType.function
603
604
605
class EntryGoProcess(_EntryChemblGo):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
606
    @classmethod
607
    def go_type(cls) -> GoType:
608
        return GoType.process
609
610
611
class EntryGoComponent(_EntryChemblGo):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
612
    @classmethod
613
    def go_type(cls) -> GoType:
614
        return GoType.component
615
616
617
class EntryPubchemDisease(Entry[DiseaseSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
618
    @classmethod
619
    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...
620
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
621
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
622
        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...
623
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
624
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
625
        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...
626
    ) -> Searcher:
627
        """
628
        Diseases in the CTD.
629
630
        Comparative Toxicogenomics Database.
631
632
        OBJECT: MeSH code of disease
633
634
        PREDICATE: "marker/mechanism evidence for" or "disease evidence for"
635
        """
636
        built = DiseaseSearch(key, Apis.Pubchem)
637
        return cls._run(built, path, to, check)
638
639
640
class _EntryPubchemCoOccurrence(Entry[U], metaclass=abc.ABCMeta):
641
    @classmethod
642
    def cmd(cls) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
643
        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...
644
        return f"lit.pubchem:{me.lower()}"
645
646
    @classmethod
647
    def get_cooccurrence_type(cls) -> CoOccurrenceType:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
648
        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...
649
        return s.cooccurrence_type()
650
651
    @classmethod
652
    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...
653
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
654
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
655
        key: str = _Typer.key("<see above>"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
656
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
657
        min_score: float = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
658
            0.0,
659
            help="Minimum enrichment score, inclusive. See docs for more info.",
660
            min=0.0,
661
        ),
662
        min_articles: int = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
663
            0,
664
            help="Minimum number of articles for both the compound and object, inclusive.",
665
            min=0,
666
        ),
667
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
668
        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...
669
    ) -> Searcher:
670
        """
671
        Co-occurrences from PubMed articles.
672
        There is extended documentation on this search.
673
        Also refer to https://pubchemdocs.ncbi.nlm.nih.gov/knowledge-panels
674
675
        OBJECT: Name of gene/chemical/disease
676
677
        PREDICATE: "co-occurs with <gene/chemical/disease>"
678
679
        OTHER COLUMNS:
680
681
        - score: enrichment score; see PubChem docs
682
683
        - intersect_count: Number of articles co-occurring
684
685
        - query_count: Total number of articles for query compound
686
687
        - neighbor_count: Total number of articles for target (co-occurring) compound
688
        """
689
        if key is None or key == "<see above>":
690
            key = cls.cmd()
691
        clazz = cls.get_search_type()
692
        built = clazz(key, Apis.Pubchem, min_score=min_score, min_articles=min_articles)
693
        return cls._run(built, path, to, check)
694
695
696
class EntryPubchemGeneCoOccurrence(_EntryPubchemCoOccurrence[GeneCoOccurrenceSearch]):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
697
    """"""
698
699
700
class EntryPubchemDiseaseCoOccurrence(_EntryPubchemCoOccurrence[DiseaseCoOccurrenceSearch]):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
701
    """"""
702
703
704
class EntryPubchemChemicalCoOccurrence(_EntryPubchemCoOccurrence[ChemicalCoOccurrenceSearch]):
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
705
    """"""
706
707
708
class EntryPubchemDgi(Entry[DgiSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
709
    @classmethod
710
    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...
711
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
712
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
713
        key: str = _Typer.key("inter.dgidb:gene"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
714
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
715
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
716
        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...
717
    ) -> Searcher:
718
        """
719
        Drug/gene interactions in the DGIDB.
720
721
        Drug Gene Interaction Database.
722
        Also see ``disease.dgidb:int``.
723
724
        OBJECT: Name of the gene
725
726
        PREDICATE: "interacts with gene"
727
        """
728
        built = DgiSearch(key, Apis.Pubchem)
729
        return cls._run(built, path, to, check)
730
731
732
class EntryPubchemCgi(Entry[CtdGeneSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
733
    @classmethod
734
    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...
735
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
736
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
737
        key: str = _Typer.key("inter.ctd:gene"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
738
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
739
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
740
        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...
741
    ) -> Searcher:
742
        """
743
        Compound/gene interactions in the DGIDB.
744
745
        Drug Gene Interaction Database.
746
        Also see ``interact.dgidb:int``.
747
748
        OBJECT: Name of the gene
749
750
        PREDICATE: "compound/gene interaction"
751
752
        """
753
        built = CtdGeneSearch(key, Apis.Pubchem)
754
        return cls._run(built, path, to, check)
755
756
757
class EntryDrugbankTarget(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
758
    @classmethod
759
    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...
760
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
761
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
762
        key: str = _Typer.key("inter.drugbank:target"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
763
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
764
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
765
        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...
766
    ) -> Searcher:
767
        """
768
        Protein targets from DrugBank.
769
770
        OBJECT: Target name (e.g. "Solute carrier family 22 member 11") from DrugBank
771
772
        PREDICATE: Action (e.g. "binder", "downregulator", or "agonist")
773
        """
774
        built = DrugbankTargetSearch(key, Apis.Pubchem, {DrugbankTargetType.target})
775
        return cls._run(built, path, to, check)
776
777
778 View Code Duplication
class EntryGeneralFunction(Entry[DrugbankGeneralFunctionSearch]):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
779
    @classmethod
780
    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...
781
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
782
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
783
        key: str = _Typer.key("inter.drugbank:target-fn"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
784
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
785
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
786
        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...
787
    ) -> Searcher:
788
        """
789
        General functions from DrugBank targets.
790
791
        OBJECT: Name of the general function (e.g. "Toxic substance binding")
792
793
        PREDICATE: against on target (e.g. "binder", "downregulator", or "agonist").
794
        """
795
        built = DrugbankGeneralFunctionSearch(key, Apis.Pubchem, {DrugbankTargetType.target})
796
        return cls._run(built, path, to, check)
797
798
799
class EntryDrugbankTransporter(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
800
    @classmethod
801
    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...
802
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
803
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
804
        key: str = _Typer.key("inter.drugbank:pk"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
805
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
806
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
807
        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...
808
    ) -> Searcher:
809
        """
810
        PK-related proteins from DrugBank.
811
812
        OBJECT: Transporter name (e.g. "Solute carrier family 22 member 11") from DrugBank
813
814
        PREDICATE: "transported by", "carried by", or "metabolized by"
815
        """
816
        target_types = {
817
            DrugbankTargetType.transporter,
818
            DrugbankTargetType.carrier,
819
            DrugbankTargetType.enzyme,
820
        }
821
        built = DrugbankTargetSearch(key, Apis.Pubchem, target_types)
822
        return cls._run(built, path, to, check)
823
824
825 View Code Duplication
class EntryTransporterGeneralFunction(Entry[DrugbankGeneralFunctionSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
826
    @classmethod
827
    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...
828
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
829
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
830
        key: str = _Typer.key("inter.drugbank:pk-fn"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
831
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
832
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
833
        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...
834
    ) -> Searcher:
835
        """
836
        DrugBank PK-related protein functions.
837
838
        OBJECT: Name of the general function (e.g. "Toxic substance binding")
839
840
        PREDICATE: "transported by", "carried by", or "metabolized by"
841
        """
842
        built = DrugbankGeneralFunctionSearch(key, Apis.Pubchem, {DrugbankTargetType.target})
843
        return cls._run(built, path, to, check)
844
845
846
class EntryDrugbankDdi(Entry[DrugbankDdiSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
847
    @classmethod
848
    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...
849
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
850
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
851
        key: str = _Typer.key("inter.drugbank:ddi"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
852
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
853
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
854
        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...
855
    ) -> Searcher:
856
        """
857
        Drug/drug interactions listed by DrugBank.
858
859
        The 'description' column includes useful information about the interaction,
860
        such as diseases and whether a risk is increased or decreased.
861
862
        OBJECT: name of the drug (e.g. "ibuprofen")
863
864
        PREDICATE: "ddi"
865
        """
866
        built = DrugbankDdiSearch(key, Apis.Pubchem)
867
        return cls._run(built, path, to, check)
868
869
870
class EntryPubchemAssay(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
871
    @classmethod
872
    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...
873
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
874
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
875
        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...
876
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
877
        name_must_match: bool = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
878
            False,
879
            help=doc(
880
                """
881
            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...
882
        """
883
            ),
884
        ),
885
        ban_sources: Optional[str] = None,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument ban_sources seems to be unused.
Loading history...
886
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
887
        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...
888
    ) -> Searcher:
889
        """
890
        PubChem bioactivity results.
891
892
        Note: The species name, if present, is taken from the target name.
893
        The taxon ID is what was curated in PubChem.
894
895
        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...
896
897
        PREDICATE: "active"|"inactive"|"inconclusive"|"undetermined"
898
899
        SOURCE: "PubChem: <referrer> "(""confirmatory"|"literature"|"other"")"
900
        """
901
        built = BioactivitySearch(
902
            key, Apis.Pubchem, assay_types=set(AssayType), compound_name_must_match=name_must_match
903
        )
904
        return cls._run(built, path, to, check)
905
906
907
class EntryDeaSchedule(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
908
    @classmethod
909
    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...
910
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
911
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
912
        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...
913
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
914
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
915
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
916
    ) -> Searcher:
917
        """
918
        DEA schedules (PENDING).
919
920
        OBJECT: (1 to 4, or "unscheduled")
921
922
        PREDICATE: "has DEA schedule"
923
        """
924
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
925
926
927
class EntryDeaClass(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
928
    @classmethod
929
    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...
930
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
931
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
932
        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...
933
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
934
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
935
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
936
    ) -> Searcher:
937
        """
938
        DEA classes (PENDING).
939
940
        OBJECT: e.g. "hallucinogen"
941
942
        PREDICATE: "is in DEA class"
943
        """
944
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
945
946
947
class EntryChemidPlusAcute(Entry[AcuteEffectSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
948
    @classmethod
949
    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...
950
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
951
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
952
        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...
953
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
954
        level: int = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
955
            2,
956
            min=1,
957
            max=2,
958
            help="""
959
          The level in the ChemIDPlus hierarchy of effect names.
960
          Level 1: e.g. 'behavioral'
961
          Level 2: 'behavioral: excitement'
962
          """,
963
        ),
964
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
965
        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...
966
    ) -> Searcher:
967
        """
968
        Acute effect codes from ChemIDPlus.
969
970
        OBJECT: E.g. "behavioral: excitement"
971
972
        PREDICATE: "causes acute effect"
973
974
        OTHER COLUMNS:
975
976
            - 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...
977
            - human: true or false
978
            - test_type: e.g. 'TDLo'
979
            - route: e.g. 'skin'
980
            - mg_per_kg: e.g. 17.5
981
        """
982
        built = AcuteEffectSearch(
983
            key,
984
            Apis.Pubchem,
985
            top_level=level == 1,
986
        )
987
        return cls._run(built, path, to, check)
988
989
990
class EntryChemidPlusLd50(Entry[Ld50Search]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
991
    @classmethod
992
    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...
993
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
994
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
995
        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...
996
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
997
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
998
        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...
999
    ) -> Searcher:
1000
        """
1001
        LD50 acute effects from ChemIDPlus.
1002
1003
        OBJECT: A dose in mg/kg (e.g. 3100)
1004
1005
        PREDICATE: "LD50 :: <route>" (e.g. "LD50 :: intravenous)
1006
1007
        OTHER COLUMNS:
1008
1009
            - 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...
1010
            - human: true or false
1011
        """
1012
        built = Ld50Search(key, Apis.Pubchem)
1013
        return cls._run(built, path, to, check)
1014
1015
1016
class EntryHmdbTissue(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1017
    @classmethod
1018
    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...
1019
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1020
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1021
        key: str = _Typer.key("hmdb:tissue"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1022
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1023
        min_nanomolar: Optional[float] = None,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1024
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1025
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1026
    ) -> Searcher:
1027
        """
1028
        Tissue concentrations from HMDB (PENDING).
1029
1030
        OBJECT:
1031
1032
        PREDICATE: "tissue"
1033
        """
1034
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1035
1036
1037
class EntryHmdbComputed(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
1038
    @classmethod
1039
    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...
1040
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1041
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1042
        key: str = _Typer.key("hmdb:computed"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1043
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1044
        min_nanomolar: Optional[float] = None,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1045
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1046
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1047
    ) -> Searcher:
1048
        """
1049
        Computed properties from HMDB (PENDING).
1050
1051
        Keys include pKa, logP, logS, etc.
1052
1053
        OBJECT: A number; booleans are converted to 0/1
1054
1055
        PREDICATE: The name of the property
1056
        """
1057
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1058
1059
1060
class EntryPubchemReact(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
1061
    @classmethod
1062
    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...
1063
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1064
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1065
        key: str = _Typer.key("inter.pubchem:react"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1066
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1067
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1068
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1069
    ) -> Searcher:
1070
        """
1071
        Metabolic reactions (PENDING).
1072
1073
        OBJECT: Equation
1074
1075
        PREDICATE: "<pathway>"
1076
        """
1077
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1078
1079
1080
def _stringify(keys: Mapping[str, str]):
1081
    return ", ".join((k if v is None else f"{k} ({v.lower()})" for k, v in keys.items()))
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable v does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable k does not seem to be defined.
Loading history...
1082
1083
1084
class EntryPubchemComputed(Entry[ComputedPropertySearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
1085
1086
    KNOWN_USEFUL_KEYS: Mapping[str, str] = {
1087
        "weight": "Molecular Weight",
1088
        "xlogp3": None,
1089
        "hydrogen-bond-donors": "Hydrogen Bond Donor Count",
1090
        "hydrogen-bond-acceptors": "Hydrogen Bond Acceptor Count",
1091
        "rotatable-bonds": "Rotatable Bond Count",
1092
        "exact-mass": None,
1093
        "monoisotopic-mass": None,
1094
        "tpsa": "Topological Polar Surface Area",
1095
        "heavy-atoms": "Heavy Atom Count",
1096
        "charge": "Formal Charge",
1097
        "complexity": None,
1098
    }
1099
    KNOWN_USELESS_KEYS: Mapping[str, str] = {
1100
        "components": "Covalently-Bonded Unit Count",
1101
        "isotope-atoms": "Isotope Atom Count",
1102
        "defined-atom-stereocenter-count": None,
1103
        "undefined-atom-stereocenter-count": None,
1104
        "defined-bond-stereocenter-count": None,
1105
        "undefined-bond-stereocenter-count": None,
1106
        "compound-is-canonicalized": None,
1107
    }
1108
1109
    @classmethod
1110
    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...
1111
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1112
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1113
        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...
1114
        keys: str = typer.Option(
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1115
            "weight,xlogp3,tpsa,complexity,exact-mass,heavy-atom-count,charge",
1116
            help="""
1117
                The keys of the computed properties, comma-separated.
1118
                Key names are case-insensitive and ignore punctuation like underscores and hyphens.
1119
1120
                Known keys are: {}
1121
1122
                Known, less-useful (metadata-like) keys are: {}
1123
            """.format(
1124
                _stringify(KNOWN_USEFUL_KEYS), _stringify(KNOWN_USELESS_KEYS)
1125
            ),
1126
        ),
1127
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1128
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1129
        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...
1130
    ) -> Searcher:
1131
        """
1132
        Computed properties from PubChem.
1133
1134
        OBJECT: Number
1135
1136
        PREDICATE: e.g. "complexity"
1137
        """
1138
        # replace acronyms, etc.
1139
        # ComputedPropertySearch standardizes punctuation and casing
1140
        known = {
1141
            k: v
1142
            for k, v in {
1143
                **EntryPubchemComputed.KNOWN_USEFUL_KEYS,
1144
                **EntryPubchemComputed.KNOWN_USELESS_KEYS,
1145
            }
1146
            if v is not None
1147
        }
1148
        keys = {known.get(s.strip(), s) for s in keys.split(",")}
1149
        built = ComputedPropertySearch(key, Apis.Pubchem, descriptors=keys, source="PubChem")
1150
        return cls._run(built, path, to, check)
1151
1152
1153
class EntryDrugbankAdmet(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1154
    @classmethod
1155
    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...
1156
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1157
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1158
        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...
1159
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1160
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1161
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1162
    ) -> Searcher:
1163
        """
1164
        Enzyme predictions from DrugBank (PENDING).
1165
1166
        OBJECT: Enzyme name
1167
1168
        PREDICATE: Action
1169
        """
1170
1171
1172
class EntryDrugbankMetabolites(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Value 'Entry' is unsubscriptable
Loading history...
introduced by
Missing class docstring
Loading history...
1173
    @classmethod
1174
    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...
1175
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1176
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1177
        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...
1178
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1179
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1180
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1181
    ) -> Searcher:
1182
        """
1183
        Metabolites from DrugBank (PENDING).
1184
1185
        OBJECT: Compound name (e.g. "norcocaine").
1186
1187
        PREDICATE: "metabolized to"
1188
        """
1189
1190
1191
class EntryDrugbankDosage(Entry[DrugbankTargetSearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1192
    @classmethod
1193
    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...
1194
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1195
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1196
        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...
1197
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1198
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1199
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1200
    ) -> Searcher:
1201
        """
1202
        Dosage from DrugBank (PENDING).
1203
1204
        OBJECT: concentration in mg/mL
1205
1206
        PREDICATE: "dosage :: <route>"
1207
1208
        OTHER COLUMNS:
1209
1210
        - form (e.g. liquid)
1211
        """
1212
1213
1214
class EntryMetaRandom(Entry[BioactivitySearch]):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
introduced by
Value 'Entry' is unsubscriptable
Loading history...
1215
    @classmethod
1216
    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...
1217
        cls,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1218
        path: Path = _Typer.path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1219
        key: str = _Typer.key("meta:random"),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1220
        to: Optional[Path] = _Typer.to,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1221
        check: bool = _Typer.test,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1222
        verbose: int = _Typer.verbose,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
1223
    ) -> Searcher:
1224
        """
1225
        Random class assignment (PENDING).
1226
1227
        OBJECT: 1 thru n-compounds
1228
1229
        PREDICATE: "random"
1230
        """
1231
        pass
0 ignored issues
show
Unused Code introduced by
Unnecessary pass statement
Loading history...
1232
1233
1234
Entries = [
1235
    EntryChemblBinding,
1236
    EntryChemblMechanism,
1237
    EntryChemblAtc,
1238
    EntryChemblTrials,
1239
    EntryGoFunction,
1240
    EntryGoProcess,
1241
    EntryGoComponent,
1242
    EntryPubchemDisease,
1243
    EntryPubchemGeneCoOccurrence,
1244
    EntryPubchemDiseaseCoOccurrence,
1245
    EntryPubchemChemicalCoOccurrence,
1246
    EntryPubchemDgi,
1247
    EntryPubchemCgi,
1248
    EntryDrugbankTarget,
1249
    EntryGeneralFunction,
1250
    EntryDrugbankTransporter,
1251
    EntryTransporterGeneralFunction,
1252
    EntryDrugbankDdi,
1253
    EntryPubchemAssay,
1254
    EntryDeaSchedule,
1255
    EntryDeaClass,
1256
    EntryChemidPlusAcute,
1257
    EntryChemidPlusLd50,
1258
    EntryHmdbTissue,
1259
    EntryPubchemReact,
1260
    EntryMetaRandom,
1261
]
1262