/
exp_repr.py
126 lines (92 loc) · 3.68 KB
/
exp_repr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#! /usr/bin/env python3
# I, Robert Rozanski, the copyright holder of this work, release this work into the public domain. This applies worldwide. In some countries this may not be legally possible; if so: I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
class ExperimentType:
def __init__(self):
self.ignoring_penalty = 1
self.covering_reward = 1
self.cost = 1
class DetectionEntity(ExperimentType):
def __init__(self, entity_id):
ExperimentType.__init__(self)
self.entity_id = entity_id
def __hash__(self):
return hash(self.entity_id)
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class LocalisationEntity(ExperimentType):
def __init__(self, entity_id, comp_id):
ExperimentType.__init__(self)
self.entity_id = entity_id
self.compartment_id = comp_id
def __hash__(self):
return hash((self.entity_id, self.compartment_id))
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class DetectionActivity(ExperimentType):
def __init__(self, activity_id):
ExperimentType.__init__(self)
self.activity_id = activity_id
def __hash__(self):
return hash(self.activity_id)
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class AdamTwoFactorExperiment(ExperimentType):
def __init__(self, gene_id, metabolite_id):
ExperimentType.__init__(self)
self.gene_id = gene_id
self.metabolite_id = metabolite_id
def __hash__(self):
return hash((self.gene_id, self.metabolite_id))
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class ReconstructionActivity(ExperimentType):
def __init__(self, activity_id):
ExperimentType.__init__(self)
self.activity_id = activity_id
def __hash__(self):
return hash(self.activity_id)
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class ReconstructionEnzReaction(ExperimentType):
def __init__(self, reaction_id, enzyme_id):
ExperimentType.__init__(self)
self.reaction_id = reaction_id
self.enzyme_id = enzyme_id
def __hash__(self):
return hash((self.reaction_id, self.enzyme_id))
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class ReconstructionTransporterRequired(ExperimentType):
def __init__(self, transport_activity_id, transporter_id):
ExperimentType.__init__(self)
self.transport_activity_id = transport_activity_id
self.transporter_id = transporter_id
def __hash__(self):
return hash((self.transport_activity_id, self.transporter_id))
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class ExperimentDescription:
def __init__(self, exp_type, interventions=[]):
self.experiment_type = exp_type
self.interventions = frozenset(interventions)
def __hash__(self):
return hash((self.experiment_type, self.interventions))
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class Result:
def __init__(self, ID, exp_description, outcome):
self.ID = ID
self.exp_description = exp_description
self.outcome = outcome # True or False
def __hash__(self):
return hash((self.ID, self.exp_description, self.outcome))
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))
class Experiment:
def __init__(self, ID, results=[]):
self.ID = ID
self.results = frozenset(results)
def __hash__(self):
return hash((self.ID, self.results))
def __eq__(self, other):
return ((hash(self) == hash(other)) and (type(self) == type(other)))