1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package fr.ens.transcriptome.doelan.data;
24
25 import fr.ens.transcriptome.doelan.algorithms.QualityUnitTest;
26 import fr.ens.transcriptome.nividic.om.BioAssay;
27
28 /***
29 * This class define a result from a QualityUnitTest
30 * @author Laurent Jourdren
31 */
32 public class QualityUnitTestResult extends QualityTestResult {
33
34 private int realFeatures;
35 private boolean[] newFlags;
36 private boolean filterFlags;
37 private SummaryResult ch635;
38 private SummaryResult ch532;
39 private SummaryResult chAll;
40
41 /***
42 * This class define the result for a channel.
43 * @author Laurent Jourdren
44 */
45 public final class SummaryResult {
46
47 private String channel;
48 private double value;
49 private double threshold;
50 private String unit;
51 private String thresholdEqualityType = "<";
52 private boolean percent;
53 private boolean pass;
54
55
56
57
58
59 /***
60 * Get the channel.
61 * @return Returns the channel
62 */
63 public String getChannel() {
64 return channel;
65 }
66
67 /***
68 * Test if the test pass.
69 * @return Returns the pass
70 */
71 public boolean isPass() {
72 return pass;
73 }
74
75 /***
76 * Get the Threshold.
77 * @return Returns the threshold in percent
78 */
79 public double getThreshold() {
80 return threshold;
81 }
82
83 /***
84 * Get the value.
85 * @return Returns the value
86 */
87 public double getValue() {
88 return value;
89 }
90
91 /***
92 * Test if the value is a percentage.
93 * @return Returns the percent
94 */
95 public boolean isPercent() {
96 return percent;
97 }
98
99 /***
100 * Get the unit of the value and the threshold.
101 * @return The unit of the value and the threshold
102 */
103 public String getUnit() {
104 return this.unit;
105 }
106
107 /***
108 * Get the type of equality between the threshold and this value. For
109 * example: "=", " <", ">", " <=", ">=", "!="... Default value is " <".
110 * @return the type of equality of the parameter.
111 */
112 public String getThresholdEqualityType() {
113 return this.thresholdEqualityType;
114 }
115
116
117
118
119
120 /***
121 * Set the channel.
122 * @param channel The channel to set
123 */
124 private void setChannel(final String channel) {
125 this.channel = channel;
126 }
127
128 /***
129 * Set if the test pass.
130 * @param pass The pass to set
131 */
132 public void setPass(final boolean pass) {
133 this.pass = pass;
134 }
135
136 /***
137 * Set the threshold.
138 * @param threshold The threshold to set
139 */
140 public void setThreshold(final double threshold) {
141 this.threshold = threshold;
142 }
143
144 /***
145 * Set the value.
146 * @param value The value to set
147 */
148 public void setValue(final double value) {
149 this.value = value;
150 }
151
152 /***
153 * Set if the value is a percentage.
154 * @param percent The percent to set
155 */
156 public void setPercent(final boolean percent) {
157 this.percent = percent;
158 }
159
160 /***
161 * Set the unit of the value and the threshold.
162 * @param unit Unit to set
163 */
164 public void setUnit(final String unit) {
165 this.unit = unit;
166 }
167
168 /***
169 * Set the equality type between the the threshold and its value.
170 * @param equality The equality to set.
171 */
172 public void setThresholdEqualityType(final String equality) {
173
174 if ("=".equals(equality) || "!=".equals(equality) || "<".equals(equality)
175 || "<=".equals(equality) || ">".equals(equality)
176 || ">=".equals(equality)) {
177 this.thresholdEqualityType = equality;
178 }
179 }
180
181
182
183
184
185 private SummaryResult(final String channel) {
186 setChannel(channel);
187 }
188
189 }
190
191
192
193
194
195 /***
196 * Get the new flags of the bioAssay after the test.
197 * @return The new flags after the test
198 */
199 public boolean[] getNewFlags() {
200 return newFlags;
201 }
202
203 /***
204 * Get the result for 532 channel.
205 * @return Returns the ch532
206 */
207 public SummaryResult getResultChannel532() {
208 return ch532;
209 }
210
211 /***
212 * Get the result for 635 channel.
213 * @return Returns the ch635
214 */
215 public SummaryResult getResultChannel635() {
216 return ch635;
217 }
218
219 /***
220 * Get the result for all channel.
221 * @return Returns the chAll
222 */
223 public SummaryResult getResultAllChannels() {
224 return chAll;
225 }
226
227 /***
228 * Get the count of the realFeatures (not abscent).
229 * @return Returns the realFeatures
230 */
231 public int getRealFeatures() {
232 return realFeatures;
233 }
234
235 /***
236 * Test new flags must be filtered.
237 * @return Returns the filterFlags
238 */
239 public boolean isFilterFlags() {
240 return filterFlags;
241 }
242
243
244
245
246
247 /***
248 * Set the new flags values after the test.
249 * @param flagsValues The new flags values
250 */
251 public void setNewFlags(final boolean[] flagsValues) {
252 newFlags = flagsValues;
253 }
254
255 /***
256 * Set the count of the realFeatures (not abscent).
257 * @param realFeatures The realFeatures to set
258 */
259 public void setRealFeatures(final int realFeatures) {
260 this.realFeatures = realFeatures;
261 }
262
263
264
265
266
267 /***
268 * Set if there is a result for each channel.
269 * @param global true if there is no result for each channel
270 */
271 public void setGlobalResultType(final boolean global) {
272 if (global) {
273 this.ch532 = null;
274 this.ch635 = null;
275 this.chAll = new SummaryResult("all");
276 } else {
277 this.ch532 = new SummaryResult("532");
278 this.ch635 = new SummaryResult("635");
279 this.chAll = null;
280 }
281 }
282
283 /***
284 * Test if there is a result for each channel.
285 * @return true is there only a global result
286 */
287 public boolean isGlobalResult() {
288 return this.chAll != null;
289 }
290
291 /***
292 * test is the test passed.
293 * @return true if the test passed
294 */
295 public boolean getResult() {
296 if (isGlobalResult())
297 return getResultAllChannels().isPass();
298
299 return getResultChannel532().isPass() && getResultChannel635().isPass();
300 }
301
302 /***
303 * Set if the new flags must be filtered.
304 * @param filterFlags The filterFlags to set
305 */
306 public void setFilterFlags(final boolean filterFlags) {
307 this.filterFlags = filterFlags;
308 }
309
310
311
312
313
314 /***
315 * Public constructor.
316 * @param bioassay The bioassay used for the test
317 * @param test The test used
318 */
319 public QualityUnitTestResult(final BioAssay bioassay,
320 final QualityUnitTest test) {
321 setBioAssay(bioassay);
322 setParameters(test.getParameters());
323 setTestId(test.getId());
324 setTestType(test.aboutModule().getName());
325 setTestDescription(test.aboutModule().getShortDescription());
326 }
327
328 }