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

Quick Search    Search Deep

Source code: org/biomage/BioAssay/DerivedBioAssay.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:11 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.BioAssay
49   *  
50   */
51  package org.biomage.BioAssay;
52  
53  /**
54   *  Import list for DerivedBioAssay
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.HasDerivedBioAssayData;
63  import org.biomage.Interface.HasType;
64  import org.biomage.BioAssayData.DerivedBioAssayData;
65  import org.biomage.Description.OntologyEntry;
66  
67  /**
68   *  A BioAssay that is created by the Transformation BioEvent from one or 
69   *  more MeasuredBioAssays or DerivedBioAssays.
70   *  
71   */
72  public
73  class DerivedBioAssay
74      extends BioAssay
75      implements Serializable,
76          HasDerivedBioAssayData,
77          HasType
78  {
79      /**
80       *  The data associated with the DerivedBioAssay.
81       *  
82       */
83      private DerivedBioAssayData_list derivedBioAssayData = new DerivedBioAssayData_list();
84  
85      /**
86       *  The derivation type, for instance collapsed spot replicate, 
87       *  ratio, averaged intensity, bioassay replicates, etc.
88       *  
89       */
90      private OntologyEntry type;
91  
92  
93      /**
94       *  Default constructor.
95       *  
96       */
97      public
98      DerivedBioAssay()
99      {
100         super();
101     }
102 
103     /**
104      *  Attribute constructor.
105      *  
106      *  Looks up the attributes in the parameter and casts them from strings 
107      *  appropriately
108      *  @param atts: the attribute list.
109      *  
110      */
111     // TODO Work in progress (attribute constructor).
112     public
113     DerivedBioAssay(Attributes atts)
114     {
115         super(atts);
116 
117     }
118 
119     /**
120      *  writeMAGEML
121      *  <p>
122      *  This method is responsible for assembling the attribute and 
123      *  association data into XML. It creates the object tag and then calls 
124      *  the writeAttributes and writeAssociation methods.
125      *  <p>
126      *  
127      */
128     public
129     void
130     writeMAGEML(Writer out)
131     throws IOException
132     {
133         out.write("<DerivedBioAssay");
134         writeAttributes(out);
135         out.write(">");
136         writeAssociations(out);
137         out.write("</DerivedBioAssay>");
138     }
139 
140     /**
141      *  writeAttributes
142      *  <p>
143      *  This method is responsible for assembling the attribute data into 
144      *  XML. It calls the super method to write out all attributes of this 
145      *  class and it's ancestors.
146      *  <p>
147      *  
148      */
149     public
150     void
151     writeAttributes(Writer out)
152     throws IOException
153     {
154         super.writeAttributes(out);
155     }
156 
157     /**
158      *  writeAssociations
159      *  <p>
160      *  This method is responsible for assembling the association data 
161      *  into XML. It calls the super method to write out all associations of 
162      *  this class's ancestors.
163      *  <p>
164      *  
165      */
166     public
167     void
168     writeAssociations(Writer out)
169     throws IOException
170     {
171         super.writeAssociations(out);
172         if ( type != null ){
173             out.write("<Type_assn>");
174             type.writeMAGEML(out);
175             out.write("</Type_assn>");
176         }
177         if ( derivedBioAssayData.size() > 0 ){
178             out.write("<DerivedBioAssayData_assnreflist>");
179             for ( int i = 0; i < derivedBioAssayData.size(); i++) {
180                 out.write("<DerivedBioAssayData_ref identifier=\"" + ((DerivedBioAssayData)derivedBioAssayData.elementAt(i)).getIdentifier() + "\"/>");
181             }
182             out.write("</DerivedBioAssayData_assnreflist>");
183         }
184     }
185 
186     /**
187      *  Set method for derivedBioAssayData
188      *  <p>
189      *  @param value to set
190      *  <p>
191      *  
192      */
193     public
194     void
195     setDerivedBioAssayData(
196         DerivedBioAssayData_list derivedBioAssayData
197     )
198     {
199         ((List)this.derivedBioAssayData).addAll((List)derivedBioAssayData);
200     }
201 
202     /**
203      *  Get method for derivedBioAssayData
204      *  <p>
205      *  @return value of the attribute
206      *  <p>
207      *  
208      */
209     public
210     DerivedBioAssayData_list
211     getDerivedBioAssayData()
212     {
213         return derivedBioAssayData;
214     }
215 
216     /**
217      *  Method to add DerivedBioAssayData to DerivedBioAssayData_list
218      *  
219      */
220     public
221     void
222     addToDerivedBioAssayData(
223         DerivedBioAssayData derivedBioAssayData
224     )
225     {
226         this.derivedBioAssayData.add(derivedBioAssayData);
227     }
228 
229     /**
230      *  Method to add DerivedBioAssayData at position to 
231      *  DerivedBioAssayData_list
232      *  
233      */
234     public
235     void
236     addToDerivedBioAssayData(
237         int position,
238         DerivedBioAssayData derivedBioAssayData
239     )
240     {
241         this.derivedBioAssayData.add(position, derivedBioAssayData);
242     }
243 
244     /**
245      *  Method to get DerivedBioAssayData from DerivedBioAssayData_list
246      *  
247      */
248     public
249     DerivedBioAssayData
250     getFromDerivedBioAssayData(
251         int position
252     )
253     {
254         return (DerivedBioAssayData) this.derivedBioAssayData.get(position);
255     }
256 
257     /**
258      *  Method to remove by position from DerivedBioAssayData_list
259      *  
260      */
261     public
262     void
263     removeElementAtFromDerivedBioAssayData(
264         int position
265     )
266     {
267         this.derivedBioAssayData.removeElementAt(position);
268     }
269 
270     /**
271      *  Method to remove first DerivedBioAssayData from 
272      *  DerivedBioAssayData_list
273      *  
274      */
275     public
276     void
277     removeFromDerivedBioAssayData(
278         DerivedBioAssayData derivedBioAssayData
279     )
280     {
281         this.derivedBioAssayData.remove(derivedBioAssayData);
282     }
283 
284     /**
285      *  Set method for type
286      *  <p>
287      *  @param value to set
288      *  <p>
289      *  
290      */
291     public
292     void
293     setType(
294         OntologyEntry type
295     )
296     {
297         this.type = type;
298     }
299 
300     /**
301      *  Get method for type
302      *  <p>
303      *  @return value of the attribute
304      *  <p>
305      *  
306      */
307     public
308     OntologyEntry
309     getType()
310     {
311         return type;
312     }
313 
314 }