Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/biomage/DesignElement/Reporter.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:43 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.DesignElement
49   *  
50   */
51  package org.biomage.DesignElement;
52  
53  /**
54   *  Import list for Reporter
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.HasFailTypes;
63  import org.biomage.Interface.HasWarningType;
64  import org.biomage.Interface.HasImmobilizedCharacteristics;
65  import org.biomage.Interface.HasFeatureReporterMaps;
66  import org.biomage.BioSequence.BioSequence;
67  import org.biomage.Description.OntologyEntry;
68  
69  /**
70   *  A Design Element that represents some biological material (clone, 
71   *  oligo, etc.) on an array which will report on some biosequence or 
72   *  biosequences.  The derived data from the measured data of its Features 
73   *  represents the presence or absence of the biosequence or biosequences it 
74   *  is reporting on in the BioAssay.
75   *  
76   *  Reporters are Identifiable and several Features on the same array can be 
77   *  mapped to the same reporter as can Features from a different 
78   *  ArrayDesign.  The granularity of the Reporters independence is dependent 
79   *  on the technology and the intent of the ArrayDesign.  Oligos using 
80   *  mature technologies can in general be assumed to be safely replicated on 
81   *  many features where as with PCR Products there might be the desire for 
82   *  quality assurence to make reporters one to one with features and use the 
83   *  mappings to CompositeSequences for replication purposes.
84   *  
85   */
86  public
87  class Reporter
88      extends DesignElement
89      implements Serializable,
90          HasFailTypes,
91          HasWarningType,
92          HasImmobilizedCharacteristics,
93          HasFeatureReporterMaps
94  {
95      /**
96       *  If at some time the reporter is determined to be failed this 
97       *  indicts the failure (doesn't report on what it was intended to 
98       *  report on, etc.)
99       *  
100      */
101     private FailTypes_list failTypes = new FailTypes_list();
102 
103     /**
104      *  Similar to failType but indicates a warning rather than a 
105      *  failure.
106      *  
107      */
108     private OntologyEntry warningType;
109 
110 
111     /**
112      *  The sequence annotation on the BioMaterial this reporter 
113      *  represents.  Typically the sequences will be an Oligo Sequence, 
114      *  Clone or PCR Primer.
115      *  
116      */
117     private ImmobilizedCharacteristics_list immobilizedCharacteristics = new ImmobilizedCharacteristics_list();
118 
119     /**
120      *  Associates features with their reporter.
121      *  
122      */
123     private FeatureReporterMaps_list featureReporterMaps = new FeatureReporterMaps_list();
124 
125     /**
126      *  Default constructor.
127      *  
128      */
129     public
130     Reporter()
131     {
132         super();
133     }
134 
135     /**
136      *  Attribute constructor.
137      *  
138      *  Looks up the attributes in the parameter and casts them from strings 
139      *  appropriately
140      *  @param atts: the attribute list.
141      *  
142      */
143     // TODO Work in progress (attribute constructor).
144     public
145     Reporter(Attributes atts)
146     {
147         super(atts);
148 
149     }
150 
151     /**
152      *  writeMAGEML
153      *  <p>
154      *  This method is responsible for assembling the attribute and 
155      *  association data into XML. It creates the object tag and then calls 
156      *  the writeAttributes and writeAssociation methods.
157      *  <p>
158      *  
159      */
160     public
161     void
162     writeMAGEML(Writer out)
163     throws IOException
164     {
165         out.write("<Reporter");
166         writeAttributes(out);
167         out.write(">");
168         writeAssociations(out);
169         out.write("</Reporter>");
170     }
171 
172     /**
173      *  writeAttributes
174      *  <p>
175      *  This method is responsible for assembling the attribute data into 
176      *  XML. It calls the super method to write out all attributes of this 
177      *  class and it's ancestors.
178      *  <p>
179      *  
180      */
181     public
182     void
183     writeAttributes(Writer out)
184     throws IOException
185     {
186         super.writeAttributes(out);
187     }
188 
189     /**
190      *  writeAssociations
191      *  <p>
192      *  This method is responsible for assembling the association data 
193      *  into XML. It calls the super method to write out all associations of 
194      *  this class's ancestors.
195      *  <p>
196      *  
197      */
198     public
199     void
200     writeAssociations(Writer out)
201     throws IOException
202     {
203         super.writeAssociations(out);
204         if ( immobilizedCharacteristics.size() > 0 ){
205             out.write("<ImmobilizedCharacteristics_assnreflist>");
206             for ( int i = 0; i < immobilizedCharacteristics.size(); i++) {
207                 out.write("<BioSequence_ref identifier=\"" + ((BioSequence)immobilizedCharacteristics.elementAt(i)).getIdentifier() + "\"/>");
208             }
209             out.write("</ImmobilizedCharacteristics_assnreflist>");
210         }
211         if ( warningType != null ){
212             out.write("<WarningType_assn>");
213             warningType.writeMAGEML(out);
214             out.write("</WarningType_assn>");
215         }
216         if ( failTypes.size() > 0 ){
217             out.write("<FailTypes_assnlist>");
218             for ( int i = 0; i < failTypes.size(); i++) {
219                 ((OntologyEntry)failTypes.elementAt(i)).writeMAGEML(out);
220             }
221             out.write("</FailTypes_assnlist>");
222         }
223         if ( featureReporterMaps.size() > 0 ){
224             out.write("<FeatureReporterMaps_assnreflist>");
225             for ( int i = 0; i < featureReporterMaps.size(); i++) {
226                 out.write("<FeatureReporterMap_ref identifier=\"" + ((FeatureReporterMap)featureReporterMaps.elementAt(i)).getIdentifier() + "\"/>");
227             }
228             out.write("</FeatureReporterMaps_assnreflist>");
229         }
230     }
231 
232     /**
233      *  Set method for failTypes
234      *  <p>
235      *  @param value to set
236      *  <p>
237      *  
238      */
239     public
240     void
241     setFailTypes(
242         FailTypes_list failTypes
243     )
244     {
245         ((List)this.failTypes).addAll((List)failTypes);
246     }
247 
248     /**
249      *  Get method for failTypes
250      *  <p>
251      *  @return value of the attribute
252      *  <p>
253      *  
254      */
255     public
256     FailTypes_list
257     getFailTypes()
258     {
259         return failTypes;
260     }
261 
262     /**
263      *  Method to add OntologyEntry to FailTypes_list
264      *  
265      */
266     public
267     void
268     addToFailTypes(
269         OntologyEntry ontologyEntry
270     )
271     {
272         this.failTypes.add(ontologyEntry);
273     }
274 
275     /**
276      *  Method to add OntologyEntry at position to FailTypes_list
277      *  
278      */
279     public
280     void
281     addToFailTypes(
282         int position,
283         OntologyEntry ontologyEntry
284     )
285     {
286         this.failTypes.add(position, ontologyEntry);
287     }
288 
289     /**
290      *  Method to get OntologyEntry from FailTypes_list
291      *  
292      */
293     public
294     OntologyEntry
295     getFromFailTypes(
296         int position
297     )
298     {
299         return (OntologyEntry) this.failTypes.get(position);
300     }
301 
302     /**
303      *  Method to remove by position from FailTypes_list
304      *  
305      */
306     public
307     void
308     removeElementAtFromFailTypes(
309         int position
310     )
311     {
312         this.failTypes.removeElementAt(position);
313     }
314 
315     /**
316      *  Method to remove first OntologyEntry from FailTypes_list
317      *  
318      */
319     public
320     void
321     removeFromFailTypes(
322         OntologyEntry ontologyEntry
323     )
324     {
325         this.failTypes.remove(ontologyEntry);
326     }
327 
328     /**
329      *  Set method for warningType
330      *  <p>
331      *  @param value to set
332      *  <p>
333      *  
334      */
335     public
336     void
337     setWarningType(
338         OntologyEntry warningType
339     )
340     {
341         this.warningType = warningType;
342     }
343 
344     /**
345      *  Get method for warningType
346      *  <p>
347      *  @return value of the attribute
348      *  <p>
349      *  
350      */
351     public
352     OntologyEntry
353     getWarningType()
354     {
355         return warningType;
356     }
357 
358     /**
359      *  Set method for immobilizedCharacteristics
360      *  <p>
361      *  @param value to set
362      *  <p>
363      *  
364      */
365     public
366     void
367     setImmobilizedCharacteristics(
368         ImmobilizedCharacteristics_list immobilizedCharacteristics
369     )
370     {
371         ((List)this.immobilizedCharacteristics).addAll((List)immobilizedCharacteristics);
372     }
373 
374     /**
375      *  Get method for immobilizedCharacteristics
376      *  <p>
377      *  @return value of the attribute
378      *  <p>
379      *  
380      */
381     public
382     ImmobilizedCharacteristics_list
383     getImmobilizedCharacteristics()
384     {
385         return immobilizedCharacteristics;
386     }
387 
388     /**
389      *  Method to add BioSequence to ImmobilizedCharacteristics_list
390      *  
391      */
392     public
393     void
394     addToImmobilizedCharacteristics(
395         BioSequence bioSequence
396     )
397     {
398         this.immobilizedCharacteristics.add(bioSequence);
399     }
400 
401     /**
402      *  Method to add BioSequence at position to 
403      *  ImmobilizedCharacteristics_list
404      *  
405      */
406     public
407     void
408     addToImmobilizedCharacteristics(
409         int position,
410         BioSequence bioSequence
411     )
412     {
413         this.immobilizedCharacteristics.add(position, bioSequence);
414     }
415 
416     /**
417      *  Method to get BioSequence from ImmobilizedCharacteristics_list
418      *  
419      */
420     public
421     BioSequence
422     getFromImmobilizedCharacteristics(
423         int position
424     )
425     {
426         return (BioSequence) this.immobilizedCharacteristics.get(position);
427     }
428 
429     /**
430      *  Method to remove by position from ImmobilizedCharacteristics_list
431      *  
432      */
433     public
434     void
435     removeElementAtFromImmobilizedCharacteristics(
436         int position
437     )
438     {
439         this.immobilizedCharacteristics.removeElementAt(position);
440     }
441 
442     /**
443      *  Method to remove first BioSequence from 
444      *  ImmobilizedCharacteristics_list
445      *  
446      */
447     public
448     void
449     removeFromImmobilizedCharacteristics(
450         BioSequence bioSequence
451     )
452     {
453         this.immobilizedCharacteristics.remove(bioSequence);
454     }
455 
456     /**
457      *  Set method for featureReporterMaps
458      *  <p>
459      *  @param value to set
460      *  <p>
461      *  
462      */
463     public
464     void
465     setFeatureReporterMaps(
466         FeatureReporterMaps_list featureReporterMaps
467     )
468     {
469         ((List)this.featureReporterMaps).addAll((List)featureReporterMaps);
470     }
471 
472     /**
473      *  Get method for featureReporterMaps
474      *  <p>
475      *  @return value of the attribute
476      *  <p>
477      *  
478      */
479     public
480     FeatureReporterMaps_list
481     getFeatureReporterMaps()
482     {
483         return featureReporterMaps;
484     }
485 
486     /**
487      *  Method to add FeatureReporterMap to FeatureReporterMaps_list
488      *  
489      */
490     public
491     void
492     addToFeatureReporterMaps(
493         FeatureReporterMap featureReporterMap
494     )
495     {
496         this.featureReporterMaps.add(featureReporterMap);
497     }
498 
499     /**
500      *  Method to add FeatureReporterMap at position to 
501      *  FeatureReporterMaps_list
502      *  
503      */
504     public
505     void
506     addToFeatureReporterMaps(
507         int position,
508         FeatureReporterMap featureReporterMap
509     )
510     {
511         this.featureReporterMaps.add(position, featureReporterMap);
512     }
513 
514     /**
515      *  Method to get FeatureReporterMap from FeatureReporterMaps_list
516      *  
517      */
518     public
519     FeatureReporterMap
520     getFromFeatureReporterMaps(
521         int position
522     )
523     {
524         return (FeatureReporterMap) this.featureReporterMaps.get(position);
525     }
526 
527     /**
528      *  Method to remove by position from FeatureReporterMaps_list
529      *  
530      */
531     public
532     void
533     removeElementAtFromFeatureReporterMaps(
534         int position
535     )
536     {
537         this.featureReporterMaps.removeElementAt(position);
538     }
539 
540     /**
541      *  Method to remove first FeatureReporterMap from 
542      *  FeatureReporterMaps_list
543      *  
544      */
545     public
546     void
547     removeFromFeatureReporterMaps(
548         FeatureReporterMap featureReporterMap
549     )
550     {
551         this.featureReporterMaps.remove(featureReporterMap);
552     }
553 
554 }