2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
* CGHTableDataModelDyeSwap.java |
2 |
26 Feb 07 |
jari |
3 |
* |
2 |
26 Feb 07 |
jari |
* Created on July 5, 2003, 11:28 PM |
2 |
26 Feb 07 |
jari |
5 |
*/ |
2 |
26 Feb 07 |
jari |
6 |
|
2 |
26 Feb 07 |
jari |
7 |
package org.tigr.microarray.mev.cgh.CGHDataModel; |
2 |
26 Feb 07 |
jari |
8 |
|
2 |
26 Feb 07 |
jari |
9 |
import org.tigr.microarray.mev.cluster.gui.IFramework; |
2 |
26 Feb 07 |
jari |
10 |
|
2 |
26 Feb 07 |
jari |
11 |
/** |
2 |
26 Feb 07 |
jari |
12 |
* |
2 |
26 Feb 07 |
jari |
* @author Adam Margolin |
2 |
26 Feb 07 |
jari |
* @author Raktim Sinha |
2 |
26 Feb 07 |
jari |
15 |
*/ |
2 |
26 Feb 07 |
jari |
16 |
|
2 |
26 Feb 07 |
jari |
17 |
public class CGHTableDataModelDyeSwap extends CGHTableDataModel { |
2 |
26 Feb 07 |
jari |
18 |
|
2 |
26 Feb 07 |
jari |
/** Creates a new instance of CGHTableDataModelDyeSwap */ |
2 |
26 Feb 07 |
jari |
20 |
public CGHTableDataModelDyeSwap(/*CGHMultipleArrayDataFcd fcd,*/ IFramework framework, int experimentIndex, int chromosomeIndex){ |
2 |
26 Feb 07 |
jari |
21 |
super(/*fcd,*/ framework, experimentIndex, chromosomeIndex); |
2 |
26 Feb 07 |
jari |
22 |
} |
2 |
26 Feb 07 |
jari |
23 |
|
2 |
26 Feb 07 |
jari |
24 |
/** |
2 |
26 Feb 07 |
jari |
* @return the number of columns. The number of annotations plus the number of experiments |
2 |
26 Feb 07 |
jari |
* if viewing all experiments, the number of annotaitons plus two (one for cy3 experiment, one for |
2 |
26 Feb 07 |
jari |
* cy5 experiment) if viewing only one experiment |
2 |
26 Feb 07 |
jari |
28 |
*/ |
2 |
26 Feb 07 |
jari |
29 |
public int getColumnCount() { |
2 |
26 Feb 07 |
jari |
30 |
int valueColumns = 0; |
2 |
26 Feb 07 |
jari |
31 |
switch(adaptor.cloneValueType){ |
2 |
26 Feb 07 |
jari |
32 |
case CGHBrowserModelAdaptor.CLONE_VALUES_DYE_SWAP: |
2 |
26 Feb 07 |
jari |
33 |
valueColumns = adaptor.experimentIndices.length * 2; |
2 |
26 Feb 07 |
jari |
34 |
break; |
2 |
26 Feb 07 |
jari |
35 |
case CGHBrowserModelAdaptor.CLONE_VALUES_LOG_AVERAGE_INVERTED: |
2 |
26 Feb 07 |
jari |
36 |
valueColumns = adaptor.experimentIndices.length; |
2 |
26 Feb 07 |
jari |
37 |
break; |
2 |
26 Feb 07 |
jari |
38 |
case CGHBrowserModelAdaptor.CLONE_VALUES_LOG_DYE_SWAP: |
2 |
26 Feb 07 |
jari |
39 |
valueColumns = adaptor.experimentIndices.length * 2; |
2 |
26 Feb 07 |
jari |
40 |
break; |
2 |
26 Feb 07 |
jari |
41 |
case CGHBrowserModelAdaptor.CLONE_VALUES_P_SCORE: |
2 |
26 Feb 07 |
jari |
42 |
valueColumns = adaptor.experimentIndices.length * 2; |
2 |
26 Feb 07 |
jari |
43 |
break; |
2 |
26 Feb 07 |
jari |
44 |
|
2 |
26 Feb 07 |
jari |
45 |
} |
2 |
26 Feb 07 |
jari |
46 |
return valueColumns + getNumAnnotationCols(); |
2 |
26 Feb 07 |
jari |
47 |
} |
2 |
26 Feb 07 |
jari |
48 |
|
2 |
26 Feb 07 |
jari |
49 |
public Object getDataValueAt(int row, int col){ |
2 |
26 Feb 07 |
jari |
50 |
int dataIndex = col - getNumAnnotationCols(); |
2 |
26 Feb 07 |
jari |
51 |
float val; |
2 |
26 Feb 07 |
jari |
// Raktim |
2 |
26 Feb 07 |
jari |
//System.out.println("adaptor.cloneValueType & adaptor.exprInd: " + adaptor.cloneValueType + " " + dataIndex); |
2 |
26 Feb 07 |
jari |
54 |
switch(adaptor.cloneValueType){ |
2 |
26 Feb 07 |
jari |
55 |
case CGHBrowserModelAdaptor.CLONE_VALUES_DYE_SWAP: |
2 |
26 Feb 07 |
jari |
56 |
return getDyeSwapValue(dataIndex, row); |
2 |
26 Feb 07 |
jari |
57 |
case CGHBrowserModelAdaptor.CLONE_VALUES_LOG_AVERAGE_INVERTED: |
2 |
26 Feb 07 |
jari |
58 |
val = getLogAverageInvertedValue(dataIndex, row); |
2 |
26 Feb 07 |
jari |
59 |
if(Float.isInfinite(val)){ |
2 |
26 Feb 07 |
jari |
60 |
return null; |
2 |
26 Feb 07 |
jari |
61 |
}else{ |
2 |
26 Feb 07 |
jari |
62 |
return new Float(val); |
2 |
26 Feb 07 |
jari |
63 |
} |
2 |
26 Feb 07 |
jari |
64 |
case CGHBrowserModelAdaptor.CLONE_VALUES_LOG_DYE_SWAP: |
2 |
26 Feb 07 |
jari |
65 |
val = getLogDyeSwapValue(dataIndex, row); |
2 |
26 Feb 07 |
jari |
66 |
if(Float.isInfinite(val)){ |
2 |
26 Feb 07 |
jari |
67 |
return new Float(Float.NaN); |
2 |
26 Feb 07 |
jari |
68 |
}else{ |
2 |
26 Feb 07 |
jari |
69 |
return new Float(val); |
2 |
26 Feb 07 |
jari |
70 |
} |
2 |
26 Feb 07 |
jari |
71 |
case CGHBrowserModelAdaptor.CLONE_VALUES_P_SCORE: |
2 |
26 Feb 07 |
jari |
72 |
return getCloneDistributionPScoreValue(dataIndex, row); |
2 |
26 Feb 07 |
jari |
73 |
default: |
2 |
26 Feb 07 |
jari |
74 |
return null; |
2 |
26 Feb 07 |
jari |
75 |
} |
2 |
26 Feb 07 |
jari |
76 |
} |
2 |
26 Feb 07 |
jari |
77 |
|
2 |
26 Feb 07 |
jari |
78 |
|
2 |
26 Feb 07 |
jari |
79 |
private Object getDyeSwapValue(int index, int row){ |
2 |
26 Feb 07 |
jari |
80 |
|
2 |
26 Feb 07 |
jari |
81 |
int dyeSwapIndex = index % 2; |
2 |
26 Feb 07 |
jari |
82 |
int experimentIndex = index / 2; |
2 |
26 Feb 07 |
jari |
83 |
|
2 |
26 Feb 07 |
jari |
84 |
if(dyeSwapIndex == 0){ |
2 |
26 Feb 07 |
jari |
//return new Float(fcd.getRatio(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row), CGHSampleData.CY3_SLIDES)); |
2 |
26 Feb 07 |
jari |
86 |
return new Float(data.getCY3(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row))); |
2 |
26 Feb 07 |
jari |
87 |
|
2 |
26 Feb 07 |
jari |
88 |
}else if(dyeSwapIndex == 1){ |
2 |
26 Feb 07 |
jari |
//return new Float(fcd.getRatio(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row), CGHSampleData.CY5_SLIDES)); |
2 |
26 Feb 07 |
jari |
90 |
return new Float(data.getCY5(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row))); |
2 |
26 Feb 07 |
jari |
91 |
} |
2 |
26 Feb 07 |
jari |
92 |
return null; |
2 |
26 Feb 07 |
jari |
93 |
} |
2 |
26 Feb 07 |
jari |
94 |
|
2 |
26 Feb 07 |
jari |
95 |
private float getLogDyeSwapValue(int index, int row){ |
2 |
26 Feb 07 |
jari |
96 |
|
2 |
26 Feb 07 |
jari |
97 |
int dyeSwapIndex = index % 2; |
2 |
26 Feb 07 |
jari |
98 |
int experimentIndex = index / 2; |
2 |
26 Feb 07 |
jari |
99 |
|
2 |
26 Feb 07 |
jari |
100 |
if(dyeSwapIndex == 0){ |
2 |
26 Feb 07 |
jari |
//return fcd.getRatio(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row), CGHSampleData.CY3_SLIDES, true); |
2 |
26 Feb 07 |
jari |
102 |
return data.getCY3(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row)); |
2 |
26 Feb 07 |
jari |
103 |
}else if(dyeSwapIndex == 1){ |
2 |
26 Feb 07 |
jari |
//return fcd.getRatio(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row), CGHSampleData.CY5_SLIDES, true); |
2 |
26 Feb 07 |
jari |
105 |
return data.getCY5(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row)); |
2 |
26 Feb 07 |
jari |
106 |
} |
2 |
26 Feb 07 |
jari |
107 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
108 |
} |
2 |
26 Feb 07 |
jari |
109 |
|
2 |
26 Feb 07 |
jari |
110 |
private float getLogAverageInvertedValue(int index, int row){ |
2 |
26 Feb 07 |
jari |
111 |
try{ |
2 |
26 Feb 07 |
jari |
112 |
float val = data.getLogAverageInvertedValue(adaptor.experimentIndices[index], adaptor.getCloneIndex(row)); |
2 |
26 Feb 07 |
jari |
113 |
return val; |
2 |
26 Feb 07 |
jari |
114 |
}catch (Exception e){ |
2 |
26 Feb 07 |
jari |
115 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
116 |
} |
2 |
26 Feb 07 |
jari |
117 |
} |
2 |
26 Feb 07 |
jari |
118 |
|
2 |
26 Feb 07 |
jari |
119 |
private Object getCloneDistributionPScoreValue(int index, int row){ |
2 |
26 Feb 07 |
jari |
120 |
|
2 |
26 Feb 07 |
jari |
121 |
int dyeSwapIndex = index % 2; |
2 |
26 Feb 07 |
jari |
122 |
int experimentIndex = index / 2; |
2 |
26 Feb 07 |
jari |
123 |
if(dyeSwapIndex == 0){ |
2 |
26 Feb 07 |
jari |
124 |
return new Float(data.getPValueByLogCloneDistribution(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row))); |
2 |
26 Feb 07 |
jari |
125 |
|
2 |
26 Feb 07 |
jari |
126 |
}else if(dyeSwapIndex == 1){ |
2 |
26 Feb 07 |
jari |
127 |
return new Float(data.getPValueByLogCloneDistribution(adaptor.experimentIndices[experimentIndex], adaptor.getCloneIndex(row))); |
2 |
26 Feb 07 |
jari |
128 |
} |
2 |
26 Feb 07 |
jari |
129 |
|
2 |
26 Feb 07 |
jari |
130 |
return null; |
2 |
26 Feb 07 |
jari |
131 |
} |
2 |
26 Feb 07 |
jari |
132 |
|
2 |
26 Feb 07 |
jari |
133 |
public String getColumnDataName(int labelIndex){ |
2 |
26 Feb 07 |
jari |
134 |
|
2 |
26 Feb 07 |
jari |
135 |
String label = ""; |
2 |
26 Feb 07 |
jari |
136 |
int dyeSwapIndex = labelIndex % 2; |
2 |
26 Feb 07 |
jari |
137 |
int experimentIndex = labelIndex / 2; |
2 |
26 Feb 07 |
jari |
138 |
String sampleName = data.getSampleName(adaptor.experimentIndices[experimentIndex]); |
2 |
26 Feb 07 |
jari |
139 |
switch(adaptor.cloneValueType){ |
2 |
26 Feb 07 |
jari |
140 |
|
2 |
26 Feb 07 |
jari |
141 |
case CGHBrowserModelAdaptor.CLONE_VALUES_DYE_SWAP: |
2 |
26 Feb 07 |
jari |
142 |
if(dyeSwapIndex == 0){ |
2 |
26 Feb 07 |
jari |
143 |
label = sampleName + " Cy3"; |
2 |
26 Feb 07 |
jari |
144 |
}else if(dyeSwapIndex == 1){ |
2 |
26 Feb 07 |
jari |
145 |
label = sampleName + " Cy5"; |
2 |
26 Feb 07 |
jari |
146 |
} |
2 |
26 Feb 07 |
jari |
147 |
break; |
2 |
26 Feb 07 |
jari |
148 |
case CGHBrowserModelAdaptor.CLONE_VALUES_LOG_AVERAGE_INVERTED: |
2 |
26 Feb 07 |
jari |
//label = data.getSampleName(experimentIndices[experimentIndex]); |
2 |
26 Feb 07 |
jari |
150 |
label = sampleName; |
2 |
26 Feb 07 |
jari |
151 |
break; |
2 |
26 Feb 07 |
jari |
152 |
case CGHBrowserModelAdaptor.CLONE_VALUES_LOG_DYE_SWAP: |
2 |
26 Feb 07 |
jari |
153 |
if(dyeSwapIndex == 0){ |
2 |
26 Feb 07 |
jari |
154 |
label = sampleName + " Cy3"; |
2 |
26 Feb 07 |
jari |
155 |
}else if(dyeSwapIndex == 1){ |
2 |
26 Feb 07 |
jari |
156 |
label = sampleName + " Cy5"; |
2 |
26 Feb 07 |
jari |
157 |
} |
2 |
26 Feb 07 |
jari |
158 |
break; |
2 |
26 Feb 07 |
jari |
159 |
case CGHBrowserModelAdaptor.CLONE_VALUES_P_SCORE: |
2 |
26 Feb 07 |
jari |
160 |
if(dyeSwapIndex == 0){ |
2 |
26 Feb 07 |
jari |
161 |
label = sampleName + " Cy3"; |
2 |
26 Feb 07 |
jari |
162 |
}else if(dyeSwapIndex == 1){ |
2 |
26 Feb 07 |
jari |
163 |
label = sampleName + " Cy5"; |
2 |
26 Feb 07 |
jari |
164 |
} |
2 |
26 Feb 07 |
jari |
165 |
break; |
2 |
26 Feb 07 |
jari |
166 |
} |
2 |
26 Feb 07 |
jari |
167 |
return label; |
2 |
26 Feb 07 |
jari |
168 |
} |
2 |
26 Feb 07 |
jari |
169 |
|
2 |
26 Feb 07 |
jari |
170 |
} |