Passed
Push — main ( ec3fe3...82dd22 )
by Douglas
02:00
created

mandos.model.concrete_hits   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 245
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 132
dl 0
loc 245
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A GoType.of() 0 5 2
1
from __future__ import annotations
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
import abc
3
import enum
4
from dataclasses import dataclass
5
from typing import Optional, Union
6
7
from mandos.model import ReflectionUtils
8
from mandos.model.hits import AbstractHit
9
10
11
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
12
class ChemblHit(AbstractHit, metaclass=abc.ABCMeta):
13
    """ """
14
15
16
@dataclass(frozen=True, order=True, repr=True)
17
class ProteinHit(ChemblHit, metaclass=abc.ABCMeta):
18
    """
19
    A protein target entry for a compound.
20
    """
21
22
    exact_target_id: str
23
24
25
@dataclass(frozen=True, order=True, repr=True)
26
class _ActivityHit(ProteinHit):
27
    taxon_id: int
28
    taxon_name: str
29
    src_id: str
30
31
32
@dataclass(frozen=True, order=True, repr=True)
33
class AtcHit(ChemblHit):
34
    """
35
    An ATC code found for a compound.
36
    """
37
38
    level: int
39
40
41
@dataclass(frozen=True, order=True, repr=True)
42
class BindingHit(_ActivityHit):
43
    """
44
    An "activity" hit for a compound.
45
    """
46
47
    pchembl: float
48
    std_type: str
49
    standard_relation: str
50
51
52
@dataclass(frozen=True, order=True, repr=True)
53
class FunctionalHit(_ActivityHit):
54
    """
55
    An "activity" hit of type "F" for a compound.
56
    """
57
58
    tissue: Optional[str]
59
    cell_type: Optional[str]
60
    subcellular_region: Optional[str]
61
62
63
class GoType(enum.Enum):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
64
    component = enum.auto()
65
    function = enum.auto()
66
    process = enum.auto()
67
68
    @classmethod
69
    def of(cls, s: Union[str, GoType]) -> GoType:
0 ignored issues
show
Coding Style Naming introduced by
Method name "of" 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...
Coding Style Naming introduced by
Argument 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...
70
        if isinstance(s, GoType):
71
            return s
72
        return GoType[s.lower()]
73
74
75
@dataclass(frozen=True, order=True, repr=True)
76
class GoHit(ChemblHit, metaclass=abc.ABCMeta):
77
    """
78
    A mechanism entry for a compound.
79
    """
80
81
    go_type: str
82
    binding: BindingHit
83
84
85
@dataclass(frozen=True, order=True, repr=True)
86
class IndicationHit(ChemblHit):
87
    """
88
    An indication with a MESH term.
89
    """
90
91
    max_phase: int
92
93
94
@dataclass(frozen=True, order=True, repr=True)
95
class MechanismHit(ProteinHit):
96
    """
97
    A mechanism entry for a compound.
98
    """
99
100
    action_type: str
101
102
103
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
104
class G2pHit(AbstractHit, metaclass=abc.ABCMeta):
105
    """ """
106
107
108
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
109
class G2pInteractionHit(G2pHit):
110
    """ """
111
112
    action: str
113
    selective: str
114
    primary: str
115
    endogenous: str
116
    species: str
117
    affinity: float
118
    measurement: str
119
120
121
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
122
class PubchemHit(AbstractHit, metaclass=abc.ABCMeta):
123
    """ """
124
125
126
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
127
class AcuteEffectHit(PubchemHit):
128
    """ """
129
130
    organism: str
131
    human: bool
132
    test_type: str
133
    route: str
134
    effect: str
135
    mg_per_kg: float
136
137
138
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
139
class Ld50Hit(PubchemHit):
140
    """ """
141
142
    organism: str
143
    human: bool
144
145
146
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
best-practice introduced by
Too many instance attributes (8/7)
Loading history...
147
class BioactivityHit(PubchemHit):
148
    """ """
149
150
    target_abbrev: Optional[str]
151
    activity: str
152
    assay_type: str
153
    micromolar: float
154
    relation: str
155
    species: Optional[str]
156
    compound_name_in_assay: str
157
    referrer: str
158
159
160
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
161
class ComputedPropertyHit(PubchemHit):
162
    pass
163
164
165
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
166
class CoOccurrenceHit(PubchemHit, metaclass=abc.ABCMeta):
167
    score: int
168
    intersect_count: int
169
    query_count: int
170
    neighbor_count: int
171
172
173
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
174
class DiseaseCoOccurrenceHit(CoOccurrenceHit):
175
    """ """
176
177
178
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
179
class GeneCoOccurrenceHit(CoOccurrenceHit):
180
    """ """
181
182
183
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
184
class ChemicalCoOccurrenceHit(CoOccurrenceHit):
185
    """ """
186
187
188
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
189
class CtdGeneHit(PubchemHit):
190
    """ """
191
192
    taxon_id: Optional[int]
193
    taxon_name: Optional[str]
194
195
196
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
197
class DgiHit(PubchemHit):
198
    """ """
199
200
201
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
202
class DiseaseHit(PubchemHit):
203
    evidence_type: str
204
205
206
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
207
class DrugbankDdiHit(PubchemHit):
208
    """ """
209
210
    type: str
211
    effect_target: Optional[str]
212
    change: Optional[str]
213
    description: str
214
215
216
@dataclass(frozen=True, order=True, repr=True)
217
class _DrugbankInteractionHit(PubchemHit):
218
    """ """
219
220
    gene_symbol: str
221
    protein_id: str
222
    target_type: str
223
    target_name: str
224
    general_function: str
225
226
227
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
228
class DrugbankTargetHit(_DrugbankInteractionHit):
229
    """ """
230
231
232
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
Documentation introduced by
Empty class docstring
Loading history...
233
class DrugbankGeneralFunctionHit(_DrugbankInteractionHit):
234
    """ """
235
236
237
@dataclass(frozen=True, order=True, repr=True)
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
238
class TrialHit(PubchemHit):
239
    phase: float
240
    status: str
241
    interventions: str
242
243
244
HIT_CLASSES = ReflectionUtils.subclass_dict(AbstractHit, concrete=True)
245