2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2004, 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 |
6 |
/* |
2 |
26 Feb 07 |
jari |
* $RCSfile: AffySlideDataElement.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.10 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/08/22 17:49:12 $ |
2 |
26 Feb 07 |
jari |
* $Author: eleanorahowe $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
12 |
*/ |
2 |
26 Feb 07 |
jari |
13 |
package org.tigr.microarray.mev; |
2 |
26 Feb 07 |
jari |
14 |
|
2 |
26 Feb 07 |
jari |
15 |
import org.tigr.microarray.mev.cluster.gui.IData; |
2 |
26 Feb 07 |
jari |
16 |
|
2 |
26 Feb 07 |
jari |
17 |
public class AffySlideDataElement extends ArrayElement implements ISlideDataElement { |
2 |
26 Feb 07 |
jari |
18 |
|
2 |
26 Feb 07 |
jari |
19 |
protected String UID; |
2 |
26 Feb 07 |
jari |
20 |
protected int[] rows; |
2 |
26 Feb 07 |
jari |
21 |
protected int[] columns; |
2 |
26 Feb 07 |
jari |
22 |
protected float[] currentIntensity, trueIntensity; |
2 |
26 Feb 07 |
jari |
23 |
protected String[] extraFields; |
2 |
26 Feb 07 |
jari |
24 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
//protected String detection; |
2 |
26 Feb 07 |
jari |
27 |
protected char detection; |
2 |
26 Feb 07 |
jari |
28 |
|
2 |
26 Feb 07 |
jari |
//wwang add for p-value filter |
2 |
26 Feb 07 |
jari |
30 |
protected float pvalue; |
2 |
26 Feb 07 |
jari |
31 |
protected int flags; |
2 |
26 Feb 07 |
jari |
32 |
protected boolean isNull = false; |
2 |
26 Feb 07 |
jari |
33 |
protected boolean isNonZero = true; |
2 |
26 Feb 07 |
jari |
34 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
36 |
|
2 |
26 Feb 07 |
jari |
37 |
/** |
2 |
26 Feb 07 |
jari |
* Constructs a <code>SlideDataElement</code> with specified meta rows, |
2 |
26 Feb 07 |
jari |
* meta columns, intensities and descriptions. |
2 |
26 Feb 07 |
jari |
40 |
*/ |
2 |
26 Feb 07 |
jari |
41 |
public AffySlideDataElement(String UID, int[] rows, int[] columns, float[] intensities, String[] values) { |
2 |
26 Feb 07 |
jari |
42 |
this.UID = UID; |
2 |
26 Feb 07 |
jari |
43 |
this.rows = copyArray(rows); |
2 |
26 Feb 07 |
jari |
44 |
this.columns = copyArray(columns); |
2 |
26 Feb 07 |
jari |
45 |
this.currentIntensity = copyArray(intensities); |
2 |
26 Feb 07 |
jari |
46 |
this.trueIntensity = copyArray(intensities); |
2 |
26 Feb 07 |
jari |
47 |
this.extraFields = copyArray(values); |
2 |
26 Feb 07 |
jari |
48 |
} |
2 |
26 Feb 07 |
jari |
49 |
|
2 |
26 Feb 07 |
jari |
50 |
/** |
2 |
26 Feb 07 |
jari |
* Constructs a <code>SlideDataElement</code> with specified meta rows, |
2 |
26 Feb 07 |
jari |
* meta columns, intensities and descriptions. |
2 |
26 Feb 07 |
jari |
53 |
*/ |
2 |
26 Feb 07 |
jari |
54 |
public AffySlideDataElement(int[] rows, int[] columns, float[] intensities, String[] values) { |
2 |
26 Feb 07 |
jari |
55 |
this.rows = copyArray(rows); |
2 |
26 Feb 07 |
jari |
56 |
this.columns = copyArray(columns); |
2 |
26 Feb 07 |
jari |
57 |
this.currentIntensity = copyArray(intensities); |
2 |
26 Feb 07 |
jari |
58 |
this.trueIntensity = copyArray(intensities); |
2 |
26 Feb 07 |
jari |
59 |
this.extraFields = copyArray(values); |
2 |
26 Feb 07 |
jari |
60 |
} |
2 |
26 Feb 07 |
jari |
61 |
/** |
2 |
26 Feb 07 |
jari |
* Constructor used by XMLEncoder to restore a previously-saved state. |
2 |
26 Feb 07 |
jari |
63 |
* |
2 |
26 Feb 07 |
jari |
* Read state-saving developer documents before altering. |
2 |
26 Feb 07 |
jari |
65 |
* |
2 |
26 Feb 07 |
jari |
* @param rows |
2 |
26 Feb 07 |
jari |
* @param cols |
2 |
26 Feb 07 |
jari |
* @param extraFields |
2 |
26 Feb 07 |
jari |
* @param uid |
2 |
26 Feb 07 |
jari |
* @param isNull |
2 |
26 Feb 07 |
jari |
* @param isNonZero |
2 |
26 Feb 07 |
jari |
* @param detection |
2 |
26 Feb 07 |
jari |
73 |
*/ |
2 |
26 Feb 07 |
jari |
74 |
public AffySlideDataElement(int[] rows, int[] columns, String[] extraFields, String uid, boolean isNull, boolean isNonZero, char detection, float pValue, int flags){ |
2 |
26 Feb 07 |
jari |
75 |
this.rows = copyArray(rows); |
2 |
26 Feb 07 |
jari |
76 |
this.columns = copyArray(columns); |
2 |
26 Feb 07 |
jari |
77 |
this.extraFields = copyArray(extraFields); |
2 |
26 Feb 07 |
jari |
78 |
this.UID = uid; |
2 |
26 Feb 07 |
jari |
79 |
this.isNull = isNull; |
2 |
26 Feb 07 |
jari |
80 |
this.isNonZero = isNonZero; |
2 |
26 Feb 07 |
jari |
81 |
this.detection = detection; |
2 |
26 Feb 07 |
jari |
82 |
this.currentIntensity = new float[2]; |
2 |
26 Feb 07 |
jari |
83 |
this.trueIntensity = new float[2]; |
2 |
26 Feb 07 |
jari |
84 |
this.pvalue = pValue; |
2 |
26 Feb 07 |
jari |
85 |
this.flags = flags; |
2 |
26 Feb 07 |
jari |
86 |
} |
2 |
26 Feb 07 |
jari |
87 |
|
2 |
26 Feb 07 |
jari |
88 |
/** |
2 |
26 Feb 07 |
jari |
* Copy constructor. |
2 |
26 Feb 07 |
jari |
90 |
*/ |
2 |
26 Feb 07 |
jari |
91 |
public AffySlideDataElement(ISlideDataElement sde) { |
2 |
26 Feb 07 |
jari |
92 |
this.UID = sde.getUID(); |
2 |
26 Feb 07 |
jari |
93 |
this.rows = sde.getRows(); |
2 |
26 Feb 07 |
jari |
94 |
this.columns = sde.getColumns(); |
2 |
26 Feb 07 |
jari |
95 |
this.currentIntensity = copyArray(sde.getCurrentIntensity()); |
2 |
26 Feb 07 |
jari |
96 |
this.trueIntensity = copyArray(sde.getTrueIntensity()); |
2 |
26 Feb 07 |
jari |
97 |
this.extraFields = sde.getExtraFields(); |
2 |
26 Feb 07 |
jari |
98 |
if(sde.getDetection() != null && sde.getDetection().length() != 0) |
2 |
26 Feb 07 |
jari |
99 |
this.setDetection(sde.getDetection()); |
2 |
26 Feb 07 |
jari |
100 |
this.setPvalue(sde.getPvalue()); |
2 |
26 Feb 07 |
jari |
101 |
this.isNull = sde.getIsNull(); |
2 |
26 Feb 07 |
jari |
102 |
this.isNonZero = sde.isNonZero(); |
2 |
26 Feb 07 |
jari |
//System.out.print(this.getPvalue()); |
2 |
26 Feb 07 |
jari |
104 |
} |
2 |
26 Feb 07 |
jari |
105 |
|
2 |
26 Feb 07 |
jari |
106 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the extra fields (annotation), appends if fields exist |
2 |
26 Feb 07 |
jari |
108 |
*/ |
2 |
26 Feb 07 |
jari |
109 |
public void setExtraFields(String [] values){ |
2 |
26 Feb 07 |
jari |
110 |
if(values == null) return; |
2 |
26 Feb 07 |
jari |
111 |
if(this.extraFields == null) |
2 |
26 Feb 07 |
jari |
112 |
this.extraFields = values; |
2 |
26 Feb 07 |
jari |
113 |
else{ |
2 |
26 Feb 07 |
jari |
114 |
String [] newFields = new String[this.extraFields.length+values.length]; |
2 |
26 Feb 07 |
jari |
115 |
for(int i = 0; i < this.extraFields.length; i++) |
2 |
26 Feb 07 |
jari |
116 |
newFields[i] = this.extraFields[i]; |
2 |
26 Feb 07 |
jari |
117 |
for(int i = 0; i < values.length; i++) |
2 |
26 Feb 07 |
jari |
118 |
newFields[i+this.extraFields.length] = values[i]; |
2 |
26 Feb 07 |
jari |
119 |
this.extraFields = newFields; |
2 |
26 Feb 07 |
jari |
120 |
} |
2 |
26 Feb 07 |
jari |
121 |
} |
2 |
26 Feb 07 |
jari |
122 |
|
2 |
26 Feb 07 |
jari |
123 |
/** |
2 |
26 Feb 07 |
jari |
* Creates clone of a string array. |
2 |
26 Feb 07 |
jari |
125 |
*/ |
2 |
26 Feb 07 |
jari |
126 |
private String[] copyArray(String[] array) { |
2 |
26 Feb 07 |
jari |
127 |
if (array == null) { |
2 |
26 Feb 07 |
jari |
128 |
return null; |
2 |
26 Feb 07 |
jari |
129 |
} |
2 |
26 Feb 07 |
jari |
130 |
String[] result = new String[array.length]; |
2 |
26 Feb 07 |
jari |
131 |
System.arraycopy(array, 0, result, 0, array.length); |
2 |
26 Feb 07 |
jari |
132 |
return result; |
2 |
26 Feb 07 |
jari |
133 |
} |
2 |
26 Feb 07 |
jari |
134 |
|
2 |
26 Feb 07 |
jari |
135 |
/** |
2 |
26 Feb 07 |
jari |
* Creates clone of an int array. |
2 |
26 Feb 07 |
jari |
137 |
*/ |
2 |
26 Feb 07 |
jari |
138 |
private int[] copyArray(int[] array) { |
2 |
26 Feb 07 |
jari |
139 |
if (array == null) { |
2 |
26 Feb 07 |
jari |
140 |
return null; |
2 |
26 Feb 07 |
jari |
141 |
} |
2 |
26 Feb 07 |
jari |
142 |
int[] result = new int[array.length]; |
2 |
26 Feb 07 |
jari |
143 |
System.arraycopy(array, 0, result, 0, array.length); |
2 |
26 Feb 07 |
jari |
144 |
return result; |
2 |
26 Feb 07 |
jari |
145 |
} |
2 |
26 Feb 07 |
jari |
146 |
|
2 |
26 Feb 07 |
jari |
147 |
/** |
2 |
26 Feb 07 |
jari |
* Creates clone of a float array. |
2 |
26 Feb 07 |
jari |
149 |
*/ |
2 |
26 Feb 07 |
jari |
150 |
private float[] copyArray(float[] array) { |
2 |
26 Feb 07 |
jari |
151 |
if (array == null) { |
2 |
26 Feb 07 |
jari |
152 |
return null; |
2 |
26 Feb 07 |
jari |
153 |
} |
2 |
26 Feb 07 |
jari |
154 |
float[] result = new float[array.length]; |
2 |
26 Feb 07 |
jari |
155 |
System.arraycopy(array, 0, result, 0, array.length); |
2 |
26 Feb 07 |
jari |
156 |
return result; |
2 |
26 Feb 07 |
jari |
157 |
} |
2 |
26 Feb 07 |
jari |
158 |
|
2 |
26 Feb 07 |
jari |
159 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an array of spot meta rows. |
2 |
26 Feb 07 |
jari |
161 |
*/ |
2 |
26 Feb 07 |
jari |
162 |
public int[] getRows() { |
2 |
26 Feb 07 |
jari |
163 |
return rows; |
2 |
26 Feb 07 |
jari |
164 |
} |
2 |
26 Feb 07 |
jari |
165 |
|
2 |
26 Feb 07 |
jari |
166 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an array of spot meta column. |
2 |
26 Feb 07 |
jari |
168 |
*/ |
2 |
26 Feb 07 |
jari |
169 |
public int[] getColumns() { |
2 |
26 Feb 07 |
jari |
170 |
return columns; |
2 |
26 Feb 07 |
jari |
171 |
} |
2 |
26 Feb 07 |
jari |
172 |
|
2 |
26 Feb 07 |
jari |
173 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an array of spot descriptions. |
2 |
26 Feb 07 |
jari |
175 |
*/ |
2 |
26 Feb 07 |
jari |
176 |
public String[] getExtraFields() { |
2 |
26 Feb 07 |
jari |
177 |
return extraFields; |
2 |
26 Feb 07 |
jari |
178 |
} |
2 |
26 Feb 07 |
jari |
179 |
|
2 |
26 Feb 07 |
jari |
180 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an array of current intensities. |
2 |
26 Feb 07 |
jari |
182 |
*/ |
2 |
26 Feb 07 |
jari |
183 |
public float[] getCurrentIntensity() { |
2 |
26 Feb 07 |
jari |
184 |
return currentIntensity; |
2 |
26 Feb 07 |
jari |
185 |
} |
2 |
26 Feb 07 |
jari |
186 |
|
2 |
26 Feb 07 |
jari |
187 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an array of true intensities. |
2 |
26 Feb 07 |
jari |
189 |
*/ |
2 |
26 Feb 07 |
jari |
190 |
public float[] getTrueIntensity() { |
2 |
26 Feb 07 |
jari |
191 |
return trueIntensity; |
2 |
26 Feb 07 |
jari |
192 |
} |
2 |
26 Feb 07 |
jari |
193 |
|
2 |
26 Feb 07 |
jari |
194 |
/** |
2 |
26 Feb 07 |
jari |
* Sets value for specified row type. |
2 |
26 Feb 07 |
jari |
196 |
*/ |
2 |
26 Feb 07 |
jari |
197 |
public void setRow(int rowType, int value) { |
2 |
26 Feb 07 |
jari |
198 |
switch (rowType) { |
2 |
26 Feb 07 |
jari |
199 |
case BASE: rows[0] = value; break; |
2 |
26 Feb 07 |
jari |
200 |
case META: rows[1] = value; break; |
2 |
26 Feb 07 |
jari |
201 |
case SUB : rows[2] = value; break; |
2 |
26 Feb 07 |
jari |
202 |
} |
2 |
26 Feb 07 |
jari |
203 |
} |
2 |
26 Feb 07 |
jari |
204 |
|
2 |
26 Feb 07 |
jari |
205 |
/** |
2 |
26 Feb 07 |
jari |
* Sets value for specified column type. |
2 |
26 Feb 07 |
jari |
207 |
*/ |
2 |
26 Feb 07 |
jari |
208 |
public void setColumn(int columnType, int value) { |
2 |
26 Feb 07 |
jari |
209 |
switch (columnType) { |
2 |
26 Feb 07 |
jari |
210 |
case BASE: columns[0] = value; break; |
2 |
26 Feb 07 |
jari |
211 |
case META: columns[1] = value; break; |
2 |
26 Feb 07 |
jari |
212 |
case SUB: columns[2] = value; break; |
2 |
26 Feb 07 |
jari |
213 |
} |
2 |
26 Feb 07 |
jari |
214 |
} |
2 |
26 Feb 07 |
jari |
215 |
|
2 |
26 Feb 07 |
jari |
//Replaces getRow, getMetaRow, getSubRow |
2 |
26 Feb 07 |
jari |
217 |
public int getRow(int rowType) { |
2 |
26 Feb 07 |
jari |
218 |
int targetRow = -1; |
2 |
26 Feb 07 |
jari |
219 |
switch (rowType) { |
2 |
26 Feb 07 |
jari |
220 |
case BASE: targetRow = rows[0]; break; |
2 |
26 Feb 07 |
jari |
221 |
case META: targetRow = rows[1]; break; |
2 |
26 Feb 07 |
jari |
222 |
case SUB: targetRow = rows[2]; break; |
2 |
26 Feb 07 |
jari |
223 |
} |
2 |
26 Feb 07 |
jari |
224 |
return targetRow; |
2 |
26 Feb 07 |
jari |
225 |
} |
2 |
26 Feb 07 |
jari |
226 |
|
2 |
26 Feb 07 |
jari |
227 |
/** |
2 |
26 Feb 07 |
jari |
* Returns index of specified column type. |
2 |
26 Feb 07 |
jari |
229 |
*/ |
2 |
26 Feb 07 |
jari |
230 |
public int getColumn(int columnType) { |
2 |
26 Feb 07 |
jari |
231 |
int targetColumn = -1; |
2 |
26 Feb 07 |
jari |
232 |
switch (columnType) { |
2 |
26 Feb 07 |
jari |
233 |
case BASE: targetColumn = columns[0]; break; |
2 |
26 Feb 07 |
jari |
234 |
case META: targetColumn = columns[1]; break; |
2 |
26 Feb 07 |
jari |
235 |
case SUB: targetColumn = columns[2]; break; |
2 |
26 Feb 07 |
jari |
236 |
} |
2 |
26 Feb 07 |
jari |
237 |
return targetColumn; |
2 |
26 Feb 07 |
jari |
238 |
} |
2 |
26 Feb 07 |
jari |
239 |
|
2 |
26 Feb 07 |
jari |
240 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a spot location. |
2 |
26 Feb 07 |
jari |
242 |
*/ |
2 |
26 Feb 07 |
jari |
243 |
public int getLocation(int positionType, int features) { |
2 |
26 Feb 07 |
jari |
244 |
int location = -1; |
2 |
26 Feb 07 |
jari |
245 |
switch (positionType) { |
2 |
26 Feb 07 |
jari |
246 |
case BASE: location = columns[0] + (rows[0] - 1) * features; break; |
2 |
26 Feb 07 |
jari |
247 |
case META: location = columns[1] + (rows[1] - 1) * features; break; |
2 |
26 Feb 07 |
jari |
248 |
case SUB : location = columns[2] + (rows[2] - 1) * features; break; |
2 |
26 Feb 07 |
jari |
249 |
} |
2 |
26 Feb 07 |
jari |
250 |
return location; |
2 |
26 Feb 07 |
jari |
251 |
} |
2 |
26 Feb 07 |
jari |
252 |
|
2 |
26 Feb 07 |
jari |
253 |
/** |
2 |
26 Feb 07 |
jari |
* Returns intensity value by its specified type. |
2 |
26 Feb 07 |
jari |
255 |
*/ |
2 |
26 Feb 07 |
jari |
256 |
public float getIntensity(int intensityType) { |
2 |
26 Feb 07 |
jari |
257 |
float targetIntensity = -1; |
2 |
26 Feb 07 |
jari |
258 |
switch (intensityType) { |
2 |
26 Feb 07 |
jari |
259 |
case CY3: |
2 |
26 Feb 07 |
jari |
260 |
targetIntensity = currentIntensity[0]; |
2 |
26 Feb 07 |
jari |
261 |
break; |
2 |
26 Feb 07 |
jari |
262 |
case CY5: |
2 |
26 Feb 07 |
jari |
263 |
targetIntensity = currentIntensity[1]; |
2 |
26 Feb 07 |
jari |
264 |
break; |
2 |
26 Feb 07 |
jari |
265 |
} |
2 |
26 Feb 07 |
jari |
266 |
return (float)targetIntensity; |
2 |
26 Feb 07 |
jari |
267 |
} |
2 |
26 Feb 07 |
jari |
268 |
|
2 |
26 Feb 07 |
jari |
269 |
/** |
2 |
26 Feb 07 |
jari |
* Sets an intensity value. |
2 |
26 Feb 07 |
jari |
271 |
*/ |
2 |
26 Feb 07 |
jari |
272 |
public void setIntensity(int intensityType, float value) { |
2 |
26 Feb 07 |
jari |
273 |
switch (intensityType) { |
2 |
26 Feb 07 |
jari |
274 |
case CY3: currentIntensity[0] = value; break; |
2 |
26 Feb 07 |
jari |
275 |
case CY5: currentIntensity[1] = value; break; |
2 |
26 Feb 07 |
jari |
276 |
} |
2 |
26 Feb 07 |
jari |
277 |
} |
2 |
26 Feb 07 |
jari |
278 |
|
2 |
26 Feb 07 |
jari |
279 |
public void setDetection(String value){ |
2 |
26 Feb 07 |
jari |
280 |
detection = value.charAt(0); |
2 |
26 Feb 07 |
jari |
281 |
} |
2 |
26 Feb 07 |
jari |
282 |
public void setPvalue(float value){ |
2 |
26 Feb 07 |
jari |
283 |
pvalue=value; |
2 |
26 Feb 07 |
jari |
284 |
} |
2 |
26 Feb 07 |
jari |
285 |
public void setGenePixFlags(int value){ |
2 |
26 Feb 07 |
jari |
286 |
flags=value; |
2 |
26 Feb 07 |
jari |
287 |
} |
2 |
26 Feb 07 |
jari |
288 |
/** |
2 |
26 Feb 07 |
jari |
* Sets true intensity value. |
2 |
26 Feb 07 |
jari |
290 |
*/ |
2 |
26 Feb 07 |
jari |
291 |
public void setTrueIntensity(int intensityType, float value) { |
2 |
26 Feb 07 |
jari |
292 |
switch (intensityType) { |
2 |
26 Feb 07 |
jari |
293 |
case CY3: trueIntensity[0] = value; break; |
2 |
26 Feb 07 |
jari |
294 |
case CY5: trueIntensity[1] = value; break; |
2 |
26 Feb 07 |
jari |
295 |
} |
2 |
26 Feb 07 |
jari |
296 |
} |
2 |
26 Feb 07 |
jari |
297 |
|
2 |
26 Feb 07 |
jari |
298 |
|
2 |
26 Feb 07 |
jari |
//Replaces getTrueCy3, getTrueCy5 |
2 |
26 Feb 07 |
jari |
300 |
public float getTrueIntensity(int intensityType) { |
2 |
26 Feb 07 |
jari |
301 |
float targetIntensity = -1; |
2 |
26 Feb 07 |
jari |
302 |
switch (intensityType) { |
2 |
26 Feb 07 |
jari |
303 |
case CY3: targetIntensity = trueIntensity[0]; break; |
2 |
26 Feb 07 |
jari |
304 |
case CY5: targetIntensity = trueIntensity[1]; break; |
2 |
26 Feb 07 |
jari |
305 |
} |
2 |
26 Feb 07 |
jari |
306 |
return targetIntensity; |
2 |
26 Feb 07 |
jari |
307 |
} |
2 |
26 Feb 07 |
jari |
308 |
|
2 |
26 Feb 07 |
jari |
309 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a ratio value for specified intensities. |
2 |
26 Feb 07 |
jari |
311 |
*/ |
2 |
26 Feb 07 |
jari |
312 |
public float getRatio(int intensityIndex1, int intensityIndex2, int logState) { |
2 |
26 Feb 07 |
jari |
313 |
return getRatio(intensityIndex1, intensityIndex2, logState, isNonZero); |
2 |
26 Feb 07 |
jari |
314 |
} |
2 |
26 Feb 07 |
jari |
315 |
|
2 |
26 Feb 07 |
jari |
316 |
public float getRatio(int intensityIndex1, int intensityIndex2, int logState, boolean nonZero) { |
2 |
26 Feb 07 |
jari |
317 |
float ratio; |
2 |
26 Feb 07 |
jari |
318 |
|
2 |
26 Feb 07 |
jari |
// - tigr_original - |
2 |
26 Feb 07 |
jari |
320 |
|
2 |
26 Feb 07 |
jari |
321 |
if (nonZero) { |
2 |
26 Feb 07 |
jari |
322 |
if ((getIntensity(intensityIndex1) == 0) && (getIntensity(intensityIndex2) == 0)) { |
2 |
26 Feb 07 |
jari |
323 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
324 |
} else if (getIntensity(intensityIndex1) == 0) { |
2 |
26 Feb 07 |
jari |
325 |
ratio = 1f / (float)getIntensity(intensityIndex2); |
2 |
26 Feb 07 |
jari |
326 |
} else if (getIntensity(intensityIndex2) == 0) { |
2 |
26 Feb 07 |
jari |
327 |
ratio = (float)getIntensity(intensityIndex1)/1f; |
2 |
26 Feb 07 |
jari |
328 |
} else { |
2 |
26 Feb 07 |
jari |
329 |
ratio = (float)getIntensity(intensityIndex1)/(float)getIntensity(intensityIndex2); |
2 |
26 Feb 07 |
jari |
330 |
} |
2 |
26 Feb 07 |
jari |
331 |
} else { |
2 |
26 Feb 07 |
jari |
332 |
if (getIntensity(intensityIndex1) == 0) return Float.NaN; |
2 |
26 Feb 07 |
jari |
333 |
if (getIntensity(intensityIndex2) == 0) return Float.NaN; |
2 |
26 Feb 07 |
jari |
334 |
ratio = (float)getIntensity(intensityIndex1)/(float)getIntensity(intensityIndex2); |
2 |
26 Feb 07 |
jari |
335 |
} |
2 |
26 Feb 07 |
jari |
336 |
if (logState == IData.LOG) |
2 |
26 Feb 07 |
jari |
//LOG |
2 |
26 Feb 07 |
jari |
//ratio = (float) Xcon.log2(ratio); |
2 |
26 Feb 07 |
jari |
339 |
ratio = (float)(Math.log(ratio)/Math.log(2.0)); |
2 |
26 Feb 07 |
jari |
340 |
return ratio; |
2 |
26 Feb 07 |
jari |
341 |
|
2 |
26 Feb 07 |
jari |
//- end tigr_original - |
2 |
26 Feb 07 |
jari |
343 |
|
2 |
26 Feb 07 |
jari |
344 |
|
2 |
26 Feb 07 |
jari |
// return this.getIntensity(0); |
2 |
26 Feb 07 |
jari |
346 |
|
2 |
26 Feb 07 |
jari |
/* pcahan |
2 |
26 Feb 07 |
jari |
pick a channel to exclude and simply return the other channel intensity |
2 |
26 Feb 07 |
jari |
think about normalization effects - currentintensity - just get trueintensity |
2 |
26 Feb 07 |
jari |
350 |
*/ |
2 |
26 Feb 07 |
jari |
//if (getIntensity(intensityIndex1) == 0) && (getIntensity(intensityIndex2) == 0) |
2 |
26 Feb 07 |
jari |
352 |
|
2 |
26 Feb 07 |
jari |
353 |
} |
2 |
26 Feb 07 |
jari |
354 |
|
2 |
26 Feb 07 |
jari |
355 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a true ratio value for specified intensities. |
2 |
26 Feb 07 |
jari |
357 |
*/ |
2 |
26 Feb 07 |
jari |
358 |
public double getTrueRatio(int intensityIndex1, int intensityIndex2, int logState) { |
2 |
26 Feb 07 |
jari |
359 |
return getTrueRatio(intensityIndex1, intensityIndex2, logState, isNonZero); |
2 |
26 Feb 07 |
jari |
360 |
} |
2 |
26 Feb 07 |
jari |
361 |
|
2 |
26 Feb 07 |
jari |
362 |
public double getTrueRatio(int intensityIndex1, int intensityIndex2, int logState, boolean nonZero) { |
2 |
26 Feb 07 |
jari |
//return (double) this.getIntensity(0); |
2 |
26 Feb 07 |
jari |
364 |
|
2 |
26 Feb 07 |
jari |
365 |
|
2 |
26 Feb 07 |
jari |
366 |
double ratio; |
2 |
26 Feb 07 |
jari |
367 |
|
2 |
26 Feb 07 |
jari |
368 |
|
2 |
26 Feb 07 |
jari |
369 |
if (nonZero) { |
2 |
26 Feb 07 |
jari |
370 |
if ((getTrueIntensity(intensityIndex1) == 0) && (getTrueIntensity(intensityIndex2) == 0)) { |
2 |
26 Feb 07 |
jari |
371 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
372 |
} else if (getTrueIntensity(intensityIndex1) == 0) { |
2 |
26 Feb 07 |
jari |
373 |
ratio = (double) 1.0 / (double) getTrueIntensity(intensityIndex2); |
2 |
26 Feb 07 |
jari |
374 |
} else if (getTrueIntensity(intensityIndex2) == 0) { |
2 |
26 Feb 07 |
jari |
375 |
ratio = (double) getTrueIntensity(intensityIndex1) / (double) 1.0; |
2 |
26 Feb 07 |
jari |
376 |
} else { |
2 |
26 Feb 07 |
jari |
377 |
ratio = (double) getTrueIntensity(intensityIndex1) / (double) getTrueIntensity(intensityIndex2); |
2 |
26 Feb 07 |
jari |
378 |
} |
2 |
26 Feb 07 |
jari |
379 |
} else { |
2 |
26 Feb 07 |
jari |
380 |
if (getTrueIntensity(intensityIndex1) == 0) return Float.NaN; |
2 |
26 Feb 07 |
jari |
381 |
if (getTrueIntensity(intensityIndex2) == 0) return Float.NaN; |
2 |
26 Feb 07 |
jari |
382 |
ratio = (double) getTrueIntensity(intensityIndex1) / (double) getTrueIntensity(intensityIndex2); |
2 |
26 Feb 07 |
jari |
383 |
} |
2 |
26 Feb 07 |
jari |
384 |
|
2 |
26 Feb 07 |
jari |
385 |
if (logState == IData.LOG) |
2 |
26 Feb 07 |
jari |
//LOG |
2 |
26 Feb 07 |
jari |
//ratio = (float) Xcon.log2(ratio); |
2 |
26 Feb 07 |
jari |
388 |
ratio = (float)(Math.log(ratio)/Math.log(2.0)); |
2 |
26 Feb 07 |
jari |
389 |
return ratio; |
2 |
26 Feb 07 |
jari |
390 |
} |
2 |
26 Feb 07 |
jari |
391 |
|
2 |
26 Feb 07 |
jari |
392 |
public float getIntensityMean(int intensityType) { |
2 |
26 Feb 07 |
jari |
393 |
return(float) 0.0; |
2 |
26 Feb 07 |
jari |
394 |
|
2 |
26 Feb 07 |
jari |
395 |
|
2 |
26 Feb 07 |
jari |
396 |
} |
2 |
26 Feb 07 |
jari |
397 |
|
2 |
26 Feb 07 |
jari |
398 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the non-zero flag. |
2 |
26 Feb 07 |
jari |
400 |
*/ |
2 |
26 Feb 07 |
jari |
401 |
public void setNonZero(boolean state) {this.isNonZero = state;} |
2 |
26 Feb 07 |
jari |
402 |
|
2 |
26 Feb 07 |
jari |
403 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the non-zero flag. |
2 |
26 Feb 07 |
jari |
405 |
*/ |
2 |
26 Feb 07 |
jari |
406 |
public boolean isNonZero() {return this.isNonZero;} |
2 |
26 Feb 07 |
jari |
407 |
|
2 |
26 Feb 07 |
jari |
408 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the isNull flag. |
2 |
26 Feb 07 |
jari |
410 |
*/ |
2 |
26 Feb 07 |
jari |
411 |
public void setIsNull(boolean state) {this.isNull = state;} |
2 |
26 Feb 07 |
jari |
412 |
|
2 |
26 Feb 07 |
jari |
413 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the isNull flag. |
2 |
26 Feb 07 |
jari |
415 |
*/ |
2 |
26 Feb 07 |
jari |
416 |
public boolean getIsNull() {return this.isNull;} |
2 |
26 Feb 07 |
jari |
417 |
|
2 |
26 Feb 07 |
jari |
418 |
/** |
2 |
26 Feb 07 |
jari |
* @return true, if spot contains no zero intensities. |
2 |
26 Feb 07 |
jari |
420 |
*/ |
2 |
26 Feb 07 |
jari |
421 |
public boolean hasNoZeros() { |
2 |
26 Feb 07 |
jari |
422 |
if ((getTrueIntensity(CY3) != 0) && (getTrueIntensity(CY5) != 0)) return true; |
2 |
26 Feb 07 |
jari |
423 |
else return false; |
2 |
26 Feb 07 |
jari |
424 |
} |
2 |
26 Feb 07 |
jari |
425 |
|
2 |
26 Feb 07 |
jari |
426 |
public String getDetection(){ |
2 |
26 Feb 07 |
jari |
427 |
return String.valueOf(detection); |
2 |
26 Feb 07 |
jari |
428 |
} |
2 |
26 Feb 07 |
jari |
429 |
public float getPvalue(){ |
2 |
26 Feb 07 |
jari |
430 |
return pvalue; |
2 |
26 Feb 07 |
jari |
431 |
} |
2 |
26 Feb 07 |
jari |
432 |
|
2 |
26 Feb 07 |
jari |
433 |
public int getGenePixFlags(){ |
2 |
26 Feb 07 |
jari |
434 |
return flags; |
2 |
26 Feb 07 |
jari |
435 |
} |
2 |
26 Feb 07 |
jari |
436 |
public String getAttributeString(int number) { |
2 |
26 Feb 07 |
jari |
437 |
String retVal = ""; |
2 |
26 Feb 07 |
jari |
438 |
int coordinatePairs = TMEV.getCoordinatePairCount() * 2; //Did you see the (* 2)? |
2 |
26 Feb 07 |
jari |
439 |
int intensities = TMEV.getIntensityCount(); |
2 |
26 Feb 07 |
jari |
440 |
int extraFields = this.extraFields.length; |
2 |
26 Feb 07 |
jari |
441 |
|
2 |
26 Feb 07 |
jari |
442 |
if (number < coordinatePairs) { |
2 |
26 Feb 07 |
jari |
443 |
if (number % 2 == 0) |
2 |
26 Feb 07 |
jari |
444 |
retVal = String.valueOf(rows[number/2]); |
2 |
26 Feb 07 |
jari |
445 |
else |
2 |
26 Feb 07 |
jari |
446 |
retVal = String.valueOf(columns[(number+1)/2]); |
2 |
26 Feb 07 |
jari |
447 |
} else if (number < coordinatePairs + intensities) { |
2 |
26 Feb 07 |
jari |
448 |
retVal = String.valueOf(currentIntensity[number - (coordinatePairs)]); |
2 |
26 Feb 07 |
jari |
449 |
} else if (number < coordinatePairs + intensities + extraFields) { |
2 |
26 Feb 07 |
jari |
450 |
retVal = getFieldAt(number - (coordinatePairs + intensities)); |
2 |
26 Feb 07 |
jari |
451 |
} else retVal = ""; |
2 |
26 Feb 07 |
jari |
452 |
return retVal; |
2 |
26 Feb 07 |
jari |
453 |
} |
2 |
26 Feb 07 |
jari |
454 |
|
2 |
26 Feb 07 |
jari |
455 |
|
2 |
26 Feb 07 |
jari |
456 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a description by specified index. Or empty string if feild index |
2 |
26 Feb 07 |
jari |
* does not exist |
2 |
26 Feb 07 |
jari |
459 |
*/ |
2 |
26 Feb 07 |
jari |
460 |
public String getFieldAt(int index) { |
2 |
26 Feb 07 |
jari |
461 |
if(index < 0 || index > (extraFields.length - 1)) |
2 |
26 Feb 07 |
jari |
462 |
return ""; |
2 |
26 Feb 07 |
jari |
463 |
return extraFields[index]; |
2 |
26 Feb 07 |
jari |
464 |
} |
2 |
26 Feb 07 |
jari |
465 |
|
2 |
26 Feb 07 |
jari |
466 |
/** |
2 |
26 Feb 07 |
jari |
* Returns clone on this element. |
2 |
26 Feb 07 |
jari |
468 |
*/ |
2 |
26 Feb 07 |
jari |
469 |
public ISlideDataElement copy() { |
2 |
26 Feb 07 |
jari |
470 |
return new AffySlideDataElement(this); |
2 |
26 Feb 07 |
jari |
471 |
} |
2 |
26 Feb 07 |
jari |
472 |
|
2 |
26 Feb 07 |
jari |
473 |
public String toString() { |
2 |
26 Feb 07 |
jari |
474 |
return "SDE " + getRow(BASE) + ", " + getColumn(BASE); |
2 |
26 Feb 07 |
jari |
475 |
} |
2 |
26 Feb 07 |
jari |
476 |
|
2 |
26 Feb 07 |
jari |
/** Sets the UID field |
2 |
26 Feb 07 |
jari |
478 |
*/ |
2 |
26 Feb 07 |
jari |
479 |
public void setUID(String uid) { |
2 |
26 Feb 07 |
jari |
480 |
this.UID = uid; |
2 |
26 Feb 07 |
jari |
481 |
} |
2 |
26 Feb 07 |
jari |
482 |
|
2 |
26 Feb 07 |
jari |
/** Returns the UID field |
2 |
26 Feb 07 |
jari |
484 |
*/ |
2 |
26 Feb 07 |
jari |
485 |
public String getUID() { |
2 |
26 Feb 07 |
jari |
486 |
return this.UID; |
2 |
26 Feb 07 |
jari |
487 |
} |
2 |
26 Feb 07 |
jari |
488 |
|
2 |
26 Feb 07 |
jari |
489 |
} |