-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathANDclasses.py
202 lines (148 loc) · 5.26 KB
/
ANDclasses.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
"""
Data Classes for the Avian Nutrient Distributions Project
"""
class BIRD:
"""
A class which represents an individual subject (in this case birds)
This class will be used to create a dictionary of objects with properties
associated with individual birds in an experiment (e.g. id, sex, treatment,
tissues, etc.).
"""
def __init__(self, i="", s="", tr="", ti={}, bm=""):
self.__idbird = i
self.__sex = s
self.__treatment = tr
self.__tissues = ti
self.__bodymass = bm
@property
def idbird(self):
"""
idbird (i) is a string that represents the identification code
(e.g. 41W) of an individul in the experiment
"""
return self._idbird
@idbird.setter
def set_idbird(self, value):
self.__idbird = value
@property
def sex(self):
"""
sex (s) is a string that represents the biological sex of the individual
"""
return self.__sex
@sex.setter
def set_sex(self, value):
self.__sex = value
@property
def treatment(self):
"""
treatment (tr) is a string that represents the experimental group that
the individual belonged to during the experiment
"""
return self.__treatment
@treatment.setter
def set_treatment(self, value):
self.__treatment = value
@property
def tissues(self):
"""
tissues (ti) represents a dictionary of tissues where the keyword is
the name of the tissue type (e.g. liver) and the value is an object
created with class TISSUE
"""
return self.__tissues
@tissues.setter
def set_tissues(self, value):
self.__tissues = value
@property
def bodymass(self):
"""
bodymass (bm) is a floating point number that represents the mass in
grams (g) of an individual bird. used to calculate relative proportions.
"""
return self.__bodymass
@bodymass.setter
def set_bodymass(self, value):
self.__bodymass = value
def __str__(self):
"""
allows user to print the contents of a BIRD-generated object
"""
return "Bird ID = {}, Sex = {}, Treatment = {}, Tissues = {}, Body Mass = {}"\
.format(self.__idbird, self.__sex, self.__treatment, self.__tissues, self.__bodymass)
class TISSUE:
"""
A class which represents a tissue (e.g. liver, spleen)
This class will be used to create a dictionary of objects with properties
associated with tissues (e.g. name/type, mass of the sample analyzed, total
mass of the tissue, nutrients, and the bird the tissue came from)
"""
def __init__(self, n="", ms=None, mt=None, nutri_a={}, b=None):
self.__name = n
self.__mass_sample = ms
self.__mass_total = mt
self.__nutrients_area = nutri_a
self.__bird = b
@property
def name(self):
"""
name (n) is a string that represents the type of tissue (e.g. liver)
"""
return self.__name
@name.setter
def set_name(self, value):
self.__name = value
@property
def mass_sample(self):
"""
mass_sample (ms) is a floating point number that represents the mass
of the sample from which nutrients were extracted in grams. used to
determine the nutrient concentration in a given sample.
"""
return self.__mass_sample
@mass_sample.setter
def set_mass_sample(self, value):
self.__mass_sample = value
@property
def mass_total(self):
"""
mass_total (mt) is a floating point number that represents the mass of
the tissue in grams which may or may not equal the mass_sample. used
to determine the total nutrient conent of a tissue within an individual.
"""
return self.__mass_total
@mass_total.setter
def set_mass_total(self, value):
self.__mass_total = value
@property
def nutrients_area(self):
"""
nutrients_area (nutri_a) represents a dictionary of nutrients where the
keyword is the name of the nutrient type (e.g. lutein) and the value is
the area associated with that nutrient type.
"""
return self.__nutrients_area
@nutrients_area.setter
def set_nutrients_area(self, value):
self.__nutrients_area = value
@property
def bird(self):
"""
bird (b) is a string that represents the bird id associated with the
tissue object. used to keep track of which tissue objects belong to
which individual birds.
"""
return self.__bird
@bird.setter
def set_bird(self, value):
self.__bird = value
@property
def carot_conc(self):
"""
carot_conc (cc) is a float number that represents the total carotenoid
concentration (ug/g) in a given tissue.
"""
return self.__carot_conc
def __str__(self):
return "Name = {}, Sample Mass = {}, Total Mass = {}, Bird = {}"\
.format(self.__name, self.__mass_sample, self.__mass_total, self.__bird)