2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2003, The Institute for Genomic Research (TIGR). |
2 |
26 Feb 07 |
jari |
All rights reserved. |
2 |
26 Feb 07 |
jari |
4 |
*/ |
2 |
26 Feb 07 |
jari |
5 |
/* |
2 |
26 Feb 07 |
jari |
* $RCSfile: FloatSlideData.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.14 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/05/12 15:09:59 $ |
2 |
26 Feb 07 |
jari |
* $Author: eleanorahowe $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
11 |
*/ |
2 |
26 Feb 07 |
jari |
12 |
package org.tigr.microarray.mev; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
import java.io.DataInputStream; |
2 |
26 Feb 07 |
jari |
15 |
import java.io.DataOutputStream; |
2 |
26 Feb 07 |
jari |
16 |
import java.io.File; |
2 |
26 Feb 07 |
jari |
17 |
import java.io.FileInputStream; |
2 |
26 Feb 07 |
jari |
18 |
import java.io.IOException; |
2 |
26 Feb 07 |
jari |
19 |
import java.util.Hashtable; |
2 |
26 Feb 07 |
jari |
20 |
import java.util.Properties; |
2 |
26 Feb 07 |
jari |
21 |
import java.util.Vector; |
2 |
26 Feb 07 |
jari |
22 |
|
2 |
26 Feb 07 |
jari |
23 |
import org.tigr.microarray.mev.cluster.gui.IData; |
2 |
26 Feb 07 |
jari |
24 |
import org.tigr.midas.engine.IterativeLinReg; |
2 |
26 Feb 07 |
jari |
25 |
import org.tigr.midas.engine.IterativeLogMean; |
2 |
26 Feb 07 |
jari |
26 |
import org.tigr.midas.engine.RatioStats; |
2 |
26 Feb 07 |
jari |
27 |
import org.tigr.midas.engine.TotInt; |
2 |
26 Feb 07 |
jari |
28 |
import org.tigr.midas.util.ColumnWorker; |
2 |
26 Feb 07 |
jari |
29 |
import org.tigr.util.math.LinearEquation; |
2 |
26 Feb 07 |
jari |
//import org.tigr.midas.display.ParameterPane; |
2 |
26 Feb 07 |
jari |
31 |
|
2 |
26 Feb 07 |
jari |
32 |
|
2 |
26 Feb 07 |
jari |
33 |
/** |
2 |
26 Feb 07 |
jari |
* Class to store CY3 and CY5 float values of a slide data. |
2 |
26 Feb 07 |
jari |
* It is possible to get ArrayIndexOutOfBoundsException if an index |
2 |
26 Feb 07 |
jari |
* was invalid. |
2 |
26 Feb 07 |
jari |
37 |
*/ |
2 |
26 Feb 07 |
jari |
38 |
public class FloatSlideData implements ISlideData { |
2 |
26 Feb 07 |
jari |
39 |
|
2 |
26 Feb 07 |
jari |
40 |
private String name; // slide name |
2 |
26 Feb 07 |
jari |
41 |
private String filename; // slide file name |
2 |
26 Feb 07 |
jari |
42 |
private float[] currentCY3; // currentCY3 values |
2 |
26 Feb 07 |
jari |
43 |
private float[] currentCY5; // currentCY5 values |
2 |
26 Feb 07 |
jari |
44 |
private float[] trueCY3; // trueCY3 values |
2 |
26 Feb 07 |
jari |
45 |
private float[] trueCY5; // trueCY5 values |
2 |
26 Feb 07 |
jari |
46 |
private static boolean isNonZero = true; |
2 |
26 Feb 07 |
jari |
47 |
private int normalizedState = 0; |
2 |
26 Feb 07 |
jari |
48 |
private int sortState = 0; |
2 |
26 Feb 07 |
jari |
49 |
private ISlideMetaData slideMetaData; |
2 |
26 Feb 07 |
jari |
50 |
private SpotInformationData spotInfoData; |
2 |
26 Feb 07 |
jari |
51 |
private boolean abbrName = false; |
2 |
26 Feb 07 |
jari |
52 |
private int dataType = IData.DATA_TYPE_TWO_INTENSITY; |
2 |
26 Feb 07 |
jari |
53 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
// affy detection flag is MAS's (P)resent, (A)bsent, (M)arginal |
2 |
26 Feb 07 |
jari |
//private String[] detection; |
2 |
26 Feb 07 |
jari |
//jcb |
2 |
26 Feb 07 |
jari |
//smaller data struct |
2 |
26 Feb 07 |
jari |
59 |
private char [] detection; |
2 |
26 Feb 07 |
jari |
//wwang |
2 |
26 Feb 07 |
jari |
//add for pvalue filter |
2 |
26 Feb 07 |
jari |
//TODO this item needs to be added to the state-saving functions for |
2 |
26 Feb 07 |
jari |
//FloatSlideData |
2 |
26 Feb 07 |
jari |
64 |
private float[] pvalue; |
2 |
26 Feb 07 |
jari |
//add for GenePix |
2 |
26 Feb 07 |
jari |
//TODO this item needs to be added to the state-saving functions for |
2 |
26 Feb 07 |
jari |
//FloatSlideData |
2 |
26 Feb 07 |
jari |
68 |
private int[] flags; |
2 |
26 Feb 07 |
jari |
69 |
|
2 |
26 Feb 07 |
jari |
//Support multiple sample labels |
2 |
26 Feb 07 |
jari |
71 |
private String sampleLabelKey = "Default Slide Name"; |
2 |
26 Feb 07 |
jari |
72 |
private Hashtable sampleLabels; |
2 |
26 Feb 07 |
jari |
73 |
private Vector sampleLabelKeys; |
2 |
26 Feb 07 |
jari |
74 |
|
2 |
26 Feb 07 |
jari |
//TODO this item needs to be added to the state-saving functions for |
2 |
26 Feb 07 |
jari |
//FloatSlideData |
2 |
26 Feb 07 |
jari |
77 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Oct 31, 2005 |
2 |
26 Feb 07 |
jari |
* CGH FlankingRegions, and Slide Consts |
2 |
26 Feb 07 |
jari |
* Vector of vectors of FlankingRegions corresponding to flanking regions |
2 |
26 Feb 07 |
jari |
* for each chromosome |
2 |
26 Feb 07 |
jari |
82 |
*/ |
2 |
26 Feb 07 |
jari |
83 |
private Vector[] flankingRegions; |
2 |
26 Feb 07 |
jari |
84 |
|
2 |
26 Feb 07 |
jari |
85 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a new FloatSlideData with no intensity or detection data. Designed for use |
2 |
26 Feb 07 |
jari |
* with XMLEncoder/XMLDecoder for state-saving. |
2 |
26 Feb 07 |
jari |
88 |
* |
2 |
26 Feb 07 |
jari |
* @param sampleLabelKeys |
2 |
26 Feb 07 |
jari |
* @param sampleLabels |
2 |
26 Feb 07 |
jari |
* @param filename |
2 |
26 Feb 07 |
jari |
* @param name |
2 |
26 Feb 07 |
jari |
* @param isNonZero |
2 |
26 Feb 07 |
jari |
* @param normalizedState |
2 |
26 Feb 07 |
jari |
* @param sortState |
2 |
26 Feb 07 |
jari |
* @param spotInfoData |
2 |
26 Feb 07 |
jari |
97 |
*/ |
2 |
26 Feb 07 |
jari |
98 |
public FloatSlideData(Vector sampleLabelKeys, Hashtable sampleLabels, |
2 |
26 Feb 07 |
jari |
99 |
String filename, String name, boolean isNonZero, |
2 |
26 Feb 07 |
jari |
100 |
int normalizedState, int sortState, SpotInformationData spotInfoData, |
2 |
26 Feb 07 |
jari |
101 |
Integer dataType, ISlideMetaData ismd) throws IOException { |
2 |
26 Feb 07 |
jari |
102 |
this.sampleLabelKeys = sampleLabelKeys; |
2 |
26 Feb 07 |
jari |
103 |
this.sampleLabels = sampleLabels; |
2 |
26 Feb 07 |
jari |
104 |
this.filename = filename; |
2 |
26 Feb 07 |
jari |
105 |
this.name = name; |
2 |
26 Feb 07 |
jari |
106 |
this.setNonZero(isNonZero); |
2 |
26 Feb 07 |
jari |
107 |
this.normalizedState = normalizedState; |
2 |
26 Feb 07 |
jari |
108 |
this.sortState = sortState; |
2 |
26 Feb 07 |
jari |
109 |
this.spotInfoData = spotInfoData; |
2 |
26 Feb 07 |
jari |
110 |
this.dataType = dataType.intValue(); |
2 |
26 Feb 07 |
jari |
111 |
this.slideMetaData = ismd; |
2 |
26 Feb 07 |
jari |
112 |
} |
2 |
26 Feb 07 |
jari |
113 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a <code>FloatSlideData</code> with specified reference |
2 |
26 Feb 07 |
jari |
* to a microarray meta data. |
2 |
26 Feb 07 |
jari |
116 |
*/ |
2 |
26 Feb 07 |
jari |
117 |
public FloatSlideData(ISlideMetaData slideMetaData) { |
2 |
26 Feb 07 |
jari |
118 |
this(slideMetaData, slideMetaData.getSize()); |
2 |
26 Feb 07 |
jari |
119 |
sampleLabelKeys = new Vector(); |
2 |
26 Feb 07 |
jari |
120 |
sampleLabelKey = "Default Slide Name"; |
2 |
26 Feb 07 |
jari |
121 |
sampleLabelKeys = new Vector(); |
2 |
26 Feb 07 |
jari |
122 |
sampleLabels = new Hashtable(); |
2 |
26 Feb 07 |
jari |
123 |
} |
2 |
26 Feb 07 |
jari |
124 |
|
2 |
26 Feb 07 |
jari |
125 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a <code>FloatSlideData</code> with specified reference |
2 |
26 Feb 07 |
jari |
* to a microarray meta data and initial size. |
2 |
26 Feb 07 |
jari |
* @param size the size of slide data. |
2 |
26 Feb 07 |
jari |
129 |
*/ |
2 |
26 Feb 07 |
jari |
130 |
public FloatSlideData(ISlideMetaData slideMetaData, int size) { |
2 |
26 Feb 07 |
jari |
131 |
this.slideMetaData = slideMetaData; |
2 |
26 Feb 07 |
jari |
132 |
trueCY3 = new float[size]; |
2 |
26 Feb 07 |
jari |
133 |
trueCY5 = new float[size]; |
2 |
26 Feb 07 |
jari |
134 |
detection = new char[size]; |
2 |
26 Feb 07 |
jari |
135 |
pvalue=new float[size]; |
2 |
26 Feb 07 |
jari |
136 |
flags=new int[size]; |
2 |
26 Feb 07 |
jari |
137 |
sampleLabelKey = "Default Slide Name"; |
2 |
26 Feb 07 |
jari |
138 |
sampleLabelKeys = new Vector(); |
2 |
26 Feb 07 |
jari |
139 |
sampleLabels = new Hashtable(); |
2 |
26 Feb 07 |
jari |
140 |
} |
2 |
26 Feb 07 |
jari |
141 |
|
2 |
26 Feb 07 |
jari |
142 |
public void setCurrentCY3(float[] f){this.currentCY3=f;} |
2 |
26 Feb 07 |
jari |
143 |
public void setCurrentCY5(float[] f){this.currentCY5=f;} |
2 |
26 Feb 07 |
jari |
144 |
public void setTrueCY3(float[] f){this.trueCY3=f;} |
2 |
26 Feb 07 |
jari |
145 |
public void setTrueCY5(float[] f){this.trueCY5=f;} |
2 |
26 Feb 07 |
jari |
146 |
public char[] getDetection() {return detection;} |
2 |
26 Feb 07 |
jari |
147 |
public float[] getCurrentCY3(){return currentCY3;} |
2 |
26 Feb 07 |
jari |
148 |
public float[] getCurrentCY5(){return currentCY5;} |
2 |
26 Feb 07 |
jari |
149 |
public float[] getTrueCY3(){return trueCY3;} |
2 |
26 Feb 07 |
jari |
150 |
public float[] getTrueCY5(){return trueCY5;} |
2 |
26 Feb 07 |
jari |
151 |
|
2 |
26 Feb 07 |
jari |
152 |
|
2 |
26 Feb 07 |
jari |
153 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a reference to a microarray meta data. |
2 |
26 Feb 07 |
jari |
155 |
*/ |
2 |
26 Feb 07 |
jari |
156 |
public ISlideMetaData getSlideMetaData() { |
2 |
26 Feb 07 |
jari |
157 |
return slideMetaData; |
2 |
26 Feb 07 |
jari |
158 |
} |
2 |
26 Feb 07 |
jari |
159 |
|
2 |
26 Feb 07 |
jari |
160 |
public void setSlideMetaData(ISlideMetaData i){this.slideMetaData = i;} |
2 |
26 Feb 07 |
jari |
161 |
|
2 |
26 Feb 07 |
jari |
162 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the data type attribute see static type variables in <code>IData</code> |
2 |
26 Feb 07 |
jari |
164 |
*/ |
2 |
26 Feb 07 |
jari |
165 |
public void setDataType(int type){ |
2 |
26 Feb 07 |
jari |
166 |
this.dataType = type; |
2 |
26 Feb 07 |
jari |
167 |
} |
2 |
26 Feb 07 |
jari |
168 |
|
2 |
26 Feb 07 |
jari |
169 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the data type attribute |
2 |
26 Feb 07 |
jari |
171 |
*/ |
2 |
26 Feb 07 |
jari |
172 |
public int getDataType(){ |
2 |
26 Feb 07 |
jari |
173 |
return this.dataType; |
2 |
26 Feb 07 |
jari |
174 |
} |
2 |
26 Feb 07 |
jari |
175 |
|
2 |
26 Feb 07 |
jari |
176 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the spot information data and associated column headers. |
2 |
26 Feb 07 |
jari |
178 |
*/ |
2 |
26 Feb 07 |
jari |
179 |
public void setSpotInformationData(String [] columnHeaders, String [][] spotInfoData){ |
2 |
26 Feb 07 |
jari |
180 |
this.spotInfoData = new SpotInformationData(columnHeaders, spotInfoData); |
2 |
26 Feb 07 |
jari |
181 |
} |
2 |
26 Feb 07 |
jari |
182 |
|
2 |
26 Feb 07 |
jari |
183 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the spot information data and associated column headers. |
2 |
26 Feb 07 |
jari |
185 |
*/ |
2 |
26 Feb 07 |
jari |
186 |
public void setSpotInformationData(SpotInformationData spotInfoData){ |
2 |
26 Feb 07 |
jari |
187 |
this.spotInfoData = spotInfoData; |
2 |
26 Feb 07 |
jari |
188 |
} |
2 |
26 Feb 07 |
jari |
189 |
|
2 |
26 Feb 07 |
jari |
190 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the <code>SpotInformationData</code> object |
2 |
26 Feb 07 |
jari |
192 |
*/ |
2 |
26 Feb 07 |
jari |
193 |
public SpotInformationData getSpotInformationData(){ return this.spotInfoData; } |
2 |
26 Feb 07 |
jari |
194 |
|
2 |
26 Feb 07 |
jari |
195 |
/** |
2 |
26 Feb 07 |
jari |
* Returns size of a microarray. |
2 |
26 Feb 07 |
jari |
197 |
*/ |
2 |
26 Feb 07 |
jari |
198 |
public int getSize() { |
2 |
26 Feb 07 |
jari |
199 |
return slideMetaData.getSize(); |
2 |
26 Feb 07 |
jari |
200 |
} |
2 |
26 Feb 07 |
jari |
201 |
|
2 |
26 Feb 07 |
jari |
202 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the slide label keys and hash table |
2 |
26 Feb 07 |
jari |
204 |
*/ |
2 |
26 Feb 07 |
jari |
205 |
public void setSlideDataLabels(Vector keys, Hashtable namesHash) { |
2 |
26 Feb 07 |
jari |
206 |
this.sampleLabelKeys = keys; |
2 |
26 Feb 07 |
jari |
207 |
this.sampleLabels = namesHash; |
2 |
26 Feb 07 |
jari |
208 |
} |
2 |
26 Feb 07 |
jari |
209 |
|
2 |
26 Feb 07 |
jari |
210 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a microarray name. |
2 |
26 Feb 07 |
jari |
212 |
*/ |
2 |
26 Feb 07 |
jari |
213 |
public void setSlideDataName(String slideDataName) { |
2 |
26 Feb 07 |
jari |
214 |
this.name = slideDataName; |
2 |
26 Feb 07 |
jari |
215 |
String key = "Default Slide Name"; |
2 |
26 Feb 07 |
jari |
216 |
sampleLabelKey = key; |
2 |
26 Feb 07 |
jari |
217 |
sampleLabelKeys.addElement(key); |
2 |
26 Feb 07 |
jari |
218 |
sampleLabels.put(key, slideDataName); |
2 |
26 Feb 07 |
jari |
219 |
} |
2 |
26 Feb 07 |
jari |
220 |
|
2 |
26 Feb 07 |
jari |
221 |
/** |
2 |
26 Feb 07 |
jari |
* sets boolean to indicate to abbr file and data name |
2 |
26 Feb 07 |
jari |
223 |
*/ |
2 |
26 Feb 07 |
jari |
224 |
public void toggleNameLength(){ |
2 |
26 Feb 07 |
jari |
225 |
this.abbrName = (!this.abbrName); |
2 |
26 Feb 07 |
jari |
226 |
} |
2 |
26 Feb 07 |
jari |
227 |
|
2 |
26 Feb 07 |
jari |
228 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the name of a microarray. |
2 |
26 Feb 07 |
jari |
230 |
*/ |
2 |
26 Feb 07 |
jari |
231 |
public String getSlideDataName() { |
2 |
26 Feb 07 |
jari |
232 |
String name = (String)this.sampleLabels.get(this.sampleLabelKey); |
2 |
26 Feb 07 |
jari |
233 |
|
2 |
26 Feb 07 |
jari |
234 |
if(name == null) |
2 |
26 Feb 07 |
jari |
235 |
return " "; |
2 |
26 Feb 07 |
jari |
236 |
|
2 |
26 Feb 07 |
jari |
237 |
if(!this.abbrName) |
2 |
26 Feb 07 |
jari |
238 |
return name; |
2 |
26 Feb 07 |
jari |
239 |
else{ |
2 |
26 Feb 07 |
jari |
240 |
if(name.length() < 26) |
2 |
26 Feb 07 |
jari |
241 |
return name; |
2 |
26 Feb 07 |
jari |
242 |
return name.substring(0, 25)+"..."; |
2 |
26 Feb 07 |
jari |
243 |
} |
2 |
26 Feb 07 |
jari |
244 |
} |
2 |
26 Feb 07 |
jari |
245 |
|
2 |
26 Feb 07 |
jari |
246 |
public String getFullSlideDataName() { |
2 |
26 Feb 07 |
jari |
247 |
String name = (String)this.sampleLabels.get(this.sampleLabelKey); |
2 |
26 Feb 07 |
jari |
248 |
if(name == null) |
2 |
26 Feb 07 |
jari |
249 |
return " "; |
2 |
26 Feb 07 |
jari |
250 |
else |
2 |
26 Feb 07 |
jari |
251 |
return name; |
2 |
26 Feb 07 |
jari |
252 |
} |
2 |
26 Feb 07 |
jari |
253 |
|
2 |
26 Feb 07 |
jari |
254 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a microarray file name. |
2 |
26 Feb 07 |
jari |
256 |
*/ |
2 |
26 Feb 07 |
jari |
257 |
public void setSlideFileName(String filename) { |
2 |
26 Feb 07 |
jari |
258 |
this.filename = filename; |
2 |
26 Feb 07 |
jari |
259 |
} |
2 |
26 Feb 07 |
jari |
260 |
|
2 |
26 Feb 07 |
jari |
261 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray file name. |
2 |
26 Feb 07 |
jari |
263 |
*/ |
2 |
26 Feb 07 |
jari |
264 |
public String getSlideFileName() { |
2 |
26 Feb 07 |
jari |
265 |
if(!this.abbrName) |
2 |
26 Feb 07 |
jari |
266 |
return this.filename; |
2 |
26 Feb 07 |
jari |
267 |
else{ |
2 |
26 Feb 07 |
jari |
268 |
if(this.filename.length() < 26) |
2 |
26 Feb 07 |
jari |
269 |
return this.filename; |
2 |
26 Feb 07 |
jari |
270 |
return this.filename.substring(0, 25)+"..."; |
2 |
26 Feb 07 |
jari |
271 |
} |
2 |
26 Feb 07 |
jari |
272 |
} |
2 |
26 Feb 07 |
jari |
273 |
public String getFullSlideFileName() { |
2 |
26 Feb 07 |
jari |
274 |
return this.filename; |
2 |
26 Feb 07 |
jari |
275 |
} |
2 |
26 Feb 07 |
jari |
276 |
|
2 |
26 Feb 07 |
jari |
277 |
/** |
2 |
26 Feb 07 |
jari |
* Used to assign the initial values. |
2 |
26 Feb 07 |
jari |
279 |
*/ |
2 |
26 Feb 07 |
jari |
280 |
public void setIntensities(int index, float cy3, float cy5) { |
2 |
26 Feb 07 |
jari |
281 |
trueCY3[index] = cy3; |
2 |
26 Feb 07 |
jari |
282 |
trueCY5[index] = cy5; |
2 |
26 Feb 07 |
jari |
283 |
} |
2 |
26 Feb 07 |
jari |
284 |
|
2 |
26 Feb 07 |
jari |
285 |
/** |
2 |
26 Feb 07 |
jari |
* Assigns current (normalized intensities) |
2 |
26 Feb 07 |
jari |
287 |
*/ |
2 |
26 Feb 07 |
jari |
288 |
public void setCurrentIntensities(int index, float cy3, float cy5){ |
2 |
26 Feb 07 |
jari |
289 |
if(this.currentCY3 != null && this.currentCY5 != null){ |
2 |
26 Feb 07 |
jari |
290 |
this.currentCY3[index] = cy3; |
2 |
26 Feb 07 |
jari |
291 |
this.currentCY5[index] = cy5; |
2 |
26 Feb 07 |
jari |
292 |
} |
2 |
26 Feb 07 |
jari |
293 |
} |
2 |
26 Feb 07 |
jari |
294 |
|
2 |
26 Feb 07 |
jari |
295 |
/** |
2 |
26 Feb 07 |
jari |
* Returns CY3 value for specified index. |
2 |
26 Feb 07 |
jari |
297 |
*/ |
2 |
26 Feb 07 |
jari |
298 |
public float getCY3(int index) { |
2 |
26 Feb 07 |
jari |
299 |
if(normalizedState == ISlideData.NO_NORMALIZATION) |
2 |
26 Feb 07 |
jari |
300 |
return trueCY3[index]; |
2 |
26 Feb 07 |
jari |
301 |
else |
2 |
26 Feb 07 |
jari |
302 |
return currentCY3[index]; |
2 |
26 Feb 07 |
jari |
303 |
} |
2 |
26 Feb 07 |
jari |
304 |
|
2 |
26 Feb 07 |
jari |
305 |
/** |
2 |
26 Feb 07 |
jari |
* Returns CY5 value for specified index. |
2 |
26 Feb 07 |
jari |
307 |
*/ |
2 |
26 Feb 07 |
jari |
308 |
public float getCY5(int index) { |
2 |
26 Feb 07 |
jari |
309 |
if(normalizedState == ISlideData.NO_NORMALIZATION) |
2 |
26 Feb 07 |
jari |
310 |
return trueCY5[index]; |
2 |
26 Feb 07 |
jari |
311 |
else |
2 |
26 Feb 07 |
jari |
312 |
return currentCY5[index]; |
2 |
26 Feb 07 |
jari |
313 |
} |
2 |
26 Feb 07 |
jari |
314 |
|
2 |
26 Feb 07 |
jari |
315 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray max ratio value. |
2 |
26 Feb 07 |
jari |
317 |
*/ |
2 |
26 Feb 07 |
jari |
318 |
public float getMaxRatio() { |
2 |
26 Feb 07 |
jari |
319 |
return getMaxRatio(IData.LINEAR); |
2 |
26 Feb 07 |
jari |
320 |
} |
2 |
26 Feb 07 |
jari |
321 |
|
2 |
26 Feb 07 |
jari |
322 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray min ratio value. |
2 |
26 Feb 07 |
jari |
324 |
*/ |
2 |
26 Feb 07 |
jari |
325 |
public float getMinRatio() { |
2 |
26 Feb 07 |
jari |
326 |
return getMinRatio(IData.LINEAR); |
2 |
26 Feb 07 |
jari |
327 |
} |
2 |
26 Feb 07 |
jari |
328 |
|
2 |
26 Feb 07 |
jari |
329 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray max ratio value, with specified log state. |
2 |
26 Feb 07 |
jari |
331 |
*/ |
2 |
26 Feb 07 |
jari |
332 |
public float getMaxRatio(int logState) { |
2 |
26 Feb 07 |
jari |
333 |
float ratio, maxRatio = Float.MIN_VALUE; |
2 |
26 Feb 07 |
jari |
334 |
final int size = getSize(); |
2 |
26 Feb 07 |
jari |
335 |
for (int i = 0; i < size; i++) { |
2 |
26 Feb 07 |
jari |
336 |
ratio = getRatio(i, logState); |
2 |
26 Feb 07 |
jari |
337 |
if (ratio > maxRatio) |
2 |
26 Feb 07 |
jari |
338 |
maxRatio = ratio; |
2 |
26 Feb 07 |
jari |
339 |
} |
2 |
26 Feb 07 |
jari |
340 |
return maxRatio; |
2 |
26 Feb 07 |
jari |
341 |
} |
2 |
26 Feb 07 |
jari |
342 |
|
2 |
26 Feb 07 |
jari |
343 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray max ratio value of specified intensities. |
2 |
26 Feb 07 |
jari |
345 |
*/ |
2 |
26 Feb 07 |
jari |
346 |
public float getMaxRatio(int index1, int index2, int logState) { |
2 |
26 Feb 07 |
jari |
347 |
if (index1 == index2) { |
2 |
26 Feb 07 |
jari |
348 |
throw new IllegalArgumentException("The indices should not be equals."); |
2 |
26 Feb 07 |
jari |
349 |
} |
2 |
26 Feb 07 |
jari |
350 |
float ratio, maxRatio = Float.MIN_VALUE; |
2 |
26 Feb 07 |
jari |
351 |
float[] numerator, denumerator; |
2 |
26 Feb 07 |
jari |
352 |
if (index1 == ISlideDataElement.CY5) { |
2 |
26 Feb 07 |
jari |
353 |
numerator = trueCY5; |
2 |
26 Feb 07 |
jari |
354 |
denumerator = trueCY3; |
2 |
26 Feb 07 |
jari |
355 |
} else { |
2 |
26 Feb 07 |
jari |
356 |
numerator = trueCY3; |
2 |
26 Feb 07 |
jari |
357 |
denumerator = trueCY5; |
2 |
26 Feb 07 |
jari |
358 |
} |
2 |
26 Feb 07 |
jari |
359 |
final int size = getSize(); |
2 |
26 Feb 07 |
jari |
360 |
for (int i = 0; i < size; i++) { |
2 |
26 Feb 07 |
jari |
361 |
ratio = getRatio(numerator[i], denumerator[i], logState); |
2 |
26 Feb 07 |
jari |
362 |
if (ratio > maxRatio) |
2 |
26 Feb 07 |
jari |
363 |
maxRatio = ratio; |
2 |
26 Feb 07 |
jari |
364 |
} |
2 |
26 Feb 07 |
jari |
365 |
return maxRatio; |
2 |
26 Feb 07 |
jari |
366 |
} |
2 |
26 Feb 07 |
jari |
367 |
|
2 |
26 Feb 07 |
jari |
368 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray min ratio value. |
2 |
26 Feb 07 |
jari |
370 |
*/ |
2 |
26 Feb 07 |
jari |
371 |
public float getMinRatio(int logState) { |
2 |
26 Feb 07 |
jari |
372 |
float ratio, minRatio = Float.MAX_VALUE; |
2 |
26 Feb 07 |
jari |
373 |
final int SIZE = getSize(); |
2 |
26 Feb 07 |
jari |
374 |
for (int i = SIZE; --i >= 0;) { |
2 |
26 Feb 07 |
jari |
375 |
ratio = getRatio(i, logState); |
2 |
26 Feb 07 |
jari |
376 |
if (ratio < minRatio) |
2 |
26 Feb 07 |
jari |
377 |
minRatio = ratio; |
2 |
26 Feb 07 |
jari |
378 |
} |
2 |
26 Feb 07 |
jari |
379 |
return minRatio; |
2 |
26 Feb 07 |
jari |
380 |
} |
2 |
26 Feb 07 |
jari |
381 |
|
2 |
26 Feb 07 |
jari |
382 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray max ratio value of specified intensities. |
2 |
26 Feb 07 |
jari |
384 |
*/ |
2 |
26 Feb 07 |
jari |
385 |
public float getMinRatio(int index1, int index2, int logState) { |
2 |
26 Feb 07 |
jari |
386 |
if (index1 == index2) { |
2 |
26 Feb 07 |
jari |
387 |
throw new IllegalArgumentException("The indices should not be equals."); |
2 |
26 Feb 07 |
jari |
388 |
} |
2 |
26 Feb 07 |
jari |
389 |
float ratio, minRatio = Float.MAX_VALUE; |
2 |
26 Feb 07 |
jari |
390 |
float[] numerator, denumerator; |
2 |
26 Feb 07 |
jari |
391 |
if (index1 == ISlideDataElement.CY5) { |
2 |
26 Feb 07 |
jari |
392 |
numerator = trueCY5; |
2 |
26 Feb 07 |
jari |
393 |
denumerator = trueCY3; |
2 |
26 Feb 07 |
jari |
394 |
} else { |
2 |
26 Feb 07 |
jari |
395 |
numerator = trueCY3; |
2 |
26 Feb 07 |
jari |
396 |
denumerator = trueCY5; |
2 |
26 Feb 07 |
jari |
397 |
} |
2 |
26 Feb 07 |
jari |
398 |
final int size = getSize(); |
2 |
26 Feb 07 |
jari |
399 |
for (int i = 0; i < size; i++) { |
2 |
26 Feb 07 |
jari |
400 |
ratio = getRatio(numerator[i], denumerator[i], logState); |
2 |
26 Feb 07 |
jari |
401 |
if (ratio < minRatio) |
2 |
26 Feb 07 |
jari |
402 |
minRatio = ratio; |
2 |
26 Feb 07 |
jari |
403 |
} |
2 |
26 Feb 07 |
jari |
404 |
return minRatio; |
2 |
26 Feb 07 |
jari |
405 |
} |
2 |
26 Feb 07 |
jari |
406 |
|
2 |
26 Feb 07 |
jari |
407 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a ratio value with specified index and log state. |
2 |
26 Feb 07 |
jari |
409 |
*/ |
2 |
26 Feb 07 |
jari |
410 |
public final float getRatio(int index, int logState) { |
2 |
26 Feb 07 |
jari |
411 |
if(normalizedState == ISlideData.NO_NORMALIZATION) { |
2 |
26 Feb 07 |
jari |
412 |
if(dataType == IData.DATA_TYPE_RATIO_ONLY) |
2 |
26 Feb 07 |
jari |
413 |
return trueCY5[index]; |
2 |
26 Feb 07 |
jari |
414 |
return getRatio(trueCY5[index], trueCY3[index], logState); |
2 |
26 Feb 07 |
jari |
415 |
} else { |
2 |
26 Feb 07 |
jari |
416 |
if(dataType == IData.DATA_TYPE_RATIO_ONLY) |
2 |
26 Feb 07 |
jari |
417 |
return currentCY5[index]; |
2 |
26 Feb 07 |
jari |
418 |
return getRatio(currentCY5[index], currentCY3[index], logState); |
2 |
26 Feb 07 |
jari |
419 |
} |
2 |
26 Feb 07 |
jari |
420 |
} |
2 |
26 Feb 07 |
jari |
421 |
|
2 |
26 Feb 07 |
jari |
422 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the non-zero flag. |
2 |
26 Feb 07 |
jari |
424 |
*/ |
2 |
26 Feb 07 |
jari |
425 |
public void setNonZero(boolean value) { |
2 |
26 Feb 07 |
jari |
426 |
isNonZero = value; |
2 |
26 Feb 07 |
jari |
427 |
} |
2 |
26 Feb 07 |
jari |
428 |
public boolean getIsNonZero() { |
2 |
26 Feb 07 |
jari |
429 |
return isNonZero; |
2 |
26 Feb 07 |
jari |
430 |
} |
2 |
26 Feb 07 |
jari |
431 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a ratio of specified values. |
2 |
26 Feb 07 |
jari |
* Raktim - Remember getRatio Glitch for CGH Data |
2 |
26 Feb 07 |
jari |
434 |
*/ |
2 |
26 Feb 07 |
jari |
435 |
public static final float getRatio(float numerator, float denominator, int logState) { |
2 |
26 Feb 07 |
jari |
436 |
float ratio; |
2 |
26 Feb 07 |
jari |
437 |
if(denominator < 0 || numerator < 0) |
2 |
26 Feb 07 |
jari |
438 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
439 |
if (isNonZero) { |
2 |
26 Feb 07 |
jari |
440 |
if (denominator == 0 && numerator == 0) { |
2 |
26 Feb 07 |
jari |
441 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
442 |
} else if (numerator == 0) { |
2 |
26 Feb 07 |
jari |
443 |
ratio = 1f/denominator; |
2 |
26 Feb 07 |
jari |
444 |
} else if (denominator == 0) { |
2 |
26 Feb 07 |
jari |
445 |
ratio = numerator; |
2 |
26 Feb 07 |
jari |
446 |
} else { |
2 |
26 Feb 07 |
jari |
447 |
ratio = numerator/denominator; |
2 |
26 Feb 07 |
jari |
448 |
} |
2 |
26 Feb 07 |
jari |
449 |
} else { |
2 |
26 Feb 07 |
jari |
450 |
if (denominator == 0) |
2 |
26 Feb 07 |
jari |
451 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
452 |
if (numerator == 0) |
2 |
26 Feb 07 |
jari |
453 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
454 |
ratio = numerator/denominator; |
2 |
26 Feb 07 |
jari |
455 |
} |
2 |
26 Feb 07 |
jari |
456 |
if (logState == IData.LOG) { |
2 |
26 Feb 07 |
jari |
457 |
ratio = (float)(Math.log(ratio)/Math.log(2.0)); |
2 |
26 Feb 07 |
jari |
458 |
} |
2 |
26 Feb 07 |
jari |
459 |
|
2 |
26 Feb 07 |
jari |
460 |
return ratio; |
2 |
26 Feb 07 |
jari |
461 |
} |
2 |
26 Feb 07 |
jari |
462 |
|
2 |
26 Feb 07 |
jari |
463 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray max CY3 value. |
2 |
26 Feb 07 |
jari |
465 |
*/ |
2 |
26 Feb 07 |
jari |
466 |
public float getMaxCY3() { |
2 |
26 Feb 07 |
jari |
467 |
if(this.normalizedState == ISlideData.NO_NORMALIZATION) |
2 |
26 Feb 07 |
jari |
468 |
return getMaxCY(trueCY3); |
2 |
26 Feb 07 |
jari |
469 |
else |
2 |
26 Feb 07 |
jari |
470 |
return getMaxCY(currentCY3); |
2 |
26 Feb 07 |
jari |
471 |
|
2 |
26 Feb 07 |
jari |
472 |
} |
2 |
26 Feb 07 |
jari |
473 |
|
2 |
26 Feb 07 |
jari |
474 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray max CY5 value. |
2 |
26 Feb 07 |
jari |
476 |
*/ |
2 |
26 Feb 07 |
jari |
477 |
public float getMaxCY5() { |
2 |
26 Feb 07 |
jari |
478 |
if(this.normalizedState == ISlideData.NO_NORMALIZATION) |
2 |
26 Feb 07 |
jari |
479 |
return getMaxCY(trueCY5); |
2 |
26 Feb 07 |
jari |
480 |
else |
2 |
26 Feb 07 |
jari |
481 |
return getMaxCY(currentCY5); |
2 |
26 Feb 07 |
jari |
482 |
} |
2 |
26 Feb 07 |
jari |
483 |
|
2 |
26 Feb 07 |
jari |
484 |
/** |
2 |
26 Feb 07 |
jari |
* Returns max value from a specified array. |
2 |
26 Feb 07 |
jari |
486 |
*/ |
2 |
26 Feb 07 |
jari |
487 |
private float getMaxCY(float[] CY) { |
2 |
26 Feb 07 |
jari |
488 |
float maxIntensity = 0f; |
2 |
26 Feb 07 |
jari |
489 |
final int SIZE = getSize(); |
2 |
26 Feb 07 |
jari |
490 |
for (int i = SIZE; --i >= 0;) { |
2 |
26 Feb 07 |
jari |
491 |
if (CY[i] > maxIntensity) |
2 |
26 Feb 07 |
jari |
492 |
maxIntensity = CY[i]; |
2 |
26 Feb 07 |
jari |
493 |
} |
2 |
26 Feb 07 |
jari |
494 |
return maxIntensity; |
2 |
26 Feb 07 |
jari |
495 |
} |
2 |
26 Feb 07 |
jari |
496 |
|
2 |
26 Feb 07 |
jari |
497 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray min CY3 value. |
2 |
26 Feb 07 |
jari |
499 |
*/ |
2 |
26 Feb 07 |
jari |
500 |
public float getMinCY3() { |
2 |
26 Feb 07 |
jari |
501 |
if(this.normalizedState == ISlideData.NO_NORMALIZATION) |
2 |
26 Feb 07 |
jari |
502 |
return getMinIntensity(trueCY3, true); |
2 |
26 Feb 07 |
jari |
503 |
else |
2 |
26 Feb 07 |
jari |
504 |
return getMinIntensity(currentCY3, true); |
2 |
26 Feb 07 |
jari |
505 |
} |
2 |
26 Feb 07 |
jari |
506 |
|
2 |
26 Feb 07 |
jari |
507 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray min CY5 value. |
2 |
26 Feb 07 |
jari |
509 |
*/ |
2 |
26 Feb 07 |
jari |
510 |
public float getMinCY5() { |
2 |
26 Feb 07 |
jari |
511 |
if(this.normalizedState == ISlideData.NO_NORMALIZATION) |
2 |
26 Feb 07 |
jari |
512 |
return getMinIntensity(trueCY5, true); |
2 |
26 Feb 07 |
jari |
513 |
else |
2 |
26 Feb 07 |
jari |
514 |
return getMinIntensity(currentCY5, true); |
2 |
26 Feb 07 |
jari |
515 |
} |
2 |
26 Feb 07 |
jari |
516 |
|
2 |
26 Feb 07 |
jari |
517 |
/** |
2 |
26 Feb 07 |
jari |
* Returns min value from a specified array. |
2 |
26 Feb 07 |
jari |
519 |
*/ |
2 |
26 Feb 07 |
jari |
520 |
private float getMinIntensity(float[] CY, boolean acceptZeros) { |
2 |
26 Feb 07 |
jari |
521 |
float intensity, minIntensity = Float.MAX_VALUE; |
2 |
26 Feb 07 |
jari |
522 |
final int SIZE = getSize(); |
2 |
26 Feb 07 |
jari |
523 |
for (int i = SIZE; --i >= 0;) { |
2 |
26 Feb 07 |
jari |
524 |
intensity = CY[i]; |
2 |
26 Feb 07 |
jari |
525 |
if (!acceptZeros) { |
2 |
26 Feb 07 |
jari |
526 |
if ((intensity < minIntensity) && (intensity != 0)) |
2 |
26 Feb 07 |
jari |
527 |
minIntensity = intensity; |
2 |
26 Feb 07 |
jari |
528 |
} else { |
2 |
26 Feb 07 |
jari |
529 |
if (intensity < minIntensity) |
2 |
26 Feb 07 |
jari |
530 |
minIntensity = intensity; |
2 |
26 Feb 07 |
jari |
531 |
} |
2 |
26 Feb 07 |
jari |
532 |
} |
2 |
26 Feb 07 |
jari |
533 |
return minIntensity; |
2 |
26 Feb 07 |
jari |
534 |
} |
2 |
26 Feb 07 |
jari |
535 |
|
2 |
26 Feb 07 |
jari |
536 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray normalization state. |
2 |
26 Feb 07 |
jari |
538 |
*/ |
2 |
26 Feb 07 |
jari |
539 |
public int getNormalizedState() { |
2 |
26 Feb 07 |
jari |
540 |
return normalizedState; |
2 |
26 Feb 07 |
jari |
541 |
} |
2 |
26 Feb 07 |
jari |
542 |
|
2 |
26 Feb 07 |
jari |
543 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a microarray normalization state. |
2 |
26 Feb 07 |
jari |
545 |
*/ |
2 |
26 Feb 07 |
jari |
546 |
public void setNormalizedState(int normalizedState) { |
2 |
26 Feb 07 |
jari |
547 |
this.normalizedState = normalizedState; |
2 |
26 Feb 07 |
jari |
548 |
} |
2 |
26 Feb 07 |
jari |
549 |
|
2 |
26 Feb 07 |
jari |
550 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray sort state. |
2 |
26 Feb 07 |
jari |
552 |
*/ |
2 |
26 Feb 07 |
jari |
553 |
public int getSortState() { |
2 |
26 Feb 07 |
jari |
554 |
return sortState; |
2 |
26 Feb 07 |
jari |
555 |
} |
2 |
26 Feb 07 |
jari |
556 |
|
2 |
26 Feb 07 |
jari |
557 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a microarray sort state. |
2 |
26 Feb 07 |
jari |
559 |
*/ |
2 |
26 Feb 07 |
jari |
560 |
public void setSortState(int sortState) { |
2 |
26 Feb 07 |
jari |
561 |
this.sortState = sortState; |
2 |
26 Feb 07 |
jari |
562 |
} |
2 |
26 Feb 07 |
jari |
563 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
565 |
public void setDetection(int index, String value){ |
2 |
26 Feb 07 |
jari |
566 |
detection[index] = value.charAt(0); |
2 |
26 Feb 07 |
jari |
567 |
} |
2 |
26 Feb 07 |
jari |
568 |
public void setDetection(char[] d){ |
2 |
26 Feb 07 |
jari |
569 |
this.detection = d; |
2 |
26 Feb 07 |
jari |
570 |
} |
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
572 |
public String getDetection(int index){ |
2 |
26 Feb 07 |
jari |
573 |
return String.valueOf(detection[index]); |
2 |
26 Feb 07 |
jari |
574 |
} |
2 |
26 Feb 07 |
jari |
575 |
|
2 |
26 Feb 07 |
jari |
//wwang add for affy p-value filter |
2 |
26 Feb 07 |
jari |
577 |
public void setPvalue(int index, float value){ |
2 |
26 Feb 07 |
jari |
//System.out.print(index+" "+value); |
2 |
26 Feb 07 |
jari |
579 |
pvalue[index] = value; |
2 |
26 Feb 07 |
jari |
580 |
} |
2 |
26 Feb 07 |
jari |
581 |
public float[] getPvalue(){ |
2 |
26 Feb 07 |
jari |
582 |
return pvalue; |
2 |
26 Feb 07 |
jari |
583 |
} |
2 |
26 Feb 07 |
jari |
584 |
public void setPvalues(float[] p){ |
2 |
26 Feb 07 |
jari |
585 |
this.pvalue = p; |
2 |
26 Feb 07 |
jari |
586 |
} |
2 |
26 Feb 07 |
jari |
587 |
public void setGenePixFlags(int[] f){ |
2 |
26 Feb 07 |
jari |
588 |
this.flags = f; |
2 |
26 Feb 07 |
jari |
589 |
} |
2 |
26 Feb 07 |
jari |
590 |
public int[] getGenePixFlags(){ |
2 |
26 Feb 07 |
jari |
591 |
return flags; |
2 |
26 Feb 07 |
jari |
592 |
} |
2 |
26 Feb 07 |
jari |
593 |
public float getPvalue(int index){ |
2 |
26 Feb 07 |
jari |
594 |
return pvalue[index]; |
2 |
26 Feb 07 |
jari |
595 |
} |
2 |
26 Feb 07 |
jari |
596 |
public int getGenePixFlags(int index){ |
2 |
26 Feb 07 |
jari |
597 |
return flags[index]; |
2 |
26 Feb 07 |
jari |
598 |
} |
2 |
26 Feb 07 |
jari |
599 |
public int setGenePixFlags(int index,int value){ |
2 |
26 Feb 07 |
jari |
600 |
return flags[index]=value; |
2 |
26 Feb 07 |
jari |
601 |
} |
2 |
26 Feb 07 |
jari |
602 |
/** |
2 |
26 Feb 07 |
jari |
* Returns max intencity of specified type. |
2 |
26 Feb 07 |
jari |
604 |
*/ |
2 |
26 Feb 07 |
jari |
605 |
public float getMaxIntensity(int intensityType) { |
2 |
26 Feb 07 |
jari |
606 |
switch (intensityType) { |
2 |
26 Feb 07 |
jari |
607 |
case ISlideDataElement.CY3: |
2 |
26 Feb 07 |
jari |
608 |
return getMaxCY3(); |
2 |
26 Feb 07 |
jari |
609 |
case ISlideDataElement.CY5: |
2 |
26 Feb 07 |
jari |
610 |
return getMaxCY5(); |
2 |
26 Feb 07 |
jari |
611 |
} |
2 |
26 Feb 07 |
jari |
612 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
613 |
} |
2 |
26 Feb 07 |
jari |
614 |
|
2 |
26 Feb 07 |
jari |
615 |
/** |
2 |
26 Feb 07 |
jari |
* Returns min intencity of specified type. |
2 |
26 Feb 07 |
jari |
617 |
*/ |
2 |
26 Feb 07 |
jari |
618 |
public float getMinIntensity(int intensityType, boolean acceptZeros) { |
2 |
26 Feb 07 |
jari |
619 |
return getMinIntensity(getIntensities(intensityType), acceptZeros); |
2 |
26 Feb 07 |
jari |
620 |
} |
2 |
26 Feb 07 |
jari |
621 |
|
2 |
26 Feb 07 |
jari |
622 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an array of intensities with specified type. |
2 |
26 Feb 07 |
jari |
624 |
*/ |
2 |
26 Feb 07 |
jari |
625 |
private float[] getIntensities(int type) { |
2 |
26 Feb 07 |
jari |
626 |
switch (type) { |
2 |
26 Feb 07 |
jari |
627 |
case ISlideDataElement.CY3: |
2 |
26 Feb 07 |
jari |
628 |
return trueCY3; |
2 |
26 Feb 07 |
jari |
629 |
case ISlideDataElement.CY5: |
2 |
26 Feb 07 |
jari |
630 |
return trueCY5; |
2 |
26 Feb 07 |
jari |
631 |
} |
2 |
26 Feb 07 |
jari |
632 |
return null; |
2 |
26 Feb 07 |
jari |
633 |
} |
2 |
26 Feb 07 |
jari |
634 |
|
2 |
26 Feb 07 |
jari |
635 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray max product value of specified intensities. |
2 |
26 Feb 07 |
jari |
637 |
*/ |
2 |
26 Feb 07 |
jari |
638 |
public float getMaxProduct(int index1, int index2) { |
2 |
26 Feb 07 |
jari |
639 |
float product = 0, maxProduct = 0; |
2 |
26 Feb 07 |
jari |
640 |
float[] v_1 = getIntensities(index1); |
2 |
26 Feb 07 |
jari |
641 |
float[] v_2 = getIntensities(index2); |
2 |
26 Feb 07 |
jari |
642 |
final int size = getSize(); |
2 |
26 Feb 07 |
jari |
643 |
for (int i = 0; i < size; i++) { |
2 |
26 Feb 07 |
jari |
644 |
product = v_1[i] * v_2[i]; |
2 |
26 Feb 07 |
jari |
645 |
if (product > maxProduct) |
2 |
26 Feb 07 |
jari |
646 |
maxProduct = product; |
2 |
26 Feb 07 |
jari |
647 |
} |
2 |
26 Feb 07 |
jari |
648 |
return maxProduct; |
2 |
26 Feb 07 |
jari |
649 |
} |
2 |
26 Feb 07 |
jari |
650 |
|
2 |
26 Feb 07 |
jari |
651 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray min product value of specified intensities. |
2 |
26 Feb 07 |
jari |
653 |
*/ |
2 |
26 Feb 07 |
jari |
654 |
public float getMinProduct(int index1, int index2, boolean acceptZeros) { |
2 |
26 Feb 07 |
jari |
655 |
return getMinProduct(index1, index2, acceptZeros, 0); |
2 |
26 Feb 07 |
jari |
656 |
} |
2 |
26 Feb 07 |
jari |
657 |
|
2 |
26 Feb 07 |
jari |
658 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray min product value of specified intensities and lower cutoff. |
2 |
26 Feb 07 |
jari |
660 |
*/ |
2 |
26 Feb 07 |
jari |
661 |
public float getMinProduct(int index1, int index2, boolean acceptZeros, int lowCutoff) { |
2 |
26 Feb 07 |
jari |
662 |
float product = 0, minProduct = Float.MAX_VALUE; |
2 |
26 Feb 07 |
jari |
663 |
float[] v_1 = getIntensities(index1); |
2 |
26 Feb 07 |
jari |
664 |
float[] v_2 = getIntensities(index2); |
2 |
26 Feb 07 |
jari |
665 |
final int size = getSize(); |
2 |
26 Feb 07 |
jari |
666 |
for (int i = 0; i < size; i++) { |
2 |
26 Feb 07 |
jari |
667 |
product = v_1[i] * v_2[i]; |
2 |
26 Feb 07 |
jari |
668 |
if (product >= lowCutoff) { |
2 |
26 Feb 07 |
jari |
669 |
if (!acceptZeros) { |
2 |
26 Feb 07 |
jari |
670 |
if ((product < minProduct) && (product != 0)) |
2 |
26 Feb 07 |
jari |
671 |
minProduct = product; |
2 |
26 Feb 07 |
jari |
672 |
} else { |
2 |
26 Feb 07 |
jari |
673 |
if (product < minProduct) |
2 |
26 Feb 07 |
jari |
674 |
minProduct = product; |
2 |
26 Feb 07 |
jari |
675 |
} |
2 |
26 Feb 07 |
jari |
676 |
} |
2 |
26 Feb 07 |
jari |
677 |
} |
2 |
26 Feb 07 |
jari |
678 |
return minProduct; |
2 |
26 Feb 07 |
jari |
679 |
} |
2 |
26 Feb 07 |
jari |
680 |
|
2 |
26 Feb 07 |
jari |
681 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an <code>ISlideDataElement</code> by specified index. |
2 |
26 Feb 07 |
jari |
683 |
*/ |
2 |
26 Feb 07 |
jari |
684 |
public ISlideDataElement getSlideDataElement(int index) { |
2 |
26 Feb 07 |
jari |
685 |
ISlideDataElement sde = slideMetaData.toSlideDataElement(index); |
2 |
26 Feb 07 |
jari |
686 |
sde.setIntensity(ISlideDataElement.CY3, getCY3(index)); |
2 |
26 Feb 07 |
jari |
687 |
sde.setIntensity(ISlideDataElement.CY5, getCY5(index)); |
2 |
26 Feb 07 |
jari |
688 |
sde.setTrueIntensity(ISlideDataElement.CY3, getCY3(index)); |
2 |
26 Feb 07 |
jari |
689 |
sde.setTrueIntensity(ISlideDataElement.CY5, getCY5(index)); |
2 |
26 Feb 07 |
jari |
//pcahan |
2 |
26 Feb 07 |
jari |
691 |
sde.setDetection(getDetection(index)); |
2 |
26 Feb 07 |
jari |
//wwang |
2 |
26 Feb 07 |
jari |
693 |
try{ |
2 |
26 Feb 07 |
jari |
694 |
sde.setPvalue(getPvalue(index)); |
2 |
26 Feb 07 |
jari |
695 |
} catch (NullPointerException npe) {} |
2 |
26 Feb 07 |
jari |
696 |
return sde; |
2 |
26 Feb 07 |
jari |
697 |
} |
2 |
26 Feb 07 |
jari |
698 |
|
2 |
26 Feb 07 |
jari |
699 |
/** |
2 |
26 Feb 07 |
jari |
* Doesn't supported method. |
2 |
26 Feb 07 |
jari |
701 |
*/ |
2 |
26 Feb 07 |
jari |
702 |
public void addSlideDataElement(ISlideDataElement element) { |
2 |
26 Feb 07 |
jari |
703 |
throwNotImplemented("addSlideDataElement"); |
2 |
26 Feb 07 |
jari |
704 |
} |
2 |
26 Feb 07 |
jari |
705 |
|
2 |
26 Feb 07 |
jari |
706 |
/** |
2 |
26 Feb 07 |
jari |
* Creates copy of an original microarray data. |
2 |
26 Feb 07 |
jari |
708 |
*/ |
2 |
26 Feb 07 |
jari |
709 |
private void createDataCopy() { |
2 |
26 Feb 07 |
jari |
710 |
if (this.currentCY3 == null || this.currentCY5 == null) { |
2 |
26 Feb 07 |
jari |
711 |
this.currentCY3 = new float[trueCY3.length]; |
2 |
26 Feb 07 |
jari |
712 |
this.currentCY5 = new float[trueCY5.length]; |
2 |
26 Feb 07 |
jari |
713 |
System.arraycopy(trueCY3, 0, currentCY3, 0, currentCY3.length); |
2 |
26 Feb 07 |
jari |
714 |
System.arraycopy(trueCY5, 0, currentCY5, 0, currentCY5.length); |
2 |
26 Feb 07 |
jari |
715 |
} |
2 |
26 Feb 07 |
jari |
716 |
} |
2 |
26 Feb 07 |
jari |
717 |
|
2 |
26 Feb 07 |
jari |
718 |
/** |
2 |
26 Feb 07 |
jari |
* Creates copy of an original microarray data. |
2 |
26 Feb 07 |
jari |
720 |
*/ |
2 |
26 Feb 07 |
jari |
721 |
public void createCurrentIntensityArrays() { |
2 |
26 Feb 07 |
jari |
722 |
if (this.currentCY3 == null || this.currentCY5 == null) { |
2 |
26 Feb 07 |
jari |
723 |
this.currentCY3 = new float[trueCY3.length]; |
2 |
26 Feb 07 |
jari |
724 |
this.currentCY5 = new float[trueCY5.length]; |
2 |
26 Feb 07 |
jari |
725 |
System.arraycopy(trueCY3, 0, currentCY3, 0, currentCY3.length); |
2 |
26 Feb 07 |
jari |
726 |
System.arraycopy(trueCY5, 0, currentCY5, 0, currentCY5.length); |
2 |
26 Feb 07 |
jari |
727 |
} |
2 |
26 Feb 07 |
jari |
728 |
} |
2 |
26 Feb 07 |
jari |
729 |
|
2 |
26 Feb 07 |
jari |
730 |
|
2 |
26 Feb 07 |
jari |
731 |
/********************************************************************** |
2 |
26 Feb 07 |
jari |
* Data Normalization Code. 04-2003 MeV will support only Total Intensity |
2 |
26 Feb 07 |
jari |
* Iterative Linear Regression, Ratio Statistics, and Iterative Log Mean Centering. |
2 |
26 Feb 07 |
jari |
* Support classes and normalization algorithms have been incorporated from |
2 |
26 Feb 07 |
jari |
* TIGR-MIDAS 2.16 (Author: Wei Liang, The Institute for Genomic Research) |
2 |
26 Feb 07 |
jari |
* which remains the primary tool for data normalization |
2 |
26 Feb 07 |
jari |
737 |
* |
2 |
26 Feb 07 |
jari |
* ColumnWorker is the main data structure used by the algorithms |
2 |
26 Feb 07 |
jari |
739 |
* |
2 |
26 Feb 07 |
jari |
* A typical normalization proceeds as follows: |
2 |
26 Feb 07 |
jari |
* 1.) "True Intensities" are accumulated into double arrays and a ColumnWorker is |
2 |
26 Feb 07 |
jari |
* constructed. |
2 |
26 Feb 07 |
jari |
* 2.) The ColumnWorker is passed via constructor into a normalization algorithm |
2 |
26 Feb 07 |
jari |
* which performs the required manipulations. (parameters are also in the constructor) |
2 |
26 Feb 07 |
jari |
* 3.) Data is retrieved from the resulting ColumnWorker and the data is placed |
2 |
26 Feb 07 |
jari |
* into the appropriate SlideDataElements (or arrays) as "Current Intensities" |
2 |
26 Feb 07 |
jari |
* (normalized). |
2 |
26 Feb 07 |
jari |
748 |
* |
2 |
26 Feb 07 |
jari |
* Conventions for normalization: |
2 |
26 Feb 07 |
jari |
750 |
* |
2 |
26 Feb 07 |
jari |
* "normalizedState" a class variable is used to indicate which intensities and |
2 |
26 Feb 07 |
jari |
* ratio's to deliver. ISlideData.NO_NORMALIZATION forces the return of "True" |
2 |
26 Feb 07 |
jari |
* intensities, meaning unaltered, while any other state indicates that "Current" |
2 |
26 Feb 07 |
jari |
* intensities (altered) should be returned. |
2 |
26 Feb 07 |
jari |
755 |
* |
2 |
26 Feb 07 |
jari |
* Handling zeros: |
2 |
26 Feb 07 |
jari |
757 |
* |
2 |
26 Feb 07 |
jari |
* A zero in one or both channels would greatly impact the normalization of points |
2 |
26 Feb 07 |
jari |
* containing two good intensities. For this reason the following convention for handling |
2 |
26 Feb 07 |
jari |
* one or two zero intensities has been adopted. If one or both intensities are zero this |
2 |
26 Feb 07 |
jari |
* data is not passed on to the ColumnWorker for normalization and following the normalization |
2 |
26 Feb 07 |
jari |
* the "current" intensities are set to equal the "true", original, intensities. |
2 |
26 Feb 07 |
jari |
763 |
* |
2 |
26 Feb 07 |
jari |
* By this convention the points are preserved AND the data that has been normalized |
2 |
26 Feb 07 |
jari |
* matches MIDAS output. |
2 |
26 Feb 07 |
jari |
766 |
* |
2 |
26 Feb 07 |
jari |
767 |
************************************************************************************/ |
2 |
26 Feb 07 |
jari |
768 |
|
2 |
26 Feb 07 |
jari |
769 |
|
2 |
26 Feb 07 |
jari |
770 |
/** |
2 |
26 Feb 07 |
jari |
* Applies a microarray data normalization. |
2 |
26 Feb 07 |
jari |
772 |
*/ |
2 |
26 Feb 07 |
jari |
773 |
public void applyNormalization(int normalizationMode, Properties props) { |
2 |
26 Feb 07 |
jari |
774 |
createDataCopy(); |
2 |
26 Feb 07 |
jari |
775 |
switch (normalizationMode) { |
2 |
26 Feb 07 |
jari |
776 |
case ISlideData.NO_NORMALIZATION: |
2 |
26 Feb 07 |
jari |
777 |
applyNoNormalization(); |
2 |
26 Feb 07 |
jari |
778 |
break; |
2 |
26 Feb 07 |
jari |
779 |
case ISlideData.TOTAL_INTENSITY: |
2 |
26 Feb 07 |
jari |
780 |
applyTotalIntensity(); |
2 |
26 Feb 07 |
jari |
781 |
break; |
2 |
26 Feb 07 |
jari |
782 |
case ISlideData.LEAST_SQUARES: // not used |
2 |
26 Feb 07 |
jari |
783 |
applyLeastSquares(); |
2 |
26 Feb 07 |
jari |
784 |
break; |
2 |
26 Feb 07 |
jari |
785 |
case ISlideData.LINEAR_REGRESSION: |
2 |
26 Feb 07 |
jari |
786 |
applyLinearRegression(props); |
2 |
26 Feb 07 |
jari |
787 |
break; |
2 |
26 Feb 07 |
jari |
788 |
case ISlideData.RATIO_STATISTICS_95: // not used |
2 |
26 Feb 07 |
jari |
789 |
applyRatioStatistics(props); |
2 |
26 Feb 07 |
jari |
790 |
break; |
2 |
26 Feb 07 |
jari |
791 |
case ISlideData.RATIO_STATISTICS_99: |
2 |
26 Feb 07 |
jari |
792 |
applyRatioStatistics(props); |
2 |
26 Feb 07 |
jari |
793 |
break; |
2 |
26 Feb 07 |
jari |
794 |
case ISlideData.ITERATIVE_LOG: |
2 |
26 Feb 07 |
jari |
795 |
applyIterativeLog(props); |
2 |
26 Feb 07 |
jari |
796 |
break; |
2 |
26 Feb 07 |
jari |
797 |
case ISlideData.LOWESS: // not used |
2 |
26 Feb 07 |
jari |
798 |
applyLowess(10); |
2 |
26 Feb 07 |
jari |
799 |
break; |
2 |
26 Feb 07 |
jari |
800 |
} |
2 |
26 Feb 07 |
jari |
801 |
setNormalizedState(normalizationMode); |
2 |
26 Feb 07 |
jari |
802 |
} |
2 |
26 Feb 07 |
jari |
803 |
|
2 |
26 Feb 07 |
jari |
//Don't forget to change over to the list versions of the functions |
2 |
26 Feb 07 |
jari |
805 |
public void applyNormalizationList(int normalizationMode) { |
2 |
26 Feb 07 |
jari |
806 |
createDataCopy(); |
2 |
26 Feb 07 |
jari |
807 |
switch (normalizationMode) { |
2 |
26 Feb 07 |
jari |
808 |
case ISlideData.TOTAL_INTENSITY_LIST: |
2 |
26 Feb 07 |
jari |
809 |
applyTotalIntensity(); |
2 |
26 Feb 07 |
jari |
810 |
break; |
2 |
26 Feb 07 |
jari |
811 |
case ISlideData.LEAST_SQUARES_LIST: |
2 |
26 Feb 07 |
jari |
812 |
applyLeastSquares(); |
2 |
26 Feb 07 |
jari |
813 |
break; |
2 |
26 Feb 07 |
jari |
814 |
case ISlideData.LINEAR_REGRESSION_LIST: |
2 |
26 Feb 07 |
jari |
815 |
applyLinearRegression(new Properties()); |
2 |
26 Feb 07 |
jari |
816 |
break; |
2 |
26 Feb 07 |
jari |
817 |
case ISlideData.RATIO_STATISTICS_95_LIST: |
2 |
26 Feb 07 |
jari |
818 |
applyRatioStatistics(new Properties()); |
2 |
26 Feb 07 |
jari |
819 |
break; |
2 |
26 Feb 07 |
jari |
820 |
case ISlideData.RATIO_STATISTICS_99_LIST: |
2 |
26 Feb 07 |
jari |
821 |
applyRatioStatistics(new Properties()); |
2 |
26 Feb 07 |
jari |
822 |
break; |
2 |
26 Feb 07 |
jari |
823 |
case ISlideData.ITERATIVE_LOG_LIST: |
2 |
26 Feb 07 |
jari |
824 |
applyIterativeLog(new Properties()); |
2 |
26 Feb 07 |
jari |
825 |
break; |
2 |
26 Feb 07 |
jari |
826 |
case ISlideData.LOWESS_LIST: |
2 |
26 Feb 07 |
jari |
827 |
applyLowess(10); |
2 |
26 Feb 07 |
jari |
828 |
break; |
2 |
26 Feb 07 |
jari |
829 |
} |
2 |
26 Feb 07 |
jari |
830 |
setNormalizedState(normalizationMode); |
2 |
26 Feb 07 |
jari |
831 |
} |
2 |
26 Feb 07 |
jari |
832 |
|
2 |
26 Feb 07 |
jari |
833 |
/** |
2 |
26 Feb 07 |
jari |
* Restore true values. |
2 |
26 Feb 07 |
jari |
835 |
*/ |
2 |
26 Feb 07 |
jari |
836 |
private void applyNoNormalization() { |
2 |
26 Feb 07 |
jari |
837 |
if (this.trueCY3 != null && this.trueCY5 != null) { |
2 |
26 Feb 07 |
jari |
838 |
System.arraycopy(trueCY3, 0, currentCY3, 0, trueCY3.length); |
2 |
26 Feb 07 |
jari |
839 |
System.arraycopy(trueCY5, 0, currentCY5, 0, trueCY5.length); |
2 |
26 Feb 07 |
jari |
840 |
} |
2 |
26 Feb 07 |
jari |
841 |
} |
2 |
26 Feb 07 |
jari |
842 |
|
2 |
26 Feb 07 |
jari |
843 |
|
2 |
26 Feb 07 |
jari |
844 |
/** |
2 |
26 Feb 07 |
jari |
* Applies total intensity normalization. |
2 |
26 Feb 07 |
jari |
846 |
*/ |
2 |
26 Feb 07 |
jari |
847 |
public void applyTotalIntensity() { |
2 |
26 Feb 07 |
jari |
848 |
boolean [] goodValues = new boolean[this.getSize()]; |
2 |
26 Feb 07 |
jari |
849 |
ColumnWorker cw = constructColumnWorker(goodValues); |
2 |
26 Feb 07 |
jari |
850 |
cw = ((new TotInt(cw, "Cy3",false)).getFileTotIntColumnWorker()); |
2 |
26 Feb 07 |
jari |
851 |
setNormalizedIntensities(cw, goodValues); |
2 |
26 Feb 07 |
jari |
852 |
normalizedState = ISlideData.TOTAL_INTENSITY; |
2 |
26 Feb 07 |
jari |
853 |
} |
2 |
26 Feb 07 |
jari |
854 |
|
2 |
26 Feb 07 |
jari |
855 |
/** |
2 |
26 Feb 07 |
jari |
* Applies linear regression normalization. |
2 |
26 Feb 07 |
jari |
857 |
*/ |
2 |
26 Feb 07 |
jari |
858 |
public void applyLinearRegression(Properties properties) { |
2 |
26 Feb 07 |
jari |
859 |
boolean [] goodValues = new boolean[this.getSize()]; |
2 |
26 Feb 07 |
jari |
860 |
ColumnWorker cw = constructColumnWorker(goodValues); |
2 |
26 Feb 07 |
jari |
861 |
|
2 |
26 Feb 07 |
jari |
862 |
try{ |
2 |
26 Feb 07 |
jari |
863 |
String mode = (String)properties.get("mode"); |
2 |
26 Feb 07 |
jari |
864 |
float sd = Float.parseFloat((String)properties.get("standard-deviation")); |
2 |
26 Feb 07 |
jari |
865 |
cw = (new IterativeLinReg(cw, sd, mode, "Cy3")).getIterLinRegColumnWorker(); |
2 |
26 Feb 07 |
jari |
866 |
setNormalizedIntensities(cw, goodValues); |
2 |
26 Feb 07 |
jari |
867 |
normalizedState = ISlideData.LINEAR_REGRESSION; |
2 |
26 Feb 07 |
jari |
868 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
869 |
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), "Error Performing Normalization: Data Unchanged", "Normalization Error : Aborted", javax.swing.JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
870 |
normalizedState = ISlideData.NO_NORMALIZATION; |
2 |
26 Feb 07 |
jari |
871 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
872 |
} |
2 |
26 Feb 07 |
jari |
873 |
} |
2 |
26 Feb 07 |
jari |
874 |
|
2 |
26 Feb 07 |
jari |
875 |
/** |
2 |
26 Feb 07 |
jari |
* Applies ratio statistics normalization. |
2 |
26 Feb 07 |
jari |
877 |
*/ |
2 |
26 Feb 07 |
jari |
878 |
public void applyRatioStatistics(Properties properties) { |
2 |
26 Feb 07 |
jari |
879 |
boolean [] goodValues = new boolean[this.getSize()]; |
2 |
26 Feb 07 |
jari |
880 |
ColumnWorker cw = constructColumnWorker(goodValues); |
2 |
26 Feb 07 |
jari |
881 |
|
2 |
26 Feb 07 |
jari |
882 |
try{ |
2 |
26 Feb 07 |
jari |
883 |
int confInt = Integer.parseInt((String)properties.get("confidence-interval")); |
2 |
26 Feb 07 |
jari |
884 |
|
2 |
26 Feb 07 |
jari |
885 |
cw = ((new RatioStats(cw, false, confInt, "Cy3")).getRatioStatsColumnWorker()); |
2 |
26 Feb 07 |
jari |
886 |
setNormalizedIntensities(cw, goodValues); |
2 |
26 Feb 07 |
jari |
887 |
normalizedState = ISlideData.LINEAR_REGRESSION; |
2 |
26 Feb 07 |
jari |
888 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
889 |
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), "Error Performing Normalization: Data Unchanged", "Normalization Error : Aborted", javax.swing.JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
890 |
normalizedState = ISlideData.NO_NORMALIZATION; |
2 |
26 Feb 07 |
jari |
891 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
892 |
} |
2 |
26 Feb 07 |
jari |
893 |
} |
2 |
26 Feb 07 |
jari |
894 |
|
2 |
26 Feb 07 |
jari |
895 |
/** |
2 |
26 Feb 07 |
jari |
* Applies iterative log normalization. |
2 |
26 Feb 07 |
jari |
897 |
*/ |
2 |
26 Feb 07 |
jari |
898 |
public void applyIterativeLog(Properties properties) { |
2 |
26 Feb 07 |
jari |
899 |
boolean [] goodValues = new boolean[this.getSize()]; |
2 |
26 Feb 07 |
jari |
900 |
ColumnWorker cw = constructColumnWorker(goodValues); |
2 |
26 Feb 07 |
jari |
901 |
|
2 |
26 Feb 07 |
jari |
902 |
try{ |
2 |
26 Feb 07 |
jari |
903 |
float sd = Float.parseFloat((String)properties.get("standard-deviation")); |
2 |
26 Feb 07 |
jari |
904 |
|
2 |
26 Feb 07 |
jari |
905 |
cw = ((new IterativeLogMean(cw, sd, "Cy3")).getIterLogMeanColumnWorker()); |
2 |
26 Feb 07 |
jari |
906 |
setNormalizedIntensities(cw, goodValues); |
2 |
26 Feb 07 |
jari |
907 |
normalizedState = ISlideData.ITERATIVE_LOG; |
2 |
26 Feb 07 |
jari |
908 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
909 |
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), "Error Performing Normalization: Data Unchanged", "Normalization Error : Aborted", javax.swing.JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
910 |
normalizedState = ISlideData.NO_NORMALIZATION; |
2 |
26 Feb 07 |
jari |
911 |
} |
2 |
26 Feb 07 |
jari |
912 |
} |
2 |
26 Feb 07 |
jari |
913 |
|
2 |
26 Feb 07 |
jari |
914 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a ColumnWorker object for normalization |
2 |
26 Feb 07 |
jari |
916 |
*/ |
2 |
26 Feb 07 |
jari |
917 |
private ColumnWorker constructColumnWorker(boolean [] goodValues){ |
2 |
26 Feb 07 |
jari |
918 |
int n = this.getSize(); |
2 |
26 Feb 07 |
jari |
919 |
int size = n; |
2 |
26 Feb 07 |
jari |
920 |
float CY3; |
2 |
26 Feb 07 |
jari |
921 |
float CY5; |
2 |
26 Feb 07 |
jari |
922 |
float [] cy3 = new float[n]; |
2 |
26 Feb 07 |
jari |
923 |
float [] cy5 = new float[n]; |
2 |
26 Feb 07 |
jari |
924 |
String [] metaCombo = new String[n]; |
2 |
26 Feb 07 |
jari |
925 |
int metaRow, metaColumn; |
2 |
26 Feb 07 |
jari |
926 |
float [] goodCy3; |
2 |
26 Feb 07 |
jari |
927 |
float [] goodCy5; |
2 |
26 Feb 07 |
jari |
928 |
n = 0; |
2 |
26 Feb 07 |
jari |
929 |
for(int i = 0; i < size; i++){ |
2 |
26 Feb 07 |
jari |
930 |
|
2 |
26 Feb 07 |
jari |
931 |
metaRow = this.getSlideDataElement(i).getRow(ISlideDataElement.META); |
2 |
26 Feb 07 |
jari |
932 |
metaColumn = this.getSlideDataElement(i).getColumn(ISlideDataElement.META); |
2 |
26 Feb 07 |
jari |
933 |
|
2 |
26 Feb 07 |
jari |
934 |
CY3 = trueCY3[i]; |
2 |
26 Feb 07 |
jari |
935 |
CY5 = trueCY5[i]; |
2 |
26 Feb 07 |
jari |
936 |
|
2 |
26 Feb 07 |
jari |
//if Stanford file is normalized then we need to generate cy3 and cy5 |
2 |
26 Feb 07 |
jari |
938 |
if (this.dataType == IData.DATA_TYPE_RATIO_ONLY) { |
2 |
26 Feb 07 |
jari |
939 |
CY3 = 100000; |
2 |
26 Feb 07 |
jari |
940 |
CY5 = (float)(100000.0*Math.pow(2.0d, CY5)); |
2 |
26 Feb 07 |
jari |
// if CY5 overflows, then set to zero and force no evaluation |
2 |
26 Feb 07 |
jari |
942 |
if(CY5 == Float.POSITIVE_INFINITY || CY5 == Float.NEGATIVE_INFINITY) |
2 |
26 Feb 07 |
jari |
943 |
CY3 = CY5 = 0; |
2 |
26 Feb 07 |
jari |
944 |
} |
2 |
26 Feb 07 |
jari |
945 |
|
2 |
26 Feb 07 |
jari |
946 |
if(CY3 != 0 && CY5 != 0){ |
2 |
26 Feb 07 |
jari |
947 |
goodValues[i] = true; |
2 |
26 Feb 07 |
jari |
948 |
cy3[n] = CY3; |
2 |
26 Feb 07 |
jari |
949 |
cy5[n] = CY5; |
2 |
26 Feb 07 |
jari |
950 |
metaCombo[n] = Integer.toString(metaRow)+"_"+Integer.toString(metaColumn); |
2 |
26 Feb 07 |
jari |
951 |
n++; |
2 |
26 Feb 07 |
jari |
952 |
} |
2 |
26 Feb 07 |
jari |
953 |
} |
2 |
26 Feb 07 |
jari |
954 |
goodCy3 = new float[n]; |
2 |
26 Feb 07 |
jari |
955 |
goodCy5 = new float[n]; |
2 |
26 Feb 07 |
jari |
956 |
System.arraycopy(cy3, 0, goodCy3, 0, n); |
2 |
26 Feb 07 |
jari |
957 |
System.arraycopy(cy5, 0, goodCy5, 0, n); |
2 |
26 Feb 07 |
jari |
958 |
System.arraycopy(metaCombo, 0, metaCombo, 0, n); |
2 |
26 Feb 07 |
jari |
959 |
|
2 |
26 Feb 07 |
jari |
//ColumnWorker cw = new ColumnWorker(goodCy3.length); |
2 |
26 Feb 07 |
jari |
//cw.setColOneArray(goodCy3); |
2 |
26 Feb 07 |
jari |
//cw.setColTwoArray(goodCy5); |
2 |
26 Feb 07 |
jari |
963 |
return new ColumnWorker(goodCy3, goodCy5, metaCombo); |
2 |
26 Feb 07 |
jari |
964 |
} |
2 |
26 Feb 07 |
jari |
965 |
|
2 |
26 Feb 07 |
jari |
966 |
/** |
2 |
26 Feb 07 |
jari |
* Extracts data from a ColumnWorker into ISlideData current (normalized) intensities |
2 |
26 Feb 07 |
jari |
968 |
*/ |
2 |
26 Feb 07 |
jari |
969 |
private void setNormalizedIntensities(ColumnWorker cw, boolean [] goodIntensity){ |
2 |
26 Feb 07 |
jari |
970 |
float [] cy3 = cw.getColumnOneArray(); |
2 |
26 Feb 07 |
jari |
971 |
float [] cy5 = cw.getColumnTwoArray(); |
2 |
26 Feb 07 |
jari |
972 |
int goodIndex= 0; |
2 |
26 Feb 07 |
jari |
973 |
for(int i = 0 ; i < goodIntensity.length; i++){ |
2 |
26 Feb 07 |
jari |
974 |
if(goodIntensity[i]){ |
2 |
26 Feb 07 |
jari |
975 |
if(this.dataType == IData.DATA_TYPE_RATIO_ONLY) { |
2 |
26 Feb 07 |
jari |
976 |
currentCY3[i] = 1.0f; |
2 |
26 Feb 07 |
jari |
977 |
currentCY5[i] = (float)(Math.log(cy5[goodIndex]/cy3[goodIndex])/Math.log(2.0)); |
2 |
26 Feb 07 |
jari |
978 |
} else { |
2 |
26 Feb 07 |
jari |
979 |
currentCY3[i] = (float)cy3[goodIndex]; |
2 |
26 Feb 07 |
jari |
980 |
currentCY5[i] = (float)cy5[goodIndex]; |
2 |
26 Feb 07 |
jari |
981 |
} |
2 |
26 Feb 07 |
jari |
982 |
goodIndex++; |
2 |
26 Feb 07 |
jari |
983 |
} |
2 |
26 Feb 07 |
jari |
984 |
else{ |
2 |
26 Feb 07 |
jari |
985 |
currentCY3[i] = trueCY3[i]; |
2 |
26 Feb 07 |
jari |
986 |
currentCY5[i] = trueCY5[i]; |
2 |
26 Feb 07 |
jari |
987 |
} |
2 |
26 Feb 07 |
jari |
988 |
} |
2 |
26 Feb 07 |
jari |
989 |
} |
2 |
26 Feb 07 |
jari |
990 |
|
2 |
26 Feb 07 |
jari |
991 |
/********************************************************************** |
2 |
26 Feb 07 |
jari |
* End supported and used normalization code |
2 |
26 Feb 07 |
jari |
993 |
*/ |
2 |
26 Feb 07 |
jari |
994 |
|
2 |
26 Feb 07 |
jari |
995 |
|
2 |
26 Feb 07 |
jari |
996 |
|
2 |
26 Feb 07 |
jari |
997 |
/** |
2 |
26 Feb 07 |
jari |
* Applies total intensity normalization. |
2 |
26 Feb 07 |
jari |
999 |
*/ |
2 |
26 Feb 07 |
jari |
1000 |
private final float applyTotalIntensity(float value, float totalCy3, float totalCy5) { |
2 |
26 Feb 07 |
jari |
1001 |
if (value > 0) { |
2 |
26 Feb 07 |
jari |
1002 |
return value*totalCy3/totalCy5; |
2 |
26 Feb 07 |
jari |
1003 |
} else { |
2 |
26 Feb 07 |
jari |
1004 |
return 0f; |
2 |
26 Feb 07 |
jari |
1005 |
} |
2 |
26 Feb 07 |
jari |
1006 |
} |
2 |
26 Feb 07 |
jari |
1007 |
|
2 |
26 Feb 07 |
jari |
1008 |
/** |
2 |
26 Feb 07 |
jari |
* Returns intensities sum of specified type. |
2 |
26 Feb 07 |
jari |
1010 |
*/ |
2 |
26 Feb 07 |
jari |
1011 |
private float getSumIntensity(int intensityType) { |
2 |
26 Feb 07 |
jari |
1012 |
float totalIntensity = 0f; |
2 |
26 Feb 07 |
jari |
1013 |
float[] intensities = getIntensities(intensityType); |
2 |
26 Feb 07 |
jari |
1014 |
for (int i = 0; i < intensities.length; i++) { |
2 |
26 Feb 07 |
jari |
1015 |
totalIntensity += intensities[i]; |
2 |
26 Feb 07 |
jari |
1016 |
} |
2 |
26 Feb 07 |
jari |
1017 |
return totalIntensity; |
2 |
26 Feb 07 |
jari |
1018 |
} |
2 |
26 Feb 07 |
jari |
1019 |
|
2 |
26 Feb 07 |
jari |
1020 |
/** |
2 |
26 Feb 07 |
jari |
* Returns non-zero intensities sum of specified type. |
2 |
26 Feb 07 |
jari |
1022 |
*/ |
2 |
26 Feb 07 |
jari |
1023 |
private float getSumNonZeroIntensity(int intensityType) { |
2 |
26 Feb 07 |
jari |
1024 |
float totalIntensity = 0; |
2 |
26 Feb 07 |
jari |
1025 |
float[] intensities = getIntensities(intensityType); |
2 |
26 Feb 07 |
jari |
1026 |
for (int i = 0; i < intensities.length; i++) { |
2 |
26 Feb 07 |
jari |
1027 |
if (slideMetaData.hasNoZeros(i)) |
2 |
26 Feb 07 |
jari |
1028 |
totalIntensity += intensities[i]; |
2 |
26 Feb 07 |
jari |
1029 |
} |
2 |
26 Feb 07 |
jari |
1030 |
return totalIntensity; |
2 |
26 Feb 07 |
jari |
1031 |
} |
2 |
26 Feb 07 |
jari |
1032 |
|
2 |
26 Feb 07 |
jari |
1033 |
/** |
2 |
26 Feb 07 |
jari |
* Applies least squares normalization. |
2 |
26 Feb 07 |
jari |
1035 |
*/ |
2 |
26 Feb 07 |
jari |
1036 |
private void applyLeastSquares() { |
2 |
26 Feb 07 |
jari |
1037 |
if (getNormalizedState() != SlideData.LEAST_SQUARES) { |
2 |
26 Feb 07 |
jari |
1038 |
LinearEquation linearEquation = getRegressionEquation(true); |
2 |
26 Feb 07 |
jari |
1039 |
final int size = getSize(); |
2 |
26 Feb 07 |
jari |
1040 |
for (int i = 0; i < size; i++) { |
2 |
26 Feb 07 |
jari |
1041 |
currentCY5[i] = applyLeastSquares(trueCY5[i], linearEquation); |
2 |
26 Feb 07 |
jari |
1042 |
} |
2 |
26 Feb 07 |
jari |
1043 |
} |
2 |
26 Feb 07 |
jari |
1044 |
} |
2 |
26 Feb 07 |
jari |
1045 |
|
2 |
26 Feb 07 |
jari |
1046 |
/** |
2 |
26 Feb 07 |
jari |
* Applies least squares normalization. |
2 |
26 Feb 07 |
jari |
1048 |
*/ |
2 |
26 Feb 07 |
jari |
1049 |
private float applyLeastSquares(float value, LinearEquation linearEquation) { |
2 |
26 Feb 07 |
jari |
1050 |
if (value > 0) { |
2 |
26 Feb 07 |
jari |
1051 |
return(float)((value-linearEquation.getYIntercept())*(1/linearEquation.getSlope())); |
2 |
26 Feb 07 |
jari |
1052 |
} else { |
2 |
26 Feb 07 |
jari |
1053 |
return 0f; |
2 |
26 Feb 07 |
jari |
1054 |
} |
2 |
26 Feb 07 |
jari |
1055 |
} |
2 |
26 Feb 07 |
jari |
1056 |
|
2 |
26 Feb 07 |
jari |
1057 |
/** |
2 |
26 Feb 07 |
jari |
* Calculates a linear equation. |
2 |
26 Feb 07 |
jari |
1059 |
*/ |
2 |
26 Feb 07 |
jari |
1060 |
private LinearEquation getRegressionEquation(boolean useTrueValues) { |
2 |
26 Feb 07 |
jari |
1061 |
LinearEquation linearEquation; |
2 |
26 Feb 07 |
jari |
1062 |
double x = 0, y = 0; |
2 |
26 Feb 07 |
jari |
1063 |
double sum = 0, sumX = 0, sumY = 0; |
2 |
26 Feb 07 |
jari |
1064 |
double sumX2 = 0, sumY2 = 0, sumXY = 0; |
2 |
26 Feb 07 |
jari |
1065 |
double weight = 1; //Change when set dynamically |
2 |
26 Feb 07 |
jari |
1066 |
double delta = 0, a = 0, b = 0; |
2 |
26 Feb 07 |
jari |
1067 |
double variance = 1; //Length of potence |
2 |
26 Feb 07 |
jari |
1068 |
double regressionCoefficient = 0; |
2 |
26 Feb 07 |
jari |
1069 |
double sigmaA = 0, sigmaB = 0; |
2 |
26 Feb 07 |
jari |
1070 |
float[] cy3 = useTrueValues ? trueCY3 : currentCY3; |
2 |
26 Feb 07 |
jari |
1071 |
float[] cy5 = useTrueValues ? trueCY5 : currentCY5; |
2 |
26 Feb 07 |
jari |
1072 |
final int size = getSize(); |
2 |
26 Feb 07 |
jari |
1073 |
for (int i = 0; i < size; i++) { |
2 |
26 Feb 07 |
jari |
1074 |
x = (double) cy3[i]; |
2 |
26 Feb 07 |
jari |
1075 |
y = (double) cy5[i]; |
2 |
26 Feb 07 |
jari |
1076 |
if (x != 0 && y != 0) { |
2 |
26 Feb 07 |
jari |
1077 |
sum += weight; |
2 |
26 Feb 07 |
jari |
1078 |
sumX += (weight * x); |
2 |
26 Feb 07 |
jari |
1079 |
sumY += (weight * y); |
2 |
26 Feb 07 |
jari |
1080 |
sumX2 += (weight * x * x); |
2 |
26 Feb 07 |
jari |
1081 |
sumY2 += (weight * y * y); |
2 |
26 Feb 07 |
jari |
1082 |
sumXY += (weight * x * y); |
2 |
26 Feb 07 |
jari |
1083 |
} |
2 |
26 Feb 07 |
jari |
1084 |
} |
2 |
26 Feb 07 |
jari |
1085 |
|
2 |
26 Feb 07 |
jari |
1086 |
delta = (sum * sumX2) - (sumX * sumX); |
2 |
26 Feb 07 |
jari |
1087 |
a = ((sumX2 * sumY) - (sumX * sumXY)) / delta; |
2 |
26 Feb 07 |
jari |
1088 |
b = ((sumXY * sum) - (sumX * sumY)) / delta; |
2 |
26 Feb 07 |
jari |
1089 |
sigmaA = Math.sqrt(variance * sumX2 / delta); |
2 |
26 Feb 07 |
jari |
1090 |
sigmaB = Math.sqrt(variance * sum / delta); |
2 |
26 Feb 07 |
jari |
1091 |
regressionCoefficient = ((sum * sumXY - sumX * sumY) / Math.sqrt(delta * (sum * sumY2) - (sumY * sumY))); |
2 |
26 Feb 07 |
jari |
1092 |
|
2 |
26 Feb 07 |
jari |
1093 |
linearEquation = new LinearEquation(b, a, regressionCoefficient); |
2 |
26 Feb 07 |
jari |
1094 |
return linearEquation; |
2 |
26 Feb 07 |
jari |
1095 |
} |
2 |
26 Feb 07 |
jari |
1096 |
|
2 |
26 Feb 07 |
jari |
1097 |
|
2 |
26 Feb 07 |
jari |
1098 |
|
2 |
26 Feb 07 |
jari |
1099 |
private void applyLowess(int bins) { |
2 |
26 Feb 07 |
jari |
1100 |
throwNotImplemented("applyLowess"); |
2 |
26 Feb 07 |
jari |
1101 |
} |
2 |
26 Feb 07 |
jari |
1102 |
|
2 |
26 Feb 07 |
jari |
1103 |
private void throwNotImplemented(String methodName) { |
2 |
26 Feb 07 |
jari |
1104 |
throw new RuntimeException("Method '"+methodName+"' is not supported"); |
2 |
26 Feb 07 |
jari |
1105 |
} |
2 |
26 Feb 07 |
jari |
1106 |
|
2 |
26 Feb 07 |
jari |
1107 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the slide name keys. |
2 |
26 Feb 07 |
jari |
1109 |
*/ |
2 |
26 Feb 07 |
jari |
1110 |
public Vector getSlideDataKeys() { |
2 |
26 Feb 07 |
jari |
1111 |
return this.sampleLabelKeys; |
2 |
26 Feb 07 |
jari |
1112 |
} |
2 |
26 Feb 07 |
jari |
1113 |
|
2 |
26 Feb 07 |
jari |
1114 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the slide name keys and pairs |
2 |
26 Feb 07 |
jari |
1116 |
*/ |
2 |
26 Feb 07 |
jari |
1117 |
public Hashtable getSlideDataLabels() { |
2 |
26 Feb 07 |
jari |
1118 |
return this.sampleLabels; |
2 |
26 Feb 07 |
jari |
1119 |
} |
2 |
26 Feb 07 |
jari |
1120 |
|
2 |
26 Feb 07 |
jari |
/** Sets the current label index. |
2 |
26 Feb 07 |
jari |
1122 |
*/ |
2 |
26 Feb 07 |
jari |
1123 |
public void setDataLabelKey(String key) { |
2 |
26 Feb 07 |
jari |
1124 |
this.sampleLabelKey = key; |
2 |
26 Feb 07 |
jari |
1125 |
} |
2 |
26 Feb 07 |
jari |
1126 |
public String getSampleLabelKey() { |
2 |
26 Feb 07 |
jari |
1127 |
return sampleLabelKey; |
2 |
26 Feb 07 |
jari |
1128 |
} |
2 |
26 Feb 07 |
jari |
1129 |
|
2 |
26 Feb 07 |
jari |
/** Adds a new key and label value |
2 |
26 Feb 07 |
jari |
1131 |
*/ |
2 |
26 Feb 07 |
jari |
1132 |
public void addNewSampleLabel(String label, String value) { |
2 |
26 Feb 07 |
jari |
1133 |
if(!sampleLabelKeys.contains(label)) |
2 |
26 Feb 07 |
jari |
1134 |
this.sampleLabelKeys.addElement(label); |
2 |
26 Feb 07 |
jari |
1135 |
this.sampleLabels.put(label, value); |
2 |
26 Feb 07 |
jari |
1136 |
} |
2 |
26 Feb 07 |
jari |
1137 |
/** |
2 |
26 Feb 07 |
jari |
* CGH IFeatureData implemetations |
2 |
26 Feb 07 |
jari |
* Raktim Oct 31, 2005 |
2 |
26 Feb 07 |
jari |
1140 |
*/ |
2 |
26 Feb 07 |
jari |
1141 |
|
2 |
26 Feb 07 |
jari |
1142 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim, CGH |
2 |
26 Feb 07 |
jari |
* Setter for property flankingRegions. |
2 |
26 Feb 07 |
jari |
* @param flankingRegions New value of property flankingRegions. |
2 |
26 Feb 07 |
jari |
1146 |
*/ |
2 |
26 Feb 07 |
jari |
1147 |
public void setFlankingRegions(java.util.Vector[] flankingRegions) { |
2 |
26 Feb 07 |
jari |
1148 |
this.flankingRegions = flankingRegions; |
2 |
26 Feb 07 |
jari |
1149 |
} |
2 |
26 Feb 07 |
jari |
1150 |
|
2 |
26 Feb 07 |
jari |
1151 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim, CGH |
2 |
26 Feb 07 |
jari |
1153 |
*/ |
2 |
26 Feb 07 |
jari |
1154 |
public int getNumFlankingRegions(int chromosomeIndex){ |
2 |
26 Feb 07 |
jari |
1155 |
return flankingRegions[chromosomeIndex].size(); |
2 |
26 Feb 07 |
jari |
1156 |
} |
2 |
26 Feb 07 |
jari |
1157 |
|
2 |
26 Feb 07 |
jari |
1158 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim, CGH |
2 |
26 Feb 07 |
jari |
* Getter for property flankingRegions. |
2 |
26 Feb 07 |
jari |
* @return Value of property flankingRegions. |
2 |
26 Feb 07 |
jari |
1162 |
*/ |
2 |
26 Feb 07 |
jari |
1163 |
public java.util.Vector[] getFlankingRegions() { |
2 |
26 Feb 07 |
jari |
1164 |
return this.flankingRegions; |
2 |
26 Feb 07 |
jari |
1165 |
} |
2 |
26 Feb 07 |
jari |
1166 |
|
2 |
26 Feb 07 |
jari |
1167 |
/** |
2 |
26 Feb 07 |
jari |
1168 |
* |
2 |
26 Feb 07 |
jari |
* Raktim, CGH |
2 |
26 Feb 07 |
jari |
* Remember to fix this later |
2 |
26 Feb 07 |
jari |
1171 |
*/ |
2 |
26 Feb 07 |
jari |
1172 |
public boolean isMissingData(int cloneIndex){ |
2 |
26 Feb 07 |
jari |
1173 |
if(Float.isNaN(getCY3(cloneIndex)) || Float.isNaN(getCY5(cloneIndex))) |
2 |
26 Feb 07 |
jari |
1174 |
return true; |
2 |
26 Feb 07 |
jari |
1175 |
return false; |
2 |
26 Feb 07 |
jari |
/* Get Back to this Later |
2 |
26 Feb 07 |
jari |
Iterator it = cy3Slides.iterator(); |
2 |
26 Feb 07 |
jari |
boolean cy3Missing = true; |
2 |
26 Feb 07 |
jari |
boolean cy5Missing = true; |
2 |
26 Feb 07 |
jari |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
CGHSlideData slideData = (CGHSlideData)it.next(); |
2 |
26 Feb 07 |
jari |
if(! Float.isNaN(slideData.getRatio(cloneIndex))){ |
2 |
26 Feb 07 |
jari |
cy3Missing = false; |
2 |
26 Feb 07 |
jari |
1184 |
} |
2 |
26 Feb 07 |
jari |
1185 |
} |
2 |
26 Feb 07 |
jari |
if(cy3Missing){ |
2 |
26 Feb 07 |
jari |
return true; |
2 |
26 Feb 07 |
jari |
1188 |
} |
2 |
26 Feb 07 |
jari |
1189 |
|
2 |
26 Feb 07 |
jari |
it = cy5Slides.iterator(); |
2 |
26 Feb 07 |
jari |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
CGHSlideData slideData = (CGHSlideData)it.next(); |
2 |
26 Feb 07 |
jari |
if(! Float.isNaN(slideData.getRatio(cloneIndex))){ |
2 |
26 Feb 07 |
jari |
cy5Missing = false; |
2 |
26 Feb 07 |
jari |
1195 |
} |
2 |
26 Feb 07 |
jari |
1196 |
} |
2 |
26 Feb 07 |
jari |
if(cy5Missing){ |
2 |
26 Feb 07 |
jari |
return true; |
2 |
26 Feb 07 |
jari |
1199 |
} |
2 |
26 Feb 07 |
jari |
1200 |
*/ |
2 |
26 Feb 07 |
jari |
1201 |
} |
2 |
26 Feb 07 |
jari |
1202 |
|
2 |
26 Feb 07 |
jari |
1203 |
|
2 |
26 Feb 07 |
jari |
1204 |
/** |
2 |
26 Feb 07 |
jari |
* (non-Javadoc) |
2 |
26 Feb 07 |
jari |
* @see org.tigr.microarray.mev.ISlideData#loadIntensities(java.io.DataInputStream) |
2 |
26 Feb 07 |
jari |
* @deprecated |
2 |
26 Feb 07 |
jari |
1208 |
*/ |
2 |
26 Feb 07 |
jari |
1209 |
public void loadIntensities(DataInputStream dis) throws IOException { |
2 |
26 Feb 07 |
jari |
1210 |
currentCY3 = new float[dis.readInt()]; |
2 |
26 Feb 07 |
jari |
1211 |
for(int i=0; i<currentCY3.length; i++){ |
2 |
26 Feb 07 |
jari |
1212 |
currentCY3[i] = dis.readFloat(); |
2 |
26 Feb 07 |
jari |
1213 |
} |
2 |
26 Feb 07 |
jari |
1214 |
currentCY5 = new float[dis.readInt()]; |
2 |
26 Feb 07 |
jari |
1215 |
for(int i=0; i<currentCY5.length; i++){ |
2 |
26 Feb 07 |
jari |
1216 |
currentCY5[i] = dis.readFloat(); |
2 |
26 Feb 07 |
jari |
1217 |
} |
2 |
26 Feb 07 |
jari |
1218 |
trueCY3 = new float[dis.readInt()]; |
2 |
26 Feb 07 |
jari |
1219 |
for(int i=0; i<trueCY3.length; i++){ |
2 |
26 Feb 07 |
jari |
1220 |
trueCY3[i] = dis.readFloat(); |
2 |
26 Feb 07 |
jari |
1221 |
} |
2 |
26 Feb 07 |
jari |
1222 |
trueCY5 = new float[dis.readInt()]; |
2 |
26 Feb 07 |
jari |
1223 |
for(int i=0; i<trueCY5.length; i++){ |
2 |
26 Feb 07 |
jari |
1224 |
trueCY5[i] = dis.readFloat(); |
2 |
26 Feb 07 |
jari |
1225 |
} |
2 |
26 Feb 07 |
jari |
1226 |
detection = new char[dis.readInt()]; |
2 |
26 Feb 07 |
jari |
1227 |
for(int i=0; i<detection.length; i++){ |
2 |
26 Feb 07 |
jari |
1228 |
detection[i] = dis.readChar(); |
2 |
26 Feb 07 |
jari |
1229 |
} |
2 |
26 Feb 07 |
jari |
1230 |
} |
2 |
26 Feb 07 |
jari |
1231 |
/** |
2 |
26 Feb 07 |
jari |
* @deprecated |
2 |
26 Feb 07 |
jari |
1233 |
*/ |
2 |
26 Feb 07 |
jari |
1234 |
public void writeIntensities(DataOutputStream dos) throws IOException { |
2 |
26 Feb 07 |
jari |
1235 |
if(currentCY3 != null){ |
2 |
26 Feb 07 |
jari |
1236 |
dos.writeInt(currentCY3.length); |
2 |
26 Feb 07 |
jari |
1237 |
for(int i=0; i<currentCY3.length; i++){ |
2 |
26 Feb 07 |
jari |
1238 |
dos.writeFloat(currentCY3[i]); |
2 |
26 Feb 07 |
jari |
1239 |
} |
2 |
26 Feb 07 |
jari |
1240 |
} else |
2 |
26 Feb 07 |
jari |
1241 |
dos.writeInt(0); |
2 |
26 Feb 07 |
jari |
1242 |
|
2 |
26 Feb 07 |
jari |
1243 |
if(currentCY5 != null){ |
2 |
26 Feb 07 |
jari |
1244 |
dos.writeInt(currentCY5.length); |
2 |
26 Feb 07 |
jari |
1245 |
for(int i=0; i<currentCY5.length; i++){ |
2 |
26 Feb 07 |
jari |
1246 |
dos.writeFloat(currentCY5[i]); |
2 |
26 Feb 07 |
jari |
1247 |
} |
2 |
26 Feb 07 |
jari |
1248 |
} else |
2 |
26 Feb 07 |
jari |
1249 |
dos.writeInt(0); |
2 |
26 Feb 07 |
jari |
1250 |
|
2 |
26 Feb 07 |
jari |
1251 |
dos.writeInt(trueCY3.length); |
2 |
26 Feb 07 |
jari |
1252 |
for(int i=0; i<trueCY3.length; i++){ |
2 |
26 Feb 07 |
jari |
1253 |
dos.writeFloat(trueCY3[i]); |
2 |
26 Feb 07 |
jari |
1254 |
} |
2 |
26 Feb 07 |
jari |
1255 |
|
2 |
26 Feb 07 |
jari |
1256 |
dos.writeInt(trueCY5.length); |
2 |
26 Feb 07 |
jari |
1257 |
for(int i=0; i<trueCY5.length; i++){ |
2 |
26 Feb 07 |
jari |
1258 |
dos.writeFloat(trueCY5[i]); |
2 |
26 Feb 07 |
jari |
1259 |
} |
2 |
26 Feb 07 |
jari |
1260 |
|
2 |
26 Feb 07 |
jari |
1261 |
dos.writeInt(detection.length); |
2 |
26 Feb 07 |
jari |
1262 |
for(int i=0; i<detection.length; i++){ |
2 |
26 Feb 07 |
jari |
1263 |
dos.writeChar(detection[i]); |
2 |
26 Feb 07 |
jari |
1264 |
} |
2 |
26 Feb 07 |
jari |
1265 |
} |
2 |
26 Feb 07 |
jari |
1266 |
} |