Source code: org/biomage/BioAssayData/BioAssayData.java
1 /***************************************************************************
2 * *
3 * C O P Y R I G H T N O T I C E *
4 * Copyright (c) 2001 by: *
5 * * The MicroArray Gene Expression Database group (MGED) *
6 * * Rosetta Inpharmatics *
7 * *
8 * All Rights Reserved. *
9 * *
10 * Permission is hereby granted, free of charge, to any person *
11 * obtaining a copy of this software and associated documentation files *
12 * (the "Software"), to deal in the Software without restriction, *
13 * including without limitation the rights to use, copy, modify, merge, *
14 * publish, distribute, sublicense, and/or sell copies of the Software, *
15 * and to permit persons to whom the Software is furnished to do so, *
16 * subject to the following conditions: *
17 * *
18 * The above copyright notice and this permission notice shall be *
19 * included in all copies or substantial portions of the Software. *
20 * *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS *
25 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN *
26 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN *
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
28 * SOFTWARE. *
29 ***************************************************************************
30 * *
31 * Created by the create_mage_java_classes java program based on the *
32 * information in the xmi file created from the MAGE-OM UML model, *
33 * copyright European Bioinformatics Institute (EBI) for MGED and Rosetta *
34 * Informatics. *
35 * *
36 * The ideas and work are built on the previous work in perl of Jason *
37 * Stewart, Open Informatics, and Robert M. Hubley, Institute for Systems *
38 * Biology *
39 * *
40 * @author Michael Miller, Rosetta Inpharmatics *
41 * @version Revision: 1.0 *
42 * @date Thu, Feb 21, 2002 10:46:19 AM *
43 * *
44 ***************************************************************************
45 */
46
47 /**
48 * org.biomage.BioAssayData
49 *
50 */
51 package org.biomage.BioAssayData;
52
53 /**
54 * Import list for BioAssayData
55 *
56 */
57 import java.io.Serializable;
58 import java.util.*;
59 import org.xml.sax.Attributes;
60 import java.io.Writer;
61 import java.io.IOException;
62 import org.biomage.Interface.HasBioAssayDimension;
63 import org.biomage.Interface.HasDesignElementDimension;
64 import org.biomage.Interface.HasQuantitationTypeDimension;
65 import org.biomage.Interface.HasSummaryStatistics;
66 import org.biomage.Interface.HasBioDataValues;
67 import org.biomage.Common.Identifiable;
68 import org.biomage.Common.NameValueType;
69
70 /**
71 * Represents the dataset created when the BioAssays are created.
72 * BioAssayData is the entry point to the values. Because the actual
73 * values are represented by a different object, BioDataValues, which can
74 * be memory intensive, the annotation of the transformation can be gotten
75 * separate from the data.
76 *
77 */
78 public
79 abstract
80 class BioAssayData
81 extends Identifiable
82 implements Serializable,
83 HasBioAssayDimension,
84 HasDesignElementDimension,
85 HasQuantitationTypeDimension,
86 HasSummaryStatistics,
87 HasBioDataValues
88 {
89 /**
90 * The BioAssays of the BioAssayData.
91 *
92 */
93 private BioAssayDimension bioAssayDimension;
94
95
96 /**
97 * The DesignElements of the BioAssayData.
98 *
99 */
100 private DesignElementDimension designElementDimension;
101
102
103 /**
104 * The QuantitationTypes of the BioAssayData.
105 *
106 */
107 private QuantitationTypeDimension quantitationTypeDimension;
108
109
110 /**
111 * Statistics on the Quality of the BioAssayData.
112 *
113 */
114 private SummaryStatistics_list summaryStatistics = new SummaryStatistics_list();
115
116 /**
117 * The data values of the BioAssayData.
118 *
119 */
120 private BioDataValues bioDataValues;
121
122
123 /**
124 * Default constructor.
125 *
126 */
127 public
128 BioAssayData()
129 {
130 super();
131 }
132
133 /**
134 * Attribute constructor.
135 *
136 * Looks up the attributes in the parameter and casts them from strings
137 * appropriately
138 * @param atts: the attribute list.
139 *
140 */
141 // TODO Work in progress (attribute constructor).
142 public
143 BioAssayData(Attributes atts)
144 {
145 super(atts);
146
147 }
148
149 /**
150 * writeMAGEML
151 * <p>
152 * This method is responsible for assembling the attribute and
153 * association data into XML. It creates the object tag and then calls
154 * the writeAttributes and writeAssociation methods.
155 * <p>
156 *
157 */
158 public
159 void
160 writeMAGEML(Writer out)
161 throws IOException
162 {
163 }
164
165 /**
166 * writeAttributes
167 * <p>
168 * This method is responsible for assembling the attribute data into
169 * XML. It calls the super method to write out all attributes of this
170 * class and it's ancestors.
171 * <p>
172 *
173 */
174 public
175 void
176 writeAttributes(Writer out)
177 throws IOException
178 {
179 super.writeAttributes(out);
180 }
181
182 /**
183 * writeAssociations
184 * <p>
185 * This method is responsible for assembling the association data
186 * into XML. It calls the super method to write out all associations of
187 * this class's ancestors.
188 * <p>
189 *
190 */
191 public
192 void
193 writeAssociations(Writer out)
194 throws IOException
195 {
196 super.writeAssociations(out);
197 if ( summaryStatistics.size() > 0 ){
198 out.write("<SummaryStatistics_assnlist>");
199 for ( int i = 0; i < summaryStatistics.size(); i++) {
200 ((NameValueType)summaryStatistics.elementAt(i)).writeMAGEML(out);
201 }
202 out.write("</SummaryStatistics_assnlist>");
203 }
204 if ( bioAssayDimension != null ){
205 out.write("<BioAssayDimension_assn>");
206 bioAssayDimension.writeMAGEML(out);
207 out.write("</BioAssayDimension_assn>");
208 }
209 if ( designElementDimension != null ){
210 out.write("<DesignElementDimension_assn>");
211 designElementDimension.writeMAGEML(out);
212 out.write("</DesignElementDimension_assn>");
213 }
214 if ( quantitationTypeDimension != null ){
215 out.write("<QuantitationTypeDimension_assn>");
216 quantitationTypeDimension.writeMAGEML(out);
217 out.write("</QuantitationTypeDimension_assn>");
218 }
219 if ( bioDataValues != null ){
220 out.write("<BioDataValues_assn>");
221 bioDataValues.writeMAGEML(out);
222 out.write("</BioDataValues_assn>");
223 }
224 }
225
226 /**
227 * Set method for bioAssayDimension
228 * <p>
229 * @param value to set
230 * <p>
231 *
232 */
233 public
234 void
235 setBioAssayDimension(
236 BioAssayDimension bioAssayDimension
237 )
238 {
239 this.bioAssayDimension = bioAssayDimension;
240 }
241
242 /**
243 * Get method for bioAssayDimension
244 * <p>
245 * @return value of the attribute
246 * <p>
247 *
248 */
249 public
250 BioAssayDimension
251 getBioAssayDimension()
252 {
253 return bioAssayDimension;
254 }
255
256 /**
257 * Set method for designElementDimension
258 * <p>
259 * @param value to set
260 * <p>
261 *
262 */
263 public
264 void
265 setDesignElementDimension(
266 DesignElementDimension designElementDimension
267 )
268 {
269 this.designElementDimension = designElementDimension;
270 }
271
272 /**
273 * Get method for designElementDimension
274 * <p>
275 * @return value of the attribute
276 * <p>
277 *
278 */
279 public
280 DesignElementDimension
281 getDesignElementDimension()
282 {
283 return designElementDimension;
284 }
285
286 /**
287 * Set method for quantitationTypeDimension
288 * <p>
289 * @param value to set
290 * <p>
291 *
292 */
293 public
294 void
295 setQuantitationTypeDimension(
296 QuantitationTypeDimension quantitationTypeDimension
297 )
298 {
299 this.quantitationTypeDimension = quantitationTypeDimension;
300 }
301
302 /**
303 * Get method for quantitationTypeDimension
304 * <p>
305 * @return value of the attribute
306 * <p>
307 *
308 */
309 public
310 QuantitationTypeDimension
311 getQuantitationTypeDimension()
312 {
313 return quantitationTypeDimension;
314 }
315
316 /**
317 * Set method for summaryStatistics
318 * <p>
319 * @param value to set
320 * <p>
321 *
322 */
323 public
324 void
325 setSummaryStatistics(
326 SummaryStatistics_list summaryStatistics
327 )
328 {
329 ((List)this.summaryStatistics).addAll((List)summaryStatistics);
330 }
331
332 /**
333 * Get method for summaryStatistics
334 * <p>
335 * @return value of the attribute
336 * <p>
337 *
338 */
339 public
340 SummaryStatistics_list
341 getSummaryStatistics()
342 {
343 return summaryStatistics;
344 }
345
346 /**
347 * Method to add NameValueType to SummaryStatistics_list
348 *
349 */
350 public
351 void
352 addToSummaryStatistics(
353 NameValueType nameValueType
354 )
355 {
356 this.summaryStatistics.add(nameValueType);
357 }
358
359 /**
360 * Method to add NameValueType at position to SummaryStatistics_list
361 *
362 */
363 public
364 void
365 addToSummaryStatistics(
366 int position,
367 NameValueType nameValueType
368 )
369 {
370 this.summaryStatistics.add(position, nameValueType);
371 }
372
373 /**
374 * Method to get NameValueType from SummaryStatistics_list
375 *
376 */
377 public
378 NameValueType
379 getFromSummaryStatistics(
380 int position
381 )
382 {
383 return (NameValueType) this.summaryStatistics.get(position);
384 }
385
386 /**
387 * Method to remove by position from SummaryStatistics_list
388 *
389 */
390 public
391 void
392 removeElementAtFromSummaryStatistics(
393 int position
394 )
395 {
396 this.summaryStatistics.removeElementAt(position);
397 }
398
399 /**
400 * Method to remove first NameValueType from SummaryStatistics_list
401 *
402 */
403 public
404 void
405 removeFromSummaryStatistics(
406 NameValueType nameValueType
407 )
408 {
409 this.summaryStatistics.remove(nameValueType);
410 }
411
412 /**
413 * Set method for bioDataValues
414 * <p>
415 * @param value to set
416 * <p>
417 *
418 */
419 public
420 void
421 setBioDataValues(
422 BioDataValues bioDataValues
423 )
424 {
425 this.bioDataValues = bioDataValues;
426 }
427
428 /**
429 * Get method for bioDataValues
430 * <p>
431 * @return value of the attribute
432 * <p>
433 *
434 */
435 public
436 BioDataValues
437 getBioDataValues()
438 {
439 return bioDataValues;
440 }
441
442 }