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

Quick Search    Search Deep

Source code: org/biomage/BioSequence/BioSequence_package.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:53 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.BioSequence
49   *  
50   */
51  package org.biomage.BioSequence;
52  
53  /**
54   *  Import list for BioSequence_package
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  
63  /**
64   *  Describes a known gene or sequence.  BioAssays typically seek to 
65   *  identify what BioSequences are expressed in a BioMaterial after 
66   *  treatments, the expression level measured from the association between 
67   *  the BioMaterial and the Array.  The Array's Features typically provide 
68   *  known locations for this association to occur.  Most often, the Reporter 
69   *  and CompositeSequence are known and the presence or absence of a 
70   *  particular BioSequence in the BioMaterial is based on whether there as 
71   *  been an association to the DesignElement targeted for it.  Some other 
72   *  experiments may not know the DesignElement's target but can discover it 
73   *  with known properties of the BioSequences in the BioMaterial.
74   *  
75   */
76  public
77  class BioSequence_package
78      implements Serializable
79  {
80      /**
81       *  Inner list class for holding multiple entries for attribute 
82       *  bioSequence_list.  Simply creates a named vector.
83       *  
84       */
85      public
86      class
87      BioSequence_list extends Vector
88      {
89      }
90  
91      /**
92       *  A BioSequence is a representation of a DNA, RNA, or protein 
93       *  sequence.  It can be represented by a Clone, Gene, or the sequence.
94       *  
95       */
96      public BioSequence_list bioSequence_list = new BioSequence_list();
97  
98      /**
99       *  Default constructor.
100      *  
101      */
102     public
103     BioSequence_package()
104     {
105     }
106 
107     /**
108      *  Attribute constructor.
109      *  
110      *  Looks up the attributes in the parameter and casts them from strings 
111      *  appropriately
112      *  @param atts: the attribute list.
113      *  
114      */
115     // TODO Work in progress (attribute constructor).
116     public
117     BioSequence_package(Attributes atts)
118     {
119     }
120 
121     /**
122      *  writeMAGEML
123      *  <p>
124      *  This method is responsible for assembling the attribute and 
125      *  association data into XML. It creates the object tag and then calls 
126      *  the writeAttributes and writeAssociation methods.
127      *  <p>
128      *  
129      */
130     public
131     void
132     writeMAGEML(Writer out)
133     throws IOException
134     {
135         out.write("<BioSequence_package");
136         writeAttributes(out);
137         out.write(">");
138         writeAssociations(out);
139         out.write("</BioSequence_package>");
140     }
141 
142     /**
143      *  writeAttributes
144      *  <p>
145      *  This method is responsible for assembling the attribute data into 
146      *  XML. It calls the super method to write out all attributes of this 
147      *  class and it's ancestors.
148      *  <p>
149      *  
150      */
151     public
152     void
153     writeAttributes(Writer out)
154     throws IOException
155     {
156     }
157 
158     /**
159      *  writeAssociations
160      *  <p>
161      *  This method is responsible for assembling the association data 
162      *  into XML. It calls the super method to write out all associations of 
163      *  this class's ancestors.
164      *  <p>
165      *  
166      */
167     public
168     void
169     writeAssociations(Writer out)
170     throws IOException
171     {
172         if ( bioSequence_list.size() > 0 ){
173             out.write("<BioSequence_assnlist>");
174             for ( int i = 0; i < bioSequence_list.size(); i++) {
175                 ((BioSequence)bioSequence_list.elementAt(i)).writeMAGEML(out);
176             }
177             out.write("</BioSequence_assnlist>");
178         }
179     }
180 
181     /**
182      *  Set method for bioSequence_list
183      *  <p>
184      *  @param value to set
185      *  <p>
186      *  
187      */
188     public
189     void
190     setBioSequence_list(
191         BioSequence_list bioSequence_list
192     )
193     {
194         ((List)this.bioSequence_list).addAll((List)bioSequence_list);
195     }
196 
197     /**
198      *  Get method for bioSequence_list
199      *  <p>
200      *  @return value of the attribute
201      *  <p>
202      *  
203      */
204     public
205     BioSequence_list
206     getBioSequence_list()
207     {
208         return bioSequence_list;
209     }
210 
211     /**
212      *  Method to add BioSequence to BioSequence_list
213      *  
214      */
215     public
216     void
217     addToBioSequence_list(
218         BioSequence bioSequence
219     )
220     {
221         this.bioSequence_list.add(bioSequence);
222     }
223 
224     /**
225      *  Method to add BioSequence at position to BioSequence_list
226      *  
227      */
228     public
229     void
230     addToBioSequence_list(
231         int position,
232         BioSequence bioSequence
233     )
234     {
235         this.bioSequence_list.add(position, bioSequence);
236     }
237 
238     /**
239      *  Method to get BioSequence from BioSequence_list
240      *  
241      */
242     public
243     BioSequence
244     getFromBioSequence_list(
245         int position
246     )
247     {
248         return (BioSequence) this.bioSequence_list.get(position);
249     }
250 
251     /**
252      *  Method to remove by position from BioSequence_list
253      *  
254      */
255     public
256     void
257     removeElementAtFromBioSequence_list(
258         int position
259     )
260     {
261         this.bioSequence_list.removeElementAt(position);
262     }
263 
264     /**
265      *  Method to remove first BioSequence from BioSequence_list
266      *  
267      */
268     public
269     void
270     removeFromBioSequence_list(
271         BioSequence bioSequence
272     )
273     {
274         this.bioSequence_list.remove(bioSequence);
275     }
276 
277 }