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 |
* $RCSfile: MultipleArrayData.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.27 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/08/22 17:50:19 $ |
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 |
|
2 |
26 Feb 07 |
jari |
13 |
package org.tigr.microarray.mev; |
2 |
26 Feb 07 |
jari |
14 |
|
2 |
26 Feb 07 |
jari |
15 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.Frame; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.event.WindowEvent; |
2 |
26 Feb 07 |
jari |
19 |
import java.io.BufferedReader; |
2 |
26 Feb 07 |
jari |
20 |
import java.io.File; |
2 |
26 Feb 07 |
jari |
21 |
import java.io.FileReader; |
2 |
26 Feb 07 |
jari |
22 |
import java.io.IOException; |
2 |
26 Feb 07 |
jari |
23 |
import java.io.Serializable; |
2 |
26 Feb 07 |
jari |
24 |
import java.util.ArrayList; |
2 |
26 Feb 07 |
jari |
25 |
import java.util.Hashtable; |
2 |
26 Feb 07 |
jari |
26 |
import java.util.Iterator; |
2 |
26 Feb 07 |
jari |
27 |
import java.util.Properties; |
2 |
26 Feb 07 |
jari |
28 |
import java.util.StringTokenizer; |
2 |
26 Feb 07 |
jari |
29 |
import java.util.Vector; |
2 |
26 Feb 07 |
jari |
30 |
|
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
32 |
|
2 |
26 Feb 07 |
jari |
33 |
import org.tigr.microarray.mev.cgh.CGHDataGenerator.CGHCopyNumberCalculator; |
2 |
26 Feb 07 |
jari |
34 |
import org.tigr.microarray.mev.cgh.CGHDataGenerator.CGHCopyNumberCalculatorNoDyeSwap; |
2 |
26 Feb 07 |
jari |
35 |
import org.tigr.microarray.mev.cgh.CGHDataObj.AlterationRegion; |
2 |
26 Feb 07 |
jari |
36 |
import org.tigr.microarray.mev.cgh.CGHDataObj.AlterationRegions; |
2 |
26 Feb 07 |
jari |
37 |
import org.tigr.microarray.mev.cgh.CGHDataObj.AlterationRegionsComparator; |
2 |
26 Feb 07 |
jari |
38 |
import org.tigr.microarray.mev.cgh.CGHDataObj.CGHClone; |
2 |
26 Feb 07 |
jari |
39 |
import org.tigr.microarray.mev.cgh.CGHDataObj.Distribution; |
2 |
26 Feb 07 |
jari |
40 |
import org.tigr.microarray.mev.cgh.CGHDataObj.FlankingRegion; |
2 |
26 Feb 07 |
jari |
41 |
import org.tigr.microarray.mev.cgh.CGHDataObj.GeneDataSet; |
2 |
26 Feb 07 |
jari |
42 |
import org.tigr.microarray.mev.cgh.CGHDataObj.ICGHDataRegion; |
2 |
26 Feb 07 |
jari |
43 |
import org.tigr.microarray.mev.cgh.CGHDataObj.IGeneData; |
2 |
26 Feb 07 |
jari |
44 |
import org.tigr.microarray.mev.cgh.CGHDataObj.Cluster.Experiment.BacClonesExperimentParameters; |
2 |
26 Feb 07 |
jari |
45 |
import org.tigr.microarray.mev.cgh.CGHDataObj.Cluster.Experiment.CGHExperiment; |
2 |
26 Feb 07 |
jari |
46 |
import org.tigr.microarray.mev.cgh.CGHDataObj.Cluster.Experiment.DataRegionsExperimentParameters; |
2 |
26 Feb 07 |
jari |
47 |
import org.tigr.microarray.mev.cgh.CGHDataObj.Cluster.Experiment.GenesExperimentParameters; |
2 |
26 Feb 07 |
jari |
48 |
import org.tigr.microarray.mev.cluster.algorithm.AlgorithmData; |
2 |
26 Feb 07 |
jari |
49 |
import org.tigr.microarray.mev.cluster.algorithm.AlgorithmParameters; |
2 |
26 Feb 07 |
jari |
50 |
import org.tigr.microarray.mev.cluster.clusterUtil.Cluster; |
2 |
26 Feb 07 |
jari |
51 |
import org.tigr.microarray.mev.cluster.clusterUtil.ClusterRepository; |
2 |
26 Feb 07 |
jari |
52 |
import org.tigr.microarray.mev.cluster.gui.Experiment; |
2 |
26 Feb 07 |
jari |
53 |
import org.tigr.microarray.mev.cluster.gui.ICGHCloneValueMenu; |
2 |
26 Feb 07 |
jari |
54 |
import org.tigr.microarray.mev.cluster.gui.IData; |
2 |
26 Feb 07 |
jari |
55 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.DialogListener; |
2 |
26 Feb 07 |
jari |
56 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.Progress; |
2 |
26 Feb 07 |
jari |
57 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.normalization.IterativeLogMCNormInitDialog; |
2 |
26 Feb 07 |
jari |
58 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.normalization.LinRegNormInitDialog; |
2 |
26 Feb 07 |
jari |
59 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.normalization.RatioStatsNormInitDialog; |
2 |
26 Feb 07 |
jari |
60 |
|
2 |
26 Feb 07 |
jari |
//EH - state-saving |
2 |
26 Feb 07 |
jari |
62 |
import org.tigr.microarray.mev.persistence.MultipleArrayDataPersistenceDelegate; |
2 |
26 Feb 07 |
jari |
63 |
import org.tigr.microarray.mev.persistence.MultipleArrayDataState; |
2 |
26 Feb 07 |
jari |
64 |
|
2 |
26 Feb 07 |
jari |
65 |
import java.beans.PersistenceDelegate; |
2 |
26 Feb 07 |
jari |
66 |
import org.tigr.microarray.mev.file.StringSplitter; |
2 |
26 Feb 07 |
jari |
67 |
import org.tigr.microarray.util.Adjustment; |
2 |
26 Feb 07 |
jari |
68 |
import org.tigr.microarray.util.SlideDataSorter; |
2 |
26 Feb 07 |
jari |
69 |
import org.tigr.midas.engine.Parameter; |
2 |
26 Feb 07 |
jari |
70 |
import org.tigr.util.FloatMatrix; |
2 |
26 Feb 07 |
jari |
71 |
import org.tigr.util.QSort; |
2 |
26 Feb 07 |
jari |
72 |
|
2 |
26 Feb 07 |
jari |
73 |
import cern.jet.math.Arithmetic; |
2 |
26 Feb 07 |
jari |
74 |
import cern.jet.stat.Probability; |
2 |
26 Feb 07 |
jari |
75 |
|
2 |
26 Feb 07 |
jari |
76 |
|
2 |
26 Feb 07 |
jari |
77 |
public class MultipleArrayData implements IData { |
2 |
26 Feb 07 |
jari |
78 |
|
2 |
26 Feb 07 |
jari |
79 |
private ArrayList featuresList = new ArrayList(); |
2 |
26 Feb 07 |
jari |
80 |
private ArrayList indicesList = new ArrayList(); // array of int[]'s |
2 |
26 Feb 07 |
jari |
81 |
|
2 |
26 Feb 07 |
jari |
82 |
private ArrayList spotColors = new ArrayList(); // array of Colors |
2 |
26 Feb 07 |
jari |
83 |
private int[] colorIndices; |
2 |
26 Feb 07 |
jari |
84 |
private ArrayList experimentColors = new ArrayList(); //array of experiment colors |
2 |
26 Feb 07 |
jari |
85 |
private int [] experimentColorIndices; |
2 |
26 Feb 07 |
jari |
86 |
|
2 |
26 Feb 07 |
jari |
87 |
private Experiment experiment = null; |
2 |
26 Feb 07 |
jari |
88 |
|
2 |
26 Feb 07 |
jari |
89 |
private int dataType; |
2 |
26 Feb 07 |
jari |
90 |
|
2 |
26 Feb 07 |
jari |
91 |
private float maxCy3 = 0f; |
2 |
26 Feb 07 |
jari |
92 |
private float maxCy5 = 0f; |
2 |
26 Feb 07 |
jari |
93 |
private float maxRatio = 0f; |
2 |
26 Feb 07 |
jari |
94 |
private float minRatio = 0f; |
2 |
26 Feb 07 |
jari |
95 |
|
2 |
26 Feb 07 |
jari |
96 |
private float percentageCutoff = 0f; |
2 |
26 Feb 07 |
jari |
97 |
private boolean usePercentageCutoff = false; |
2 |
26 Feb 07 |
jari |
98 |
private boolean usePvaluePercentageCutoff = false; |
2 |
26 Feb 07 |
jari |
99 |
private boolean usePresentCallCutoff = false; |
2 |
26 Feb 07 |
jari |
100 |
private boolean useGCOSPercentCutoff = false; |
2 |
26 Feb 07 |
jari |
101 |
|
2 |
26 Feb 07 |
jari |
102 |
private boolean useVarianceFilter = false; |
2 |
26 Feb 07 |
jari |
103 |
private Properties varianceFilterProps; |
2 |
26 Feb 07 |
jari |
104 |
|
2 |
26 Feb 07 |
jari |
105 |
private float lowerCY3Cutoff = 0f; |
2 |
26 Feb 07 |
jari |
106 |
private float lowerCY5Cutoff = 0f; |
2 |
26 Feb 07 |
jari |
107 |
private boolean useLowerCutoffs = false; |
2 |
26 Feb 07 |
jari |
108 |
|
2 |
26 Feb 07 |
jari |
//wwang add for genepix filter |
2 |
26 Feb 07 |
jari |
110 |
private float genePixCutoff = 80f; |
2 |
26 Feb 07 |
jari |
111 |
private boolean useGenePixCutoffs = false; |
2 |
26 Feb 07 |
jari |
112 |
|
2 |
26 Feb 07 |
jari |
113 |
|
2 |
26 Feb 07 |
jari |
114 |
private Progress progressBar; |
2 |
26 Feb 07 |
jari |
115 |
private boolean normalizationAbort = false; |
2 |
26 Feb 07 |
jari |
116 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
118 |
private DetectionFilter detectionFilter; |
2 |
26 Feb 07 |
jari |
119 |
private FoldFilter foldFilter; |
2 |
26 Feb 07 |
jari |
120 |
private boolean useDetectionFilter = false; |
2 |
26 Feb 07 |
jari |
121 |
private boolean dfSet = false; |
2 |
26 Feb 07 |
jari |
122 |
private boolean ffSet = false; |
2 |
26 Feb 07 |
jari |
123 |
private boolean useFoldFilter = false; |
2 |
26 Feb 07 |
jari |
124 |
|
2 |
26 Feb 07 |
jari |
125 |
private ClusterRepository geneClusterRepository; |
2 |
26 Feb 07 |
jari |
126 |
private ClusterRepository expClusterRepository; |
2 |
26 Feb 07 |
jari |
127 |
|
2 |
26 Feb 07 |
jari |
128 |
private int logState = LOG; |
2 |
26 Feb 07 |
jari |
129 |
|
2 |
26 Feb 07 |
jari |
130 |
private boolean isMedianIntensities = false; |
2 |
26 Feb 07 |
jari |
131 |
|
2 |
26 Feb 07 |
jari |
//fields for maintaining the 'experiment to use' statu |
2 |
26 Feb 07 |
jari |
133 |
private boolean useMainData = true; |
2 |
26 Feb 07 |
jari |
134 |
private Experiment alternateExperiment = null; |
2 |
26 Feb 07 |
jari |
135 |
|
2 |
26 Feb 07 |
jari |
136 |
|
2 |
26 Feb 07 |
jari |
//EH |
2 |
26 Feb 07 |
jari |
138 |
MultipleArrayDataState mads; |
2 |
26 Feb 07 |
jari |
139 |
/** |
2 |
26 Feb 07 |
jari |
* List of all clones ordered by chromosome and then start position. |
2 |
26 Feb 07 |
jari |
* Raktim OCt 3, 2005 |
2 |
26 Feb 07 |
jari |
142 |
*/ |
2 |
26 Feb 07 |
jari |
143 |
ArrayList clones = new ArrayList(); |
2 |
26 Feb 07 |
jari |
144 |
/** |
2 |
26 Feb 07 |
jari |
* Start and stop index of each chromosome in clones ArrayList |
2 |
26 Feb 07 |
jari |
* Raktim OCt 3, 2005 |
2 |
26 Feb 07 |
jari |
147 |
*/ |
2 |
26 Feb 07 |
jari |
148 |
int[][] chromosomeIndices = new int[24][]; |
2 |
26 Feb 07 |
jari |
149 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Order that the samples are displayed |
2 |
26 Feb 07 |
jari |
* Raktim Oct 3, 2005 |
2 |
26 Feb 07 |
jari |
152 |
*/ |
2 |
26 Feb 07 |
jari |
153 |
int[] samplesOrder; |
2 |
26 Feb 07 |
jari |
154 |
/** |
2 |
26 Feb 07 |
jari |
* CGH private int cloneValueType and Distribution array; |
2 |
26 Feb 07 |
jari |
* Imported from Facade Class |
2 |
26 Feb 07 |
jari |
157 |
*/ |
2 |
26 Feb 07 |
jari |
158 |
private int cloneValueType; |
2 |
26 Feb 07 |
jari |
159 |
Distribution[] cloneDistributions; |
2 |
26 Feb 07 |
jari |
160 |
CGHCopyNumberCalculator copyNumberCalculator; |
2 |
26 Feb 07 |
jari |
161 |
ICGHDataRegion[][] annotations = new ICGHDataRegion[0][0]; |
2 |
26 Feb 07 |
jari |
162 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Very Important CGH variable, imported from older FCD class |
2 |
26 Feb 07 |
jari |
* gets set in fcd.getRatio(..), ctl.OnShowBrowser(..), CGHViewer.OnExperimentsINitialized(..) |
2 |
26 Feb 07 |
jari |
166 |
*/ |
2 |
26 Feb 07 |
jari |
167 |
boolean hasDyeSwap = false; |
2 |
26 Feb 07 |
jari |
168 |
public boolean CGHData = false; |
2 |
26 Feb 07 |
jari |
169 |
public boolean log2Data = false; |
2 |
26 Feb 07 |
jari |
170 |
public int CGH_SPECIES = TMEV.CGH_SPECIES_Undef; |
2 |
26 Feb 07 |
jari |
171 |
public boolean hasCloneDistribution = false; |
2 |
26 Feb 07 |
jari |
172 |
|
2 |
26 Feb 07 |
jari |
173 |
public MultipleArrayData(){mads = new MultipleArrayDataState();} |
2 |
26 Feb 07 |
jari |
174 |
/** |
2 |
26 Feb 07 |
jari |
* PersistenceDelegate constructor. This constructor can be used to recreate a |
2 |
26 Feb 07 |
jari |
* previously-stored MultipleArrayData. |
2 |
26 Feb 07 |
jari |
177 |
* |
2 |
26 Feb 07 |
jari |
* @param useMainData |
2 |
26 Feb 07 |
jari |
* @param percentageCutoff |
2 |
26 Feb 07 |
jari |
* @param usePercentageCutoffs |
2 |
26 Feb 07 |
jari |
* @param useVarianceFilter |
2 |
26 Feb 07 |
jari |
* @param useDetectionFilter |
2 |
26 Feb 07 |
jari |
* @param useFoldFilter |
2 |
26 Feb 07 |
jari |
* @param dfSet |
2 |
26 Feb 07 |
jari |
* @param ffSet |
2 |
26 Feb 07 |
jari |
* @param df |
2 |
26 Feb 07 |
jari |
* @param ff |
2 |
26 Feb 07 |
jari |
* @param isMedianIntensities |
2 |
26 Feb 07 |
jari |
* @param useLowerCutoffs |
2 |
26 Feb 07 |
jari |
* @param lowerCY3Cutoff |
2 |
26 Feb 07 |
jari |
* @param lowerCY5Cutoff |
2 |
26 Feb 07 |
jari |
* @param experimentColors |
2 |
26 Feb 07 |
jari |
* @param spotColors |
2 |
26 Feb 07 |
jari |
* @param currentSampleLabelKey |
2 |
26 Feb 07 |
jari |
* @param featuresList |
2 |
26 Feb 07 |
jari |
* @param hasDyeSwap |
2 |
26 Feb 07 |
jari |
* @param CGHData |
2 |
26 Feb 07 |
jari |
* @param log2Data |
2 |
26 Feb 07 |
jari |
* @param cgh_Sp |
2 |
26 Feb 07 |
jari |
* @param hasCloneDistribution |
2 |
26 Feb 07 |
jari |
* @param clones |
2 |
26 Feb 07 |
jari |
202 |
*/ |
2 |
26 Feb 07 |
jari |
203 |
public MultipleArrayData( |
2 |
26 Feb 07 |
jari |
204 |
Experiment experiment, |
2 |
26 Feb 07 |
jari |
205 |
Boolean useMainData, Experiment alternateExperiment, Float percentageCutoff, Boolean usePercentageCutoffs, |
2 |
26 Feb 07 |
jari |
206 |
Boolean useVarianceFilter, Boolean useDetectionFilter, Boolean useFoldFilter, |
2 |
26 Feb 07 |
jari |
207 |
Boolean dfSet, Boolean ffSet, DetectionFilter df, FoldFilter ff, Boolean isMedianIntensities, |
2 |
26 Feb 07 |
jari |
208 |
Boolean useLowerCutoffs, Float lowerCY3Cutoff, Float lowerCY5Cutoff, |
2 |
26 Feb 07 |
jari |
209 |
ArrayList experimentColors, ArrayList spotColors, |
2 |
26 Feb 07 |
jari |
210 |
String currentSampleLabelKey, ArrayList featuresList, Integer dataType, |
2 |
26 Feb 07 |
jari |
211 |
int[] samplesOrder, Boolean hasDyeSwap, Boolean CGHData, Boolean log2Data, ArrayList clones, Integer cgh_Sp, MultipleArrayDataState mads){ |
2 |
26 Feb 07 |
jari |
212 |
this.experiment = experiment; |
2 |
26 Feb 07 |
jari |
213 |
this.setFeaturesList(featuresList); |
2 |
26 Feb 07 |
jari |
214 |
this.alternateExperiment = alternateExperiment; |
2 |
26 Feb 07 |
jari |
215 |
this.useMainData = useMainData.booleanValue(); |
2 |
26 Feb 07 |
jari |
216 |
this.percentageCutoff = percentageCutoff.floatValue(); |
2 |
26 Feb 07 |
jari |
217 |
this.usePercentageCutoff = usePercentageCutoffs.booleanValue(); |
2 |
26 Feb 07 |
jari |
218 |
this.useVarianceFilter = useVarianceFilter.booleanValue(); |
2 |
26 Feb 07 |
jari |
219 |
this.useDetectionFilter = useDetectionFilter.booleanValue(); |
2 |
26 Feb 07 |
jari |
220 |
this.useFoldFilter = useFoldFilter.booleanValue(); |
2 |
26 Feb 07 |
jari |
221 |
this.samplesOrder = samplesOrder; |
2 |
26 Feb 07 |
jari |
222 |
this.dfSet = dfSet.booleanValue(); |
2 |
26 Feb 07 |
jari |
223 |
if(dfSet.booleanValue()) |
2 |
26 Feb 07 |
jari |
224 |
this.detectionFilter = df; |
2 |
26 Feb 07 |
jari |
225 |
this.ffSet = ffSet.booleanValue(); |
2 |
26 Feb 07 |
jari |
226 |
if(ffSet.booleanValue()) |
2 |
26 Feb 07 |
jari |
227 |
this.foldFilter = ff; |
2 |
26 Feb 07 |
jari |
228 |
this.isMedianIntensities = isMedianIntensities.booleanValue(); |
2 |
26 Feb 07 |
jari |
229 |
this.useLowerCutoffs = useLowerCutoffs.booleanValue(); |
2 |
26 Feb 07 |
jari |
230 |
this.lowerCY3Cutoff = lowerCY3Cutoff.floatValue(); |
2 |
26 Feb 07 |
jari |
231 |
this.lowerCY5Cutoff = lowerCY5Cutoff.floatValue(); |
2 |
26 Feb 07 |
jari |
232 |
this.experimentColors = experimentColors; |
2 |
26 Feb 07 |
jari |
233 |
this.spotColors = spotColors; |
2 |
26 Feb 07 |
jari |
234 |
setSampleLabelKey(currentSampleLabelKey); |
2 |
26 Feb 07 |
jari |
235 |
try{ |
2 |
26 Feb 07 |
jari |
236 |
setDataType(dataType.intValue()); |
2 |
26 Feb 07 |
jari |
237 |
} catch (Exception e){e.printStackTrace();} |
2 |
26 Feb 07 |
jari |
238 |
|
2 |
26 Feb 07 |
jari |
//Raktim 4/11. SS modifications |
2 |
26 Feb 07 |
jari |
240 |
this.hasDyeSwap = hasDyeSwap.booleanValue(); |
2 |
26 Feb 07 |
jari |
241 |
this.CGHData = CGHData.booleanValue(); |
2 |
26 Feb 07 |
jari |
242 |
this.log2Data = log2Data.booleanValue(); |
2 |
26 Feb 07 |
jari |
243 |
this.clones = clones; |
2 |
26 Feb 07 |
jari |
244 |
this.CGH_SPECIES = cgh_Sp.intValue(); |
2 |
26 Feb 07 |
jari |
245 |
loadMADS(mads); |
2 |
26 Feb 07 |
jari |
246 |
} |
2 |
26 Feb 07 |
jari |
247 |
/** |
2 |
26 Feb 07 |
jari |
* @param mads2 |
2 |
26 Feb 07 |
jari |
249 |
*/ |
2 |
26 Feb 07 |
jari |
250 |
private void loadMADS(MultipleArrayDataState mads) { |
2 |
26 Feb 07 |
jari |
251 |
this.mads = mads; |
2 |
26 Feb 07 |
jari |
252 |
setMaxCy3(mads.getMaxCY3()); |
2 |
26 Feb 07 |
jari |
253 |
setMaxCy5(mads.getMaxCY5()); |
2 |
26 Feb 07 |
jari |
254 |
} |
2 |
26 Feb 07 |
jari |
255 |
public MultipleArrayDataState getMultipleArrayDataState(){return mads;} |
2 |
26 Feb 07 |
jari |
256 |
|
2 |
26 Feb 07 |
jari |
257 |
|
2 |
26 Feb 07 |
jari |
258 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the data objects feature list |
2 |
26 Feb 07 |
jari |
260 |
*/ |
2 |
26 Feb 07 |
jari |
261 |
public void setFeaturesList(ArrayList list) { |
2 |
26 Feb 07 |
jari |
262 |
this.featuresList = list; |
2 |
26 Feb 07 |
jari |
263 |
for(int i=0; i<featuresList.size(); i++){ |
2 |
26 Feb 07 |
jari |
264 |
indicesList.add(createIndices((ISlideData)featuresList.get(i))); |
2 |
26 Feb 07 |
jari |
265 |
} |
2 |
26 Feb 07 |
jari |
266 |
updateSpotColors(); |
2 |
26 Feb 07 |
jari |
267 |
updateExperimentColors(); |
2 |
26 Feb 07 |
jari |
268 |
this.experiment = this.createExperiment(); |
2 |
26 Feb 07 |
jari |
269 |
} |
2 |
26 Feb 07 |
jari |
270 |
|
2 |
26 Feb 07 |
jari |
271 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the geneClusterRepository |
2 |
26 Feb 07 |
jari |
273 |
*/ |
2 |
26 Feb 07 |
jari |
274 |
public void setGeneClusterRepository(ClusterRepository rep){ |
2 |
26 Feb 07 |
jari |
275 |
this.geneClusterRepository = rep; |
2 |
26 Feb 07 |
jari |
276 |
} |
2 |
26 Feb 07 |
jari |
277 |
|
2 |
26 Feb 07 |
jari |
278 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the experimentClusterRepository |
2 |
26 Feb 07 |
jari |
280 |
*/ |
2 |
26 Feb 07 |
jari |
281 |
public void setExperimentClusterRepository(ClusterRepository rep){ |
2 |
26 Feb 07 |
jari |
282 |
this.expClusterRepository = rep; |
2 |
26 Feb 07 |
jari |
283 |
} |
2 |
26 Feb 07 |
jari |
284 |
|
2 |
26 Feb 07 |
jari |
285 |
|
2 |
26 Feb 07 |
jari |
286 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the main data marker |
2 |
26 Feb 07 |
jari |
288 |
*/ |
2 |
26 Feb 07 |
jari |
289 |
public void setUseMainData(boolean useMainDataSelection) { |
2 |
26 Feb 07 |
jari |
290 |
this.useMainData = useMainDataSelection; |
2 |
26 Feb 07 |
jari |
291 |
if(this.useMainData) |
2 |
26 Feb 07 |
jari |
292 |
this.alternateExperiment = null; |
2 |
26 Feb 07 |
jari |
293 |
} |
2 |
26 Feb 07 |
jari |
294 |
public boolean getUseMainData() { |
2 |
26 Feb 07 |
jari |
295 |
return useMainData; |
2 |
26 Feb 07 |
jari |
296 |
} |
2 |
26 Feb 07 |
jari |
297 |
/** |
2 |
26 Feb 07 |
jari |
* Set alternate experiment |
2 |
26 Feb 07 |
jari |
299 |
*/ |
2 |
26 Feb 07 |
jari |
300 |
public void setAlternateExperiment(Experiment e) { |
2 |
26 Feb 07 |
jari |
301 |
this.alternateExperiment = e; |
2 |
26 Feb 07 |
jari |
302 |
} |
2 |
26 Feb 07 |
jari |
303 |
/** |
2 |
26 Feb 07 |
jari |
* EH - used by MulipleArrayViewer to get AlternateExperiment |
2 |
26 Feb 07 |
jari |
* so it can be stored in a saved state file |
2 |
26 Feb 07 |
jari |
306 |
*/ |
2 |
26 Feb 07 |
jari |
307 |
public Experiment getAlternateExperiment() { |
2 |
26 Feb 07 |
jari |
308 |
return alternateExperiment; |
2 |
26 Feb 07 |
jari |
309 |
} |
2 |
26 Feb 07 |
jari |
310 |
|
2 |
26 Feb 07 |
jari |
311 |
|
2 |
26 Feb 07 |
jari |
312 |
public void constructAndSetAlternateExperiment(Experiment coreExperiment, int [] clusterIndices, int clusterType) { |
2 |
26 Feb 07 |
jari |
313 |
int [] origRowIndices = coreExperiment.getRowMappingArrayCopy(); |
2 |
26 Feb 07 |
jari |
314 |
int [] origColIndices = coreExperiment.getColumnIndicesCopy(); |
2 |
26 Feb 07 |
jari |
315 |
FloatMatrix coreMatrix = coreExperiment.getMatrix(); |
2 |
26 Feb 07 |
jari |
316 |
|
2 |
26 Feb 07 |
jari |
317 |
FloatMatrix newMatrix; |
2 |
26 Feb 07 |
jari |
318 |
int [] newRowIndices; |
2 |
26 Feb 07 |
jari |
319 |
int [] newColIndices; |
2 |
26 Feb 07 |
jari |
320 |
|
2 |
26 Feb 07 |
jari |
321 |
if(clusterType == Cluster.GENE_CLUSTER) { |
2 |
26 Feb 07 |
jari |
322 |
newMatrix = new FloatMatrix(clusterIndices.length, origColIndices.length); |
2 |
26 Feb 07 |
jari |
323 |
newRowIndices = new int[clusterIndices.length]; |
2 |
26 Feb 07 |
jari |
324 |
|
2 |
26 Feb 07 |
jari |
325 |
for(int row = 0; row < clusterIndices.length; row++) { |
2 |
26 Feb 07 |
jari |
326 |
for(int col = 0; col < origColIndices.length; col++) { |
2 |
26 Feb 07 |
jari |
327 |
newMatrix.set(row, col, coreMatrix.get(clusterIndices[row], col)); |
2 |
26 Feb 07 |
jari |
328 |
} |
2 |
26 Feb 07 |
jari |
329 |
newRowIndices[row] = origRowIndices[clusterIndices[row]]; |
2 |
26 Feb 07 |
jari |
330 |
} |
2 |
26 Feb 07 |
jari |
//EH |
2 |
26 Feb 07 |
jari |
332 |
setAlternateExperiment(new Experiment(newMatrix, origColIndices, newRowIndices)); |
2 |
26 Feb 07 |
jari |
333 |
this.useMainData = false; |
2 |
26 Feb 07 |
jari |
334 |
|
2 |
26 Feb 07 |
jari |
335 |
} else { |
2 |
26 Feb 07 |
jari |
336 |
|
2 |
26 Feb 07 |
jari |
337 |
newMatrix = new FloatMatrix(origRowIndices.length, clusterIndices.length); |
2 |
26 Feb 07 |
jari |
338 |
newColIndices = new int[clusterIndices.length]; |
2 |
26 Feb 07 |
jari |
339 |
int colCount = 0; |
2 |
26 Feb 07 |
jari |
340 |
|
2 |
26 Feb 07 |
jari |
341 |
for(int col = 0; col < clusterIndices.length; col++) { |
2 |
26 Feb 07 |
jari |
342 |
for(int row = 0; row < origRowIndices.length; row++) { |
2 |
26 Feb 07 |
jari |
343 |
newMatrix.set(row, col, coreMatrix.get(row, clusterIndices[col])); |
2 |
26 Feb 07 |
jari |
344 |
} |
2 |
26 Feb 07 |
jari |
345 |
newColIndices[col] = origColIndices[clusterIndices[col]]; |
2 |
26 Feb 07 |
jari |
346 |
} |
2 |
26 Feb 07 |
jari |
//EH |
2 |
26 Feb 07 |
jari |
348 |
setAlternateExperiment(new Experiment(newMatrix, newColIndices, origRowIndices)); |
2 |
26 Feb 07 |
jari |
349 |
this.useMainData = false; |
2 |
26 Feb 07 |
jari |
350 |
} |
2 |
26 Feb 07 |
jari |
351 |
|
2 |
26 Feb 07 |
jari |
352 |
} |
2 |
26 Feb 07 |
jari |
353 |
|
2 |
26 Feb 07 |
jari |
354 |
/** |
2 |
26 Feb 07 |
jari |
* Returns number of loaded microarrays. |
2 |
26 Feb 07 |
jari |
356 |
*/ |
2 |
26 Feb 07 |
jari |
357 |
public int getFeaturesCount() { |
2 |
26 Feb 07 |
jari |
358 |
return featuresList.size(); |
2 |
26 Feb 07 |
jari |
359 |
} |
2 |
26 Feb 07 |
jari |
360 |
|
2 |
26 Feb 07 |
jari |
361 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a size of first loaded microarray. |
2 |
26 Feb 07 |
jari |
363 |
*/ |
2 |
26 Feb 07 |
jari |
364 |
public int getFeaturesSize() { |
2 |
26 Feb 07 |
jari |
365 |
if (featuresList.size() == 0) { |
2 |
26 Feb 07 |
jari |
366 |
return 0; |
2 |
26 Feb 07 |
jari |
367 |
} |
2 |
26 Feb 07 |
jari |
368 |
return((ISlideData)featuresList.get(0)).getSize(); |
2 |
26 Feb 07 |
jari |
369 |
} |
2 |
26 Feb 07 |
jari |
370 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim. For CGH Functions |
2 |
26 Feb 07 |
jari |
* Returns a reference to the data objects feature list |
2 |
26 Feb 07 |
jari |
* Also used for state-saving. |
2 |
26 Feb 07 |
jari |
374 |
*/ |
2 |
26 Feb 07 |
jari |
375 |
public ArrayList getFeaturesList() { |
2 |
26 Feb 07 |
jari |
376 |
return this.featuresList; |
2 |
26 Feb 07 |
jari |
377 |
} |
2 |
26 Feb 07 |
jari |
378 |
|
2 |
26 Feb 07 |
jari |
379 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the percentage cutoff value. |
2 |
26 Feb 07 |
jari |
381 |
*/ |
2 |
26 Feb 07 |
jari |
382 |
public float getPercentageCutoff() { |
2 |
26 Feb 07 |
jari |
383 |
return percentageCutoff; |
2 |
26 Feb 07 |
jari |
384 |
} |
2 |
26 Feb 07 |
jari |
385 |
|
2 |
26 Feb 07 |
jari |
386 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a percentage cutoff value. |
2 |
26 Feb 07 |
jari |
388 |
*/ |
2 |
26 Feb 07 |
jari |
389 |
public void setPercentageCutoff(float value) { |
2 |
26 Feb 07 |
jari |
390 |
percentageCutoff = value; |
2 |
26 Feb 07 |
jari |
391 |
if (isPercentageCutoff()) { |
2 |
26 Feb 07 |
jari |
392 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
393 |
} |
2 |
26 Feb 07 |
jari |
394 |
} |
2 |
26 Feb 07 |
jari |
395 |
public void setPvaluePercentageCutoff(float value) { |
2 |
26 Feb 07 |
jari |
396 |
percentageCutoff = value; |
2 |
26 Feb 07 |
jari |
397 |
if (isPvaluePercentageCutoff()) { |
2 |
26 Feb 07 |
jari |
398 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
399 |
} |
2 |
26 Feb 07 |
jari |
400 |
} |
2 |
26 Feb 07 |
jari |
401 |
|
2 |
26 Feb 07 |
jari |
402 |
public void setPresenCallCutoff(float value) { |
2 |
26 Feb 07 |
jari |
403 |
percentageCutoff = value; |
2 |
26 Feb 07 |
jari |
404 |
if (isPresentCallCutoff()) { |
2 |
26 Feb 07 |
jari |
//System.out.print("hooooo"); |
2 |
26 Feb 07 |
jari |
406 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
407 |
} |
2 |
26 Feb 07 |
jari |
408 |
} |
2 |
26 Feb 07 |
jari |
409 |
|
2 |
26 Feb 07 |
jari |
410 |
|
2 |
26 Feb 07 |
jari |
411 |
public void setVarianceFilter(Properties props) { |
2 |
26 Feb 07 |
jari |
412 |
this.varianceFilterProps = props; |
2 |
26 Feb 07 |
jari |
413 |
if(props.getProperty("Filter Enabled").equals("true")) |
2 |
26 Feb 07 |
jari |
414 |
this.useVarianceFilter = true; |
2 |
26 Feb 07 |
jari |
415 |
else |
2 |
26 Feb 07 |
jari |
416 |
this.useVarianceFilter = false; |
2 |
26 Feb 07 |
jari |
417 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
418 |
} |
2 |
26 Feb 07 |
jari |
419 |
|
2 |
26 Feb 07 |
jari |
420 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a use percentage cutoff value. |
2 |
26 Feb 07 |
jari |
422 |
*/ |
2 |
26 Feb 07 |
jari |
423 |
public void setUsePercentageCutoff(boolean value) { |
2 |
26 Feb 07 |
jari |
424 |
if (usePercentageCutoff == value) { |
2 |
26 Feb 07 |
jari |
425 |
return; |
2 |
26 Feb 07 |
jari |
426 |
} |
2 |
26 Feb 07 |
jari |
427 |
usePercentageCutoff = value; |
2 |
26 Feb 07 |
jari |
428 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
429 |
} |
2 |
26 Feb 07 |
jari |
430 |
|
2 |
26 Feb 07 |
jari |
431 |
public void setUsePvaluePercentageCutoff(boolean value) { |
2 |
26 Feb 07 |
jari |
432 |
if (usePvaluePercentageCutoff == value) { |
2 |
26 Feb 07 |
jari |
433 |
return; |
2 |
26 Feb 07 |
jari |
434 |
} |
2 |
26 Feb 07 |
jari |
435 |
usePvaluePercentageCutoff = value; |
2 |
26 Feb 07 |
jari |
436 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
437 |
} |
2 |
26 Feb 07 |
jari |
438 |
public void setUsePresentCutoff(boolean value) { |
2 |
26 Feb 07 |
jari |
439 |
if (usePresentCallCutoff == value) { |
2 |
26 Feb 07 |
jari |
440 |
return; |
2 |
26 Feb 07 |
jari |
441 |
} |
2 |
26 Feb 07 |
jari |
442 |
usePresentCallCutoff = value; |
2 |
26 Feb 07 |
jari |
443 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
444 |
} |
2 |
26 Feb 07 |
jari |
445 |
|
2 |
26 Feb 07 |
jari |
446 |
/** |
2 |
26 Feb 07 |
jari |
*wwang |
2 |
26 Feb 07 |
jari |
* Sets a use percentage cutoff value. |
2 |
26 Feb 07 |
jari |
449 |
*/ |
2 |
26 Feb 07 |
jari |
450 |
|
2 |
26 Feb 07 |
jari |
451 |
public void setUseGCOSPercentageCutoff(boolean value) { |
2 |
26 Feb 07 |
jari |
452 |
if (useGCOSPercentCutoff == value) { |
2 |
26 Feb 07 |
jari |
453 |
return; |
2 |
26 Feb 07 |
jari |
454 |
} |
2 |
26 Feb 07 |
jari |
455 |
useGCOSPercentCutoff = value; |
2 |
26 Feb 07 |
jari |
456 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
457 |
} |
2 |
26 Feb 07 |
jari |
458 |
public void setUseGenePixCutoff(boolean value) { |
2 |
26 Feb 07 |
jari |
459 |
if (useGenePixCutoffs == value) { |
2 |
26 Feb 07 |
jari |
460 |
return; |
2 |
26 Feb 07 |
jari |
461 |
} |
2 |
26 Feb 07 |
jari |
462 |
useGenePixCutoffs = value; |
2 |
26 Feb 07 |
jari |
463 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
464 |
} |
2 |
26 Feb 07 |
jari |
//pcahan for affy ******************************************** |
2 |
26 Feb 07 |
jari |
466 |
|
2 |
26 Feb 07 |
jari |
467 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a use detection Filter value. |
2 |
26 Feb 07 |
jari |
469 |
*/ |
2 |
26 Feb 07 |
jari |
470 |
public void setUseDetectionFilter(boolean value) { |
2 |
26 Feb 07 |
jari |
471 |
if (useDetectionFilter == value) { |
2 |
26 Feb 07 |
jari |
472 |
return; |
2 |
26 Feb 07 |
jari |
473 |
} |
2 |
26 Feb 07 |
jari |
474 |
useDetectionFilter = value; |
2 |
26 Feb 07 |
jari |
475 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
476 |
} |
2 |
26 Feb 07 |
jari |
477 |
|
2 |
26 Feb 07 |
jari |
478 |
public void setUseFoldFilter(boolean value) { |
2 |
26 Feb 07 |
jari |
479 |
if (useFoldFilter == value) { |
2 |
26 Feb 07 |
jari |
480 |
return; |
2 |
26 Feb 07 |
jari |
481 |
} |
2 |
26 Feb 07 |
jari |
482 |
useFoldFilter = value; |
2 |
26 Feb 07 |
jari |
483 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
484 |
} |
2 |
26 Feb 07 |
jari |
485 |
|
2 |
26 Feb 07 |
jari |
486 |
public void setdfSet(boolean b) { |
2 |
26 Feb 07 |
jari |
487 |
dfSet = b; |
2 |
26 Feb 07 |
jari |
488 |
} |
2 |
26 Feb 07 |
jari |
489 |
|
2 |
26 Feb 07 |
jari |
490 |
public boolean getdfSet(){ |
2 |
26 Feb 07 |
jari |
491 |
return dfSet; |
2 |
26 Feb 07 |
jari |
492 |
} |
2 |
26 Feb 07 |
jari |
493 |
|
2 |
26 Feb 07 |
jari |
494 |
public void setffSet(boolean b) { |
2 |
26 Feb 07 |
jari |
495 |
ffSet = b; |
2 |
26 Feb 07 |
jari |
496 |
} |
2 |
26 Feb 07 |
jari |
497 |
|
2 |
26 Feb 07 |
jari |
498 |
public boolean getffSet(){ |
2 |
26 Feb 07 |
jari |
499 |
return ffSet; |
2 |
26 Feb 07 |
jari |
500 |
} |
2 |
26 Feb 07 |
jari |
501 |
|
2 |
26 Feb 07 |
jari |
502 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the use DetectionFilter. |
2 |
26 Feb 07 |
jari |
504 |
*/ |
2 |
26 Feb 07 |
jari |
505 |
public boolean isDetectionFilter() { |
2 |
26 Feb 07 |
jari |
506 |
return useDetectionFilter; |
2 |
26 Feb 07 |
jari |
507 |
} |
2 |
26 Feb 07 |
jari |
508 |
|
2 |
26 Feb 07 |
jari |
509 |
public boolean isFoldFilter() { |
2 |
26 Feb 07 |
jari |
510 |
return useFoldFilter; |
2 |
26 Feb 07 |
jari |
511 |
} |
2 |
26 Feb 07 |
jari |
512 |
|
2 |
26 Feb 07 |
jari |
513 |
public boolean isGenePixFilter() { |
2 |
26 Feb 07 |
jari |
514 |
return useGenePixCutoffs; |
2 |
26 Feb 07 |
jari |
515 |
} |
2 |
26 Feb 07 |
jari |
516 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the detection filter. Change from bool -> detection filter class. |
2 |
26 Feb 07 |
jari |
518 |
*/ |
2 |
26 Feb 07 |
jari |
519 |
public DetectionFilter getDetectionFilter() { |
2 |
26 Feb 07 |
jari |
520 |
return detectionFilter; |
2 |
26 Feb 07 |
jari |
521 |
} |
2 |
26 Feb 07 |
jari |
522 |
|
2 |
26 Feb 07 |
jari |
523 |
public FoldFilter getFoldFilter() { |
2 |
26 Feb 07 |
jari |
524 |
return foldFilter; |
2 |
26 Feb 07 |
jari |
525 |
} |
2 |
26 Feb 07 |
jari |
526 |
|
2 |
26 Feb 07 |
jari |
527 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the detection filter values. |
2 |
26 Feb 07 |
jari |
529 |
* |
2 |
26 Feb 07 |
jari |
* public void setDetectionFilter(boolean use_filter) { |
2 |
26 Feb 07 |
jari |
* detectionFilter = use_filter; |
2 |
26 Feb 07 |
jari |
* if (isDetectionFilter()) { |
2 |
26 Feb 07 |
jari |
* this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
534 |
* } |
2 |
26 Feb 07 |
jari |
535 |
* } |
2 |
26 Feb 07 |
jari |
536 |
*/ |
2 |
26 Feb 07 |
jari |
537 |
public void setDetectionFilter(DetectionFilter filter) { |
2 |
26 Feb 07 |
jari |
538 |
detectionFilter = filter; |
2 |
26 Feb 07 |
jari |
539 |
if (isDetectionFilter()) { |
2 |
26 Feb 07 |
jari |
540 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
541 |
} |
2 |
26 Feb 07 |
jari |
542 |
} |
2 |
26 Feb 07 |
jari |
//add by wwang |
2 |
26 Feb 07 |
jari |
544 |
public void setGenePixCutoff(float value){ |
2 |
26 Feb 07 |
jari |
545 |
useGenePixCutoffs=true; |
2 |
26 Feb 07 |
jari |
546 |
percentageCutoff = value; |
2 |
26 Feb 07 |
jari |
547 |
if(isGenePixFilter()) |
2 |
26 Feb 07 |
jari |
548 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
549 |
} |
2 |
26 Feb 07 |
jari |
550 |
public void setFoldFilter(FoldFilter filter) { |
2 |
26 Feb 07 |
jari |
551 |
foldFilter = filter; |
2 |
26 Feb 07 |
jari |
552 |
if (isFoldFilter()) { |
2 |
26 Feb 07 |
jari |
553 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
554 |
} |
2 |
26 Feb 07 |
jari |
555 |
} |
2 |
26 Feb 07 |
jari |
556 |
|
2 |
26 Feb 07 |
jari |
557 |
/* |
2 |
26 Feb 07 |
jari |
pcahan |
2 |
26 Feb 07 |
jari |
Also want for affy data, want to retrieve detection for each chip*/ |
2 |
26 Feb 07 |
jari |
560 |
public String getDetection(int column, int row) { |
2 |
26 Feb 07 |
jari |
561 |
if (featuresList.size() == 0) { |
2 |
26 Feb 07 |
jari |
562 |
return ""; |
2 |
26 Feb 07 |
jari |
563 |
} |
2 |
26 Feb 07 |
jari |
564 |
|
2 |
26 Feb 07 |
jari |
565 |
return ((ISlideData)(featuresList.get(column))).getDetection(row); |
2 |
26 Feb 07 |
jari |
566 |
} |
2 |
26 Feb 07 |
jari |
567 |
|
2 |
26 Feb 07 |
jari |
// end affy specific methods ******************************************** |
2 |
26 Feb 07 |
jari |
569 |
|
2 |
26 Feb 07 |
jari |
//wwang add for p-value filter |
2 |
26 Feb 07 |
jari |
571 |
public float getPvalue(int column, int row) { |
2 |
26 Feb 07 |
jari |
572 |
if (featuresList.size() == 0) { |
2 |
26 Feb 07 |
jari |
573 |
return 0.0f; |
2 |
26 Feb 07 |
jari |
574 |
} |
2 |
26 Feb 07 |
jari |
575 |
return ((ISlideData)(featuresList.get(column))).getPvalue(row); |
2 |
26 Feb 07 |
jari |
576 |
} |
2 |
26 Feb 07 |
jari |
577 |
public int getGenePixFlags(int column, int row) { |
2 |
26 Feb 07 |
jari |
578 |
if (featuresList.size() == 0) { |
2 |
26 Feb 07 |
jari |
579 |
return 0; |
2 |
26 Feb 07 |
jari |
580 |
} |
2 |
26 Feb 07 |
jari |
581 |
|
2 |
26 Feb 07 |
jari |
582 |
return ((ISlideData)(featuresList.get(column))).getGenePixFlags(row); |
2 |
26 Feb 07 |
jari |
583 |
} |
2 |
26 Feb 07 |
jari |
584 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the use percentage cutoff value. |
2 |
26 Feb 07 |
jari |
586 |
*/ |
2 |
26 Feb 07 |
jari |
587 |
public boolean isPercentageCutoff() { |
2 |
26 Feb 07 |
jari |
588 |
return usePercentageCutoff; |
2 |
26 Feb 07 |
jari |
589 |
} |
2 |
26 Feb 07 |
jari |
590 |
public boolean isPvaluePercentageCutoff() { |
2 |
26 Feb 07 |
jari |
591 |
return usePvaluePercentageCutoff; |
2 |
26 Feb 07 |
jari |
592 |
} |
2 |
26 Feb 07 |
jari |
593 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the use percentage cutoff value. |
2 |
26 Feb 07 |
jari |
595 |
*/ |
2 |
26 Feb 07 |
jari |
596 |
public boolean isPresentCallCutoff() { |
2 |
26 Feb 07 |
jari |
597 |
return usePresentCallCutoff; |
2 |
26 Feb 07 |
jari |
598 |
} |
2 |
26 Feb 07 |
jari |
599 |
|
2 |
26 Feb 07 |
jari |
600 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the use percentage cutoff value. |
2 |
26 Feb 07 |
jari |
602 |
*/ |
2 |
26 Feb 07 |
jari |
603 |
public boolean isGCOSPercentCutoff() { |
2 |
26 Feb 07 |
jari |
604 |
return useGCOSPercentCutoff; |
2 |
26 Feb 07 |
jari |
605 |
} |
2 |
26 Feb 07 |
jari |
606 |
|
2 |
26 Feb 07 |
jari |
607 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the use percentage cutoff value. |
2 |
26 Feb 07 |
jari |
609 |
*/ |
2 |
26 Feb 07 |
jari |
610 |
public boolean isVarianceFilter() { |
2 |
26 Feb 07 |
jari |
611 |
return useVarianceFilter; |
2 |
26 Feb 07 |
jari |
612 |
} |
2 |
26 Feb 07 |
jari |
613 |
|
2 |
26 Feb 07 |
jari |
614 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the lower CY3 cutoff value. |
2 |
26 Feb 07 |
jari |
616 |
*/ |
2 |
26 Feb 07 |
jari |
617 |
public float getLowerCY3Cutoff() { |
2 |
26 Feb 07 |
jari |
618 |
return lowerCY3Cutoff; |
2 |
26 Feb 07 |
jari |
619 |
} |
2 |
26 Feb 07 |
jari |
620 |
|
2 |
26 Feb 07 |
jari |
621 |
/** |
2 |
26 Feb 07 |
jari |
* Sets marker for median intensities |
2 |
26 Feb 07 |
jari |
623 |
*/ |
2 |
26 Feb 07 |
jari |
624 |
public void setMedianIntensities(boolean areMedians) { |
2 |
26 Feb 07 |
jari |
625 |
this.isMedianIntensities = areMedians; |
2 |
26 Feb 07 |
jari |
626 |
} |
2 |
26 Feb 07 |
jari |
627 |
|
2 |
26 Feb 07 |
jari |
628 |
/** |
2 |
26 Feb 07 |
jari |
* Returns true if intensities are median intensities |
2 |
26 Feb 07 |
jari |
630 |
*/ |
2 |
26 Feb 07 |
jari |
631 |
public boolean areMedianIntensities() { |
2 |
26 Feb 07 |
jari |
632 |
return isMedianIntensities; |
2 |
26 Feb 07 |
jari |
633 |
} |
2 |
26 Feb 07 |
jari |
634 |
|
2 |
26 Feb 07 |
jari |
635 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the lower cutoff values. |
2 |
26 Feb 07 |
jari |
637 |
*/ |
2 |
26 Feb 07 |
jari |
638 |
public void setLowerCutoffs(float lowerCY3, float lowerCY5) { |
2 |
26 Feb 07 |
jari |
639 |
lowerCY3Cutoff = lowerCY3; |
2 |
26 Feb 07 |
jari |
640 |
lowerCY5Cutoff = lowerCY5; |
2 |
26 Feb 07 |
jari |
641 |
if (isLowerCutoffs()) { |
2 |
26 Feb 07 |
jari |
642 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
643 |
} |
2 |
26 Feb 07 |
jari |
644 |
} |
2 |
26 Feb 07 |
jari |
645 |
|
2 |
26 Feb 07 |
jari |
646 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the lower CY5 cutoff value. |
2 |
26 Feb 07 |
jari |
648 |
*/ |
2 |
26 Feb 07 |
jari |
649 |
public float getLowerCY5Cutoff() { |
2 |
26 Feb 07 |
jari |
650 |
return lowerCY5Cutoff; |
2 |
26 Feb 07 |
jari |
651 |
} |
2 |
26 Feb 07 |
jari |
652 |
|
2 |
26 Feb 07 |
jari |
653 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the use lower cutoff attribute flag. |
2 |
26 Feb 07 |
jari |
655 |
*/ |
2 |
26 Feb 07 |
jari |
656 |
public void setUseLowerCutoffs(boolean value) { |
2 |
26 Feb 07 |
jari |
657 |
if (useLowerCutoffs == value) { |
2 |
26 Feb 07 |
jari |
658 |
return; |
2 |
26 Feb 07 |
jari |
659 |
} |
2 |
26 Feb 07 |
jari |
660 |
useLowerCutoffs = value; |
2 |
26 Feb 07 |
jari |
661 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
662 |
} |
2 |
26 Feb 07 |
jari |
663 |
|
2 |
26 Feb 07 |
jari |
664 |
/** |
2 |
26 Feb 07 |
jari |
* Return the use lower cutoff flag. |
2 |
26 Feb 07 |
jari |
666 |
*/ |
2 |
26 Feb 07 |
jari |
667 |
public boolean isLowerCutoffs() { |
2 |
26 Feb 07 |
jari |
668 |
return useLowerCutoffs; |
2 |
26 Feb 07 |
jari |
669 |
} |
2 |
26 Feb 07 |
jari |
670 |
|
2 |
26 Feb 07 |
jari |
671 |
/** |
2 |
26 Feb 07 |
jari |
* Returns CY3 value for specified row and column. |
2 |
26 Feb 07 |
jari |
673 |
*/ |
2 |
26 Feb 07 |
jari |
674 |
public float getCY3(int column, int row) { |
2 |
26 Feb 07 |
jari |
675 |
ISlideData slideData = (ISlideData)featuresList.get(column); |
2 |
26 Feb 07 |
jari |
676 |
return slideData.getCY3(row); |
2 |
26 Feb 07 |
jari |
677 |
} |
2 |
26 Feb 07 |
jari |
678 |
|
2 |
26 Feb 07 |
jari |
679 |
/** |
2 |
26 Feb 07 |
jari |
* Returns CY3 value for specified row and column. |
2 |
26 Feb 07 |
jari |
681 |
*/ |
2 |
26 Feb 07 |
jari |
682 |
public float getCY5(int column, int row) { |
2 |
26 Feb 07 |
jari |
683 |
ISlideData slideData = (ISlideData)featuresList.get(column); |
2 |
26 Feb 07 |
jari |
684 |
return slideData.getCY5(row); |
2 |
26 Feb 07 |
jari |
685 |
} |
2 |
26 Feb 07 |
jari |
686 |
|
2 |
26 Feb 07 |
jari |
687 |
/** |
2 |
26 Feb 07 |
jari |
* Returns ratio value for specified row, column and log state. |
2 |
26 Feb 07 |
jari |
689 |
*/ |
2 |
26 Feb 07 |
jari |
690 |
public float getRatio(int column, int row, int logState) { |
2 |
26 Feb 07 |
jari |
691 |
ISlideData slideData = (ISlideData)featuresList.get(column); |
2 |
26 Feb 07 |
jari |
692 |
logState = this.logState; //set to current log state |
2 |
26 Feb 07 |
jari |
693 |
return slideData.getRatio(row, logState); |
2 |
26 Feb 07 |
jari |
694 |
} |
2 |
26 Feb 07 |
jari |
695 |
|
2 |
26 Feb 07 |
jari |
696 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray name for specified column. |
2 |
26 Feb 07 |
jari |
698 |
*/ |
2 |
26 Feb 07 |
jari |
699 |
public String getSampleName(int column) { |
2 |
26 Feb 07 |
jari |
700 |
return((ISlideData)featuresList.get(column)).getSlideDataName(); |
2 |
26 Feb 07 |
jari |
701 |
} |
2 |
26 Feb 07 |
jari |
702 |
|
2 |
26 Feb 07 |
jari |
/** Sets the experiment label index for the collection of features |
2 |
26 Feb 07 |
jari |
704 |
*/ |
2 |
26 Feb 07 |
jari |
705 |
public void setSampleLabelKey(String key) { |
2 |
26 Feb 07 |
jari |
706 |
for(int i = 0; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
707 |
((ISlideData)featuresList.get(i)).setDataLabelKey(key); |
2 |
26 Feb 07 |
jari |
708 |
} |
2 |
26 Feb 07 |
jari |
709 |
} |
2 |
26 Feb 07 |
jari |
710 |
|
2 |
26 Feb 07 |
jari |
711 |
/** |
2 |
26 Feb 07 |
jari |
* Returns full feature name. |
2 |
26 Feb 07 |
jari |
713 |
*/ |
2 |
26 Feb 07 |
jari |
714 |
public String getFullSampleName(int column) { |
2 |
26 Feb 07 |
jari |
715 |
return((ISlideData)featuresList.get(column)).getFullSlideDataName(); |
2 |
26 Feb 07 |
jari |
716 |
} |
2 |
26 Feb 07 |
jari |
717 |
|
2 |
26 Feb 07 |
jari |
718 |
public Vector getSlideDataNameKeys(int column) { |
2 |
26 Feb 07 |
jari |
719 |
return((ISlideData)featuresList.get(column)).getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
720 |
} |
2 |
26 Feb 07 |
jari |
721 |
|
2 |
26 Feb 07 |
jari |
722 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the key vector for the sample with the longest sample name key list |
2 |
26 Feb 07 |
jari |
724 |
*/ |
2 |
26 Feb 07 |
jari |
725 |
public Vector getSlideNameKeyVectorUnion() { |
2 |
26 Feb 07 |
jari |
726 |
Vector keyVector; |
2 |
26 Feb 07 |
jari |
727 |
Vector fullKeyVector = new Vector(); |
2 |
26 Feb 07 |
jari |
728 |
String key; |
2 |
26 Feb 07 |
jari |
729 |
for( int i = 0; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
730 |
keyVector = ((ISlideData)featuresList.get(i)).getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
731 |
for(int j = 0; j < keyVector.size(); j++) { |
2 |
26 Feb 07 |
jari |
732 |
key = (String)(keyVector.elementAt(j)); |
2 |
26 Feb 07 |
jari |
733 |
if(!fullKeyVector.contains(key)) |
2 |
26 Feb 07 |
jari |
734 |
fullKeyVector.addElement(key); |
2 |
26 Feb 07 |
jari |
735 |
} |
2 |
26 Feb 07 |
jari |
736 |
} |
2 |
26 Feb 07 |
jari |
737 |
return fullKeyVector; |
2 |
26 Feb 07 |
jari |
738 |
} |
2 |
26 Feb 07 |
jari |
739 |
|
2 |
26 Feb 07 |
jari |
740 |
|
2 |
26 Feb 07 |
jari |
741 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the key vector for the sample with the longest sample name key list |
2 |
26 Feb 07 |
jari |
743 |
*/ |
2 |
26 Feb 07 |
jari |
744 |
public Vector getSampleAnnotationFieldNames() { |
2 |
26 Feb 07 |
jari |
745 |
Vector keyVector; |
2 |
26 Feb 07 |
jari |
746 |
Vector fullKeyVector = new Vector(); |
2 |
26 Feb 07 |
jari |
747 |
String key; |
2 |
26 Feb 07 |
jari |
748 |
for( int i = 0; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
749 |
keyVector = ((ISlideData)featuresList.get(i)).getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
750 |
for(int j = 0; j < keyVector.size(); j++) { |
2 |
26 Feb 07 |
jari |
751 |
key = (String)(keyVector.elementAt(j)); |
2 |
26 Feb 07 |
jari |
752 |
if(!fullKeyVector.contains(key)) |
2 |
26 Feb 07 |
jari |
753 |
fullKeyVector.addElement(key); |
2 |
26 Feb 07 |
jari |
754 |
} |
2 |
26 Feb 07 |
jari |
755 |
} |
2 |
26 Feb 07 |
jari |
756 |
return fullKeyVector; |
2 |
26 Feb 07 |
jari |
757 |
} |
2 |
26 Feb 07 |
jari |
758 |
|
2 |
26 Feb 07 |
jari |
759 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the key vector for the sample with the longest sample name key list |
2 |
26 Feb 07 |
jari |
761 |
*/ |
2 |
26 Feb 07 |
jari |
762 |
public String [] getSlideNameKeyArray() { |
2 |
26 Feb 07 |
jari |
763 |
Vector keyVector; |
2 |
26 Feb 07 |
jari |
764 |
Vector fullKeyVector = new Vector(); |
2 |
26 Feb 07 |
jari |
765 |
String key; |
2 |
26 Feb 07 |
jari |
766 |
for( int i = 0; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
767 |
keyVector = ((ISlideData)featuresList.get(i)).getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
768 |
for(int j = 0; j < keyVector.size(); j++) { |
2 |
26 Feb 07 |
jari |
769 |
key = (String)(keyVector.elementAt(j)); |
2 |
26 Feb 07 |
jari |
770 |
if(!fullKeyVector.contains(key)) |
2 |
26 Feb 07 |
jari |
771 |
fullKeyVector.addElement(key); |
2 |
26 Feb 07 |
jari |
772 |
} |
2 |
26 Feb 07 |
jari |
773 |
} |
2 |
26 Feb 07 |
jari |
774 |
|
2 |
26 Feb 07 |
jari |
775 |
String [] keys = new String[fullKeyVector.size()]; |
2 |
26 Feb 07 |
jari |
776 |
for(int i = 0 ; i < keys.length; i++) { |
2 |
26 Feb 07 |
jari |
777 |
keys[i] = (String)(fullKeyVector.elementAt(i)); |
2 |
26 Feb 07 |
jari |
778 |
} |
2 |
26 Feb 07 |
jari |
779 |
return keys; |
2 |
26 Feb 07 |
jari |
780 |
} |
2 |
26 Feb 07 |
jari |
781 |
|
2 |
26 Feb 07 |
jari |
782 |
|
2 |
26 Feb 07 |
jari |
783 |
public void addNewExperimentLabel(String key, String [] values) { |
2 |
26 Feb 07 |
jari |
784 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
785 |
|
2 |
26 Feb 07 |
jari |
786 |
for(int i = 0; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
787 |
getFeature(i).addNewSampleLabel(key, values[i]);; |
2 |
26 Feb 07 |
jari |
788 |
} |
2 |
26 Feb 07 |
jari |
789 |
} |
2 |
26 Feb 07 |
jari |
790 |
|
2 |
26 Feb 07 |
jari |
791 |
/** |
2 |
26 Feb 07 |
jari |
* Adds sample labels from <code>file</code>. |
2 |
26 Feb 07 |
jari |
* @param parent the parent frame |
2 |
26 Feb 07 |
jari |
* @param file the text file containing the labels to associate with samples |
2 |
26 Feb 07 |
jari |
* @return true if successful |
2 |
26 Feb 07 |
jari |
* @throws IOException if there is something wrong with <code>file</code> |
2 |
26 Feb 07 |
jari |
797 |
*/ |
2 |
26 Feb 07 |
jari |
798 |
public boolean addNewSampleLabels(Frame parent, File file) throws IOException { |
2 |
26 Feb 07 |
jari |
799 |
int sampleCount = this.getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
800 |
String line; |
2 |
26 Feb 07 |
jari |
801 |
BufferedReader reader = new BufferedReader(new FileReader(file)); |
2 |
26 Feb 07 |
jari |
802 |
StringTokenizer stok; |
2 |
26 Feb 07 |
jari |
803 |
boolean readingFirstRow = true; |
2 |
26 Feb 07 |
jari |
804 |
String [] annKeys = null; //a list of the headers for each column in file |
2 |
26 Feb 07 |
jari |
805 |
String[] annotationRow; |
2 |
26 Feb 07 |
jari |
806 |
Vector data = new Vector(); |
2 |
26 Feb 07 |
jari |
807 |
int fieldCount; |
2 |
26 Feb 07 |
jari |
808 |
int annCnt = 0; |
2 |
26 Feb 07 |
jari |
809 |
int rowCnt = 0; |
2 |
26 Feb 07 |
jari |
810 |
Hashtable annotation = new Hashtable(); |
2 |
26 Feb 07 |
jari |
811 |
String fileName; |
2 |
26 Feb 07 |
jari |
812 |
|
2 |
26 Feb 07 |
jari |
813 |
line=reader.readLine(); |
2 |
26 Feb 07 |
jari |
814 |
stok = new StringTokenizer(line, "\t"); |
2 |
26 Feb 07 |
jari |
815 |
annKeys = new String[stok.countTokens()]; |
2 |
26 Feb 07 |
jari |
816 |
for(int i = 0; i < annKeys.length; i++) { |
2 |
26 Feb 07 |
jari |
817 |
annKeys[i] = stok.nextToken(); |
2 |
26 Feb 07 |
jari |
818 |
} |
2 |
26 Feb 07 |
jari |
819 |
fieldCount = annKeys.length; |
2 |
26 Feb 07 |
jari |
820 |
|
2 |
26 Feb 07 |
jari |
821 |
while( (line = reader.readLine()) != null) { |
2 |
26 Feb 07 |
jari |
822 |
stok = new StringTokenizer(line, "\t"); |
2 |
26 Feb 07 |
jari |
823 |
annCnt = 0; |
2 |
26 Feb 07 |
jari |
824 |
annotationRow = new String[fieldCount]; |
2 |
26 Feb 07 |
jari |
825 |
while(stok.hasMoreTokens()) { |
2 |
26 Feb 07 |
jari |
826 |
annotationRow[annCnt] = stok.nextToken(); |
2 |
26 Feb 07 |
jari |
827 |
annCnt++; |
2 |
26 Feb 07 |
jari |
828 |
} |
2 |
26 Feb 07 |
jari |
829 |
annotation.put(annotationRow[0], annotationRow); |
2 |
26 Feb 07 |
jari |
830 |
data.add(annotationRow); |
2 |
26 Feb 07 |
jari |
831 |
rowCnt++; |
2 |
26 Feb 07 |
jari |
832 |
} |
2 |
26 Feb 07 |
jari |
833 |
|
2 |
26 Feb 07 |
jari |
834 |
String thisSlideFileName; |
2 |
26 Feb 07 |
jari |
835 |
String thisAnnotationValue; |
2 |
26 Feb 07 |
jari |
836 |
for(int i = 0; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
837 |
ISlideData thisSlide = getFeature(i); |
2 |
26 Feb 07 |
jari |
838 |
thisSlideFileName = thisSlide.getSlideFileName(); |
2 |
26 Feb 07 |
jari |
839 |
thisSlideFileName = thisSlide.getSlideFileName().substring(thisSlideFileName.lastIndexOf(System.getProperty("file.separator"))+1); |
2 |
26 Feb 07 |
jari |
840 |
if(annotation.containsKey(thisSlideFileName)) { |
2 |
26 Feb 07 |
jari |
841 |
for(int j=0; j< annKeys.length; j++) { |
2 |
26 Feb 07 |
jari |
842 |
thisAnnotationValue = ((String[])annotation.get(thisSlideFileName))[j]; |
2 |
26 Feb 07 |
jari |
843 |
thisSlide.addNewSampleLabel(annKeys[j], thisAnnotationValue); |
2 |
26 Feb 07 |
jari |
844 |
} |
2 |
26 Feb 07 |
jari |
845 |
} else { |
2 |
26 Feb 07 |
jari |
846 |
System.out.println("No annotation for " + thisSlideFileName); |
2 |
26 Feb 07 |
jari |
847 |
} |
2 |
26 Feb 07 |
jari |
848 |
} |
2 |
26 Feb 07 |
jari |
849 |
return true; |
2 |
26 Feb 07 |
jari |
850 |
} |
2 |
26 Feb 07 |
jari |
851 |
|
2 |
26 Feb 07 |
jari |
/** Adds new gene annotation present in the annMatrix, Note: annMatrix contains headers with field names |
2 |
26 Feb 07 |
jari |
853 |
*/ |
2 |
26 Feb 07 |
jari |
854 |
public int addNewGeneAnnotation(String [][] annMatrix, String dataKey, String annFileKey, String [] fieldsToAppend) { |
2 |
26 Feb 07 |
jari |
855 |
|
2 |
26 Feb 07 |
jari |
856 |
int updateCount = 0; |
2 |
26 Feb 07 |
jari |
857 |
|
2 |
26 Feb 07 |
jari |
//get annFile key column number |
2 |
26 Feb 07 |
jari |
859 |
int keyCol; |
2 |
26 Feb 07 |
jari |
860 |
for(keyCol = 0; keyCol < annMatrix[0].length; keyCol++){ |
2 |
26 Feb 07 |
jari |
861 |
if(annMatrix[0][keyCol].equals(annFileKey)) |
2 |
26 Feb 07 |
jari |
862 |
break; |
2 |
26 Feb 07 |
jari |
863 |
} |
2 |
26 Feb 07 |
jari |
864 |
|
2 |
26 Feb 07 |
jari |
865 |
|
2 |
26 Feb 07 |
jari |
866 |
if(keyCol > annMatrix[0].length) |
2 |
26 Feb 07 |
jari |
867 |
return updateCount; |
2 |
26 Feb 07 |
jari |
868 |
|
2 |
26 Feb 07 |
jari |
//get current field index for datakey |
2 |
26 Feb 07 |
jari |
870 |
String [] fieldNames = getFieldNames(); |
2 |
26 Feb 07 |
jari |
871 |
int dataKeyCol = -1; |
2 |
26 Feb 07 |
jari |
872 |
if(!dataKey.equals("UID")) { |
2 |
26 Feb 07 |
jari |
873 |
for(dataKeyCol = 0; dataKeyCol < fieldNames.length; dataKeyCol++) { |
2 |
26 Feb 07 |
jari |
874 |
if(dataKey.equals(fieldNames[dataKeyCol])) |
2 |
26 Feb 07 |
jari |
875 |
break; |
2 |
26 Feb 07 |
jari |
876 |
} |
2 |
26 Feb 07 |
jari |
877 |
} |
2 |
26 Feb 07 |
jari |
878 |
|
2 |
26 Feb 07 |
jari |
879 |
if(dataKeyCol > fieldNames.length) |
2 |
26 Feb 07 |
jari |
880 |
return updateCount; |
2 |
26 Feb 07 |
jari |
881 |
|
2 |
26 Feb 07 |
jari |
882 |
|
2 |
26 Feb 07 |
jari |
883 |
/* |
2 |
26 Feb 07 |
jari |
* Probably want to make the hash contain only fields that are |
2 |
26 Feb 07 |
jari |
* specified, maybe pass in String [] fieldsToAppend |
2 |
26 Feb 07 |
jari |
886 |
*/ |
2 |
26 Feb 07 |
jari |
887 |
|
2 |
26 Feb 07 |
jari |
//build hash of annFileKeys and String [] rows |
2 |
26 Feb 07 |
jari |
889 |
Hashtable annotationHash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
890 |
|
2 |
26 Feb 07 |
jari |
// appending all annotation fields |
2 |
26 Feb 07 |
jari |
892 |
if(fieldsToAppend.length == annMatrix[0].length) { |
2 |
26 Feb 07 |
jari |
893 |
for(int row = 1; row < annMatrix.length; row++) { |
2 |
26 Feb 07 |
jari |
894 |
annotationHash.put(annMatrix[row][keyCol], annMatrix[row]); |
2 |
26 Feb 07 |
jari |
895 |
} |
2 |
26 Feb 07 |
jari |
896 |
} else { |
2 |
26 Feb 07 |
jari |
897 |
|
2 |
26 Feb 07 |
jari |
//Just build a hash with selected fields |
2 |
26 Feb 07 |
jari |
899 |
Vector testVector = new Vector(); |
2 |
26 Feb 07 |
jari |
900 |
|
2 |
26 Feb 07 |
jari |
901 |
for(int i = 0; i < fieldsToAppend.length;i++) |
2 |
26 Feb 07 |
jari |
902 |
testVector.add(fieldsToAppend[i]); |
2 |
26 Feb 07 |
jari |
903 |
|
2 |
26 Feb 07 |
jari |
904 |
int subsetIndex = 0; |
2 |
26 Feb 07 |
jari |
905 |
String [] annSubset; |
2 |
26 Feb 07 |
jari |
906 |
for(int row = 1; row < annMatrix.length; row++) { |
2 |
26 Feb 07 |
jari |
907 |
subsetIndex = 0; |
2 |
26 Feb 07 |
jari |
908 |
|
2 |
26 Feb 07 |
jari |
909 |
annSubset = new String[fieldsToAppend.length]; |
2 |
26 Feb 07 |
jari |
910 |
|
2 |
26 Feb 07 |
jari |
911 |
for(int fieldIndex = 0; fieldIndex < annMatrix[0].length; fieldIndex++) |
2 |
26 Feb 07 |
jari |
912 |
if(testVector.contains(annMatrix[0][fieldIndex])) { |
2 |
26 Feb 07 |
jari |
913 |
annSubset[subsetIndex] = annMatrix[row][fieldIndex]; |
2 |
26 Feb 07 |
jari |
914 |
subsetIndex++; |
2 |
26 Feb 07 |
jari |
915 |
} |
2 |
26 Feb 07 |
jari |
916 |
|
2 |
26 Feb 07 |
jari |
917 |
annotationHash.put(annMatrix[row][keyCol], annSubset); |
2 |
26 Feb 07 |
jari |
918 |
} |
2 |
26 Feb 07 |
jari |
919 |
} |
2 |
26 Feb 07 |
jari |
920 |
|
2 |
26 Feb 07 |
jari |
921 |
|
2 |
26 Feb 07 |
jari |
//loop through IData to get ISlideDataElements, get dataKey, get values from hash to apppend to sde |
2 |
26 Feb 07 |
jari |
//if hash returns null append "" for each field. |
2 |
26 Feb 07 |
jari |
924 |
ISlideData slideData = (ISlideData)getSlideMetaData(); |
2 |
26 Feb 07 |
jari |
925 |
int rows = getFeaturesSize(); |
2 |
26 Feb 07 |
jari |
926 |
ISlideDataElement sde; |
2 |
26 Feb 07 |
jari |
927 |
String dataID = ""; |
2 |
26 Feb 07 |
jari |
928 |
String [] newFields; |
2 |
26 Feb 07 |
jari |
929 |
|
2 |
26 Feb 07 |
jari |
//check for id matches, and count updates |
2 |
26 Feb 07 |
jari |
931 |
for(int row = 0; row < rows; row++) { |
2 |
26 Feb 07 |
jari |
//get sde |
2 |
26 Feb 07 |
jari |
933 |
sde = slideData.getSlideDataElement(row); |
2 |
26 Feb 07 |
jari |
934 |
|
2 |
26 Feb 07 |
jari |
//get the data key |
2 |
26 Feb 07 |
jari |
936 |
if(dataKeyCol == -1) //use UID |
2 |
26 Feb 07 |
jari |
937 |
dataID = sde.getUID(); |
2 |
26 Feb 07 |
jari |
938 |
else |
2 |
26 Feb 07 |
jari |
939 |
dataID = sde.getFieldAt(dataKeyCol); |
2 |
26 Feb 07 |
jari |
940 |
|
2 |
26 Feb 07 |
jari |
941 |
if(annotationHash.containsKey(dataID)) |
2 |
26 Feb 07 |
jari |
942 |
updateCount++; |
2 |
26 Feb 07 |
jari |
943 |
} |
2 |
26 Feb 07 |
jari |
944 |
|
2 |
26 Feb 07 |
jari |
945 |
if(updateCount > 0) { |
2 |
26 Feb 07 |
jari |
946 |
for(int row = 0; row < rows; row++) { |
2 |
26 Feb 07 |
jari |
//get sde |
2 |
26 Feb 07 |
jari |
948 |
sde = slideData.getSlideDataElement(row); |
2 |
26 Feb 07 |
jari |
949 |
|
2 |
26 Feb 07 |
jari |
//get the data key |
2 |
26 Feb 07 |
jari |
951 |
if(dataKeyCol == -1) //use UID |
2 |
26 Feb 07 |
jari |
952 |
dataID = sde.getUID(); |
2 |
26 Feb 07 |
jari |
953 |
else |
2 |
26 Feb 07 |
jari |
954 |
dataID = sde.getFieldAt(dataKeyCol); |
2 |
26 Feb 07 |
jari |
955 |
|
2 |
26 Feb 07 |
jari |
956 |
|
2 |
26 Feb 07 |
jari |
957 |
newFields = (String []) annotationHash.get(dataID); |
2 |
26 Feb 07 |
jari |
958 |
|
2 |
26 Feb 07 |
jari |
959 |
if(newFields != null) { |
2 |
26 Feb 07 |
jari |
960 |
sde.setExtraFields(newFields); |
2 |
26 Feb 07 |
jari |
961 |
updateCount++; |
2 |
26 Feb 07 |
jari |
962 |
} else { |
2 |
26 Feb 07 |
jari |
963 |
sde.setExtraFields(new String[annMatrix[0].length]); |
2 |
26 Feb 07 |
jari |
964 |
} |
2 |
26 Feb 07 |
jari |
965 |
} |
2 |
26 Feb 07 |
jari |
966 |
} |
2 |
26 Feb 07 |
jari |
967 |
|
2 |
26 Feb 07 |
jari |
968 |
return updateCount; |
2 |
26 Feb 07 |
jari |
969 |
} |
2 |
26 Feb 07 |
jari |
970 |
|
2 |
26 Feb 07 |
jari |
971 |
|
2 |
26 Feb 07 |
jari |
972 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an element attribute for specified row and |
2 |
26 Feb 07 |
jari |
* attribute index. |
2 |
26 Feb 07 |
jari |
975 |
*/ |
2 |
26 Feb 07 |
jari |
976 |
public String getElementAttribute(int row, int attr) { |
2 |
26 Feb 07 |
jari |
977 |
if (featuresList.size() == 0) { |
2 |
26 Feb 07 |
jari |
978 |
return ""; |
2 |
26 Feb 07 |
jari |
979 |
} |
2 |
26 Feb 07 |
jari |
980 |
ISlideData slideData = (ISlideData)featuresList.get(0); |
2 |
26 Feb 07 |
jari |
981 |
ISlideDataElement element = slideData.getSlideDataElement(row); |
2 |
26 Feb 07 |
jari |
982 |
return element.getFieldAt(attr); |
2 |
26 Feb 07 |
jari |
983 |
} |
2 |
26 Feb 07 |
jari |
984 |
|
2 |
26 Feb 07 |
jari |
985 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a gene unique id. |
2 |
26 Feb 07 |
jari |
987 |
*/ |
2 |
26 Feb 07 |
jari |
988 |
public String getUniqueId(int row) { |
2 |
26 Feb 07 |
jari |
989 |
return getElementAttribute(row, TMEV.getUniqueIDIndex()); |
2 |
26 Feb 07 |
jari |
990 |
} |
2 |
26 Feb 07 |
jari |
991 |
|
2 |
26 Feb 07 |
jari |
992 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a gene name. |
2 |
26 Feb 07 |
jari |
994 |
*/ |
2 |
26 Feb 07 |
jari |
995 |
public String getGeneName(int row) { |
2 |
26 Feb 07 |
jari |
996 |
return getElementAttribute(row, TMEV.getNameIndex()); |
2 |
26 Feb 07 |
jari |
997 |
} |
2 |
26 Feb 07 |
jari |
998 |
|
2 |
26 Feb 07 |
jari |
999 |
/** |
2 |
26 Feb 07 |
jari |
* EH updated to get field names from slideData rather than TMEV |
2 |
26 Feb 07 |
jari |
* Returns all annotation fields |
2 |
26 Feb 07 |
jari |
1002 |
*/ |
2 |
26 Feb 07 |
jari |
1003 |
public String[] getFieldNames() { |
2 |
26 Feb 07 |
jari |
//6/10/06 jcb changed to ISlideData rather than Slide data since |
2 |
26 Feb 07 |
jari |
//the first feature might not be a SlideData object if it's a sample subset (cluster) |
2 |
26 Feb 07 |
jari |
1006 |
return ((ISlideData)featuresList.get(0)).getSlideMetaData().getFieldNames(); |
2 |
26 Feb 07 |
jari |
1007 |
} |
2 |
26 Feb 07 |
jari |
1008 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a spot base row. |
2 |
26 Feb 07 |
jari |
1010 |
*/ |
2 |
26 Feb 07 |
jari |
1011 |
public int getProbeRow(int column, int row) { |
2 |
26 Feb 07 |
jari |
1012 |
ISlideMetaData meta = getFeature(column).getSlideMetaData(); |
2 |
26 Feb 07 |
jari |
1013 |
return meta.getRow(row); |
2 |
26 Feb 07 |
jari |
1014 |
} |
2 |
26 Feb 07 |
jari |
1015 |
|
2 |
26 Feb 07 |
jari |
1016 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a spot base column. |
2 |
26 Feb 07 |
jari |
1018 |
*/ |
2 |
26 Feb 07 |
jari |
1019 |
public int getProbeColumn(int column, int row) { |
2 |
26 Feb 07 |
jari |
1020 |
ISlideMetaData meta = getFeature(column).getSlideMetaData(); |
2 |
26 Feb 07 |
jari |
1021 |
return meta.getColumn(row); |
2 |
26 Feb 07 |
jari |
1022 |
} |
2 |
26 Feb 07 |
jari |
1023 |
|
2 |
26 Feb 07 |
jari |
1024 |
/** |
2 |
26 Feb 07 |
jari |
* Returns array of published colors. |
2 |
26 Feb 07 |
jari |
1026 |
*/ |
2 |
26 Feb 07 |
jari |
1027 |
public Color[] getColors() { |
2 |
26 Feb 07 |
jari |
1028 |
updateSpotColors(); |
2 |
26 Feb 07 |
jari |
1029 |
Color[] colors = new Color[spotColors.size()]; |
2 |
26 Feb 07 |
jari |
1030 |
return(Color[])spotColors.toArray(colors); |
2 |
26 Feb 07 |
jari |
1031 |
} |
2 |
26 Feb 07 |
jari |
1032 |
/** |
2 |
26 Feb 07 |
jari |
* EH - added for state-saving. May not be necessary |
2 |
26 Feb 07 |
jari |
1034 |
*/ |
2 |
26 Feb 07 |
jari |
1035 |
public ArrayList getSpotColors() { |
2 |
26 Feb 07 |
jari |
1036 |
return spotColors; |
2 |
26 Feb 07 |
jari |
1037 |
} |
2 |
26 Feb 07 |
jari |
1038 |
/** |
2 |
26 Feb 07 |
jari |
* EH - added for state-saving. May not be necessary |
2 |
26 Feb 07 |
jari |
1040 |
*/ |
2 |
26 Feb 07 |
jari |
1041 |
public void setSpotColors(ArrayList sp) { |
2 |
26 Feb 07 |
jari |
1042 |
this.spotColors = sp; |
2 |
26 Feb 07 |
jari |
1043 |
} |
2 |
26 Feb 07 |
jari |
1044 |
|
2 |
26 Feb 07 |
jari |
1045 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a spot public color by specified row. |
2 |
26 Feb 07 |
jari |
1047 |
*/ |
2 |
26 Feb 07 |
jari |
1048 |
public Color getProbeColor(int row) { |
2 |
26 Feb 07 |
jari |
1049 |
if(this.geneClusterRepository == null) |
2 |
26 Feb 07 |
jari |
1050 |
return null; |
2 |
26 Feb 07 |
jari |
1051 |
return this.geneClusterRepository.getColor(row); |
2 |
26 Feb 07 |
jari |
1052 |
} |
2 |
26 Feb 07 |
jari |
1053 |
|
2 |
26 Feb 07 |
jari |
1054 |
public void updateSpotColors(){ |
2 |
26 Feb 07 |
jari |
1055 |
this.colorIndices = new int[this.getFeaturesSize()]; |
2 |
26 Feb 07 |
jari |
1056 |
spotColors = new ArrayList(); |
2 |
26 Feb 07 |
jari |
1057 |
Color color; |
2 |
26 Feb 07 |
jari |
1058 |
int index; |
2 |
26 Feb 07 |
jari |
1059 |
int count = 0; |
2 |
26 Feb 07 |
jari |
1060 |
for( int i = 0; i < colorIndices.length ; i++){ |
2 |
26 Feb 07 |
jari |
// index = null; |
2 |
26 Feb 07 |
jari |
1062 |
if(geneClusterRepository == null) |
2 |
26 Feb 07 |
jari |
1063 |
color = null; |
2 |
26 Feb 07 |
jari |
1064 |
else |
2 |
26 Feb 07 |
jari |
1065 |
color = geneClusterRepository.getColor(i); |
2 |
26 Feb 07 |
jari |
1066 |
if(color == null){ |
2 |
26 Feb 07 |
jari |
1067 |
colorIndices[i] = -1; |
2 |
26 Feb 07 |
jari |
1068 |
} else{ |
2 |
26 Feb 07 |
jari |
1069 |
index = spotColors.indexOf(color); |
2 |
26 Feb 07 |
jari |
1070 |
if(index < 0){ |
2 |
26 Feb 07 |
jari |
1071 |
spotColors.add(color); |
2 |
26 Feb 07 |
jari |
1072 |
this.colorIndices[i] = count; |
2 |
26 Feb 07 |
jari |
1073 |
count++; |
2 |
26 Feb 07 |
jari |
1074 |
} else { |
2 |
26 Feb 07 |
jari |
1075 |
this.colorIndices[i] = index; |
2 |
26 Feb 07 |
jari |
1076 |
} |
2 |
26 Feb 07 |
jari |
1077 |
} |
2 |
26 Feb 07 |
jari |
1078 |
} |
2 |
26 Feb 07 |
jari |
1079 |
} |
2 |
26 Feb 07 |
jari |
1080 |
|
2 |
26 Feb 07 |
jari |
1081 |
public void updateExperimentColors(){ |
2 |
26 Feb 07 |
jari |
1082 |
this.experimentColorIndices = new int[this.getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
1083 |
this.experimentColors = new ArrayList(); |
2 |
26 Feb 07 |
jari |
1084 |
Color color; |
2 |
26 Feb 07 |
jari |
1085 |
int index; |
2 |
26 Feb 07 |
jari |
1086 |
int count = 0; |
2 |
26 Feb 07 |
jari |
1087 |
for( int i = 0; i < experimentColorIndices.length ; i++){ |
2 |
26 Feb 07 |
jari |
1088 |
if(expClusterRepository == null) |
2 |
26 Feb 07 |
jari |
1089 |
color = null; |
2 |
26 Feb 07 |
jari |
1090 |
else |
2 |
26 Feb 07 |
jari |
1091 |
color = expClusterRepository.getColor(i); |
2 |
26 Feb 07 |
jari |
1092 |
if(color == null){ |
2 |
26 Feb 07 |
jari |
1093 |
experimentColorIndices[i] = -1; |
2 |
26 Feb 07 |
jari |
1094 |
} else{ |
2 |
26 Feb 07 |
jari |
1095 |
index = experimentColors.indexOf(color); |
2 |
26 Feb 07 |
jari |
1096 |
if(index < 0 ){ |
2 |
26 Feb 07 |
jari |
1097 |
experimentColors.add(color); |
2 |
26 Feb 07 |
jari |
1098 |
this.experimentColorIndices[i] = count; |
2 |
26 Feb 07 |
jari |
1099 |
count++; |
2 |
26 Feb 07 |
jari |
1100 |
} |
2 |
26 Feb 07 |
jari |
1101 |
else{ |
2 |
26 Feb 07 |
jari |
1102 |
this.experimentColorIndices[i] = index; |
2 |
26 Feb 07 |
jari |
1103 |
} |
2 |
26 Feb 07 |
jari |
1104 |
} |
2 |
26 Feb 07 |
jari |
1105 |
} |
2 |
26 Feb 07 |
jari |
1106 |
} |
2 |
26 Feb 07 |
jari |
1107 |
|
2 |
26 Feb 07 |
jari |
1108 |
public int [] getColorIndices(){ |
2 |
26 Feb 07 |
jari |
1109 |
this.updateSpotColors(); |
2 |
26 Feb 07 |
jari |
1110 |
return this.colorIndices; |
2 |
26 Feb 07 |
jari |
1111 |
} |
2 |
26 Feb 07 |
jari |
1112 |
|
2 |
26 Feb 07 |
jari |
1113 |
public int [] getExperimentColorIndices(){ |
2 |
26 Feb 07 |
jari |
1114 |
this.updateExperimentColors(); |
2 |
26 Feb 07 |
jari |
1115 |
return this.experimentColorIndices; |
2 |
26 Feb 07 |
jari |
1116 |
} |
2 |
26 Feb 07 |
jari |
1117 |
|
2 |
26 Feb 07 |
jari |
1118 |
/** |
2 |
26 Feb 07 |
jari |
* EH - added for state-saving |
2 |
26 Feb 07 |
jari |
1120 |
*/ |
2 |
26 Feb 07 |
jari |
1121 |
public void setColorIndices(int[] ci) { |
2 |
26 Feb 07 |
jari |
1122 |
colorIndices = ci; |
2 |
26 Feb 07 |
jari |
1123 |
} |
2 |
26 Feb 07 |
jari |
1124 |
/** |
2 |
26 Feb 07 |
jari |
* EH - added for state-saving |
2 |
26 Feb 07 |
jari |
1126 |
*/ |
2 |
26 Feb 07 |
jari |
1127 |
public void setExperimentColorIndices(int[] eci) { |
2 |
26 Feb 07 |
jari |
1128 |
experimentColorIndices = eci; |
2 |
26 Feb 07 |
jari |
1129 |
} |
2 |
26 Feb 07 |
jari |
1130 |
|
2 |
26 Feb 07 |
jari |
1131 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a spot public color for specified rows. |
2 |
26 Feb 07 |
jari |
1133 |
*/ |
2 |
26 Feb 07 |
jari |
1134 |
public void setProbesColor(int[] rows, Color color) { |
2 |
26 Feb 07 |
jari |
1135 |
int colorIndex; |
2 |
26 Feb 07 |
jari |
1136 |
if (color == null) { |
2 |
26 Feb 07 |
jari |
1137 |
colorIndex = -1; |
2 |
26 Feb 07 |
jari |
1138 |
} else { |
2 |
26 Feb 07 |
jari |
1139 |
colorIndex = spotColors.indexOf(color); |
2 |
26 Feb 07 |
jari |
1140 |
if (colorIndex < 0) { |
2 |
26 Feb 07 |
jari |
1141 |
colorIndex = spotColors.size(); |
2 |
26 Feb 07 |
jari |
1142 |
spotColors.add(color); |
2 |
26 Feb 07 |
jari |
1143 |
} |
2 |
26 Feb 07 |
jari |
1144 |
} |
2 |
26 Feb 07 |
jari |
1145 |
for (int i=0; i<rows.length; i++) { |
2 |
26 Feb 07 |
jari |
1146 |
this.colorIndices[rows[i]] = colorIndex; |
2 |
26 Feb 07 |
jari |
1147 |
} |
2 |
26 Feb 07 |
jari |
1148 |
removeUnusedColors(); |
2 |
26 Feb 07 |
jari |
1149 |
} |
2 |
26 Feb 07 |
jari |
1150 |
|
2 |
26 Feb 07 |
jari |
1151 |
/** |
2 |
26 Feb 07 |
jari |
* Returns index of the public color for specified row. |
2 |
26 Feb 07 |
jari |
1153 |
*/ |
2 |
26 Feb 07 |
jari |
1154 |
public int getProbeColorIndex(int row) { |
2 |
26 Feb 07 |
jari |
1155 |
return colorIndices[row]; |
2 |
26 Feb 07 |
jari |
1156 |
} |
2 |
26 Feb 07 |
jari |
1157 |
|
2 |
26 Feb 07 |
jari |
1158 |
/** |
2 |
26 Feb 07 |
jari |
* Returns count of rows which have public color index equals to colorIndex. |
2 |
26 Feb 07 |
jari |
1160 |
*/ |
2 |
26 Feb 07 |
jari |
1161 |
public int getColoredProbesCount(int colorIndex) { |
2 |
26 Feb 07 |
jari |
1162 |
int count = 0; |
2 |
26 Feb 07 |
jari |
1163 |
for (int i=0; i<colorIndices.length; i++) { |
2 |
26 Feb 07 |
jari |
1164 |
if (colorIndices[i] == colorIndex) { |
2 |
26 Feb 07 |
jari |
1165 |
count++; |
2 |
26 Feb 07 |
jari |
1166 |
} |
2 |
26 Feb 07 |
jari |
1167 |
} |
2 |
26 Feb 07 |
jari |
1168 |
return count; |
2 |
26 Feb 07 |
jari |
1169 |
} |
2 |
26 Feb 07 |
jari |
1170 |
|
2 |
26 Feb 07 |
jari |
1171 |
|
2 |
26 Feb 07 |
jari |
1172 |
public Color getExperimentColor(int index){ |
2 |
26 Feb 07 |
jari |
1173 |
if(this.expClusterRepository == null){ |
2 |
26 Feb 07 |
jari |
1174 |
return null; |
2 |
26 Feb 07 |
jari |
1175 |
} |
2 |
26 Feb 07 |
jari |
1176 |
return this.expClusterRepository.getColor(index); |
2 |
26 Feb 07 |
jari |
1177 |
} |
2 |
26 Feb 07 |
jari |
1178 |
|
2 |
26 Feb 07 |
jari |
1179 |
|
2 |
26 Feb 07 |
jari |
1180 |
public void setExperimentColor(int [] indices, Color color){ |
2 |
26 Feb 07 |
jari |
1181 |
if(this.experimentColorIndices == null){ |
2 |
26 Feb 07 |
jari |
1182 |
this.experimentColorIndices = createExperimentColorIndices(); |
2 |
26 Feb 07 |
jari |
1183 |
} |
2 |
26 Feb 07 |
jari |
1184 |
|
2 |
26 Feb 07 |
jari |
1185 |
int colorIndex; |
2 |
26 Feb 07 |
jari |
1186 |
if (color == null) { |
2 |
26 Feb 07 |
jari |
1187 |
colorIndex = -1; |
2 |
26 Feb 07 |
jari |
1188 |
} else { |
2 |
26 Feb 07 |
jari |
1189 |
colorIndex = experimentColors.indexOf(color); |
2 |
26 Feb 07 |
jari |
1190 |
if (colorIndex < 0) { |
2 |
26 Feb 07 |
jari |
1191 |
colorIndex = experimentColors.size(); |
2 |
26 Feb 07 |
jari |
1192 |
experimentColors.add(color); |
2 |
26 Feb 07 |
jari |
1193 |
} |
2 |
26 Feb 07 |
jari |
1194 |
} |
2 |
26 Feb 07 |
jari |
1195 |
for (int i=0; i<indices.length; i++) { |
2 |
26 Feb 07 |
jari |
1196 |
this.experimentColorIndices[indices[i]] = colorIndex; |
2 |
26 Feb 07 |
jari |
1197 |
} |
2 |
26 Feb 07 |
jari |
1198 |
removeUnusedExperimentColors(); |
2 |
26 Feb 07 |
jari |
1199 |
} |
2 |
26 Feb 07 |
jari |
1200 |
|
2 |
26 Feb 07 |
jari |
1201 |
/** |
2 |
26 Feb 07 |
jari |
* EH - added for state-saving |
2 |
26 Feb 07 |
jari |
1203 |
*/ |
2 |
26 Feb 07 |
jari |
1204 |
public void setExperimentColors(Color[] ec) { |
2 |
26 Feb 07 |
jari |
1205 |
ArrayList al = new ArrayList(ec.length); |
2 |
26 Feb 07 |
jari |
1206 |
for(int i=0; i<al.size(); i++) { |
2 |
26 Feb 07 |
jari |
1207 |
al.set(i, ec[i]); |
2 |
26 Feb 07 |
jari |
1208 |
} |
2 |
26 Feb 07 |
jari |
1209 |
this.experimentColors = al; |
2 |
26 Feb 07 |
jari |
1210 |
} |
2 |
26 Feb 07 |
jari |
1211 |
|
2 |
26 Feb 07 |
jari |
1212 |
/** |
2 |
26 Feb 07 |
jari |
* Returns count of columns which have public color index equals to colorIndex. |
2 |
26 Feb 07 |
jari |
1214 |
*/ |
2 |
26 Feb 07 |
jari |
1215 |
public int getColoredExperimentsCount(int colorIndex) { |
2 |
26 Feb 07 |
jari |
1216 |
int count = 0; |
2 |
26 Feb 07 |
jari |
1217 |
if(this.experimentColorIndices == null){ |
2 |
26 Feb 07 |
jari |
1218 |
this.experimentColorIndices = createExperimentColorIndices(); |
2 |
26 Feb 07 |
jari |
1219 |
} |
2 |
26 Feb 07 |
jari |
1220 |
for (int i=0; i<experimentColorIndices.length; i++) { |
2 |
26 Feb 07 |
jari |
1221 |
if (experimentColorIndices[i] == colorIndex) { |
2 |
26 Feb 07 |
jari |
1222 |
count++; |
2 |
26 Feb 07 |
jari |
1223 |
} |
2 |
26 Feb 07 |
jari |
1224 |
} |
2 |
26 Feb 07 |
jari |
1225 |
return count; |
2 |
26 Feb 07 |
jari |
1226 |
} |
2 |
26 Feb 07 |
jari |
1227 |
|
2 |
26 Feb 07 |
jari |
1228 |
/** |
2 |
26 Feb 07 |
jari |
* Returns array of published experiment colors. |
2 |
26 Feb 07 |
jari |
1230 |
*/ |
2 |
26 Feb 07 |
jari |
1231 |
public Color[] getExperimentColors() { |
2 |
26 Feb 07 |
jari |
1232 |
this.updateExperimentColors(); |
2 |
26 Feb 07 |
jari |
1233 |
Color[] colors = new Color[experimentColors.size()]; |
2 |
26 Feb 07 |
jari |
1234 |
return(Color[])experimentColors.toArray(colors); |
2 |
26 Feb 07 |
jari |
1235 |
} |
2 |
26 Feb 07 |
jari |
1236 |
|
2 |
26 Feb 07 |
jari |
1237 |
/** |
2 |
26 Feb 07 |
jari |
* Returns index of the public color for specified column. |
2 |
26 Feb 07 |
jari |
1239 |
*/ |
2 |
26 Feb 07 |
jari |
1240 |
public int getExperimentColorIndex(int col) { |
2 |
26 Feb 07 |
jari |
1241 |
if(this.experimentColorIndices == null){ |
2 |
26 Feb 07 |
jari |
1242 |
this.experimentColorIndices = createExperimentColorIndices(); |
2 |
26 Feb 07 |
jari |
1243 |
} |
2 |
26 Feb 07 |
jari |
1244 |
return experimentColorIndices[col]; |
2 |
26 Feb 07 |
jari |
1245 |
} |
2 |
26 Feb 07 |
jari |
1246 |
|
2 |
26 Feb 07 |
jari |
1247 |
public void clearExperimentColor(int index){ |
2 |
26 Feb 07 |
jari |
1248 |
if(index > this.experimentColorIndices.length) |
2 |
26 Feb 07 |
jari |
1249 |
return; |
2 |
26 Feb 07 |
jari |
1250 |
this.experimentColors.remove(this.experimentColorIndices[index]); |
2 |
26 Feb 07 |
jari |
1251 |
this.experimentColorIndices[index] = -1; |
2 |
26 Feb 07 |
jari |
1252 |
} |
2 |
26 Feb 07 |
jari |
1253 |
|
2 |
26 Feb 07 |
jari |
1254 |
public void clearExperimentColors(int [] indices){ |
2 |
26 Feb 07 |
jari |
1255 |
for(int i = 0 ; i < indices.length ; i++){ |
2 |
26 Feb 07 |
jari |
1256 |
clearExperimentColor(indices[i]); |
2 |
26 Feb 07 |
jari |
1257 |
} |
2 |
26 Feb 07 |
jari |
1258 |
} |
2 |
26 Feb 07 |
jari |
1259 |
|
2 |
26 Feb 07 |
jari |
1260 |
public void deleteExperimentColors(){ |
2 |
26 Feb 07 |
jari |
// reinit colors state |
2 |
26 Feb 07 |
jari |
1262 |
experimentColors.clear(); |
2 |
26 Feb 07 |
jari |
1263 |
experimentColorIndices = createExperimentColorIndices(); |
2 |
26 Feb 07 |
jari |
1264 |
} |
2 |
26 Feb 07 |
jari |
1265 |
|
2 |
26 Feb 07 |
jari |
1266 |
private int[] createExperimentColorIndices(){ |
2 |
26 Feb 07 |
jari |
1267 |
int [] indices = new int[featuresList.size()]; |
2 |
26 Feb 07 |
jari |
1268 |
for(int i = 0; i < featuresList.size(); i++){ |
2 |
26 Feb 07 |
jari |
1269 |
indices[i] = -1; |
2 |
26 Feb 07 |
jari |
1270 |
} |
2 |
26 Feb 07 |
jari |
1271 |
return indices; |
2 |
26 Feb 07 |
jari |
1272 |
} |
2 |
26 Feb 07 |
jari |
1273 |
|
2 |
26 Feb 07 |
jari |
1274 |
/** |
2 |
26 Feb 07 |
jari |
* Removes all does'nt used colors. |
2 |
26 Feb 07 |
jari |
1276 |
*/ |
2 |
26 Feb 07 |
jari |
1277 |
private void removeUnusedColors() { |
2 |
26 Feb 07 |
jari |
1278 |
boolean unused; |
2 |
26 Feb 07 |
jari |
1279 |
final int size = spotColors.size(); |
2 |
26 Feb 07 |
jari |
1280 |
for (int i = size; --i >= 0;) { |
2 |
26 Feb 07 |
jari |
1281 |
unused = true; |
2 |
26 Feb 07 |
jari |
1282 |
for (int j = colorIndices.length; --j >= 0;) { |
2 |
26 Feb 07 |
jari |
1283 |
if (colorIndices[j] == i) { |
2 |
26 Feb 07 |
jari |
1284 |
unused = false; |
2 |
26 Feb 07 |
jari |
1285 |
break; |
2 |
26 Feb 07 |
jari |
1286 |
} |
2 |
26 Feb 07 |
jari |
1287 |
} |
2 |
26 Feb 07 |
jari |
1288 |
if (unused) { |
2 |
26 Feb 07 |
jari |
1289 |
spotColors.remove(i); |
2 |
26 Feb 07 |
jari |
// adjust indices |
2 |
26 Feb 07 |
jari |
1291 |
for (int j = colorIndices.length; --j >= 0;) { |
2 |
26 Feb 07 |
jari |
1292 |
if (colorIndices[j] > i) { |
2 |
26 Feb 07 |
jari |
1293 |
colorIndices[j]--; |
2 |
26 Feb 07 |
jari |
1294 |
} |
2 |
26 Feb 07 |
jari |
1295 |
} |
2 |
26 Feb 07 |
jari |
1296 |
} |
2 |
26 Feb 07 |
jari |
1297 |
} |
2 |
26 Feb 07 |
jari |
1298 |
} |
2 |
26 Feb 07 |
jari |
1299 |
|
2 |
26 Feb 07 |
jari |
1300 |
private void removeUnusedExperimentColors(){ |
2 |
26 Feb 07 |
jari |
1301 |
boolean unused; |
2 |
26 Feb 07 |
jari |
1302 |
final int size = experimentColors.size(); |
2 |
26 Feb 07 |
jari |
1303 |
for (int i = size; --i >= 0;) { |
2 |
26 Feb 07 |
jari |
1304 |
unused = true; |
2 |
26 Feb 07 |
jari |
1305 |
for (int j = experimentColorIndices.length; --j >= 0;) { |
2 |
26 Feb 07 |
jari |
1306 |
if (experimentColorIndices[j] == i) { |
2 |
26 Feb 07 |
jari |
1307 |
unused = false; |
2 |
26 Feb 07 |
jari |
1308 |
break; |
2 |
26 Feb 07 |
jari |
1309 |
} |
2 |
26 Feb 07 |
jari |
1310 |
} |
2 |
26 Feb 07 |
jari |
1311 |
if (unused) { |
2 |
26 Feb 07 |
jari |
1312 |
experimentColors.remove(i); |
2 |
26 Feb 07 |
jari |
// adjust indices |
2 |
26 Feb 07 |
jari |
1314 |
for (int j = experimentColorIndices.length; --j >= 0;) { |
2 |
26 Feb 07 |
jari |
1315 |
if (experimentColorIndices[j] > i) { |
2 |
26 Feb 07 |
jari |
1316 |
experimentColorIndices[j]--; |
2 |
26 Feb 07 |
jari |
1317 |
} |
2 |
26 Feb 07 |
jari |
1318 |
} |
2 |
26 Feb 07 |
jari |
1319 |
} |
2 |
26 Feb 07 |
jari |
1320 |
} |
2 |
26 Feb 07 |
jari |
1321 |
} |
2 |
26 Feb 07 |
jari |
1322 |
|
2 |
26 Feb 07 |
jari |
1323 |
/** |
2 |
26 Feb 07 |
jari |
* Delete all the published colors. |
2 |
26 Feb 07 |
jari |
1325 |
*/ |
2 |
26 Feb 07 |
jari |
1326 |
public void deleteColors() { |
2 |
26 Feb 07 |
jari |
// reinit colors state |
2 |
26 Feb 07 |
jari |
1328 |
spotColors.clear(); |
2 |
26 Feb 07 |
jari |
1329 |
if (colorIndices != null) { |
2 |
26 Feb 07 |
jari |
1330 |
colorIndices = createColorIndices(colorIndices.length); |
2 |
26 Feb 07 |
jari |
1331 |
} |
2 |
26 Feb 07 |
jari |
1332 |
} |
2 |
26 Feb 07 |
jari |
1333 |
|
2 |
26 Feb 07 |
jari |
1334 |
|
2 |
26 Feb 07 |
jari |
1335 |
/** |
2 |
26 Feb 07 |
jari |
* Creates an array of ordered integers. |
2 |
26 Feb 07 |
jari |
1337 |
*/ |
2 |
26 Feb 07 |
jari |
1338 |
private int[] createIndices(ISlideData slideData) { |
2 |
26 Feb 07 |
jari |
1339 |
int[] indices = new int[slideData.getSize()]; |
2 |
26 Feb 07 |
jari |
1340 |
for (int i=0; i<indices.length; i++) { |
2 |
26 Feb 07 |
jari |
1341 |
indices[i] = i; |
2 |
26 Feb 07 |
jari |
1342 |
} |
2 |
26 Feb 07 |
jari |
1343 |
return indices; |
2 |
26 Feb 07 |
jari |
1344 |
} |
2 |
26 Feb 07 |
jari |
1345 |
|
2 |
26 Feb 07 |
jari |
1346 |
/** |
2 |
26 Feb 07 |
jari |
* Adds a microarray data. |
2 |
26 Feb 07 |
jari |
1348 |
*/ |
2 |
26 Feb 07 |
jari |
1349 |
void addFeature(ISlideData slideData) { |
2 |
26 Feb 07 |
jari |
1350 |
featuresList.add(slideData); |
2 |
26 Feb 07 |
jari |
1351 |
slideData.setDataType(this.dataType); |
2 |
26 Feb 07 |
jari |
1352 |
indicesList.add(createIndices(slideData)); |
2 |
26 Feb 07 |
jari |
1353 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
1354 |
if (this.colorIndices == null) { |
2 |
26 Feb 07 |
jari |
1355 |
this.colorIndices = createColorIndices(slideData.getSize()); |
2 |
26 Feb 07 |
jari |
1356 |
} |
2 |
26 Feb 07 |
jari |
1357 |
updateMaxValues(slideData); |
2 |
26 Feb 07 |
jari |
1358 |
} |
2 |
26 Feb 07 |
jari |
1359 |
|
2 |
26 Feb 07 |
jari |
1360 |
/** |
2 |
26 Feb 07 |
jari |
* Adds an array of microarrays data. |
2 |
26 Feb 07 |
jari |
1362 |
*/ |
2 |
26 Feb 07 |
jari |
1363 |
void addFeatures(ISlideData[] slideData) { |
2 |
26 Feb 07 |
jari |
1364 |
for (int i = 0; i < slideData.length; i++) { |
2 |
26 Feb 07 |
jari |
1365 |
featuresList.add(slideData[i]); |
2 |
26 Feb 07 |
jari |
1366 |
slideData[i].setDataType(this.dataType); |
2 |
26 Feb 07 |
jari |
1367 |
indicesList.add(createIndices(slideData[i])); |
2 |
26 Feb 07 |
jari |
1368 |
updateMaxValues(slideData[i]); |
2 |
26 Feb 07 |
jari |
1369 |
} |
2 |
26 Feb 07 |
jari |
1370 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
1371 |
if (this.colorIndices == null) { |
2 |
26 Feb 07 |
jari |
1372 |
this.colorIndices = createColorIndices(slideData[0].getSize()); |
2 |
26 Feb 07 |
jari |
1373 |
} |
2 |
26 Feb 07 |
jari |
1374 |
} |
2 |
26 Feb 07 |
jari |
1375 |
|
2 |
26 Feb 07 |
jari |
1376 |
/** |
2 |
26 Feb 07 |
jari |
* Creates an array of color indices. |
2 |
26 Feb 07 |
jari |
1378 |
*/ |
2 |
26 Feb 07 |
jari |
1379 |
private int[] createColorIndices(int size) { |
2 |
26 Feb 07 |
jari |
1380 |
int[] indices = new int[size]; |
2 |
26 Feb 07 |
jari |
1381 |
for (int i=0; i<size; i++) { |
2 |
26 Feb 07 |
jari |
1382 |
indices[i] = -1; |
2 |
26 Feb 07 |
jari |
1383 |
} |
2 |
26 Feb 07 |
jari |
1384 |
return indices; |
2 |
26 Feb 07 |
jari |
1385 |
} |
2 |
26 Feb 07 |
jari |
1386 |
|
2 |
26 Feb 07 |
jari |
1387 |
/** |
2 |
26 Feb 07 |
jari |
* Updates the data CY3 and CY5 max values. |
2 |
26 Feb 07 |
jari |
1389 |
*/ |
2 |
26 Feb 07 |
jari |
1390 |
private void updateMaxValues(ISlideData slideData) { |
2 |
26 Feb 07 |
jari |
1391 |
float value; |
2 |
26 Feb 07 |
jari |
1392 |
value = slideData.getMaxCY3(); |
2 |
26 Feb 07 |
jari |
1393 |
if (value > maxCy3) { |
2 |
26 Feb 07 |
jari |
1394 |
setMaxCY3(value); |
2 |
26 Feb 07 |
jari |
1395 |
} |
2 |
26 Feb 07 |
jari |
1396 |
value = slideData.getMaxCY5(); |
2 |
26 Feb 07 |
jari |
1397 |
if (value > maxCy5) { |
2 |
26 Feb 07 |
jari |
1398 |
setMaxCY5(value); |
2 |
26 Feb 07 |
jari |
1399 |
} |
2 |
26 Feb 07 |
jari |
1400 |
updateMaxMinRatios(slideData); |
2 |
26 Feb 07 |
jari |
1401 |
} |
2 |
26 Feb 07 |
jari |
1402 |
|
2 |
26 Feb 07 |
jari |
1403 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a meta data. |
2 |
26 Feb 07 |
jari |
1405 |
*/ |
2 |
26 Feb 07 |
jari |
1406 |
ISlideMetaData getSlideMetaData() { |
2 |
26 Feb 07 |
jari |
1407 |
if (featuresList.size() > 0) { |
2 |
26 Feb 07 |
jari |
1408 |
return((ISlideData)featuresList.get(0)).getSlideMetaData(); |
2 |
26 Feb 07 |
jari |
1409 |
} |
2 |
26 Feb 07 |
jari |
1410 |
return null; |
2 |
26 Feb 07 |
jari |
1411 |
} |
2 |
26 Feb 07 |
jari |
1412 |
|
2 |
26 Feb 07 |
jari |
1413 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a microarray data by specified column. |
2 |
26 Feb 07 |
jari |
1415 |
*/ |
2 |
26 Feb 07 |
jari |
1416 |
public ISlideData getFeature(int column) { |
2 |
26 Feb 07 |
jari |
1417 |
return(ISlideData)featuresList.get(column); |
2 |
26 Feb 07 |
jari |
1418 |
} |
2 |
26 Feb 07 |
jari |
1419 |
|
2 |
26 Feb 07 |
jari |
1420 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an element by specified row and column. |
2 |
26 Feb 07 |
jari |
1422 |
*/ |
2 |
26 Feb 07 |
jari |
1423 |
public ISlideDataElement getSlideDataElement(int column, int row) { |
2 |
26 Feb 07 |
jari |
1424 |
ISlideData slideData = getFeature(column); |
2 |
26 Feb 07 |
jari |
1425 |
return slideData.getSlideDataElement(row); |
2 |
26 Feb 07 |
jari |
1426 |
} |
2 |
26 Feb 07 |
jari |
1427 |
|
2 |
26 Feb 07 |
jari |
1428 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the non zero flag. |
2 |
26 Feb 07 |
jari |
1430 |
*/ |
2 |
26 Feb 07 |
jari |
1431 |
void setNonZero(boolean value) { |
2 |
26 Feb 07 |
jari |
1432 |
resetMaxValues(); |
2 |
26 Feb 07 |
jari |
1433 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
1434 |
final int size = getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
1435 |
for (int i=0; i<size; i++) { |
2 |
26 Feb 07 |
jari |
1436 |
slideData = getFeature(i); |
2 |
26 Feb 07 |
jari |
1437 |
slideData.setNonZero(value); |
2 |
26 Feb 07 |
jari |
1438 |
updateMaxValues(slideData); |
2 |
26 Feb 07 |
jari |
1439 |
} |
2 |
26 Feb 07 |
jari |
1440 |
} |
2 |
26 Feb 07 |
jari |
1441 |
|
2 |
26 Feb 07 |
jari |
1442 |
/** |
2 |
26 Feb 07 |
jari |
* The class to allow run loading process in a separate thread. |
2 |
26 Feb 07 |
jari |
1444 |
*/ |
2 |
26 Feb 07 |
jari |
1445 |
private class Normalizer{ |
2 |
26 Feb 07 |
jari |
1446 |
Properties properties; |
2 |
26 Feb 07 |
jari |
1447 |
int mode; |
2 |
26 Feb 07 |
jari |
1448 |
int size; |
2 |
26 Feb 07 |
jari |
1449 |
MultipleArrayViewer viewer; |
2 |
26 Feb 07 |
jari |
1450 |
public Normalizer(int mode, Properties properties, int size, MultipleArrayViewer viewer) { |
2 |
26 Feb 07 |
jari |
1451 |
this.mode = mode; |
2 |
26 Feb 07 |
jari |
1452 |
this.properties = properties; |
2 |
26 Feb 07 |
jari |
1453 |
this.size = size; |
2 |
26 Feb 07 |
jari |
1454 |
this.viewer = viewer; |
2 |
26 Feb 07 |
jari |
1455 |
} |
2 |
26 Feb 07 |
jari |
1456 |
|
2 |
26 Feb 07 |
jari |
1457 |
public void runNormalization() { |
2 |
26 Feb 07 |
jari |
1458 |
try { |
2 |
26 Feb 07 |
jari |
1459 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
1460 |
normalizationAbort = false; |
2 |
26 Feb 07 |
jari |
1461 |
progressBar = new Progress(new java.awt.Frame(), "Normalization Progress", new NormalizationListener()); |
2 |
26 Feb 07 |
jari |
1462 |
progressBar.show(); |
2 |
26 Feb 07 |
jari |
1463 |
progressBar.setUnits(size); |
2 |
26 Feb 07 |
jari |
1464 |
progressBar.setValue(0); |
2 |
26 Feb 07 |
jari |
1465 |
for (int feature=0; feature<size; feature++) { |
2 |
26 Feb 07 |
jari |
1466 |
progressBar.setValue(feature); |
2 |
26 Feb 07 |
jari |
1467 |
progressBar.setDescription("Normalizing Experiment "+Integer.toString(feature)); |
2 |
26 Feb 07 |
jari |
1468 |
progressBar.repaint(); |
2 |
26 Feb 07 |
jari |
1469 |
slideData = getFeature(feature); |
2 |
26 Feb 07 |
jari |
1470 |
if(normalizationAbort) |
2 |
26 Feb 07 |
jari |
1471 |
break; |
2 |
26 Feb 07 |
jari |
1472 |
slideData.applyNormalization(mode, properties); |
2 |
26 Feb 07 |
jari |
1473 |
viewer.fireDataChanged(); |
2 |
26 Feb 07 |
jari |
1474 |
updateMaxValues(slideData); |
2 |
26 Feb 07 |
jari |
1475 |
} |
2 |
26 Feb 07 |
jari |
1476 |
if(normalizationAbort){ |
2 |
26 Feb 07 |
jari |
1477 |
System.out.println("Abort"); |
2 |
26 Feb 07 |
jari |
1478 |
progressBar.setVisible(false); |
2 |
26 Feb 07 |
jari |
1479 |
progressBar.dispose(); |
2 |
26 Feb 07 |
jari |
1480 |
for (int feature=0; feature<size; feature++) { |
2 |
26 Feb 07 |
jari |
1481 |
slideData = getFeature(feature); |
2 |
26 Feb 07 |
jari |
1482 |
slideData.applyNormalization(ISlideData.NO_NORMALIZATION, properties); |
2 |
26 Feb 07 |
jari |
1483 |
updateMaxValues(slideData); |
2 |
26 Feb 07 |
jari |
1484 |
} |
2 |
26 Feb 07 |
jari |
1485 |
} |
2 |
26 Feb 07 |
jari |
1486 |
progressBar.dispose(); |
2 |
26 Feb 07 |
jari |
1487 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1488 |
|
2 |
26 Feb 07 |
jari |
1489 |
} finally { |
2 |
26 Feb 07 |
jari |
1490 |
|
2 |
26 Feb 07 |
jari |
1491 |
} |
2 |
26 Feb 07 |
jari |
1492 |
} |
2 |
26 Feb 07 |
jari |
1493 |
} |
2 |
26 Feb 07 |
jari |
1494 |
|
2 |
26 Feb 07 |
jari |
1495 |
/** |
2 |
26 Feb 07 |
jari |
* Normalize the data according to a specified mode. |
2 |
26 Feb 07 |
jari |
1497 |
*/ |
2 |
26 Feb 07 |
jari |
1498 |
String normalize(int mode, MultipleArrayViewer viewer) { |
2 |
26 Feb 07 |
jari |
1499 |
resetMaxValues(); |
2 |
26 Feb 07 |
jari |
1500 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
1501 |
final int size = getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
1502 |
Properties properties = new Properties(); |
2 |
26 Feb 07 |
jari |
//construct normalization parameter defaults |
2 |
26 Feb 07 |
jari |
1504 |
new Parameter(); |
2 |
26 Feb 07 |
jari |
1505 |
if(mode == ISlideData.NO_NORMALIZATION){ |
2 |
26 Feb 07 |
jari |
1506 |
for (int feature=0; feature<size; feature++) { |
2 |
26 Feb 07 |
jari |
1507 |
slideData = getFeature(feature); |
2 |
26 Feb 07 |
jari |
1508 |
slideData.applyNormalization(ISlideData.NO_NORMALIZATION, properties); |
2 |
26 Feb 07 |
jari |
1509 |
updateMaxValues(slideData); |
2 |
26 Feb 07 |
jari |
1510 |
} |
2 |
26 Feb 07 |
jari |
1511 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
1512 |
return "normalized"; //actually signals altered state |
2 |
26 Feb 07 |
jari |
1513 |
} |
2 |
26 Feb 07 |
jari |
1514 |
if(mode == ISlideData.LINEAR_REGRESSION){ |
2 |
26 Feb 07 |
jari |
1515 |
LinRegNormInitDialog dialog = new LinRegNormInitDialog(); |
2 |
26 Feb 07 |
jari |
1516 |
if(dialog.showModal() == JOptionPane.OK_OPTION){ |
2 |
26 Feb 07 |
jari |
1517 |
properties.setProperty("standard-deviation", Float.toString(dialog.getSD())); |
2 |
26 Feb 07 |
jari |
1518 |
properties.setProperty("mode", dialog.getMode()); |
2 |
26 Feb 07 |
jari |
1519 |
dialog.dispose(); |
2 |
26 Feb 07 |
jari |
1520 |
} |
2 |
26 Feb 07 |
jari |
1521 |
else{ |
2 |
26 Feb 07 |
jari |
1522 |
return "no_change"; |
2 |
26 Feb 07 |
jari |
1523 |
} |
2 |
26 Feb 07 |
jari |
1524 |
} |
2 |
26 Feb 07 |
jari |
1525 |
else if(mode == ISlideData.RATIO_STATISTICS_95 || mode == ISlideData.RATIO_STATISTICS_99){ |
2 |
26 Feb 07 |
jari |
1526 |
RatioStatsNormInitDialog dialog = new RatioStatsNormInitDialog(); |
2 |
26 Feb 07 |
jari |
1527 |
if(dialog.showModal() == JOptionPane.OK_OPTION){ |
2 |
26 Feb 07 |
jari |
1528 |
properties.setProperty("confidence-interval", Integer.toString(dialog.getCI())); |
2 |
26 Feb 07 |
jari |
1529 |
dialog.dispose(); |
2 |
26 Feb 07 |
jari |
1530 |
} |
2 |
26 Feb 07 |
jari |
1531 |
else{ |
2 |
26 Feb 07 |
jari |
1532 |
return "no_change"; |
2 |
26 Feb 07 |
jari |
1533 |
} |
2 |
26 Feb 07 |
jari |
1534 |
} |
2 |
26 Feb 07 |
jari |
1535 |
else if(mode == ISlideData.ITERATIVE_LOG){ |
2 |
26 Feb 07 |
jari |
1536 |
IterativeLogMCNormInitDialog dialog = new IterativeLogMCNormInitDialog(); |
2 |
26 Feb 07 |
jari |
1537 |
if(dialog.showModal() == JOptionPane.OK_OPTION){ |
2 |
26 Feb 07 |
jari |
1538 |
properties.setProperty("standard-deviation", Float.toString(dialog.getSD())); |
2 |
26 Feb 07 |
jari |
1539 |
dialog.dispose(); |
2 |
26 Feb 07 |
jari |
1540 |
} |
2 |
26 Feb 07 |
jari |
1541 |
else{ |
2 |
26 Feb 07 |
jari |
1542 |
return "no_change"; |
2 |
26 Feb 07 |
jari |
1543 |
} |
2 |
26 Feb 07 |
jari |
1544 |
} |
2 |
26 Feb 07 |
jari |
// Thread thread = new Thread(new Normalizer(mode, properties, size)); |
2 |
26 Feb 07 |
jari |
// thread.setPriority(Thread.MIN_PRIORITY); |
2 |
26 Feb 07 |
jari |
// thread.start(); |
2 |
26 Feb 07 |
jari |
1548 |
Normalizer normalizer = new Normalizer(mode, properties, size, viewer); |
2 |
26 Feb 07 |
jari |
1549 |
normalizer.runNormalization(); |
2 |
26 Feb 07 |
jari |
1550 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
1551 |
if(!normalizationAbort) |
2 |
26 Feb 07 |
jari |
1552 |
return "normalized"; |
2 |
26 Feb 07 |
jari |
1553 |
else |
2 |
26 Feb 07 |
jari |
1554 |
return "process_abort_reset"; |
2 |
26 Feb 07 |
jari |
1555 |
} |
2 |
26 Feb 07 |
jari |
1556 |
|
2 |
26 Feb 07 |
jari |
1557 |
/** |
2 |
26 Feb 07 |
jari |
* The class to listen to algorithm events. |
2 |
26 Feb 07 |
jari |
1559 |
*/ |
2 |
26 Feb 07 |
jari |
1560 |
private class NormalizationListener extends DialogListener { |
2 |
26 Feb 07 |
jari |
1561 |
|
2 |
26 Feb 07 |
jari |
1562 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
1563 |
String command = e.getActionCommand(); |
2 |
26 Feb 07 |
jari |
1564 |
if (command.equals("cancel-command")) { |
2 |
26 Feb 07 |
jari |
1565 |
normalizationAbort = true; |
2 |
26 Feb 07 |
jari |
1566 |
progressBar.dispose(); |
2 |
26 Feb 07 |
jari |
1567 |
} |
2 |
26 Feb 07 |
jari |
1568 |
} |
2 |
26 Feb 07 |
jari |
1569 |
|
2 |
26 Feb 07 |
jari |
1570 |
public void windowClosing(WindowEvent e) { |
2 |
26 Feb 07 |
jari |
1571 |
normalizationAbort = true; |
2 |
26 Feb 07 |
jari |
1572 |
progressBar.dispose(); |
2 |
26 Feb 07 |
jari |
1573 |
} |
2 |
26 Feb 07 |
jari |
1574 |
} |
2 |
26 Feb 07 |
jari |
1575 |
|
2 |
26 Feb 07 |
jari |
1576 |
|
2 |
26 Feb 07 |
jari |
1577 |
|
2 |
26 Feb 07 |
jari |
1578 |
|
2 |
26 Feb 07 |
jari |
1579 |
/** |
2 |
26 Feb 07 |
jari |
* Normalize the data according to a specified mode. |
2 |
26 Feb 07 |
jari |
1581 |
*/ |
2 |
26 Feb 07 |
jari |
1582 |
void normalizeList(int mode) { |
2 |
26 Feb 07 |
jari |
1583 |
resetMaxValues(); |
2 |
26 Feb 07 |
jari |
1584 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
1585 |
final int size = getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
1586 |
for (int i=0; i<size; i++) { |
2 |
26 Feb 07 |
jari |
1587 |
slideData = getFeature(i); |
2 |
26 Feb 07 |
jari |
1588 |
slideData.applyNormalizationList(mode); |
2 |
26 Feb 07 |
jari |
1589 |
updateMaxValues(slideData); |
2 |
26 Feb 07 |
jari |
1590 |
} |
2 |
26 Feb 07 |
jari |
1591 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
1592 |
} |
2 |
26 Feb 07 |
jari |
1593 |
|
2 |
26 Feb 07 |
jari |
1594 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an array of sorted indices for specified column. |
2 |
26 Feb 07 |
jari |
1596 |
*/ |
2 |
26 Feb 07 |
jari |
1597 |
public int[] getSortedIndices(int column) { |
2 |
26 Feb 07 |
jari |
1598 |
return(int[])indicesList.get(column); |
2 |
26 Feb 07 |
jari |
1599 |
} |
2 |
26 Feb 07 |
jari |
1600 |
|
2 |
26 Feb 07 |
jari |
1601 |
/** |
2 |
26 Feb 07 |
jari |
* Creates an experiment data. |
2 |
26 Feb 07 |
jari |
* @see Experiment |
2 |
26 Feb 07 |
jari |
1604 |
*/ |
2 |
26 Feb 07 |
jari |
1605 |
private Experiment createExperiment() { |
2 |
26 Feb 07 |
jari |
1606 |
final int featuresSize = featuresList.size(); |
2 |
26 Feb 07 |
jari |
1607 |
if (featuresSize < 1) { |
2 |
26 Feb 07 |
jari |
1608 |
return null; |
2 |
26 Feb 07 |
jari |
1609 |
} |
2 |
26 Feb 07 |
jari |
1610 |
final int probesSize = getFeature(0).getSize(); |
2 |
26 Feb 07 |
jari |
1611 |
Experiment experiment = null; |
2 |
26 Feb 07 |
jari |
1612 |
int[] features = null; |
2 |
26 Feb 07 |
jari |
1613 |
int[] probes = null; |
2 |
26 Feb 07 |
jari |
1614 |
|
2 |
26 Feb 07 |
jari |
// pcahan affy detection filter or fold filter |
2 |
26 Feb 07 |
jari |
1616 |
if ((isLowerCutoffs()||isGenePixFilter() || isPercentageCutoff()) ||isPvaluePercentageCutoff()|| isPresentCallCutoff()||isGCOSPercentCutoff()||isVarianceFilter() || ( (TMEV.getDataType() == TMEV.DATA_TYPE_AFFY) && (isDetectionFilter() || isFoldFilter())) ) { |
2 |
26 Feb 07 |
jari |
1617 |
probes = createCutoffGeneList(featuresSize, probesSize); |
2 |
26 Feb 07 |
jari |
1618 |
experiment = createExperiment(featuresSize, probes); |
2 |
26 Feb 07 |
jari |
1619 |
} else { |
2 |
26 Feb 07 |
jari |
// all features used for experiment |
2 |
26 Feb 07 |
jari |
1621 |
features = createDefaultFeatures(featuresSize, probesSize); |
2 |
26 Feb 07 |
jari |
1622 |
experiment = createExperiment(features, probesSize); |
2 |
26 Feb 07 |
jari |
1623 |
} |
2 |
26 Feb 07 |
jari |
1624 |
return experiment; |
2 |
26 Feb 07 |
jari |
1625 |
} |
2 |
26 Feb 07 |
jari |
1626 |
|
2 |
26 Feb 07 |
jari |
1627 |
|
2 |
26 Feb 07 |
jari |
1628 |
|
2 |
26 Feb 07 |
jari |
1629 |
/** |
2 |
26 Feb 07 |
jari |
* Creates an array of ordered integers. |
2 |
26 Feb 07 |
jari |
1631 |
*/ |
2 |
26 Feb 07 |
jari |
1632 |
private int[] createDefaultFeatures(final int featuresSize, final int probesSize) { |
2 |
26 Feb 07 |
jari |
1633 |
int[] features = new int[featuresSize]; |
2 |
26 Feb 07 |
jari |
1634 |
for (int i=0; i<featuresSize; i++) { |
2 |
26 Feb 07 |
jari |
1635 |
features[i] = i; |
2 |
26 Feb 07 |
jari |
1636 |
} |
2 |
26 Feb 07 |
jari |
1637 |
return features; |
2 |
26 Feb 07 |
jari |
1638 |
} |
2 |
26 Feb 07 |
jari |
1639 |
|
2 |
26 Feb 07 |
jari |
1640 |
/** |
2 |
26 Feb 07 |
jari |
* Creates an array of indices of used microarrays. |
2 |
26 Feb 07 |
jari |
1642 |
*/ |
2 |
26 Feb 07 |
jari |
1643 |
private int[] createCutoffFeatures(final int featuresSize, final int probesSize) { |
2 |
26 Feb 07 |
jari |
1644 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
1645 |
float cy3, cy5; |
2 |
26 Feb 07 |
jari |
1646 |
ArrayList list = new ArrayList(); |
2 |
26 Feb 07 |
jari |
1647 |
boolean criteria = true; |
2 |
26 Feb 07 |
jari |
1648 |
int percentageCount = 0; |
2 |
26 Feb 07 |
jari |
1649 |
for (int feature=0; feature<featuresSize; feature++) { |
2 |
26 Feb 07 |
jari |
1650 |
slideData = getFeature(feature); |
2 |
26 Feb 07 |
jari |
1651 |
for (int probe=0; probe<probesSize; probe++) { |
2 |
26 Feb 07 |
jari |
1652 |
cy3 = slideData.getCY3(probe); |
2 |
26 Feb 07 |
jari |
1653 |
cy5 = slideData.getCY5(probe); |
2 |
26 Feb 07 |
jari |
1654 |
if (isLowerCutoffs()) { |
2 |
26 Feb 07 |
jari |
1655 |
if ((cy3 < lowerCY3Cutoff) || (cy5 < lowerCY5Cutoff)) { |
2 |
26 Feb 07 |
jari |
1656 |
criteria = false; |
2 |
26 Feb 07 |
jari |
1657 |
break; |
2 |
26 Feb 07 |
jari |
1658 |
} |
2 |
26 Feb 07 |
jari |
1659 |
} |
2 |
26 Feb 07 |
jari |
1660 |
if (isPercentageCutoff()) { |
2 |
26 Feb 07 |
jari |
1661 |
if ((cy3 > 0) && (cy5 > 0)) { |
2 |
26 Feb 07 |
jari |
1662 |
percentageCount++; |
2 |
26 Feb 07 |
jari |
1663 |
} |
2 |
26 Feb 07 |
jari |
1664 |
} |
2 |
26 Feb 07 |
jari |
1665 |
} |
2 |
26 Feb 07 |
jari |
1666 |
if (criteria && isPercentageCutoff()) { |
2 |
26 Feb 07 |
jari |
1667 |
if ((float)percentageCount/(float)probesSize*100f < percentageCutoff) { |
2 |
26 Feb 07 |
jari |
1668 |
criteria = false; |
2 |
26 Feb 07 |
jari |
1669 |
} |
2 |
26 Feb 07 |
jari |
1670 |
} |
2 |
26 Feb 07 |
jari |
1671 |
if (criteria) { |
2 |
26 Feb 07 |
jari |
1672 |
list.add(new Integer(feature)); |
2 |
26 Feb 07 |
jari |
1673 |
} |
2 |
26 Feb 07 |
jari |
1674 |
} |
2 |
26 Feb 07 |
jari |
1675 |
int[] features = new int[list.size()]; |
2 |
26 Feb 07 |
jari |
1676 |
for (int i=0; i<features.length; i++) { |
2 |
26 Feb 07 |
jari |
1677 |
features[i] = ((Integer)list.get(i)).intValue(); |
2 |
26 Feb 07 |
jari |
1678 |
} |
2 |
26 Feb 07 |
jari |
1679 |
return features; |
2 |
26 Feb 07 |
jari |
1680 |
} |
2 |
26 Feb 07 |
jari |
1681 |
|
2 |
26 Feb 07 |
jari |
1682 |
|
2 |
26 Feb 07 |
jari |
//Below: new createCutoffGeneList() that trims off genes instead of experiments. 8/2/2002, N. Bhagabati |
2 |
26 Feb 07 |
jari |
1684 |
|
2 |
26 Feb 07 |
jari |
1685 |
/* |
2 |
26 Feb 07 |
jari |
* Retired for MeV 2.2. Replaced by method to handle affy cutoff criteria (below, from pcahan) |
2 |
26 Feb 07 |
jari |
1687 |
* |
2 |
26 Feb 07 |
jari |
private int[] createCutoffGeneList(final int featuresSize, final int probesSize) { |
2 |
26 Feb 07 |
jari |
ISlideData[] slideData = new ISlideData[featuresSize]; |
2 |
26 Feb 07 |
jari |
//float cy3, cy5; |
2 |
26 Feb 07 |
jari |
ArrayList list = new ArrayList(); |
2 |
26 Feb 07 |
jari |
boolean lowerCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
boolean percentageCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
int percentageCount = 0; |
2 |
26 Feb 07 |
jari |
1695 |
|
2 |
26 Feb 07 |
jari |
for (int i = 0; i < slideData.length; i++) { |
2 |
26 Feb 07 |
jari |
slideData[i] = getFeature(i); |
2 |
26 Feb 07 |
jari |
1698 |
} |
2 |
26 Feb 07 |
jari |
1699 |
|
2 |
26 Feb 07 |
jari |
for (int probe = 0; probe < probesSize; probe++) { |
2 |
26 Feb 07 |
jari |
float[] cy3 = new float[featuresSize]; |
2 |
26 Feb 07 |
jari |
float[] cy5 = new float[featuresSize]; |
2 |
26 Feb 07 |
jari |
percentageCount = 0; |
2 |
26 Feb 07 |
jari |
lowerCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
percentageCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1706 |
|
2 |
26 Feb 07 |
jari |
for (int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
cy3[j] = slideData[j].getCY3(probe); |
2 |
26 Feb 07 |
jari |
cy5[j] = slideData[j].getCY5(probe); |
2 |
26 Feb 07 |
jari |
1710 |
} |
2 |
26 Feb 07 |
jari |
1711 |
|
2 |
26 Feb 07 |
jari |
if (isLowerCutoffs()) { |
2 |
26 Feb 07 |
jari |
for (int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
if ((cy3[j] < lowerCY3Cutoff) || (cy5[j] < lowerCY5Cutoff)) { |
2 |
26 Feb 07 |
jari |
lowerCutoffCriterion = false; |
2 |
26 Feb 07 |
jari |
break; |
2 |
26 Feb 07 |
jari |
1717 |
} |
2 |
26 Feb 07 |
jari |
1718 |
} |
2 |
26 Feb 07 |
jari |
1719 |
} |
2 |
26 Feb 07 |
jari |
1720 |
|
2 |
26 Feb 07 |
jari |
if (isPercentageCutoff()) { |
2 |
26 Feb 07 |
jari |
for (int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
if ((cy3[j] > 0) && (cy5[j] > 0)) { |
2 |
26 Feb 07 |
jari |
percentageCount++; |
2 |
26 Feb 07 |
jari |
1725 |
} |
2 |
26 Feb 07 |
jari |
1726 |
} |
2 |
26 Feb 07 |
jari |
1727 |
|
2 |
26 Feb 07 |
jari |
if ((float)percentageCount/(float)featuresSize*100f < percentageCutoff) { |
2 |
26 Feb 07 |
jari |
percentageCutoffCriterion = false; |
2 |
26 Feb 07 |
jari |
1730 |
} |
2 |
26 Feb 07 |
jari |
1731 |
} |
2 |
26 Feb 07 |
jari |
1732 |
|
2 |
26 Feb 07 |
jari |
if (lowerCutoffCriterion && percentageCutoffCriterion) { |
2 |
26 Feb 07 |
jari |
list.add(new Integer(probe)); |
2 |
26 Feb 07 |
jari |
1735 |
} |
2 |
26 Feb 07 |
jari |
1736 |
|
2 |
26 Feb 07 |
jari |
if (lowerCutoffCriterion && percentageCutoffCriterion && detectionCriterion && foldCriterion) { |
2 |
26 Feb 07 |
jari |
list.add(new Integer(probe)); |
2 |
26 Feb 07 |
jari |
1739 |
} |
2 |
26 Feb 07 |
jari |
1740 |
} |
2 |
26 Feb 07 |
jari |
1741 |
|
2 |
26 Feb 07 |
jari |
int[] retainedProbes = new int[list.size()]; |
2 |
26 Feb 07 |
jari |
for (int i = 0; i < retainedProbes.length; i++) { |
2 |
26 Feb 07 |
jari |
retainedProbes[i] = ((Integer)list.get(i)).intValue(); |
2 |
26 Feb 07 |
jari |
1745 |
} |
2 |
26 Feb 07 |
jari |
1746 |
|
2 |
26 Feb 07 |
jari |
return retainedProbes; |
2 |
26 Feb 07 |
jari |
1748 |
} |
2 |
26 Feb 07 |
jari |
1749 |
* |
2 |
26 Feb 07 |
jari |
1750 |
*/ |
2 |
26 Feb 07 |
jari |
//add for mas5 filter some genes according A/(P+m+A) percentage |
2 |
26 Feb 07 |
jari |
1752 |
private int[]filterAbsentCall(int generows,float percentage)throws IOException{ |
2 |
26 Feb 07 |
jari |
1753 |
int counter=0; |
2 |
26 Feb 07 |
jari |
1754 |
int tag=0; |
2 |
26 Feb 07 |
jari |
1755 |
int list[]=new int[generows+1]; |
2 |
26 Feb 07 |
jari |
1756 |
boolean head=true; |
2 |
26 Feb 07 |
jari |
1757 |
String [] fields=this.getFieldNames(); |
2 |
26 Feb 07 |
jari |
1758 |
|
2 |
26 Feb 07 |
jari |
1759 |
BufferedReader reader= new BufferedReader(new FileReader(fields[this.getFieldNames().length-1])); |
2 |
26 Feb 07 |
jari |
1760 |
StringSplitter ss = new StringSplitter((char)0x09); |
2 |
26 Feb 07 |
jari |
1761 |
String currentLine; |
2 |
26 Feb 07 |
jari |
1762 |
while((currentLine=reader.readLine())!=null){ |
2 |
26 Feb 07 |
jari |
1763 |
counter=0; |
2 |
26 Feb 07 |
jari |
1764 |
ss.init(currentLine); |
2 |
26 Feb 07 |
jari |
1765 |
if(head) head=false; |
2 |
26 Feb 07 |
jari |
1766 |
else{ |
2 |
26 Feb 07 |
jari |
1767 |
for(int i=0;i<ss.countTokens();i++){ |
2 |
26 Feb 07 |
jari |
1768 |
if(ss.nextToken().compareTo("A")==0){ |
2 |
26 Feb 07 |
jari |
1769 |
counter++; |
2 |
26 Feb 07 |
jari |
1770 |
} |
2 |
26 Feb 07 |
jari |
1771 |
|
2 |
26 Feb 07 |
jari |
1772 |
} |
2 |
26 Feb 07 |
jari |
1773 |
if(counter*100/ss.countTokens()>percentage) |
2 |
26 Feb 07 |
jari |
1774 |
list[tag]=1; |
2 |
26 Feb 07 |
jari |
1775 |
tag++; |
2 |
26 Feb 07 |
jari |
1776 |
} |
2 |
26 Feb 07 |
jari |
1777 |
} |
2 |
26 Feb 07 |
jari |
1778 |
reader.close(); |
2 |
26 Feb 07 |
jari |
1779 |
return list; |
2 |
26 Feb 07 |
jari |
1780 |
} |
2 |
26 Feb 07 |
jari |
1781 |
|
2 |
26 Feb 07 |
jari |
1782 |
|
2 |
26 Feb 07 |
jari |
1783 |
|
2 |
26 Feb 07 |
jari |
//modified from original above ( by pcahan) |
2 |
26 Feb 07 |
jari |
1785 |
|
2 |
26 Feb 07 |
jari |
1786 |
private int[] createCutoffGeneList(final int featuresSize, final int probesSize) { |
2 |
26 Feb 07 |
jari |
1787 |
ISlideData[] slideData = new ISlideData[featuresSize]; |
2 |
26 Feb 07 |
jari |
//float cy3, cy5; |
2 |
26 Feb 07 |
jari |
1789 |
ArrayList list = new ArrayList(); |
2 |
26 Feb 07 |
jari |
1790 |
boolean lowerCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1791 |
boolean percentageCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1792 |
boolean varianceFilterCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1793 |
boolean detectionCriterion = true; |
2 |
26 Feb 07 |
jari |
1794 |
boolean foldCriterion = true; |
2 |
26 Feb 07 |
jari |
1795 |
boolean presentCallCutoffCriterion = true,genePixCutoffCriterion=true; |
2 |
26 Feb 07 |
jari |
1796 |
boolean GCOSCutoffCriterion=true; |
2 |
26 Feb 07 |
jari |
1797 |
boolean pvaluepercentageCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1798 |
int mas5CallList[]=new int[slideData.length]; |
2 |
26 Feb 07 |
jari |
1799 |
int pvaluepercentCount=0,percentageCount = 0; |
2 |
26 Feb 07 |
jari |
1800 |
int absentCount = 0; |
2 |
26 Feb 07 |
jari |
1801 |
int percentCount=0; |
2 |
26 Feb 07 |
jari |
1802 |
int genepixCount=0; |
2 |
26 Feb 07 |
jari |
1803 |
int[]tagList=new int[probesSize]; |
2 |
26 Feb 07 |
jari |
1804 |
|
2 |
26 Feb 07 |
jari |
1805 |
if(isPresentCallCutoff()){ |
2 |
26 Feb 07 |
jari |
1806 |
try{ |
2 |
26 Feb 07 |
jari |
1807 |
tagList=filterAbsentCall(probesSize,percentageCutoff); |
2 |
26 Feb 07 |
jari |
1808 |
}catch(IOException e){ |
2 |
26 Feb 07 |
jari |
1809 |
System.out.print("Call file wrong"); |
2 |
26 Feb 07 |
jari |
1810 |
} |
2 |
26 Feb 07 |
jari |
1811 |
} |
2 |
26 Feb 07 |
jari |
// get each chip |
2 |
26 Feb 07 |
jari |
1813 |
for (int i = 0; i < slideData.length; i++) { |
2 |
26 Feb 07 |
jari |
1814 |
slideData[i] = getFeature(i); |
2 |
26 Feb 07 |
jari |
1815 |
} |
2 |
26 Feb 07 |
jari |
//System.out.print(featuresSize); |
2 |
26 Feb 07 |
jari |
// iterate over each gene |
2 |
26 Feb 07 |
jari |
1818 |
for (int probe = 0; probe < probesSize; probe++) { |
2 |
26 Feb 07 |
jari |
1819 |
|
2 |
26 Feb 07 |
jari |
// arrays of length = number of chips |
2 |
26 Feb 07 |
jari |
1821 |
float[] cy3 = new float[featuresSize]; |
2 |
26 Feb 07 |
jari |
1822 |
float[] cy5 = new float[featuresSize]; |
2 |
26 Feb 07 |
jari |
1823 |
|
2 |
26 Feb 07 |
jari |
1824 |
String[] detection = new String[featuresSize]; |
2 |
26 Feb 07 |
jari |
1825 |
float[] pvalue=new float[featuresSize]; |
2 |
26 Feb 07 |
jari |
1826 |
float[] flags=new float[featuresSize]; |
2 |
26 Feb 07 |
jari |
1827 |
pvaluepercentCount=0; |
2 |
26 Feb 07 |
jari |
1828 |
percentageCount = 0; |
2 |
26 Feb 07 |
jari |
1829 |
percentCount=0; |
2 |
26 Feb 07 |
jari |
1830 |
absentCount = 0; |
2 |
26 Feb 07 |
jari |
1831 |
genepixCount=0; |
2 |
26 Feb 07 |
jari |
1832 |
lowerCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1833 |
percentageCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1834 |
detectionCriterion = true; |
2 |
26 Feb 07 |
jari |
1835 |
foldCriterion = true; |
2 |
26 Feb 07 |
jari |
1836 |
presentCallCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1837 |
GCOSCutoffCriterion=true; |
2 |
26 Feb 07 |
jari |
1838 |
pvaluepercentageCutoffCriterion = true; |
2 |
26 Feb 07 |
jari |
1839 |
genePixCutoffCriterion=true; |
2 |
26 Feb 07 |
jari |
1840 |
|
2 |
26 Feb 07 |
jari |
1841 |
if(tagList[probe]==1){ |
2 |
26 Feb 07 |
jari |
1842 |
presentCallCutoffCriterion = false; |
2 |
26 Feb 07 |
jari |
1843 |
} |
2 |
26 Feb 07 |
jari |
// iterate over each chip |
2 |
26 Feb 07 |
jari |
1845 |
|
2 |
26 Feb 07 |
jari |
1846 |
for (int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
1847 |
cy3[j] = slideData[j].getCY3(probe); |
2 |
26 Feb 07 |
jari |
1848 |
cy5[j] = slideData[j].getCY5(probe); |
2 |
26 Feb 07 |
jari |
1849 |
detection[j] = getDetection(j, probe); |
2 |
26 Feb 07 |
jari |
1850 |
pvalue[j]=getPvalue(j,probe); |
2 |
26 Feb 07 |
jari |
1851 |
flags[j]=getGenePixFlags(j,probe); |
2 |
26 Feb 07 |
jari |
1852 |
} |
2 |
26 Feb 07 |
jari |
1853 |
|
2 |
26 Feb 07 |
jari |
1854 |
if(isGenePixFilter()){ |
2 |
26 Feb 07 |
jari |
1855 |
for (int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
1856 |
if(flags[j]<0) |
2 |
26 Feb 07 |
jari |
1857 |
genepixCount++; |
2 |
26 Feb 07 |
jari |
1858 |
} |
2 |
26 Feb 07 |
jari |
1859 |
if((float)genepixCount/(float)featuresSize*100f >percentageCutoff) |
2 |
26 Feb 07 |
jari |
1860 |
genePixCutoffCriterion=false; |
2 |
26 Feb 07 |
jari |
1861 |
} |
2 |
26 Feb 07 |
jari |
1862 |
|
2 |
26 Feb 07 |
jari |
// run tests |
2 |
26 Feb 07 |
jari |
1864 |
|
2 |
26 Feb 07 |
jari |
1865 |
if (isLowerCutoffs()) { |
2 |
26 Feb 07 |
jari |
1866 |
for (int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
1867 |
if ((cy3[j] < lowerCY3Cutoff) || (cy5[j] < lowerCY5Cutoff)) { |
2 |
26 Feb 07 |
jari |
1868 |
lowerCutoffCriterion = false; |
2 |
26 Feb 07 |
jari |
1869 |
break; |
2 |
26 Feb 07 |
jari |
1870 |
} |
2 |
26 Feb 07 |
jari |
1871 |
} |
2 |
26 Feb 07 |
jari |
1872 |
} |
2 |
26 Feb 07 |
jari |
1873 |
|
2 |
26 Feb 07 |
jari |
1874 |
if (isPercentageCutoff()) { |
2 |
26 Feb 07 |
jari |
1875 |
for (int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
1876 |
if ((cy3[j] > 0) && (cy5[j] > 0) || (dataType == IData.DATA_TYPE_RATIO_ONLY && !Float.isNaN(cy5[j]))) { |
2 |
26 Feb 07 |
jari |
1877 |
percentageCount++; |
2 |
26 Feb 07 |
jari |
1878 |
} |
2 |
26 Feb 07 |
jari |
1879 |
} |
2 |
26 Feb 07 |
jari |
1880 |
if ((float)percentageCount/(float)featuresSize*100f < percentageCutoff) { |
2 |
26 Feb 07 |
jari |
1881 |
percentageCutoffCriterion = false; |
2 |
26 Feb 07 |
jari |
1882 |
} |
2 |
26 Feb 07 |
jari |
1883 |
} |
2 |
26 Feb 07 |
jari |
1884 |
|
2 |
26 Feb 07 |
jari |
//fiter on present calls A/(P+M+A) |
2 |
26 Feb 07 |
jari |
1886 |
if(isGCOSPercentCutoff()){ |
2 |
26 Feb 07 |
jari |
1887 |
for(int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
1888 |
detection[j] = getDetection(j, probe); |
2 |
26 Feb 07 |
jari |
1889 |
if(((String)detection[j]).compareTo("A")==0||((String)detection[j]).compareTo("a")==0) |
2 |
26 Feb 07 |
jari |
1890 |
percentCount++; |
2 |
26 Feb 07 |
jari |
1891 |
|
2 |
26 Feb 07 |
jari |
1892 |
} |
2 |
26 Feb 07 |
jari |
1893 |
if ((float)percentCount/(float)featuresSize*100f >percentageCutoff) { |
2 |
26 Feb 07 |
jari |
1894 |
GCOSCutoffCriterion = false; |
2 |
26 Feb 07 |
jari |
1895 |
} |
2 |
26 Feb 07 |
jari |
1896 |
} |
2 |
26 Feb 07 |
jari |
/* if(isVarianceFilter()) { |
2 |
26 Feb 07 |
jari |
varianceCriterion = retainBasedOnSD; |
2 |
26 Feb 07 |
jari |
1899 |
} |
2 |
26 Feb 07 |
jari |
1900 |
*/ |
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
1902 |
if (isDetectionFilter()){ |
2 |
26 Feb 07 |
jari |
1903 |
detectionCriterion = detectionFilter.keep_gene(detection); |
2 |
26 Feb 07 |
jari |
1904 |
} |
2 |
26 Feb 07 |
jari |
1905 |
|
2 |
26 Feb 07 |
jari |
1906 |
if (isFoldFilter() ){ |
2 |
26 Feb 07 |
jari |
1907 |
foldCriterion = foldFilter.keep_gene(cy5); |
2 |
26 Feb 07 |
jari |
1908 |
} |
2 |
26 Feb 07 |
jari |
1909 |
|
2 |
26 Feb 07 |
jari |
//wwang add for affy p-value filter: |
2 |
26 Feb 07 |
jari |
//choose a percent below a particular |
2 |
26 Feb 07 |
jari |
//p-value cutoff - for example 80% below p=0.001 |
2 |
26 Feb 07 |
jari |
1913 |
if(isPvaluePercentageCutoff()){ |
2 |
26 Feb 07 |
jari |
1914 |
for(int j = 0; j < cy3.length; j++) { |
2 |
26 Feb 07 |
jari |
1915 |
pvalue[j] = getPvalue(j, probe); |
2 |
26 Feb 07 |
jari |
1916 |
if(pvalue[j]>0.01) |
2 |
26 Feb 07 |
jari |
1917 |
pvaluepercentCount++; |
2 |
26 Feb 07 |
jari |
1918 |
|
2 |
26 Feb 07 |
jari |
1919 |
} |
2 |
26 Feb 07 |
jari |
1920 |
if ((float)pvaluepercentCount/(float)featuresSize*100f >20) { |
2 |
26 Feb 07 |
jari |
1921 |
pvaluepercentageCutoffCriterion = false; |
2 |
26 Feb 07 |
jari |
1922 |
} |
2 |
26 Feb 07 |
jari |
1923 |
} |
2 |
26 Feb 07 |
jari |
1924 |
|
2 |
26 Feb 07 |
jari |
1925 |
if (lowerCutoffCriterion &&pvaluepercentageCutoffCriterion&& percentageCutoffCriterion&&GCOSCutoffCriterion&&presentCallCutoffCriterion&& detectionCriterion &&genePixCutoffCriterion&& foldCriterion) { |
2 |
26 Feb 07 |
jari |
1926 |
list.add(new Integer(probe)); |
2 |
26 Feb 07 |
jari |
1927 |
} |
2 |
26 Feb 07 |
jari |
1928 |
} |
2 |
26 Feb 07 |
jari |
1929 |
|
2 |
26 Feb 07 |
jari |
1930 |
|
2 |
26 Feb 07 |
jari |
//handle variance cuttoffs after other cutoffs, |
2 |
26 Feb 07 |
jari |
1932 |
|
2 |
26 Feb 07 |
jari |
1933 |
boolean [] retainBasedOnSD = null; |
2 |
26 Feb 07 |
jari |
1934 |
|
2 |
26 Feb 07 |
jari |
1935 |
if(isVarianceFilter()) { |
2 |
26 Feb 07 |
jari |
//generate a new list now applying var. filter |
2 |
26 Feb 07 |
jari |
1937 |
list = imposeVarianceFilter(list); |
2 |
26 Feb 07 |
jari |
1938 |
} |
2 |
26 Feb 07 |
jari |
1939 |
|
2 |
26 Feb 07 |
jari |
1940 |
int[] retainedProbes = new int[list.size()]; |
2 |
26 Feb 07 |
jari |
1941 |
for (int i = 0; i < retainedProbes.length; i++) { |
2 |
26 Feb 07 |
jari |
1942 |
retainedProbes[i] = ((Integer)list.get(i)).intValue(); |
2 |
26 Feb 07 |
jari |
1943 |
} |
2 |
26 Feb 07 |
jari |
1944 |
|
2 |
26 Feb 07 |
jari |
1945 |
return retainedProbes; |
2 |
26 Feb 07 |
jari |
1946 |
} |
2 |
26 Feb 07 |
jari |
1947 |
|
2 |
26 Feb 07 |
jari |
1948 |
|
2 |
26 Feb 07 |
jari |
1949 |
/** |
2 |
26 Feb 07 |
jari |
* Determines which genes pass the variance filter |
2 |
26 Feb 07 |
jari |
1951 |
*/ |
2 |
26 Feb 07 |
jari |
1952 |
private float [] getStandardDeviations() { |
2 |
26 Feb 07 |
jari |
1953 |
int numGenes = this.getFeaturesSize(); |
2 |
26 Feb 07 |
jari |
1954 |
int numSamples = this.getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
1955 |
float [] vars = new float[numGenes]; |
2 |
26 Feb 07 |
jari |
1956 |
|
2 |
26 Feb 07 |
jari |
1957 |
float val; |
2 |
26 Feb 07 |
jari |
1958 |
int validN; |
2 |
26 Feb 07 |
jari |
1959 |
float sum; |
2 |
26 Feb 07 |
jari |
1960 |
float sse; |
2 |
26 Feb 07 |
jari |
1961 |
float mean; |
2 |
26 Feb 07 |
jari |
1962 |
|
2 |
26 Feb 07 |
jari |
1963 |
float [] sds = new float[numGenes]; |
2 |
26 Feb 07 |
jari |
1964 |
boolean [] retentionList = new boolean[numGenes]; |
2 |
26 Feb 07 |
jari |
1965 |
|
2 |
26 Feb 07 |
jari |
1966 |
for(int i = 0; i < numGenes; i++) { |
2 |
26 Feb 07 |
jari |
1967 |
|
2 |
26 Feb 07 |
jari |
1968 |
validN = 0; |
2 |
26 Feb 07 |
jari |
1969 |
sum = 0; |
2 |
26 Feb 07 |
jari |
1970 |
sse = 0; |
2 |
26 Feb 07 |
jari |
1971 |
|
2 |
26 Feb 07 |
jari |
1972 |
for(int j = 0; j < numSamples; j++) { |
2 |
26 Feb 07 |
jari |
1973 |
val = this.getRatio(j,i,this.logState); |
2 |
26 Feb 07 |
jari |
1974 |
if(!Float.isNaN(val)) { |
2 |
26 Feb 07 |
jari |
1975 |
sum += val; |
2 |
26 Feb 07 |
jari |
1976 |
validN++; |
2 |
26 Feb 07 |
jari |
1977 |
} |
2 |
26 Feb 07 |
jari |
1978 |
} |
2 |
26 Feb 07 |
jari |
1979 |
|
2 |
26 Feb 07 |
jari |
1980 |
if(validN > 0) { |
2 |
26 Feb 07 |
jari |
1981 |
mean = sum/validN++; |
2 |
26 Feb 07 |
jari |
//System.out.println("mean = "+mean); |
2 |
26 Feb 07 |
jari |
1983 |
} else { |
2 |
26 Feb 07 |
jari |
1984 |
sds[i] = -1; //marker for a gene with no values |
2 |
26 Feb 07 |
jari |
1985 |
continue; |
2 |
26 Feb 07 |
jari |
1986 |
} |
2 |
26 Feb 07 |
jari |
1987 |
|
2 |
26 Feb 07 |
jari |
1988 |
for(int j = 0; j < numSamples; j++) { |
2 |
26 Feb 07 |
jari |
1989 |
val = this.getRatio(j,i,this.logState); |
2 |
26 Feb 07 |
jari |
1990 |
if(!Float.isNaN(val)) { |
2 |
26 Feb 07 |
jari |
1991 |
sse += Math.pow(val - mean,2.0); |
2 |
26 Feb 07 |
jari |
1992 |
} |
2 |
26 Feb 07 |
jari |
1993 |
} |
2 |
26 Feb 07 |
jari |
1994 |
if(validN > 0) |
2 |
26 Feb 07 |
jari |
1995 |
sds[i] =(float)Math.sqrt(sse/validN); |
2 |
26 Feb 07 |
jari |
1996 |
else |
2 |
26 Feb 07 |
jari |
1997 |
sds[i] = 0; |
2 |
26 Feb 07 |
jari |
1998 |
} |
2 |
26 Feb 07 |
jari |
1999 |
return sds; |
2 |
26 Feb 07 |
jari |
2000 |
} |
2 |
26 Feb 07 |
jari |
2001 |
|
2 |
26 Feb 07 |
jari |
2002 |
|
2 |
26 Feb 07 |
jari |
2003 |
|
2 |
26 Feb 07 |
jari |
2004 |
public ArrayList imposeVarianceFilter( ArrayList listOfIndices) { |
2 |
26 Feb 07 |
jari |
2005 |
|
2 |
26 Feb 07 |
jari |
2006 |
String mode = varianceFilterProps.getProperty("Filter Mode"); |
2 |
26 Feb 07 |
jari |
2007 |
float [] sds = getStandardDeviations(); |
2 |
26 Feb 07 |
jari |
2008 |
boolean [] retentionList = new boolean[sds.length]; |
2 |
26 Feb 07 |
jari |
2009 |
|
2 |
26 Feb 07 |
jari |
2010 |
ArrayList newList = new ArrayList(); |
2 |
26 Feb 07 |
jari |
2011 |
|
2 |
26 Feb 07 |
jari |
2012 |
if(mode.equals("sd value mode")) { //cutoff = hard |
2 |
26 Feb 07 |
jari |
2013 |
float sdCut = Float.parseFloat(varianceFilterProps.getProperty("Value")); |
2 |
26 Feb 07 |
jari |
2014 |
for(int i = 0; i < sds.length; i++) { |
2 |
26 Feb 07 |
jari |
2015 |
if(sds[i] >= sdCut && listOfIndices.contains(new Integer(i))) |
2 |
26 Feb 07 |
jari |
2016 |
newList.add(new Integer(i)); |
2 |
26 Feb 07 |
jari |
2017 |
} |
2 |
26 Feb 07 |
jari |
2018 |
} else if(mode.equals("percent mode")) { //top x percent |
2 |
26 Feb 07 |
jari |
2019 |
float percent = Float.parseFloat(varianceFilterProps.getProperty("Value")); |
2 |
26 Feb 07 |
jari |
2020 |
QSort sorter = new QSort(sds); |
2 |
26 Feb 07 |
jari |
2021 |
float [] sortedSDs = sorter.getSorted(); |
2 |
26 Feb 07 |
jari |
2022 |
int [] origOrder = sorter.getOrigIndx(); |
2 |
26 Feb 07 |
jari |
2023 |
int targetSize = (int)(listOfIndices.size()*(percent/100f)); |
2 |
26 Feb 07 |
jari |
2024 |
|
2 |
26 Feb 07 |
jari |
2025 |
for(int i = origOrder.length-1; i >= 0 && newList.size() < targetSize; i--) { |
2 |
26 Feb 07 |
jari |
2026 |
if(listOfIndices.contains(new Integer(origOrder[i]))) |
2 |
26 Feb 07 |
jari |
2027 |
newList.add(new Integer(origOrder[i])); |
2 |
26 Feb 07 |
jari |
2028 |
} |
2 |
26 Feb 07 |
jari |
2029 |
|
2 |
26 Feb 07 |
jari |
2030 |
} else { |
2 |
26 Feb 07 |
jari |
2031 |
int targetSize = Integer.parseInt(varianceFilterProps.getProperty("Value")); |
2 |
26 Feb 07 |
jari |
2032 |
QSort sorter = new QSort(sds); |
2 |
26 Feb 07 |
jari |
2033 |
float [] sortedSDs = sorter.getSorted(); |
2 |
26 Feb 07 |
jari |
2034 |
int [] origOrder = sorter.getOrigIndx(); |
2 |
26 Feb 07 |
jari |
2035 |
|
2 |
26 Feb 07 |
jari |
2036 |
for(int i = origOrder.length-1; i >= 0 && newList.size() < targetSize; i--) { |
2 |
26 Feb 07 |
jari |
2037 |
if(listOfIndices.contains(new Integer(origOrder[i]))) |
2 |
26 Feb 07 |
jari |
2038 |
newList.add(new Integer(origOrder[i])); |
2 |
26 Feb 07 |
jari |
2039 |
} |
2 |
26 Feb 07 |
jari |
2040 |
} |
2 |
26 Feb 07 |
jari |
2041 |
|
2 |
26 Feb 07 |
jari |
2042 |
return newList; |
2 |
26 Feb 07 |
jari |
2043 |
} |
2 |
26 Feb 07 |
jari |
2044 |
|
2 |
26 Feb 07 |
jari |
2045 |
|
2 |
26 Feb 07 |
jari |
2046 |
/** |
2 |
26 Feb 07 |
jari |
* @param indices the indices of used experiments. |
2 |
26 Feb 07 |
jari |
2048 |
*/ |
2 |
26 Feb 07 |
jari |
2049 |
private Experiment createExperiment(final int[] columns, final int rows) { |
2 |
26 Feb 07 |
jari |
2050 |
ISlideData sd; |
2 |
26 Feb 07 |
jari |
2051 |
FloatMatrix fm = new FloatMatrix(rows, columns.length); |
2 |
26 Feb 07 |
jari |
2052 |
float[][] matrix = fm.A; |
2 |
26 Feb 07 |
jari |
2053 |
for (int i = 0; i < columns.length; i++) { |
2 |
26 Feb 07 |
jari |
2054 |
sd = (ISlideData)featuresList.get(columns[i]); |
2 |
26 Feb 07 |
jari |
2055 |
|
2 |
26 Feb 07 |
jari |
//pcahan -- don't log2 transform affy data |
2 |
26 Feb 07 |
jari |
2057 |
/* |
2 |
26 Feb 07 |
jari |
if (TMEV.getDataType() == TMEV.DATA_TYPE_AFFY){ |
2 |
26 Feb 07 |
jari |
for (int row = rows; --row >= 0; ) { |
2 |
26 Feb 07 |
jari |
fm.A[row][columns[i]] = sd.getRatio(row, LINEAR); |
2 |
26 Feb 07 |
jari |
2061 |
} |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
2063 |
}*/ |
2 |
26 Feb 07 |
jari |
2064 |
for (int row = rows; --row >= 0;) { |
2 |
26 Feb 07 |
jari |
2065 |
fm.A[row][columns[i]] = sd.getRatio(row, this.logState); |
2 |
26 Feb 07 |
jari |
2066 |
} |
2 |
26 Feb 07 |
jari |
2067 |
// } |
2 |
26 Feb 07 |
jari |
2068 |
} |
2 |
26 Feb 07 |
jari |
2069 |
return new Experiment(fm, columns); |
2 |
26 Feb 07 |
jari |
2070 |
} |
2 |
26 Feb 07 |
jari |
2071 |
|
2 |
26 Feb 07 |
jari |
//The following method was added to correct the way "set Lower Cutoffs" |
2 |
26 Feb 07 |
jari |
//and "Set %age cutoffs" is handled, i.e., to trim out rows (genes), |
2 |
26 Feb 07 |
jari |
//rather than columns (experiments) |
2 |
26 Feb 07 |
jari |
//this is called if cutoffs have been used |
2 |
26 Feb 07 |
jari |
2076 |
private Experiment createExperiment(final int columns, final int[] rows) { |
2 |
26 Feb 07 |
jari |
2077 |
ISlideData sd; |
2 |
26 Feb 07 |
jari |
2078 |
FloatMatrix fm = new FloatMatrix(rows.length, columns); |
2 |
26 Feb 07 |
jari |
2079 |
int[] columnArray = new int[columns]; |
2 |
26 Feb 07 |
jari |
2080 |
float[][] matrix = fm.A; |
2 |
26 Feb 07 |
jari |
2081 |
for (int i = 0; i < columns; i++) { |
2 |
26 Feb 07 |
jari |
2082 |
columnArray[i] = i; |
2 |
26 Feb 07 |
jari |
2083 |
sd = (ISlideData)featuresList.get(i); |
2 |
26 Feb 07 |
jari |
2084 |
|
2 |
26 Feb 07 |
jari |
//pcahan -- don't log2 transform affy data |
2 |
26 Feb 07 |
jari |
2086 |
/* |
2 |
26 Feb 07 |
jari |
if (TMEV.getDataType() == TMEV.DATA_TYPE_AFFY) { |
2 |
26 Feb 07 |
jari |
2088 |
|
2 |
26 Feb 07 |
jari |
for (int j = 0; j < rows.length; j++) { |
2 |
26 Feb 07 |
jari |
fm.A[j][i] = sd.getRatio(rows[j], LINEAR); |
2 |
26 Feb 07 |
jari |
2091 |
} |
2 |
26 Feb 07 |
jari |
} else {*/ |
2 |
26 Feb 07 |
jari |
2093 |
|
2 |
26 Feb 07 |
jari |
2094 |
for (int j = 0; j < rows.length; j++) { |
2 |
26 Feb 07 |
jari |
2095 |
fm.A[j][i] = sd.getRatio(rows[j], this.logState); |
2 |
26 Feb 07 |
jari |
2096 |
} |
2 |
26 Feb 07 |
jari |
2097 |
//} |
2 |
26 Feb 07 |
jari |
2098 |
} |
2 |
26 Feb 07 |
jari |
2099 |
return new Experiment(fm, columnArray, rows); |
2 |
26 Feb 07 |
jari |
2100 |
} |
2 |
26 Feb 07 |
jari |
2101 |
|
2 |
26 Feb 07 |
jari |
2102 |
|
2 |
26 Feb 07 |
jari |
2103 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the normalization state of the data set |
2 |
26 Feb 07 |
jari |
2105 |
*/ |
2 |
26 Feb 07 |
jari |
2106 |
public int getNormalizationState(){ |
2 |
26 Feb 07 |
jari |
2107 |
if(this.featuresList == null || this.featuresList.size() < 1) |
2 |
26 Feb 07 |
jari |
2108 |
return ISlideData.NO_NORMALIZATION; |
2 |
26 Feb 07 |
jari |
2109 |
else |
2 |
26 Feb 07 |
jari |
2110 |
return ((ISlideData)this.featuresList.get(0)).getNormalizedState(); |
2 |
26 Feb 07 |
jari |
2111 |
} |
2 |
26 Feb 07 |
jari |
2112 |
|
2 |
26 Feb 07 |
jari |
2113 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a MultipleArrayData object comprised of a subset of elements |
2 |
26 Feb 07 |
jari |
2115 |
*/ |
2 |
26 Feb 07 |
jari |
2116 |
public MultipleArrayData getDataSubset(int [] indices){ |
2 |
26 Feb 07 |
jari |
2117 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
2118 |
ISlideMetaData metaData = null; |
2 |
26 Feb 07 |
jari |
2119 |
ISlideDataElement sde; |
2 |
26 Feb 07 |
jari |
2120 |
String name; |
2 |
26 Feb 07 |
jari |
2121 |
MultipleArrayData data = new MultipleArrayData(); |
2 |
26 Feb 07 |
jari |
2122 |
data.setDataType(this.dataType); |
2 |
26 Feb 07 |
jari |
2123 |
int normalizedState = this.getNormalizationState(); |
2 |
26 Feb 07 |
jari |
2124 |
|
2 |
26 Feb 07 |
jari |
2125 |
if(indices.length < 1) |
2 |
26 Feb 07 |
jari |
2126 |
return null; |
2 |
26 Feb 07 |
jari |
2127 |
|
2 |
26 Feb 07 |
jari |
2128 |
int index; |
2 |
26 Feb 07 |
jari |
2129 |
|
2 |
26 Feb 07 |
jari |
2130 |
for(int slide = 0; slide < this.getFeaturesCount(); slide++){ |
2 |
26 Feb 07 |
jari |
2131 |
if(slide == 0){ |
2 |
26 Feb 07 |
jari |
2132 |
slideData = new SlideData(); |
2 |
26 Feb 07 |
jari |
2133 |
name = this.getSampleName(slide); |
2 |
26 Feb 07 |
jari |
2134 |
if(name.endsWith("...")){ |
2 |
26 Feb 07 |
jari |
2135 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2136 |
|
2 |
26 Feb 07 |
jari |
2137 |
slideData.setSlideDataLabels(this.getFeature(slide).getSlideDataKeys(), this.getFeature(slide).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2138 |
((SlideData) slideData).setSlideFileName(this.getSampleName(slide)); |
2 |
26 Feb 07 |
jari |
2139 |
|
2 |
26 Feb 07 |
jari |
2140 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2141 |
} else{ |
2 |
26 Feb 07 |
jari |
2142 |
|
2 |
26 Feb 07 |
jari |
2143 |
slideData.setSlideDataLabels(this.getFeature(slide).getSlideDataKeys(), this.getFeature(slide).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2144 |
((SlideData) slideData).setSlideFileName(this.getSampleName(slide)); |
2 |
26 Feb 07 |
jari |
2145 |
} |
2 |
26 Feb 07 |
jari |
2146 |
|
2 |
26 Feb 07 |
jari |
2147 |
for(int spot = 0; spot < indices.length; spot++){ |
2 |
26 Feb 07 |
jari |
2148 |
index = indices[spot]; |
2 |
26 Feb 07 |
jari |
2149 |
sde = new SlideDataElement(this.getSlideDataElement(slide, index)); |
2 |
26 Feb 07 |
jari |
2150 |
slideData.addSlideDataElement(sde); |
2 |
26 Feb 07 |
jari |
2151 |
} |
2 |
26 Feb 07 |
jari |
2152 |
|
2 |
26 Feb 07 |
jari |
2153 |
metaData = (ISlideMetaData)slideData; |
2 |
26 Feb 07 |
jari |
2154 |
|
2 |
26 Feb 07 |
jari |
//7/10/06 jcb added to set field names in new data |
2 |
26 Feb 07 |
jari |
2156 |
metaData.clearFieldNames(); |
2 |
26 Feb 07 |
jari |
2157 |
metaData.setFieldNames(this.getFieldNames()); |
2 |
26 Feb 07 |
jari |
2158 |
|
2 |
26 Feb 07 |
jari |
2159 |
} else{ |
2 |
26 Feb 07 |
jari |
2160 |
slideData = new FloatSlideData(metaData); |
2 |
26 Feb 07 |
jari |
2161 |
((FloatSlideData) slideData).createCurrentIntensityArrays(); |
2 |
26 Feb 07 |
jari |
2162 |
|
2 |
26 Feb 07 |
jari |
2163 |
name = this.getSampleName(slide); |
2 |
26 Feb 07 |
jari |
2164 |
if(name.endsWith("...")){ |
2 |
26 Feb 07 |
jari |
2165 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2166 |
slideData.setSlideDataLabels(this.getFeature(slide).getSlideDataKeys(), this.getFeature(slide).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2167 |
((FloatSlideData) slideData).setSlideFileName(this.getSampleName(slide)); |
2 |
26 Feb 07 |
jari |
2168 |
|
2 |
26 Feb 07 |
jari |
2169 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2170 |
} else{ |
2 |
26 Feb 07 |
jari |
2171 |
slideData.setSlideDataLabels(this.getFeature(slide).getSlideDataKeys(), this.getFeature(slide).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2172 |
((FloatSlideData) slideData).setSlideFileName(this.getSampleName(slide)); |
2 |
26 Feb 07 |
jari |
2173 |
} |
2 |
26 Feb 07 |
jari |
2174 |
|
2 |
26 Feb 07 |
jari |
2175 |
for(int spot = 0; spot < indices.length; spot++){ |
2 |
26 Feb 07 |
jari |
2176 |
index = indices[spot]; |
2 |
26 Feb 07 |
jari |
2177 |
sde = this.getSlideDataElement(slide, index); |
2 |
26 Feb 07 |
jari |
2178 |
((FloatSlideData)slideData).setIntensities(spot, sde.getTrueIntensity(ISlideDataElement.CY3), sde.getTrueIntensity(ISlideDataElement.CY5)); |
2 |
26 Feb 07 |
jari |
2179 |
((FloatSlideData)slideData).setCurrentIntensities(spot, sde.getCurrentIntensity()[0], sde.getCurrentIntensity()[1]); |
2 |
26 Feb 07 |
jari |
2180 |
} |
2 |
26 Feb 07 |
jari |
2181 |
} |
2 |
26 Feb 07 |
jari |
2182 |
slideData.setNormalizedState(normalizedState); |
2 |
26 Feb 07 |
jari |
2183 |
data.addFeature(slideData); |
2 |
26 Feb 07 |
jari |
2184 |
} |
2 |
26 Feb 07 |
jari |
2185 |
return data; |
2 |
26 Feb 07 |
jari |
2186 |
} |
2 |
26 Feb 07 |
jari |
2187 |
|
2 |
26 Feb 07 |
jari |
2188 |
|
2 |
26 Feb 07 |
jari |
2189 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a MultipleArrayData object comprised of a subset of column indices and rows indices |
2 |
26 Feb 07 |
jari |
2191 |
*/ |
2 |
26 Feb 07 |
jari |
2192 |
public MultipleArrayData getDataSubset(int [] columnIndices, int [] rowIndices){ |
2 |
26 Feb 07 |
jari |
2193 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
2194 |
ISlideMetaData metaData = (ISlideMetaData)this.featuresList.get(0); |
2 |
26 Feb 07 |
jari |
2195 |
ISlideDataElement sde; |
2 |
26 Feb 07 |
jari |
2196 |
String name; |
2 |
26 Feb 07 |
jari |
2197 |
MultipleArrayData data = new MultipleArrayData(); |
2 |
26 Feb 07 |
jari |
2198 |
data.setDataType(this.dataType); |
2 |
26 Feb 07 |
jari |
2199 |
int normalizedState = this.getNormalizationState(); |
2 |
26 Feb 07 |
jari |
2200 |
|
2 |
26 Feb 07 |
jari |
2201 |
if(columnIndices.length < 1 || rowIndices.length < 1) |
2 |
26 Feb 07 |
jari |
2202 |
return null; |
2 |
26 Feb 07 |
jari |
2203 |
|
2 |
26 Feb 07 |
jari |
2204 |
int index; |
2 |
26 Feb 07 |
jari |
2205 |
int slideIndex; |
2 |
26 Feb 07 |
jari |
2206 |
|
2 |
26 Feb 07 |
jari |
2207 |
for(int slide = 0; slide < columnIndices.length; slide++){ |
2 |
26 Feb 07 |
jari |
2208 |
slideIndex = columnIndices[slide]; |
2 |
26 Feb 07 |
jari |
2209 |
|
2 |
26 Feb 07 |
jari |
2210 |
if(slideIndex == 0){ |
2 |
26 Feb 07 |
jari |
2211 |
slideData = new SlideData(); |
2 |
26 Feb 07 |
jari |
2212 |
|
2 |
26 Feb 07 |
jari |
2213 |
name = this.getSampleName(slideIndex); |
2 |
26 Feb 07 |
jari |
2214 |
if(name.endsWith("...")){ |
2 |
26 Feb 07 |
jari |
2215 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2216 |
slideData.setSlideDataLabels(this.getFeature(slideIndex).getSlideDataKeys(), this.getFeature(slideIndex).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2217 |
((SlideData) slideData).setSlideFileName(this.getSampleName(slideIndex)); |
2 |
26 Feb 07 |
jari |
2218 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2219 |
} else{ |
2 |
26 Feb 07 |
jari |
2220 |
slideData.setSlideDataLabels(this.getFeature(slideIndex).getSlideDataKeys(), this.getFeature(slideIndex).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2221 |
((SlideData) slideData).setSlideFileName(this.getSampleName(slideIndex)); |
2 |
26 Feb 07 |
jari |
2222 |
} |
2 |
26 Feb 07 |
jari |
2223 |
|
2 |
26 Feb 07 |
jari |
2224 |
for(int spot = 0; spot < rowIndices.length; spot++){ |
2 |
26 Feb 07 |
jari |
2225 |
sde = new SlideDataElement(this.getSlideDataElement(slideIndex, rowIndices[spot])); |
2 |
26 Feb 07 |
jari |
2226 |
slideData.addSlideDataElement(sde); |
2 |
26 Feb 07 |
jari |
2227 |
} |
2 |
26 Feb 07 |
jari |
2228 |
metaData = (ISlideMetaData)slideData; |
2 |
26 Feb 07 |
jari |
2229 |
|
2 |
26 Feb 07 |
jari |
//7/10/06 jcb added to set field names in new data |
2 |
26 Feb 07 |
jari |
2231 |
metaData.clearFieldNames(); |
2 |
26 Feb 07 |
jari |
2232 |
metaData.setFieldNames(this.getFieldNames()); |
2 |
26 Feb 07 |
jari |
2233 |
|
2 |
26 Feb 07 |
jari |
2234 |
} else { |
2 |
26 Feb 07 |
jari |
2235 |
slideData = new FloatSlideData(metaData); |
2 |
26 Feb 07 |
jari |
2236 |
((FloatSlideData) slideData).createCurrentIntensityArrays(); |
2 |
26 Feb 07 |
jari |
2237 |
|
2 |
26 Feb 07 |
jari |
2238 |
name = this.getSampleName(slideIndex); |
2 |
26 Feb 07 |
jari |
2239 |
if(name.endsWith("...")){ |
2 |
26 Feb 07 |
jari |
2240 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2241 |
slideData.setSlideDataLabels(this.getFeature(slideIndex).getSlideDataKeys(), this.getFeature(slideIndex).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2242 |
((FloatSlideData) slideData).setSlideFileName(this.getSampleName(slideIndex)); |
2 |
26 Feb 07 |
jari |
2243 |
toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
2244 |
} else{ |
2 |
26 Feb 07 |
jari |
2245 |
slideData.setSlideDataLabels(this.getFeature(slideIndex).getSlideDataKeys(), this.getFeature(slideIndex).getSlideDataLabels()); |
2 |
26 Feb 07 |
jari |
2246 |
((FloatSlideData) slideData).setSlideFileName(this.getSampleName(slideIndex)); |
2 |
26 Feb 07 |
jari |
2247 |
} |
2 |
26 Feb 07 |
jari |
2248 |
for(int spot = 0; spot < rowIndices.length; spot++){ |
2 |
26 Feb 07 |
jari |
2249 |
sde = this.getSlideDataElement(slideIndex, rowIndices[spot]); |
2 |
26 Feb 07 |
jari |
2250 |
((FloatSlideData)slideData).setIntensities(spot, sde.getTrueIntensity(ISlideDataElement.CY3), sde.getTrueIntensity(ISlideDataElement.CY5)); |
2 |
26 Feb 07 |
jari |
2251 |
((FloatSlideData)slideData).setCurrentIntensities(spot, sde.getCurrentIntensity()[0], sde.getCurrentIntensity()[1]); |
2 |
26 Feb 07 |
jari |
2252 |
} |
2 |
26 Feb 07 |
jari |
2253 |
|
2 |
26 Feb 07 |
jari |
2254 |
} |
2 |
26 Feb 07 |
jari |
2255 |
slideData.setNormalizedState(normalizedState); |
2 |
26 Feb 07 |
jari |
2256 |
data.addFeature(slideData); |
2 |
26 Feb 07 |
jari |
2257 |
} |
2 |
26 Feb 07 |
jari |
2258 |
return data; |
2 |
26 Feb 07 |
jari |
2259 |
} |
2 |
26 Feb 07 |
jari |
2260 |
|
2 |
26 Feb 07 |
jari |
2261 |
|
2 |
26 Feb 07 |
jari |
2262 |
/** |
2 |
26 Feb 07 |
jari |
* Sets initial max values. |
2 |
26 Feb 07 |
jari |
2264 |
*/ |
2 |
26 Feb 07 |
jari |
2265 |
private void resetMaxValues() { |
2 |
26 Feb 07 |
jari |
2266 |
setMaxCY3(0f); |
2 |
26 Feb 07 |
jari |
2267 |
setMaxCY5(0f); |
2 |
26 Feb 07 |
jari |
2268 |
setMaxRatio(0f); |
2 |
26 Feb 07 |
jari |
2269 |
setMinRatio(0f); |
2 |
26 Feb 07 |
jari |
2270 |
} |
2 |
26 Feb 07 |
jari |
2271 |
|
2 |
26 Feb 07 |
jari |
2272 |
/** |
2 |
26 Feb 07 |
jari |
* Updates min and max ratio values. |
2 |
26 Feb 07 |
jari |
2274 |
*/ |
2 |
26 Feb 07 |
jari |
2275 |
private void updateMaxMinRatios(ISlideData slideData) { |
2 |
26 Feb 07 |
jari |
2276 |
float min = minRatio; |
2 |
26 Feb 07 |
jari |
2277 |
float max = maxRatio; |
2 |
26 Feb 07 |
jari |
2278 |
float value; |
2 |
26 Feb 07 |
jari |
2279 |
final int features = featuresList.size(); |
2 |
26 Feb 07 |
jari |
2280 |
final int probes = ((ISlideData)featuresList.get(0)).getSize(); |
2 |
26 Feb 07 |
jari |
2281 |
for (int probe=0; probe<probes; probe++) { |
2 |
26 Feb 07 |
jari |
2282 |
value = slideData.getRatio(probe, this.logState); |
2 |
26 Feb 07 |
jari |
2283 |
max = Math.max(max, value); |
2 |
26 Feb 07 |
jari |
2284 |
min = Math.min(min, value); |
2 |
26 Feb 07 |
jari |
2285 |
} |
2 |
26 Feb 07 |
jari |
2286 |
setMaxRatio(max); |
2 |
26 Feb 07 |
jari |
2287 |
setMinRatio(max); |
2 |
26 Feb 07 |
jari |
2288 |
} |
2 |
26 Feb 07 |
jari |
2289 |
|
2 |
26 Feb 07 |
jari |
2290 |
/** |
2 |
26 Feb 07 |
jari |
* Toggles the length of the displayed file name. |
2 |
26 Feb 07 |
jari |
2292 |
*/ |
2 |
26 Feb 07 |
jari |
2293 |
public void toggleExptNameLength(){ |
2 |
26 Feb 07 |
jari |
2294 |
if(this.getFeaturesCount() < 1) |
2 |
26 Feb 07 |
jari |
2295 |
return; |
2 |
26 Feb 07 |
jari |
2296 |
for(int i = 0; i < this.getFeaturesCount(); i++){ |
2 |
26 Feb 07 |
jari |
2297 |
((ISlideData)(this.getFeature(i))).toggleNameLength(); |
2 |
26 Feb 07 |
jari |
2298 |
} |
2 |
26 Feb 07 |
jari |
2299 |
} |
2 |
26 Feb 07 |
jari |
2300 |
|
2 |
26 Feb 07 |
jari |
2301 |
/** |
2 |
26 Feb 07 |
jari |
* Sort the data with specified style. |
2 |
26 Feb 07 |
jari |
2303 |
*/ |
2 |
26 Feb 07 |
jari |
2304 |
void sort(int style) { |
2 |
26 Feb 07 |
jari |
2305 |
SlideDataSorter sorter = new SlideDataSorter(); |
2 |
26 Feb 07 |
jari |
2306 |
if (style == SlideDataSorter.SORT_BY_RATIO) { // ratio values are unique for slides |
2 |
26 Feb 07 |
jari |
2307 |
for (int i = 0; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
2308 |
sorter.setSlideData((ISlideData)featuresList.get(i)); |
2 |
26 Feb 07 |
jari |
2309 |
sorter.sort((int[])indicesList.get(i), style); |
2 |
26 Feb 07 |
jari |
2310 |
} |
2 |
26 Feb 07 |
jari |
2311 |
} else { // all the other values are shared |
2 |
26 Feb 07 |
jari |
2312 |
if (featuresList.size() < 1) { |
2 |
26 Feb 07 |
jari |
2313 |
return; |
2 |
26 Feb 07 |
jari |
2314 |
} |
2 |
26 Feb 07 |
jari |
2315 |
sorter.setSlideData((ISlideData)featuresList.get(0)); |
2 |
26 Feb 07 |
jari |
2316 |
int[] src = (int[])indicesList.get(0); |
2 |
26 Feb 07 |
jari |
2317 |
sorter.sort(src, style); |
2 |
26 Feb 07 |
jari |
2318 |
int[] dst; |
2 |
26 Feb 07 |
jari |
2319 |
for (int i = 1; i < featuresList.size(); i++) { |
2 |
26 Feb 07 |
jari |
2320 |
dst = (int[])indicesList.get(i); |
2 |
26 Feb 07 |
jari |
2321 |
System.arraycopy(src, 0, dst, 0, src.length); |
2 |
26 Feb 07 |
jari |
2322 |
} |
2 |
26 Feb 07 |
jari |
2323 |
} |
2 |
26 Feb 07 |
jari |
2324 |
} |
2 |
26 Feb 07 |
jari |
2325 |
|
2 |
26 Feb 07 |
jari |
2326 |
|
2 |
26 Feb 07 |
jari |
2327 |
|
2 |
26 Feb 07 |
jari |
2328 |
/** |
2 |
26 Feb 07 |
jari |
* Returns ratio values of the data. |
2 |
26 Feb 07 |
jari |
2330 |
*/ |
2 |
26 Feb 07 |
jari |
2331 |
public Experiment getFullExperiment() { |
2 |
26 Feb 07 |
jari |
2332 |
int featuresSize = this.getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
2333 |
int probesSize = this.getFeaturesSize(); |
2 |
26 Feb 07 |
jari |
2334 |
int [] features = createDefaultFeatures(featuresSize, probesSize); |
2 |
26 Feb 07 |
jari |
2335 |
Experiment experiment = createExperiment(features, probesSize); |
2 |
26 Feb 07 |
jari |
2336 |
return experiment; |
2 |
26 Feb 07 |
jari |
2337 |
} |
2 |
26 Feb 07 |
jari |
2338 |
|
2 |
26 Feb 07 |
jari |
2339 |
/** |
2 |
26 Feb 07 |
jari |
* Returns ratio values of the data. |
2 |
26 Feb 07 |
jari |
2341 |
*/ |
2 |
26 Feb 07 |
jari |
2342 |
public Experiment getExperiment() { |
2 |
26 Feb 07 |
jari |
2343 |
if(useMainData) |
2 |
26 Feb 07 |
jari |
2344 |
return experiment; |
2 |
26 Feb 07 |
jari |
2345 |
return alternateExperiment; |
2 |
26 Feb 07 |
jari |
2346 |
} |
2 |
26 Feb 07 |
jari |
2347 |
|
2 |
26 Feb 07 |
jari |
2348 |
private void setMaxCY3(float value) {this.maxCy3 = value;} |
2 |
26 Feb 07 |
jari |
2349 |
private void setMaxCY5(float value) {this.maxCy5 = value;} |
2 |
26 Feb 07 |
jari |
2350 |
public float getMaxCY3() {return this.maxCy3;} |
2 |
26 Feb 07 |
jari |
2351 |
public float getMaxCY5() {return this.maxCy5;} |
2 |
26 Feb 07 |
jari |
2352 |
|
2 |
26 Feb 07 |
jari |
2353 |
private void setMaxRatio(float value) {this.maxRatio = value;} |
2 |
26 Feb 07 |
jari |
2354 |
private void setMinRatio(float value) {this.minRatio = value;} |
2 |
26 Feb 07 |
jari |
2355 |
public float getMaxRatio() {return this.maxRatio;} |
2 |
26 Feb 07 |
jari |
2356 |
public float getMinRatio() {return this.minRatio;} |
2 |
26 Feb 07 |
jari |
2357 |
|
2 |
26 Feb 07 |
jari |
2358 |
////////////////////////////////// |
2 |
26 Feb 07 |
jari |
2359 |
// // |
2 |
26 Feb 07 |
jari |
// adjust experiment methods // |
2 |
26 Feb 07 |
jari |
2361 |
// // |
2 |
26 Feb 07 |
jari |
2362 |
////////////////////////////////// |
2 |
26 Feb 07 |
jari |
2363 |
void log2Transform() { |
2 |
26 Feb 07 |
jari |
2364 |
Adjustment.log2Transform(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2365 |
} |
2 |
26 Feb 07 |
jari |
2366 |
|
2 |
26 Feb 07 |
jari |
2367 |
void unlog2Transform() { |
2 |
26 Feb 07 |
jari |
2368 |
Adjustment.unlog2Transform(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2369 |
} |
2 |
26 Feb 07 |
jari |
2370 |
void normalizeSpots() { |
2 |
26 Feb 07 |
jari |
2371 |
Adjustment.normalizeSpots(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2372 |
} |
2 |
26 Feb 07 |
jari |
2373 |
|
2 |
26 Feb 07 |
jari |
2374 |
void divideSpotsRMS() { |
2 |
26 Feb 07 |
jari |
2375 |
Adjustment.divideSpotsRMS(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2376 |
} |
2 |
26 Feb 07 |
jari |
2377 |
|
2 |
26 Feb 07 |
jari |
2378 |
void divideSpotsSD() { |
2 |
26 Feb 07 |
jari |
2379 |
Adjustment.divideSpotsSD(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2380 |
} |
2 |
26 Feb 07 |
jari |
2381 |
|
2 |
26 Feb 07 |
jari |
// pcahan -- affy- abs specific |
2 |
26 Feb 07 |
jari |
2383 |
void divideGenesMedian() { |
2 |
26 Feb 07 |
jari |
2384 |
Adjustment.divideGenesMedian(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2385 |
} |
2 |
26 Feb 07 |
jari |
2386 |
|
2 |
26 Feb 07 |
jari |
2387 |
void divideGenesMean() { |
2 |
26 Feb 07 |
jari |
2388 |
Adjustment.divideGenesMean(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2389 |
} |
2 |
26 Feb 07 |
jari |
2390 |
|
2 |
26 Feb 07 |
jari |
2391 |
void meanCenterSpots() { |
2 |
26 Feb 07 |
jari |
2392 |
Adjustment.meanCenterSpots(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2393 |
} |
2 |
26 Feb 07 |
jari |
2394 |
|
2 |
26 Feb 07 |
jari |
2395 |
void medianCenterSpots() { |
2 |
26 Feb 07 |
jari |
2396 |
Adjustment.medianCenterSpots(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2397 |
} |
2 |
26 Feb 07 |
jari |
2398 |
|
2 |
26 Feb 07 |
jari |
2399 |
void digitalSpots() { |
2 |
26 Feb 07 |
jari |
2400 |
Adjustment.digitalSpots(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2401 |
} |
2 |
26 Feb 07 |
jari |
2402 |
|
2 |
26 Feb 07 |
jari |
2403 |
void normalizeExperiments() { |
2 |
26 Feb 07 |
jari |
2404 |
Adjustment.normalizeExperiments(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2405 |
} |
2 |
26 Feb 07 |
jari |
2406 |
|
2 |
26 Feb 07 |
jari |
2407 |
void divideExperimentsRMS() { |
2 |
26 Feb 07 |
jari |
2408 |
Adjustment.divideExperimentsRMS(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2409 |
} |
2 |
26 Feb 07 |
jari |
2410 |
|
2 |
26 Feb 07 |
jari |
2411 |
void divideExperimentsSD() { |
2 |
26 Feb 07 |
jari |
2412 |
Adjustment.divideExperimentsSD(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2413 |
} |
2 |
26 Feb 07 |
jari |
2414 |
|
2 |
26 Feb 07 |
jari |
2415 |
void meanCenterExperiments() { |
2 |
26 Feb 07 |
jari |
2416 |
Adjustment.meanCenterExperiments(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2417 |
} |
2 |
26 Feb 07 |
jari |
2418 |
|
2 |
26 Feb 07 |
jari |
2419 |
void medianCenterExperiments() { |
2 |
26 Feb 07 |
jari |
2420 |
Adjustment.medianCenterExperiments(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2421 |
} |
2 |
26 Feb 07 |
jari |
2422 |
|
2 |
26 Feb 07 |
jari |
2423 |
void digitalExperiments() { |
2 |
26 Feb 07 |
jari |
2424 |
Adjustment.digitalExperiments(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2425 |
} |
2 |
26 Feb 07 |
jari |
2426 |
|
2 |
26 Feb 07 |
jari |
2427 |
void log10toLog2() { |
2 |
26 Feb 07 |
jari |
2428 |
Adjustment.log10toLog2(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2429 |
} |
2 |
26 Feb 07 |
jari |
2430 |
void log2toLog10() { |
2 |
26 Feb 07 |
jari |
2431 |
Adjustment.log2toLog10(experiment.getMatrix()); |
2 |
26 Feb 07 |
jari |
2432 |
} |
2 |
26 Feb 07 |
jari |
2433 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
2435 |
private static float getGeneMean(float[] row) { |
2 |
26 Feb 07 |
jari |
2436 |
float mean = 0f; |
2 |
26 Feb 07 |
jari |
2437 |
for (int i = 0; i < row.length; i++){ |
2 |
26 Feb 07 |
jari |
2438 |
mean += row[i]; |
2 |
26 Feb 07 |
jari |
2439 |
} |
2 |
26 Feb 07 |
jari |
2440 |
return (float)mean/row.length; |
2 |
26 Feb 07 |
jari |
2441 |
} |
2 |
26 Feb 07 |
jari |
2442 |
|
2 |
26 Feb 07 |
jari |
2443 |
public int getDataType() { |
2 |
26 Feb 07 |
jari |
2444 |
return this.dataType; |
2 |
26 Feb 07 |
jari |
2445 |
} |
2 |
26 Feb 07 |
jari |
2446 |
|
2 |
26 Feb 07 |
jari |
2447 |
public void setDataType(int type){ |
2 |
26 Feb 07 |
jari |
2448 |
this.dataType = type; |
2 |
26 Feb 07 |
jari |
2449 |
ISlideData slideData; |
2 |
26 Feb 07 |
jari |
2450 |
for(int i = 0; i < this.getFeaturesCount(); i++){ |
2 |
26 Feb 07 |
jari |
2451 |
slideData = this.getFeature(i); |
2 |
26 Feb 07 |
jari |
2452 |
slideData.setDataType(type); |
2 |
26 Feb 07 |
jari |
2453 |
} |
2 |
26 Feb 07 |
jari |
2454 |
if(this.dataType == IData.DATA_TYPE_RATIO_ONLY || this.dataType == IData.DATA_TYPE_AFFY_ABS ){ |
2 |
26 Feb 07 |
jari |
2455 |
this.logState = LINEAR; |
2 |
26 Feb 07 |
jari |
2456 |
} else { |
2 |
26 Feb 07 |
jari |
2457 |
this.logState = LOG; |
2 |
26 Feb 07 |
jari |
2458 |
} |
2 |
26 Feb 07 |
jari |
2459 |
if(this.dataType == IData.DATA_TYPE_AFFY_ABS){ |
2 |
26 Feb 07 |
jari |
2460 |
convertToAffy(); |
2 |
26 Feb 07 |
jari |
2461 |
} |
2 |
26 Feb 07 |
jari |
2462 |
if(this.getFeaturesCount() > 0) |
2 |
26 Feb 07 |
jari |
2463 |
this.experiment = createExperiment(); |
2 |
26 Feb 07 |
jari |
2464 |
} |
2 |
26 Feb 07 |
jari |
2465 |
|
2 |
26 Feb 07 |
jari |
2466 |
private void convertToAffy(){ |
2 |
26 Feb 07 |
jari |
2467 |
SlideData ismd = (SlideData)getFeature(0); |
2 |
26 Feb 07 |
jari |
2468 |
Vector allSlideDataElements = ismd.getAllElements(); |
2 |
26 Feb 07 |
jari |
2469 |
ISlideDataElement sde; |
2 |
26 Feb 07 |
jari |
2470 |
for(int i=0; i<allSlideDataElements.size(); i++){ |
2 |
26 Feb 07 |
jari |
2471 |
sde = (ISlideDataElement)allSlideDataElements.get(i); |
2 |
26 Feb 07 |
jari |
2472 |
if(!(sde instanceof AffySlideDataElement)){ |
2 |
26 Feb 07 |
jari |
//If this slidedataelement isn't already an Affy slidedataelement, turn it into one |
2 |
26 Feb 07 |
jari |
2474 |
AffySlideDataElement asde = new AffySlideDataElement(sde); |
2 |
26 Feb 07 |
jari |
2475 |
allSlideDataElements.remove(i); |
2 |
26 Feb 07 |
jari |
2476 |
allSlideDataElements.add(i, asde); |
2 |
26 Feb 07 |
jari |
2477 |
} |
2 |
26 Feb 07 |
jari |
2478 |
} |
2 |
26 Feb 07 |
jari |
2479 |
} |
2 |
26 Feb 07 |
jari |
2480 |
|
2 |
26 Feb 07 |
jari |
/** Returns gene or sample indices related to search terms. |
2 |
26 Feb 07 |
jari |
2482 |
*/ |
2 |
26 Feb 07 |
jari |
2483 |
public int [] search(AlgorithmData criteria) { |
2 |
26 Feb 07 |
jari |
2484 |
AlgorithmParameters params = criteria.getParams(); |
2 |
26 Feb 07 |
jari |
2485 |
boolean geneSearch = params.getBoolean("gene-search"); |
2 |
26 Feb 07 |
jari |
2486 |
boolean caseSens = params.getBoolean("case-sensitive"); |
2 |
26 Feb 07 |
jari |
2487 |
boolean fullTerm = params.getBoolean("full-term"); |
2 |
26 Feb 07 |
jari |
2488 |
String searchTerm = params.getString("search-term"); |
2 |
26 Feb 07 |
jari |
2489 |
String upperSearchString = searchTerm.toUpperCase(); |
2 |
26 Feb 07 |
jari |
2490 |
String [] fields = criteria.getStringArray("field-names"); |
2 |
26 Feb 07 |
jari |
2491 |
String annot; |
2 |
26 Feb 07 |
jari |
2492 |
String [] fullFieldNames; |
2 |
26 Feb 07 |
jari |
2493 |
boolean hit = false; |
2 |
26 Feb 07 |
jari |
2494 |
int n; |
2 |
26 Feb 07 |
jari |
//need to find indices of fields to check. |
2 |
26 Feb 07 |
jari |
//the input fields should be in order |
2 |
26 Feb 07 |
jari |
2497 |
Vector fieldIndices = new Vector(); |
2 |
26 Feb 07 |
jari |
2498 |
|
2 |
26 Feb 07 |
jari |
2499 |
Vector indexVector = new Vector(); |
2 |
26 Feb 07 |
jari |
2500 |
|
2 |
26 Feb 07 |
jari |
2501 |
int [] indices; |
2 |
26 Feb 07 |
jari |
2502 |
|
2 |
26 Feb 07 |
jari |
2503 |
|
2 |
26 Feb 07 |
jari |
2504 |
|
2 |
26 Feb 07 |
jari |
2505 |
Hashtable keys = new Hashtable(); |
2 |
26 Feb 07 |
jari |
2506 |
|
2 |
26 Feb 07 |
jari |
2507 |
if(getFeaturesCount() < 1 || getFeaturesSize() < 1) |
2 |
26 Feb 07 |
jari |
2508 |
return new int[0]; //empty result |
2 |
26 Feb 07 |
jari |
2509 |
|
2 |
26 Feb 07 |
jari |
2510 |
if(geneSearch) { |
2 |
26 Feb 07 |
jari |
2511 |
|
2 |
26 Feb 07 |
jari |
2512 |
fullFieldNames = this.getFieldNames(); |
2 |
26 Feb 07 |
jari |
2513 |
|
2 |
26 Feb 07 |
jari |
2514 |
for(int i = 0; i < fields.length; i++) { |
2 |
26 Feb 07 |
jari |
2515 |
for(int j = 0; j < fullFieldNames.length; j++) { |
2 |
26 Feb 07 |
jari |
2516 |
if(fields[i].equals(fullFieldNames[j])) { |
2 |
26 Feb 07 |
jari |
2517 |
fieldIndices.addElement(new Integer(j)); |
2 |
26 Feb 07 |
jari |
2518 |
break; |
2 |
26 Feb 07 |
jari |
2519 |
} |
2 |
26 Feb 07 |
jari |
2520 |
} |
2 |
26 Feb 07 |
jari |
2521 |
} |
2 |
26 Feb 07 |
jari |
2522 |
|
2 |
26 Feb 07 |
jari |
2523 |
n = getFeaturesSize(); |
2 |
26 Feb 07 |
jari |
2524 |
ISlideDataElement sde; |
2 |
26 Feb 07 |
jari |
2525 |
ISlideData slide = this.getFeature(0); |
2 |
26 Feb 07 |
jari |
2526 |
int annotIndex; |
2 |
26 Feb 07 |
jari |
2527 |
for(int i = 0; i < n; i++) { |
2 |
26 Feb 07 |
jari |
2528 |
hit = false; |
2 |
26 Feb 07 |
jari |
2529 |
for(int j = 0; j < fieldIndices.size(); j++) { |
2 |
26 Feb 07 |
jari |
2530 |
annotIndex = ((Integer)fieldIndices.elementAt(j)).intValue(); |
2 |
26 Feb 07 |
jari |
2531 |
annot = getElementAttribute(i, annotIndex); |
2 |
26 Feb 07 |
jari |
2532 |
|
2 |
26 Feb 07 |
jari |
2533 |
if(fullTerm) { |
2 |
26 Feb 07 |
jari |
2534 |
if(caseSens) { |
2 |
26 Feb 07 |
jari |
2535 |
if(annot.equals(searchTerm)) { |
2 |
26 Feb 07 |
jari |
2536 |
hit = true; |
2 |
26 Feb 07 |
jari |
// break; |
2 |
26 Feb 07 |
jari |
2538 |
} |
2 |
26 Feb 07 |
jari |
2539 |
} else { |
2 |
26 Feb 07 |
jari |
2540 |
if(annot.equalsIgnoreCase(searchTerm)) { |
2 |
26 Feb 07 |
jari |
2541 |
hit = true; |
2 |
26 Feb 07 |
jari |
2542 |
break; |
2 |
26 Feb 07 |
jari |
2543 |
} |
2 |
26 Feb 07 |
jari |
2544 |
} |
2 |
26 Feb 07 |
jari |
2545 |
|
2 |
26 Feb 07 |
jari |
2546 |
} else { //able to look within a term |
2 |
26 Feb 07 |
jari |
2547 |
|
2 |
26 Feb 07 |
jari |
2548 |
if(caseSens) { |
2 |
26 Feb 07 |
jari |
2549 |
if(annot.indexOf(searchTerm) != -1) { |
2 |
26 Feb 07 |
jari |
2550 |
hit = true; |
2 |
26 Feb 07 |
jari |
2551 |
break; |
2 |
26 Feb 07 |
jari |
2552 |
} |
2 |
26 Feb 07 |
jari |
2553 |
} else { |
2 |
26 Feb 07 |
jari |
2554 |
if((annot.toUpperCase()).indexOf(upperSearchString) != -1) { |
2 |
26 Feb 07 |
jari |
2555 |
hit = true; |
2 |
26 Feb 07 |
jari |
2556 |
break; |
2 |
26 Feb 07 |
jari |
2557 |
} |
2 |
26 Feb 07 |
jari |
2558 |
|
2 |
26 Feb 07 |
jari |
2559 |
} |
2 |
26 Feb 07 |
jari |
2560 |
|
2 |
26 Feb 07 |
jari |
2561 |
} |
2 |
26 Feb 07 |
jari |
2562 |
|
2 |
26 Feb 07 |
jari |
2563 |
|
2 |
26 Feb 07 |
jari |
2564 |
|
2 |
26 Feb 07 |
jari |
2565 |
} |
2 |
26 Feb 07 |
jari |
2566 |
if(hit == true) { |
2 |
26 Feb 07 |
jari |
2567 |
indexVector.addElement(new Integer(i)); |
2 |
26 Feb 07 |
jari |
2568 |
} |
2 |
26 Feb 07 |
jari |
2569 |
} |
2 |
26 Feb 07 |
jari |
2570 |
|
2 |
26 Feb 07 |
jari |
2571 |
|
2 |
26 Feb 07 |
jari |
2572 |
indices = new int[indexVector.size()]; |
2 |
26 Feb 07 |
jari |
2573 |
|
2 |
26 Feb 07 |
jari |
2574 |
for(int i = 0; i < indices.length; i++) { |
2 |
26 Feb 07 |
jari |
2575 |
indices[i] = ((Integer)(indexVector.elementAt(i))).intValue(); |
2 |
26 Feb 07 |
jari |
2576 |
} |
2 |
26 Feb 07 |
jari |
2577 |
|
2 |
26 Feb 07 |
jari |
//Sample search |
2 |
26 Feb 07 |
jari |
2579 |
} else { |
2 |
26 Feb 07 |
jari |
2580 |
|
2 |
26 Feb 07 |
jari |
2581 |
n = getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
2582 |
Hashtable sampleNameHash; |
2 |
26 Feb 07 |
jari |
2583 |
|
2 |
26 Feb 07 |
jari |
2584 |
|
2 |
26 Feb 07 |
jari |
2585 |
for(int i = 0; i < n; i++) { |
2 |
26 Feb 07 |
jari |
2586 |
hit = false; |
2 |
26 Feb 07 |
jari |
2587 |
sampleNameHash = this.getFeature(i).getSlideDataLabels(); |
2 |
26 Feb 07 |
jari |
2588 |
|
2 |
26 Feb 07 |
jari |
2589 |
for(int j = 0; j < fields.length; j++) { |
2 |
26 Feb 07 |
jari |
2590 |
annot = (String)(sampleNameHash.get(fields[j])); |
2 |
26 Feb 07 |
jari |
2591 |
if(annot == null) |
2 |
26 Feb 07 |
jari |
2592 |
continue; |
2 |
26 Feb 07 |
jari |
2593 |
|
2 |
26 Feb 07 |
jari |
2594 |
if(fullTerm) { |
2 |
26 Feb 07 |
jari |
2595 |
if(caseSens) { |
2 |
26 Feb 07 |
jari |
2596 |
if(annot.equals(searchTerm)) { |
2 |
26 Feb 07 |
jari |
2597 |
hit = true; |
2 |
26 Feb 07 |
jari |
2598 |
break; |
2 |
26 Feb 07 |
jari |
2599 |
} |
2 |
26 Feb 07 |
jari |
2600 |
} else { |
2 |
26 Feb 07 |
jari |
2601 |
if(annot.equalsIgnoreCase(searchTerm)) { |
2 |
26 Feb 07 |
jari |
2602 |
hit = true; |
2 |
26 Feb 07 |
jari |
2603 |
break; |
2 |
26 Feb 07 |
jari |
2604 |
} |
2 |
26 Feb 07 |
jari |
2605 |
} |
2 |
26 Feb 07 |
jari |
2606 |
|
2 |
26 Feb 07 |
jari |
2607 |
} else { //able to look within a term |
2 |
26 Feb 07 |
jari |
2608 |
|
2 |
26 Feb 07 |
jari |
2609 |
if(caseSens) { |
2 |
26 Feb 07 |
jari |
2610 |
if(annot.indexOf(searchTerm) != -1) { |
2 |
26 Feb 07 |
jari |
2611 |
hit = true; |
2 |
26 Feb 07 |
jari |
2612 |
break; |
2 |
26 Feb 07 |
jari |
2613 |
} |
2 |
26 Feb 07 |
jari |
2614 |
} else { |
2 |
26 Feb 07 |
jari |
2615 |
if((annot.toUpperCase()).indexOf(upperSearchString) != -1) { |
2 |
26 Feb 07 |
jari |
2616 |
hit = true; |
2 |
26 Feb 07 |
jari |
2617 |
break; |
2 |
26 Feb 07 |
jari |
2618 |
} |
2 |
26 Feb 07 |
jari |
2619 |
|
2 |
26 Feb 07 |
jari |
2620 |
} |
2 |
26 Feb 07 |
jari |
2621 |
|
2 |
26 Feb 07 |
jari |
2622 |
} |
2 |
26 Feb 07 |
jari |
2623 |
} |
2 |
26 Feb 07 |
jari |
2624 |
if(hit == true) { |
2 |
26 Feb 07 |
jari |
2625 |
indexVector.addElement(new Integer(i)); |
2 |
26 Feb 07 |
jari |
2626 |
} |
2 |
26 Feb 07 |
jari |
2627 |
} |
2 |
26 Feb 07 |
jari |
2628 |
|
2 |
26 Feb 07 |
jari |
2629 |
indices = new int[indexVector.size()]; |
2 |
26 Feb 07 |
jari |
2630 |
|
2 |
26 Feb 07 |
jari |
2631 |
for(int i = 0; i < indices.length; i++) { |
2 |
26 Feb 07 |
jari |
2632 |
indices[i] = ((Integer)(indexVector.elementAt(i))).intValue(); |
2 |
26 Feb 07 |
jari |
2633 |
} |
2 |
26 Feb 07 |
jari |
2634 |
} |
2 |
26 Feb 07 |
jari |
2635 |
return indices; |
2 |
26 Feb 07 |
jari |
2636 |
} |
2 |
26 Feb 07 |
jari |
2637 |
|
2 |
26 Feb 07 |
jari |
/** Returns an annotation array for the provided indices based on annotation key |
2 |
26 Feb 07 |
jari |
2639 |
*/ |
2 |
26 Feb 07 |
jari |
2640 |
public String[] getAnnotationList(String fieldName, int[] indices) { |
2 |
26 Feb 07 |
jari |
2641 |
String [] fieldNames = this.getFieldNames(); |
2 |
26 Feb 07 |
jari |
2642 |
int fieldIndex; |
2 |
26 Feb 07 |
jari |
2643 |
for(fieldIndex = 0; fieldIndex < fieldNames.length; fieldIndex++){ |
2 |
26 Feb 07 |
jari |
2644 |
if(fieldName.equals(fieldNames[fieldIndex])) |
2 |
26 Feb 07 |
jari |
2645 |
break; |
2 |
26 Feb 07 |
jari |
2646 |
} |
2 |
26 Feb 07 |
jari |
2647 |
|
2 |
26 Feb 07 |
jari |
2648 |
if(fieldIndex >= fieldNames.length) |
2 |
26 Feb 07 |
jari |
2649 |
return null; |
2 |
26 Feb 07 |
jari |
2650 |
|
2 |
26 Feb 07 |
jari |
2651 |
String [] annot = new String[indices.length]; |
2 |
26 Feb 07 |
jari |
2652 |
|
2 |
26 Feb 07 |
jari |
2653 |
for(int i = 0; i < annot.length; i++){ |
2 |
26 Feb 07 |
jari |
2654 |
annot[i] = this.getElementAttribute(indices[i], fieldIndex); |
2 |
26 Feb 07 |
jari |
2655 |
} |
2 |
26 Feb 07 |
jari |
2656 |
|
2 |
26 Feb 07 |
jari |
2657 |
return annot; |
2 |
26 Feb 07 |
jari |
2658 |
} |
2 |
26 Feb 07 |
jari |
2659 |
|
2 |
26 Feb 07 |
jari |
2660 |
/** |
2 |
26 Feb 07 |
jari |
* Overload getAnnotatilnList, using the full indices list if no int[] input |
2 |
26 Feb 07 |
jari |
* @param fieldName |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2664 |
*/ |
2 |
26 Feb 07 |
jari |
2665 |
public String[] getAnnotationList(String fieldName) { |
2 |
26 Feb 07 |
jari |
//System.out.println("MultipleArrayData, size of indicesList = " + this.experiment.getNumberOfGenes()); |
2 |
26 Feb 07 |
jari |
2667 |
int[] indices = new int[this.experiment.getNumberOfGenes()]; |
2 |
26 Feb 07 |
jari |
2668 |
for (int i = 0 ; i < indices.length; i ++) { |
2 |
26 Feb 07 |
jari |
2669 |
indices[i] = i; |
2 |
26 Feb 07 |
jari |
2670 |
} |
2 |
26 Feb 07 |
jari |
2671 |
return this.getAnnotationList(fieldName, indices); |
2 |
26 Feb 07 |
jari |
2672 |
} |
2 |
26 Feb 07 |
jari |
2673 |
|
2 |
26 Feb 07 |
jari |
/** Returns the slected sample annotation |
2 |
26 Feb 07 |
jari |
2675 |
*/ |
2 |
26 Feb 07 |
jari |
2676 |
public String getSampleAnnotation(int column, String key) { |
2 |
26 Feb 07 |
jari |
2677 |
return (String)(this.getFeature(column).getSlideDataLabels().get(key)); |
2 |
26 Feb 07 |
jari |
2678 |
} |
2 |
26 Feb 07 |
jari |
2679 |
/************************************************************************* |
2 |
26 Feb 07 |
jari |
* Raktim CGH Functions |
2 |
26 Feb 07 |
jari |
* Oct 3rd, 2005 |
2 |
26 Feb 07 |
jari |
2682 |
************************************************************************/ |
2 |
26 Feb 07 |
jari |
2683 |
public void setCGHCopyNumberCalculator(){ |
2 |
26 Feb 07 |
jari |
2684 |
copyNumberCalculator = new CGHCopyNumberCalculator(this); |
2 |
26 Feb 07 |
jari |
2685 |
} |
2 |
26 Feb 07 |
jari |
2686 |
public CGHCopyNumberCalculator getCGHCopyNumberCalculator(){ |
2 |
26 Feb 07 |
jari |
2687 |
return this.copyNumberCalculator; |
2 |
26 Feb 07 |
jari |
2688 |
} |
2 |
26 Feb 07 |
jari |
2689 |
|
2 |
26 Feb 07 |
jari |
2690 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2692 |
*/ |
2 |
26 Feb 07 |
jari |
2693 |
public int getFeaturesSize(int chromosome){ |
2 |
26 Feb 07 |
jari |
2694 |
return chromosomeIndices[chromosome][1] - chromosomeIndices[chromosome][0]; |
2 |
26 Feb 07 |
jari |
2695 |
} |
2 |
26 Feb 07 |
jari |
2696 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Returns CY3 value. |
2 |
26 Feb 07 |
jari |
* For dye swap experiments, returns the value of the experiment |
2 |
26 Feb 07 |
jari |
* with test DNA labeled with cy3 dye |
2 |
26 Feb 07 |
jari |
* @param column the experiment index |
2 |
26 Feb 07 |
jari |
* @param row the relative index of the probe on the specified chromosome |
2 |
26 Feb 07 |
jari |
* @param chromosome the chromosome index |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2704 |
*/ |
2 |
26 Feb 07 |
jari |
2705 |
public float getCY3(int column, int row, int chromosome){ |
2 |
26 Feb 07 |
jari |
2706 |
return getCY3(column, chromosomeIndices[chromosome][0] + row); |
2 |
26 Feb 07 |
jari |
2707 |
} |
2 |
26 Feb 07 |
jari |
2708 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Returns CY5 value. |
2 |
26 Feb 07 |
jari |
* For dye swap experiments, returns the value of the experiment |
2 |
26 Feb 07 |
jari |
* with test DNA labeled with cy3 dye |
2 |
26 Feb 07 |
jari |
* @param column the experiment index |
2 |
26 Feb 07 |
jari |
* @param row the relative index of the probe on the specified chromosome |
2 |
26 Feb 07 |
jari |
* @param chromosome the chromosome index |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2716 |
*/ |
2 |
26 Feb 07 |
jari |
2717 |
public float getCY5(int column, int row, int chromosome){ |
2 |
26 Feb 07 |
jari |
2718 |
return getCY5(column, chromosomeIndices[chromosome][0] + row); |
2 |
26 Feb 07 |
jari |
2719 |
} |
2 |
26 Feb 07 |
jari |
2720 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an element attribute. |
2 |
26 Feb 07 |
jari |
2722 |
*/ |
2 |
26 Feb 07 |
jari |
2723 |
public String getElementAttribute(int row, int attr, int chromosome){ |
2 |
26 Feb 07 |
jari |
2724 |
return getCloneAt(row).getName(); |
2 |
26 Feb 07 |
jari |
2725 |
} |
2 |
26 Feb 07 |
jari |
2726 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Returns the number of chromosomes |
2 |
26 Feb 07 |
jari |
2728 |
*/ |
2 |
26 Feb 07 |
jari |
2729 |
public int getNumChromosomes(){ |
2 |
26 Feb 07 |
jari |
2730 |
return chromosomeIndices.length; |
2 |
26 Feb 07 |
jari |
2731 |
} |
2 |
26 Feb 07 |
jari |
2732 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Returns the number of data points in a given chromosome |
2 |
26 Feb 07 |
jari |
2734 |
*/ |
2 |
26 Feb 07 |
jari |
2735 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2737 |
*/ |
2 |
26 Feb 07 |
jari |
2738 |
public int getNumDataPointsInChrom(int chromosome){ |
2 |
26 Feb 07 |
jari |
2739 |
return chromosomeIndices[chromosome][1] - chromosomeIndices[chromosome][0]; |
2 |
26 Feb 07 |
jari |
2740 |
} |
2 |
26 Feb 07 |
jari |
2741 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2743 |
*/ |
2 |
26 Feb 07 |
jari |
2744 |
public int getCloneIndex(int relativeIndex, int chromosome){ |
2 |
26 Feb 07 |
jari |
2745 |
return chromosomeIndices[chromosome][0] + relativeIndex; |
2 |
26 Feb 07 |
jari |
2746 |
} |
2 |
26 Feb 07 |
jari |
2747 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2749 |
*/ |
2 |
26 Feb 07 |
jari |
2750 |
public int getRelativeIndex(int cloneIndex, int chromosome){ |
2 |
26 Feb 07 |
jari |
2751 |
return cloneIndex - chromosomeIndices[chromosome][0]; |
2 |
26 Feb 07 |
jari |
2752 |
} |
2 |
26 Feb 07 |
jari |
/** Getter for property chromosomeIndices. |
2 |
26 Feb 07 |
jari |
* @return Value of property chromosomeIndices. |
2 |
26 Feb 07 |
jari |
2755 |
*/ |
2 |
26 Feb 07 |
jari |
2756 |
public int[][] getChromosomeIndices() { |
2 |
26 Feb 07 |
jari |
2757 |
return this.chromosomeIndices; |
2 |
26 Feb 07 |
jari |
2758 |
} |
2 |
26 Feb 07 |
jari |
/** Setter for property chromosomeIndices. |
2 |
26 Feb 07 |
jari |
* @param chromosomeIndices New value of property chromosomeIndices. |
2 |
26 Feb 07 |
jari |
2761 |
*/ |
2 |
26 Feb 07 |
jari |
2762 |
public void setChromosomeIndices(int[][] chromosomeIndices) { |
2 |
26 Feb 07 |
jari |
2763 |
this.chromosomeIndices = chromosomeIndices; |
2 |
26 Feb 07 |
jari |
2764 |
System.out.println("Chr Indices.len : " + chromosomeIndices.length + ", " + chromosomeIndices[0].length); |
2 |
26 Feb 07 |
jari |
2765 |
/* |
2 |
26 Feb 07 |
jari |
for(int i=0; i < chromosomeIndices.length; i++){ |
2 |
26 Feb 07 |
jari |
int j = 0; |
2 |
26 Feb 07 |
jari |
System.out.print("chromosomeIndices["+i+"]["+j+"]: "); |
2 |
26 Feb 07 |
jari |
for(; j < chromosomeIndices[0].length; j++){ |
2 |
26 Feb 07 |
jari |
System.out.print(chromosomeIndices[i][j] + ", "); |
2 |
26 Feb 07 |
jari |
2771 |
} |
2 |
26 Feb 07 |
jari |
System.out.println(); |
2 |
26 Feb 07 |
jari |
2773 |
} |
2 |
26 Feb 07 |
jari |
2774 |
*/ |
2 |
26 Feb 07 |
jari |
2775 |
} |
2 |
26 Feb 07 |
jari |
2776 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2778 |
*/ |
2 |
26 Feb 07 |
jari |
2779 |
public int getChromosomeStartIndex(int chromosomeIndex){ |
2 |
26 Feb 07 |
jari |
2780 |
return this.chromosomeIndices[chromosomeIndex][0]; |
2 |
26 Feb 07 |
jari |
2781 |
} |
2 |
26 Feb 07 |
jari |
2782 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2784 |
*/ |
2 |
26 Feb 07 |
jari |
2785 |
public int getChromosomeEndIndex(int chromosomeIndex){ |
2 |
26 Feb 07 |
jari |
2786 |
return this.chromosomeIndices[chromosomeIndex][1]; |
2 |
26 Feb 07 |
jari |
2787 |
} |
2 |
26 Feb 07 |
jari |
2788 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2790 |
*/ |
2 |
26 Feb 07 |
jari |
2791 |
public CGHClone getCloneAt(int index){ |
2 |
26 Feb 07 |
jari |
2792 |
/* |
2 |
26 Feb 07 |
jari |
CGHSlideDataElement sde_T1 = (CGHSlideDataElement)((ISlideData)featuresList.get(0)).getSlideDataElement(index); |
2 |
26 Feb 07 |
jari |
CGHClone clone_T1 = sde_T1.getClone(); |
2 |
26 Feb 07 |
jari |
return clone_T1; |
2 |
26 Feb 07 |
jari |
2796 |
*/ |
2 |
26 Feb 07 |
jari |
2797 |
return (CGHClone)clones.get(index); |
2 |
26 Feb 07 |
jari |
2798 |
} |
2 |
26 Feb 07 |
jari |
2799 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
2801 |
*/ |
2 |
26 Feb 07 |
jari |
2802 |
public CGHClone getCloneAt(int index, int chromosome){ |
2 |
26 Feb 07 |
jari |
2803 |
return getCloneAt(getCloneIndex(index, chromosome)); |
2 |
26 Feb 07 |
jari |
2804 |
} |
2 |
26 Feb 07 |
jari |
2805 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
* corresponds to ISlideData function |
2 |
26 Feb 07 |
jari |
2808 |
*/ |
2 |
26 Feb 07 |
jari |
2809 |
public int getNumFlankingRegions(int experimentIndex, int chromosomeIndex){ |
2 |
26 Feb 07 |
jari |
2810 |
return ((ISlideData)featuresList.get(experimentIndex)).getNumFlankingRegions(chromosomeIndex); |
2 |
26 Feb 07 |
jari |
2811 |
} |
2 |
26 Feb 07 |
jari |
2812 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
* corresponds to ISlideData function |
2 |
26 Feb 07 |
jari |
2815 |
*/ |
2 |
26 Feb 07 |
jari |
2816 |
public void setFlankingRegions(int experimentIndex, Vector[] flankingRegions){ |
2 |
26 Feb 07 |
jari |
2817 |
((ISlideData)featuresList.get(experimentIndex)).setFlankingRegions(flankingRegions); |
2 |
26 Feb 07 |
jari |
2818 |
} |
2 |
26 Feb 07 |
jari |
2819 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
* Setter for property samplesOrder. |
2 |
26 Feb 07 |
jari |
* @param samplesOrder New value of property samplesOrder. |
2 |
26 Feb 07 |
jari |
2823 |
*/ |
2 |
26 Feb 07 |
jari |
2824 |
public void setSamplesOrder(int[] samplesOrder) { |
2 |
26 Feb 07 |
jari |
2825 |
this.samplesOrder = samplesOrder; |
2 |
26 Feb 07 |
jari |
2826 |
} |
2 |
26 Feb 07 |
jari |
2827 |
/** |
2 |
26 Feb 07 |
jari |
* CGH |
2 |
26 Feb 07 |
jari |
* Getter for property samplesOrder. |
2 |
26 Feb 07 |
jari |
* @return Value of property samplesOrder. |
2 |
26 Feb 07 |
jari |
2831 |
*/ |
2 |
26 Feb 07 |
jari |
2832 |
public int[] getSamplesOrder() { |
2 |
26 Feb 07 |
jari |
2833 |
return this.samplesOrder; |
2 |
26 Feb 07 |
jari |
2834 |
} |
2 |
26 Feb 07 |
jari |
2835 |
/* |
2 |
26 Feb 07 |
jari |
* UN-used |
2 |
26 Feb 07 |
jari |
public Vector getSlides(){ |
2 |
26 Feb 07 |
jari |
Vector slides = new Vector(); |
2 |
26 Feb 07 |
jari |
Iterator it = featuresList.iterator(); |
2 |
26 Feb 07 |
jari |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
CGHSampleData sampleData = (CGHSampleData)it.next(); |
2 |
26 Feb 07 |
jari |
Iterator cy3It = sampleData.getCy3Slides().iterator(); |
2 |
26 Feb 07 |
jari |
while(cy3It.hasNext()){ |
2 |
26 Feb 07 |
jari |
slides.add( (CGHSlideData) cy3It.next() ); |
2 |
26 Feb 07 |
jari |
2845 |
} |
2 |
26 Feb 07 |
jari |
Iterator cy5It = sampleData.getCy5Slides().iterator(); |
2 |
26 Feb 07 |
jari |
while(cy5It.hasNext()){ |
2 |
26 Feb 07 |
jari |
slides.add( (CGHSlideData) cy5It.next() ); |
2 |
26 Feb 07 |
jari |
2849 |
} |
2 |
26 Feb 07 |
jari |
2850 |
} |
2 |
26 Feb 07 |
jari |
return slides; |
2 |
26 Feb 07 |
jari |
2852 |
} |
2 |
26 Feb 07 |
jari |
2853 |
*/ |
2 |
26 Feb 07 |
jari |
// Addition - Raktim, Oct 31, 05 |
2 |
26 Feb 07 |
jari |
2855 |
/** |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @param clone |
2 |
26 Feb 07 |
jari |
* @param chromosome |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2860 |
*/ |
2 |
26 Feb 07 |
jari |
2861 |
public float getValue(int experiment, int clone, int chromosome){ |
2 |
26 Feb 07 |
jari |
//return getValue(experiment, data.getCloneIndex(clone, chromosome)); |
2 |
26 Feb 07 |
jari |
2863 |
return getValue(experiment, getCloneIndex(clone, chromosome)); |
2 |
26 Feb 07 |
jari |
2864 |
} |
2 |
26 Feb 07 |
jari |
/** Returns the appropriate data value based on |
2 |
26 Feb 07 |
jari |
* the user selected clone value type. This can be. |
2 |
26 Feb 07 |
jari |
* for example, the log average inverted value, or |
2 |
26 Feb 07 |
jari |
* any number of discrete copy number determination |
2 |
26 Feb 07 |
jari |
* methods |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @param clone |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2873 |
*/ |
2 |
26 Feb 07 |
jari |
2874 |
public float getValue(int experiment, int clone){ |
2 |
26 Feb 07 |
jari |
2875 |
if(cloneValueType == ICGHCloneValueMenu.CLONE_VALUE_DISCRETE_DETERMINATION){ |
2 |
26 Feb 07 |
jari |
2876 |
return getCopyNumberDetermination(experiment, clone); |
2 |
26 Feb 07 |
jari |
2877 |
}else if(cloneValueType == ICGHCloneValueMenu.CLONE_VALUE_LOG_AVERAGE_INVERTED){ |
2 |
26 Feb 07 |
jari |
//return getLogAverageInvertedValue(experiment, clone); |
2 |
26 Feb 07 |
jari |
//return dataValues[clone][experiment]; |
2 |
26 Feb 07 |
jari |
2880 |
return getRatio(experiment, clone, this.logState); |
2 |
26 Feb 07 |
jari |
2881 |
}else if(cloneValueType == ICGHCloneValueMenu.CLONE_VALUE_LOG_CLONE_DISTRIBUTION){ |
2 |
26 Feb 07 |
jari |
2882 |
return getCopyNumberDeterminationByLogCloneDistribution(experiment, clone); |
2 |
26 Feb 07 |
jari |
2883 |
}else if(cloneValueType == ICGHCloneValueMenu.CLONE_VALUE_THRESHOLD_OR_CLONE_DISTRIBUTION){ |
2 |
26 Feb 07 |
jari |
2884 |
return getCopyNumberDeterminationByThresholdOrCloneDistribution(experiment, clone); |
2 |
26 Feb 07 |
jari |
2885 |
} |
2 |
26 Feb 07 |
jari |
2886 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
2887 |
} |
2 |
26 Feb 07 |
jari |
2888 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
* Calculates the log average inverted value |
2 |
26 Feb 07 |
jari |
* for a dye swap experiment. Returns the log |
2 |
26 Feb 07 |
jari |
* value if the experiment was not done in dye swap |
2 |
26 Feb 07 |
jari |
2893 |
*/ |
2 |
26 Feb 07 |
jari |
2894 |
public float getLogAverageInvertedValue(int experiment, int clone){ |
2 |
26 Feb 07 |
jari |
2895 |
if(!hasDyeSwap){ |
2 |
26 Feb 07 |
jari |
2896 |
return getRatio(experiment, clone, LOG); |
2 |
26 Feb 07 |
jari |
2897 |
} |
2 |
26 Feb 07 |
jari |
2898 |
float cy3Ratio = getCY3(experiment, clone); |
2 |
26 Feb 07 |
jari |
2899 |
float cy5Ratio = getCY5(experiment, clone); |
2 |
26 Feb 07 |
jari |
2900 |
if(cy3Ratio == IData.BAD_CLONE || cy5Ratio == IData.BAD_CLONE){ |
2 |
26 Feb 07 |
jari |
2901 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
2902 |
} |
2 |
26 Feb 07 |
jari |
2903 |
if(cy3Ratio == 0 || cy5Ratio == 0){ |
2 |
26 Feb 07 |
jari |
2904 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
2905 |
} |
2 |
26 Feb 07 |
jari |
2906 |
try{ |
2 |
26 Feb 07 |
jari |
2907 |
float ratio = (float) (Arithmetic.log2(cy3Ratio) - Arithmetic.log2(cy5Ratio)) / 2; |
2 |
26 Feb 07 |
jari |
2908 |
return ratio; |
2 |
26 Feb 07 |
jari |
2909 |
}catch (Exception e){ |
2 |
26 Feb 07 |
jari |
2910 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
2911 |
} |
2 |
26 Feb 07 |
jari |
2912 |
} |
2 |
26 Feb 07 |
jari |
/** Alterts that the method of calculating a probe copy number |
2 |
26 Feb 07 |
jari |
* has changed. This can be either a change in the determination |
2 |
26 Feb 07 |
jari |
* method or in the thresholds appropriate for classification |
2 |
26 Feb 07 |
jari |
2916 |
* |
2 |
26 Feb 07 |
jari |
* @param menu |
2 |
26 Feb 07 |
jari |
2918 |
*/ |
2 |
26 Feb 07 |
jari |
2919 |
public void onCopyDeterminationChanged(ICGHCloneValueMenu menu){ |
2 |
26 Feb 07 |
jari |
2920 |
this.cloneValueType = menu.getCloneValueType(); |
2 |
26 Feb 07 |
jari |
2921 |
System.out.println("Print onCopyDeterminationChanged().this.cloneValueType " + this.cloneValueType); |
2 |
26 Feb 07 |
jari |
2922 |
this.copyNumberCalculator.onCopyDeterminationChanged(menu); |
2 |
26 Feb 07 |
jari |
2923 |
} |
2 |
26 Feb 07 |
jari |
2924 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim OCt 31, 05, CGH Function |
2 |
26 Feb 07 |
jari |
* Calculates the copy number of a probe based |
2 |
26 Feb 07 |
jari |
* on probe value thresholding |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @param clone |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2931 |
*/ |
2 |
26 Feb 07 |
jari |
2932 |
public int getCopyNumberDetermination(int experiment, int clone){ |
2 |
26 Feb 07 |
jari |
2933 |
return copyNumberCalculator.getCopyNumberDetermination(experiment, clone); |
2 |
26 Feb 07 |
jari |
2934 |
} |
2 |
26 Feb 07 |
jari |
2935 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Oct 31, 2005 |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @param clone |
2 |
26 Feb 07 |
jari |
* @param chromosome |
2 |
26 Feb 07 |
jari |
* @return */ |
2 |
26 Feb 07 |
jari |
2941 |
public int getCopyNumberDetermination(int experiment, int clone, int chromosome){ |
2 |
26 Feb 07 |
jari |
2942 |
return copyNumberCalculator.getCopyNumberDetermination(experiment, clone, chromosome); |
2 |
26 Feb 07 |
jari |
2943 |
} |
2 |
26 Feb 07 |
jari |
2944 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim OCt 31, 05, CGH Function |
2 |
26 Feb 07 |
jari |
* Calculates the copy number of a probe based |
2 |
26 Feb 07 |
jari |
* on the probe's normal distribution |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @param clone |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2951 |
*/ |
2 |
26 Feb 07 |
jari |
2952 |
public int getCopyNumberDeterminationByLogCloneDistribution(int experiment, int clone){ |
2 |
26 Feb 07 |
jari |
2953 |
return copyNumberCalculator.getCopyNumberDeterminationByLogCloneDistribution(experiment, clone); |
2 |
26 Feb 07 |
jari |
2954 |
} |
2 |
26 Feb 07 |
jari |
2955 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim OCt 31, 05, CGH Function |
2 |
26 Feb 07 |
jari |
* Calculates the copy number of a probe based |
2 |
26 Feb 07 |
jari |
* on the probe's normal distribution or probe value thresholding |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @param clone |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
2962 |
*/ |
2 |
26 Feb 07 |
jari |
2963 |
public int getCopyNumberDeterminationByThresholdOrCloneDistribution(int experiment, int clone){ |
2 |
26 Feb 07 |
jari |
2964 |
return copyNumberCalculator.getCopyNumberDeterminationByThresholdOrCloneDistribution(experiment, clone); |
2 |
26 Feb 07 |
jari |
2965 |
} |
2 |
26 Feb 07 |
jari |
/** Calculates the p-value of the probe's value |
2 |
26 Feb 07 |
jari |
* based on the normal distribution curve corresponding |
2 |
26 Feb 07 |
jari |
* to the probe, for an experiment not done in dye swap |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @param clone |
2 |
26 Feb 07 |
jari |
* @param logState |
2 |
26 Feb 07 |
jari |
* @return */ |
2 |
26 Feb 07 |
jari |
2973 |
public float getPValueByLogCloneDistribution(int experiment, int clone){ |
2 |
26 Feb 07 |
jari |
2974 |
double ratio = getRatio(experiment, clone, this.logState); |
2 |
26 Feb 07 |
jari |
2975 |
Distribution dist = getDistributionAt(clone); |
2 |
26 Feb 07 |
jari |
2976 |
if(dist == null){ |
2 |
26 Feb 07 |
jari |
2977 |
return Float.NaN; |
2 |
26 Feb 07 |
jari |
2978 |
}else{ |
2 |
26 Feb 07 |
jari |
2979 |
double mean = dist.getMean(); |
2 |
26 Feb 07 |
jari |
2980 |
double sd = dist.getSd(); |
2 |
26 Feb 07 |
jari |
//double z = Probability.normal(mean, Descriptive.variance(sd), ratio); |
2 |
26 Feb 07 |
jari |
2982 |
double z = (ratio - mean) / sd; |
2 |
26 Feb 07 |
jari |
2983 |
double p = Probability.normal(z); |
2 |
26 Feb 07 |
jari |
2984 |
return (float)p; |
2 |
26 Feb 07 |
jari |
2985 |
} |
2 |
26 Feb 07 |
jari |
2986 |
} |
2 |
26 Feb 07 |
jari |
2987 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Oct31, 2005 |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
* Getter for property cloneDistributions. |
2 |
26 Feb 07 |
jari |
* @return Value of property cloneDistributions. |
2 |
26 Feb 07 |
jari |
2992 |
*/ |
2 |
26 Feb 07 |
jari |
2993 |
public Distribution[] getCloneDistributions() { |
2 |
26 Feb 07 |
jari |
2994 |
return cloneDistributions; |
2 |
26 Feb 07 |
jari |
2995 |
} |
2 |
26 Feb 07 |
jari |
2996 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Oct31, 2005 |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
* Setter for property cloneDistributions. |
2 |
26 Feb 07 |
jari |
* @param cloneDistributions New value of property cloneDistributions. |
2 |
26 Feb 07 |
jari |
3001 |
*/ |
2 |
26 Feb 07 |
jari |
3002 |
public void setCloneDistributions(Distribution[] cloneDistributions) { |
2 |
26 Feb 07 |
jari |
3003 |
this.cloneDistributions = cloneDistributions; |
2 |
26 Feb 07 |
jari |
3004 |
} |
2 |
26 Feb 07 |
jari |
3005 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Oct31, 2005 |
2 |
26 Feb 07 |
jari |
* CGH Function |
2 |
26 Feb 07 |
jari |
* @param index |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3010 |
*/ |
2 |
26 Feb 07 |
jari |
3011 |
public Distribution getDistributionAt(int index){ |
2 |
26 Feb 07 |
jari |
3012 |
try{ |
2 |
26 Feb 07 |
jari |
3013 |
return cloneDistributions[index]; |
2 |
26 Feb 07 |
jari |
3014 |
}catch (Exception e){ |
2 |
26 Feb 07 |
jari |
3015 |
return null; |
2 |
26 Feb 07 |
jari |
3016 |
} |
2 |
26 Feb 07 |
jari |
3017 |
} |
2 |
26 Feb 07 |
jari |
3018 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim October 31, 2005 |
2 |
26 Feb 07 |
jari |
* CGH createExperiment Function |
2 |
26 Feb 07 |
jari |
3021 |
*/ |
2 |
26 Feb 07 |
jari |
3022 |
public Experiment createExperiment(Object results){ |
2 |
26 Feb 07 |
jari |
3023 |
/* |
2 |
26 Feb 07 |
jari |
ExperimentWizard wiz = new ExperimentWizard(framework.getFrame()); |
2 |
26 Feb 07 |
jari |
if(wiz.showModal() == javax.swing.JOptionPane.OK_OPTION){ |
2 |
26 Feb 07 |
jari |
3026 |
*/ |
2 |
26 Feb 07 |
jari |
//Object results = wiz.getResults(); |
2 |
26 Feb 07 |
jari |
3028 |
if(results instanceof BacClonesExperimentParameters){ |
2 |
26 Feb 07 |
jari |
3029 |
return createBacClonesExperiment((BacClonesExperimentParameters)results); |
2 |
26 Feb 07 |
jari |
3030 |
}else if(results instanceof GenesExperimentParameters){ |
2 |
26 Feb 07 |
jari |
3031 |
return createGenesExperiment((GenesExperimentParameters)results); |
2 |
26 Feb 07 |
jari |
3032 |
}else if(results instanceof DataRegionsExperimentParameters){ |
2 |
26 Feb 07 |
jari |
3033 |
return createDataRegionsExperiment((DataRegionsExperimentParameters)results); |
2 |
26 Feb 07 |
jari |
3034 |
} |
2 |
26 Feb 07 |
jari |
3035 |
/* |
2 |
26 Feb 07 |
jari |
}else{ |
2 |
26 Feb 07 |
jari |
System.out.println("cancelled"); |
2 |
26 Feb 07 |
jari |
3038 |
} |
2 |
26 Feb 07 |
jari |
wiz = null; |
2 |
26 Feb 07 |
jari |
3040 |
*/ |
2 |
26 Feb 07 |
jari |
3041 |
return null; |
2 |
26 Feb 07 |
jari |
3042 |
} |
2 |
26 Feb 07 |
jari |
3043 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Helper Method |
2 |
26 Feb 07 |
jari |
* @param chromosomeIndices |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3048 |
*/ |
2 |
26 Feb 07 |
jari |
3049 |
private int getNumSelectedDataPoints(int[] chromosomeIndices){ |
2 |
26 Feb 07 |
jari |
3050 |
int numBacs = 0; |
2 |
26 Feb 07 |
jari |
3051 |
for(int i = 0; i < chromosomeIndices.length; i++){ |
2 |
26 Feb 07 |
jari |
3052 |
if(chromosomeIndices[i] == BacClonesExperimentParameters.ALL_CHROMOSOMES){ |
2 |
26 Feb 07 |
jari |
3053 |
return getFeaturesSize(); |
2 |
26 Feb 07 |
jari |
3054 |
} |
2 |
26 Feb 07 |
jari |
3055 |
numBacs += getNumDataPointsInChrom(chromosomeIndices[i]); |
2 |
26 Feb 07 |
jari |
3056 |
} |
2 |
26 Feb 07 |
jari |
3057 |
return numBacs; |
2 |
26 Feb 07 |
jari |
3058 |
} |
2 |
26 Feb 07 |
jari |
3059 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Helper Method |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3063 |
*/ |
2 |
26 Feb 07 |
jari |
3064 |
public int[] createDefaultColumns(){ |
2 |
26 Feb 07 |
jari |
3065 |
int[] defaultCols = new int[getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3066 |
for(int i = 0; i < defaultCols.length; i++){ |
2 |
26 Feb 07 |
jari |
3067 |
defaultCols[i] = i; |
2 |
26 Feb 07 |
jari |
3068 |
} |
2 |
26 Feb 07 |
jari |
3069 |
return defaultCols; |
2 |
26 Feb 07 |
jari |
3070 |
} |
2 |
26 Feb 07 |
jari |
3071 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Helper Method |
2 |
26 Feb 07 |
jari |
* @param row |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3076 |
*/ |
2 |
26 Feb 07 |
jari |
3077 |
public boolean isMissingData(int row){ |
2 |
26 Feb 07 |
jari |
3078 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
3079 |
if(Float.isNaN(getRatio(row, col, this.logState))){ |
2 |
26 Feb 07 |
jari |
3080 |
return true; |
2 |
26 Feb 07 |
jari |
3081 |
} |
2 |
26 Feb 07 |
jari |
3082 |
} |
2 |
26 Feb 07 |
jari |
3083 |
return false; |
2 |
26 Feb 07 |
jari |
3084 |
} |
2 |
26 Feb 07 |
jari |
3085 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Oct 31, 2005 |
2 |
26 Feb 07 |
jari |
* @param parameters |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3089 |
*/ |
2 |
26 Feb 07 |
jari |
3090 |
private CGHExperiment createBacClonesExperiment(BacClonesExperimentParameters parameters){ |
2 |
26 Feb 07 |
jari |
3091 |
if(parameters.isIncludeMissingBacs()){ |
2 |
26 Feb 07 |
jari |
3092 |
return createBacClonesExperimentAllValues(parameters); |
2 |
26 Feb 07 |
jari |
3093 |
}else{ |
2 |
26 Feb 07 |
jari |
3094 |
return createBacClonesExperimentNoMissing(parameters); |
2 |
26 Feb 07 |
jari |
3095 |
} |
2 |
26 Feb 07 |
jari |
3096 |
} |
2 |
26 Feb 07 |
jari |
3097 |
/** |
2 |
26 Feb 07 |
jari |
3098 |
* |
2 |
26 Feb 07 |
jari |
* @param parameters |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3101 |
*/ |
2 |
26 Feb 07 |
jari |
3102 |
private CGHExperiment createBacClonesExperimentAllValues(BacClonesExperimentParameters parameters){ |
2 |
26 Feb 07 |
jari |
3103 |
int[] chromosomeIndices = parameters.getChromosomeIndices(); |
2 |
26 Feb 07 |
jari |
3104 |
int numSelectedBacs = getNumSelectedDataPoints(chromosomeIndices); |
2 |
26 Feb 07 |
jari |
3105 |
if(numSelectedBacs == getFeaturesSize()){ |
2 |
26 Feb 07 |
jari |
3106 |
return createBacClonesExperimentAllValuesAllChromosomes(); |
2 |
26 Feb 07 |
jari |
3107 |
} |
2 |
26 Feb 07 |
jari |
3108 |
float[][] fmData = new float[numSelectedBacs][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3109 |
String[] annotations = new String[numSelectedBacs]; |
2 |
26 Feb 07 |
jari |
3110 |
int counter = 0; |
2 |
26 Feb 07 |
jari |
3111 |
for(int chrom = 0; chrom < chromosomeIndices.length; chrom++){ |
2 |
26 Feb 07 |
jari |
3112 |
int chromosomeIndex = chromosomeIndices[chrom]; |
2 |
26 Feb 07 |
jari |
3113 |
for(int cloneIndex = 0; cloneIndex < getNumDataPointsInChrom(chromosomeIndex); cloneIndex++){ |
2 |
26 Feb 07 |
jari |
3114 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
3115 |
fmData[counter][col] = getRatio(getCloneIndex(cloneIndex, chromosomeIndex), col, this.logState); //data.getRatio(col, cloneIndex, chromosomeIndex, 1); |
2 |
26 Feb 07 |
jari |
3116 |
annotations[counter] = getCloneAt(cloneIndex, chromosomeIndex).getName(); |
2 |
26 Feb 07 |
jari |
3117 |
} |
2 |
26 Feb 07 |
jari |
3118 |
counter++; |
2 |
26 Feb 07 |
jari |
3119 |
} |
2 |
26 Feb 07 |
jari |
3120 |
} |
2 |
26 Feb 07 |
jari |
3121 |
FloatMatrix fm = new FloatMatrix(fmData); |
2 |
26 Feb 07 |
jari |
3122 |
CGHExperiment exp = new CGHExperiment(fm, createDefaultColumns(), annotations); |
2 |
26 Feb 07 |
jari |
3123 |
return exp; |
2 |
26 Feb 07 |
jari |
3124 |
} |
2 |
26 Feb 07 |
jari |
3125 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3128 |
*/ |
2 |
26 Feb 07 |
jari |
3129 |
private CGHExperiment createBacClonesExperimentAllValuesAllChromosomes(){ |
2 |
26 Feb 07 |
jari |
3130 |
float[][] fmData = new float[getFeaturesSize()][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3131 |
String[] annotations = new String[getFeaturesSize()]; |
2 |
26 Feb 07 |
jari |
3132 |
for(int row = 0; row < getFeaturesSize(); row++){ |
2 |
26 Feb 07 |
jari |
3133 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
3134 |
fmData[row][col] = getRatio(row,col,this.logState); |
2 |
26 Feb 07 |
jari |
3135 |
annotations[row] = getCloneAt(row).getName(); |
2 |
26 Feb 07 |
jari |
3136 |
} |
2 |
26 Feb 07 |
jari |
3137 |
} |
2 |
26 Feb 07 |
jari |
3138 |
FloatMatrix fm = new FloatMatrix(fmData); |
2 |
26 Feb 07 |
jari |
3139 |
CGHExperiment exp = new CGHExperiment(fm, createDefaultColumns(), annotations); |
2 |
26 Feb 07 |
jari |
3140 |
return exp; |
2 |
26 Feb 07 |
jari |
3141 |
} |
2 |
26 Feb 07 |
jari |
3142 |
/** |
2 |
26 Feb 07 |
jari |
3143 |
* |
2 |
26 Feb 07 |
jari |
* @param parameters |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3146 |
*/ |
2 |
26 Feb 07 |
jari |
3147 |
private CGHExperiment createBacClonesExperimentNoMissing(BacClonesExperimentParameters parameters){ |
2 |
26 Feb 07 |
jari |
3148 |
int[] chromosomeIndices = parameters.getChromosomeIndices(); |
2 |
26 Feb 07 |
jari |
3149 |
int numSelectedBacs = getNumSelectedDataPoints(chromosomeIndices); |
2 |
26 Feb 07 |
jari |
3150 |
if(numSelectedBacs == getFeaturesSize()){ |
2 |
26 Feb 07 |
jari |
3151 |
return createBacClonesExperimentAllChromosomesNoMissing(); |
2 |
26 Feb 07 |
jari |
3152 |
} |
2 |
26 Feb 07 |
jari |
3153 |
float[][] fmDataTmp = new float[numSelectedBacs][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3154 |
String[] annotationsTmp = new String[numSelectedBacs]; |
2 |
26 Feb 07 |
jari |
3155 |
int counter = 0; |
2 |
26 Feb 07 |
jari |
3156 |
for(int chrom = 0; chrom < chromosomeIndices.length; chrom++){ |
2 |
26 Feb 07 |
jari |
3157 |
int chromosomeIndex = chromosomeIndices[chrom]; |
2 |
26 Feb 07 |
jari |
3158 |
for(int cloneIndex = 0; cloneIndex < getNumDataPointsInChrom(chromosomeIndex); cloneIndex++){ |
2 |
26 Feb 07 |
jari |
3159 |
if(!isMissingData(getCloneIndex(cloneIndex, chromosomeIndex))){ |
2 |
26 Feb 07 |
jari |
3160 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
//fmDataTmp[counter][col] = data.getRatio(col, cloneIndex, chromosomeIndex, 1); |
2 |
26 Feb 07 |
jari |
3162 |
fmDataTmp[counter][col] = getRatio(getCloneIndex(cloneIndex, chromosomeIndex), col, this.logState); |
2 |
26 Feb 07 |
jari |
3163 |
annotationsTmp[counter] = getCloneAt(cloneIndex, chromosomeIndex).getName(); |
2 |
26 Feb 07 |
jari |
3164 |
} |
2 |
26 Feb 07 |
jari |
3165 |
counter++; |
2 |
26 Feb 07 |
jari |
3166 |
} |
2 |
26 Feb 07 |
jari |
3167 |
} |
2 |
26 Feb 07 |
jari |
3168 |
} |
2 |
26 Feb 07 |
jari |
3169 |
float[][] fmData = new float[counter][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3170 |
String[] annotations = new String[counter]; |
2 |
26 Feb 07 |
jari |
3171 |
for(int row = 0; row < counter; row++){ |
2 |
26 Feb 07 |
jari |
3172 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
3173 |
fmData[row][col] = fmDataTmp[row][col]; |
2 |
26 Feb 07 |
jari |
3174 |
annotations[row] = annotationsTmp[row]; |
2 |
26 Feb 07 |
jari |
3175 |
} |
2 |
26 Feb 07 |
jari |
3176 |
} |
2 |
26 Feb 07 |
jari |
3177 |
FloatMatrix fm = new FloatMatrix(fmData); |
2 |
26 Feb 07 |
jari |
3178 |
CGHExperiment exp = new CGHExperiment(fm, createDefaultColumns(), annotations); |
2 |
26 Feb 07 |
jari |
3179 |
return exp; |
2 |
26 Feb 07 |
jari |
3180 |
} |
2 |
26 Feb 07 |
jari |
3181 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3184 |
*/ |
2 |
26 Feb 07 |
jari |
3185 |
private CGHExperiment createBacClonesExperimentAllChromosomesNoMissing(){ |
2 |
26 Feb 07 |
jari |
3186 |
float[][] fmDataTmp = new float[getFeaturesSize()][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3187 |
String[] annotationsTmp = new String[getFeaturesSize()]; |
2 |
26 Feb 07 |
jari |
3188 |
int counter = 0; |
2 |
26 Feb 07 |
jari |
3189 |
for(int row = 0; row < getFeaturesSize(); row++){ |
2 |
26 Feb 07 |
jari |
3190 |
if(!isMissingData(row)){ |
2 |
26 Feb 07 |
jari |
3191 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
//fmDataTmp[counter][col] = data.getRatio(col, counter, 1); |
2 |
26 Feb 07 |
jari |
3193 |
fmDataTmp[counter][col] = getRatio(row, col, this.logState); |
2 |
26 Feb 07 |
jari |
3194 |
annotationsTmp[counter] = getCloneAt(counter).getName(); |
2 |
26 Feb 07 |
jari |
3195 |
} |
2 |
26 Feb 07 |
jari |
3196 |
counter++; |
2 |
26 Feb 07 |
jari |
3197 |
} |
2 |
26 Feb 07 |
jari |
3198 |
} |
2 |
26 Feb 07 |
jari |
3199 |
float[][] fmData = new float[counter][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3200 |
String[] annotations = new String[counter]; |
2 |
26 Feb 07 |
jari |
3201 |
for(int row = 0; row < counter; row++){ |
2 |
26 Feb 07 |
jari |
3202 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
3203 |
fmData[row][col] = fmDataTmp[row][col]; |
2 |
26 Feb 07 |
jari |
3204 |
annotations[row] = annotationsTmp[row]; |
2 |
26 Feb 07 |
jari |
3205 |
} |
2 |
26 Feb 07 |
jari |
3206 |
} |
2 |
26 Feb 07 |
jari |
3207 |
FloatMatrix fm = new FloatMatrix(fmData); |
2 |
26 Feb 07 |
jari |
3208 |
CGHExperiment exp = new CGHExperiment(fm, createDefaultColumns(), annotations); |
2 |
26 Feb 07 |
jari |
3209 |
return exp; |
2 |
26 Feb 07 |
jari |
3210 |
} |
2 |
26 Feb 07 |
jari |
3211 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Should **NOT** be used without verification |
2 |
26 Feb 07 |
jari |
* @param parameters |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3216 |
*/ |
2 |
26 Feb 07 |
jari |
3217 |
private CGHExperiment createGenesExperiment(GenesExperimentParameters parameters){ |
2 |
26 Feb 07 |
jari |
3218 |
File genesFile = parameters.getGenesFile(); |
2 |
26 Feb 07 |
jari |
3219 |
try{ |
2 |
26 Feb 07 |
jari |
3220 |
BufferedReader reader = new BufferedReader(new FileReader(genesFile)); |
2 |
26 Feb 07 |
jari |
3221 |
String line; |
2 |
26 Feb 07 |
jari |
3222 |
Vector geneNames = new Vector(); |
2 |
26 Feb 07 |
jari |
3223 |
while((line = reader.readLine()) != null){ |
2 |
26 Feb 07 |
jari |
3224 |
geneNames.add(line); |
2 |
26 Feb 07 |
jari |
3225 |
} |
2 |
26 Feb 07 |
jari |
3226 |
GeneDataSet geneDataSet = new GeneDataSet(); |
2 |
26 Feb 07 |
jari |
3227 |
geneDataSet.loadGeneDataByGeneNames(geneNames, this.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
3228 |
Vector geneData = geneDataSet.getGeneData(); |
2 |
26 Feb 07 |
jari |
3229 |
float[][] fmData = new float[geneData.size()][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3230 |
String[] annotations = new String[geneData.size()]; |
2 |
26 Feb 07 |
jari |
3231 |
for(int row = 0; row < geneData.size(); row++){ |
2 |
26 Feb 07 |
jari |
3232 |
for(int col = 0; col < getFeaturesCount(); col++){ |
2 |
26 Feb 07 |
jari |
3233 |
fmData[row][col] = getExperimentGeneValue((IGeneData)geneData.get(row), col); |
2 |
26 Feb 07 |
jari |
3234 |
annotations[row] = ((IGeneData)geneData.get(row)).getName(); |
2 |
26 Feb 07 |
jari |
3235 |
} |
2 |
26 Feb 07 |
jari |
3236 |
} |
2 |
26 Feb 07 |
jari |
3237 |
FloatMatrix fm = new FloatMatrix(fmData); |
2 |
26 Feb 07 |
jari |
3238 |
CGHExperiment exp = new CGHExperiment(fm, createDefaultColumns(), annotations); |
2 |
26 Feb 07 |
jari |
3239 |
return exp; |
2 |
26 Feb 07 |
jari |
3240 |
}catch (IOException e){ |
2 |
26 Feb 07 |
jari |
3241 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
3242 |
} |
2 |
26 Feb 07 |
jari |
3243 |
return null; |
2 |
26 Feb 07 |
jari |
3244 |
} |
2 |
26 Feb 07 |
jari |
3245 |
/** |
2 |
26 Feb 07 |
jari |
* Helper for above |
2 |
26 Feb 07 |
jari |
* Should **NOT** be used |
2 |
26 Feb 07 |
jari |
* @param geneData |
2 |
26 Feb 07 |
jari |
* @param experiment |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3251 |
*/ |
2 |
26 Feb 07 |
jari |
3252 |
private float getExperimentGeneValue(IGeneData geneData, int experiment){ |
2 |
26 Feb 07 |
jari |
3253 |
int geneStart = geneData.getStart(); |
2 |
26 Feb 07 |
jari |
3254 |
int geneEnd = geneData.getStop(); |
2 |
26 Feb 07 |
jari |
3255 |
if(geneData.getChromosomeIndex() < 0){ |
2 |
26 Feb 07 |
jari |
3256 |
System.out.println("Gene " + geneData.getName() + " Chrom = " + geneData.getChromosomeIndex()); |
2 |
26 Feb 07 |
jari |
3257 |
return 0; |
2 |
26 Feb 07 |
jari |
3258 |
} |
2 |
26 Feb 07 |
jari |
3259 |
ISlideData featureData = (ISlideData)getFeaturesList().get(experiment); |
2 |
26 Feb 07 |
jari |
3260 |
Vector[] allFrs = featureData.getFlankingRegions(); |
2 |
26 Feb 07 |
jari |
3261 |
Vector chromFrs = allFrs[geneData.getChromosomeIndex()]; |
2 |
26 Feb 07 |
jari |
3262 |
Iterator it = chromFrs.iterator(); |
2 |
26 Feb 07 |
jari |
3263 |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
3264 |
FlankingRegion fr = (FlankingRegion)it.next(); |
2 |
26 Feb 07 |
jari |
3265 |
int frStart = fr.getStart(); |
2 |
26 Feb 07 |
jari |
3266 |
int frStop = fr.getStop(); |
2 |
26 Feb 07 |
jari |
3267 |
if( (geneStart < frStop && geneStart > frStart) || (geneEnd < frStop && geneStart > frStart) ){ |
2 |
26 Feb 07 |
jari |
3268 |
if(fr.getType() == FlankingRegion.DELETION){ |
2 |
26 Feb 07 |
jari |
3269 |
return -1; |
2 |
26 Feb 07 |
jari |
3270 |
}else if(fr.getType() == FlankingRegion.AMPLIFICATION){ |
2 |
26 Feb 07 |
jari |
3271 |
return 1; |
2 |
26 Feb 07 |
jari |
3272 |
} |
2 |
26 Feb 07 |
jari |
3273 |
} |
2 |
26 Feb 07 |
jari |
3274 |
} |
2 |
26 Feb 07 |
jari |
3275 |
return 0; |
2 |
26 Feb 07 |
jari |
3276 |
} |
2 |
26 Feb 07 |
jari |
3277 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* @param parameters |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3281 |
*/ |
2 |
26 Feb 07 |
jari |
3282 |
private CGHExperiment createDataRegionsExperiment(DataRegionsExperimentParameters parameters){ |
2 |
26 Feb 07 |
jari |
3283 |
int[] chromosomeIndices = parameters.getChromosomeIndices(); |
2 |
26 Feb 07 |
jari |
3284 |
Vector dataRegions = new Vector(); |
2 |
26 Feb 07 |
jari |
3285 |
dataRegions.addAll(getDataRegionsValues(FlankingRegion.DELETION, chromosomeIndices)); |
2 |
26 Feb 07 |
jari |
3286 |
dataRegions.addAll(getDataRegionsValues(FlankingRegion.AMPLIFICATION, chromosomeIndices)); |
2 |
26 Feb 07 |
jari |
3287 |
float[][] fmData = new float[dataRegions.size()][getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3288 |
String[] annotations = new String[dataRegions.size()]; |
2 |
26 Feb 07 |
jari |
3289 |
for(int row = 0; row < fmData.length; row++){ |
2 |
26 Feb 07 |
jari |
3290 |
fmData[row] = ((AlterationRegion)dataRegions.get(row)).getAlteredExperimentValues(); |
2 |
26 Feb 07 |
jari |
3291 |
annotations[row] = ((AlterationRegion)dataRegions.get(row)).getName(); |
2 |
26 Feb 07 |
jari |
3292 |
} |
2 |
26 Feb 07 |
jari |
3293 |
FloatMatrix fm = new FloatMatrix(fmData); |
2 |
26 Feb 07 |
jari |
3294 |
CGHExperiment exp = new CGHExperiment(fm, createDefaultColumns(), annotations); |
2 |
26 Feb 07 |
jari |
3295 |
return exp; |
2 |
26 Feb 07 |
jari |
3296 |
} |
2 |
26 Feb 07 |
jari |
3297 |
/** |
2 |
26 Feb 07 |
jari |
* Helper for createDataRegionsExperiment(...) |
2 |
26 Feb 07 |
jari |
* @param flankingRegionType |
2 |
26 Feb 07 |
jari |
* @param chromosomeIndices |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3302 |
*/ |
2 |
26 Feb 07 |
jari |
3303 |
public Vector getDataRegionsValues(int flankingRegionType, int[] chromosomeIndices){ |
2 |
26 Feb 07 |
jari |
3304 |
Vector allAlterationRegions = new Vector(); |
2 |
26 Feb 07 |
jari |
//for(int chromIndex = 0; chromIndex < data.getNumChromosomes(); chromIndex++){ |
2 |
26 Feb 07 |
jari |
3306 |
for(int curChrom = 0; curChrom < chromosomeIndices.length; curChrom++){ |
2 |
26 Feb 07 |
jari |
3307 |
int chromIndex = chromosomeIndices[curChrom]; |
2 |
26 Feb 07 |
jari |
3308 |
AlterationRegions curAlterationRegions = new AlterationRegions(chromIndex); |
2 |
26 Feb 07 |
jari |
3309 |
Vector curFlankingRegions = new Vector(getFeaturesCount()); |
2 |
26 Feb 07 |
jari |
3310 |
Iterator featuresIt = getFeaturesList().iterator(); |
2 |
26 Feb 07 |
jari |
3311 |
while(featuresIt.hasNext()){ |
2 |
26 Feb 07 |
jari |
3312 |
Vector curFrs = ((ISlideData)featuresIt.next()).getFlankingRegions()[chromIndex]; |
2 |
26 Feb 07 |
jari |
3313 |
curFlankingRegions.add( curFrs.clone() ); |
2 |
26 Feb 07 |
jari |
3314 |
} |
2 |
26 Feb 07 |
jari |
3315 |
int[] indices = new int[getFeaturesCount()]; |
2 |
26 Feb 07 |
jari |
3316 |
for(int i = 0; i < getFeaturesCount(); i++){ |
2 |
26 Feb 07 |
jari |
3317 |
indices[i] = 0; |
2 |
26 Feb 07 |
jari |
3318 |
} |
2 |
26 Feb 07 |
jari |
3319 |
boolean more = true; |
2 |
26 Feb 07 |
jari |
3320 |
while(more){ |
2 |
26 Feb 07 |
jari |
3321 |
for(int i = 0; i < indices.length; i++){ |
2 |
26 Feb 07 |
jari |
3322 |
Vector expRegions = (Vector) curFlankingRegions.get(i); |
2 |
26 Feb 07 |
jari |
3323 |
while(indices[i] < expRegions.size() && ((FlankingRegion)expRegions.get(indices[i])).getType() != flankingRegionType ){ |
2 |
26 Feb 07 |
jari |
3324 |
indices[i] += 1; |
2 |
26 Feb 07 |
jari |
3325 |
} |
2 |
26 Feb 07 |
jari |
3326 |
} |
2 |
26 Feb 07 |
jari |
3327 |
int minStartIndex = getMinStartIndex(curFlankingRegions, indices); |
2 |
26 Feb 07 |
jari |
3328 |
int minEndIndex = getMinEndIndex(curFlankingRegions, indices, minStartIndex); |
2 |
26 Feb 07 |
jari |
3329 |
for(int i = 0; i < indices.length; i++){ |
2 |
26 Feb 07 |
jari |
3330 |
Vector expRegions = (Vector) curFlankingRegions.get(i); |
2 |
26 Feb 07 |
jari |
3331 |
if(indices[i] < expRegions.size()){ |
2 |
26 Feb 07 |
jari |
3332 |
FlankingRegion fr = (FlankingRegion) expRegions.get(indices[i]); |
2 |
26 Feb 07 |
jari |
3333 |
int start = fr.getStart(); |
2 |
26 Feb 07 |
jari |
3334 |
int stop = fr.getStop(); |
2 |
26 Feb 07 |
jari |
3335 |
if(start == minStartIndex){ |
2 |
26 Feb 07 |
jari |
3336 |
AlterationRegion curAlterationRegion = curAlterationRegions.getAlterationRegion(minStartIndex, minEndIndex, flankingRegionType, getFeaturesCount()); |
2 |
26 Feb 07 |
jari |
3337 |
curAlterationRegion.incrementAlterations(); |
2 |
26 Feb 07 |
jari |
3338 |
if(flankingRegionType == FlankingRegion.AMPLIFICATION){ |
2 |
26 Feb 07 |
jari |
3339 |
curAlterationRegion.getAlteredExperimentValues()[i] = 1; |
2 |
26 Feb 07 |
jari |
3340 |
}else{ |
2 |
26 Feb 07 |
jari |
3341 |
curAlterationRegion.getAlteredExperimentValues()[i] = -1; |
2 |
26 Feb 07 |
jari |
3342 |
} |
2 |
26 Feb 07 |
jari |
3343 |
if(stop == minEndIndex){ |
2 |
26 Feb 07 |
jari |
3344 |
indices[i] += 1; |
2 |
26 Feb 07 |
jari |
3345 |
}else{ |
2 |
26 Feb 07 |
jari |
3346 |
FlankingRegion tmp = new FlankingRegion(minEndIndex, fr.getStop(), |
2 |
26 Feb 07 |
jari |
3347 |
flankingRegionType, chromIndex); |
2 |
26 Feb 07 |
jari |
3348 |
expRegions.set(indices[i], tmp); |
2 |
26 Feb 07 |
jari |
3349 |
} |
2 |
26 Feb 07 |
jari |
3350 |
} |
2 |
26 Feb 07 |
jari |
3351 |
} |
2 |
26 Feb 07 |
jari |
3352 |
} |
2 |
26 Feb 07 |
jari |
3353 |
more = false; |
2 |
26 Feb 07 |
jari |
3354 |
for(int i = 0; i < indices.length; i++){ |
2 |
26 Feb 07 |
jari |
3355 |
Vector expRegions = (Vector) curFlankingRegions.get(i); |
2 |
26 Feb 07 |
jari |
3356 |
if(indices[i] < expRegions.size()){ |
2 |
26 Feb 07 |
jari |
3357 |
more = true; |
2 |
26 Feb 07 |
jari |
3358 |
} |
2 |
26 Feb 07 |
jari |
3359 |
} |
2 |
26 Feb 07 |
jari |
3360 |
} |
2 |
26 Feb 07 |
jari |
3361 |
allAlterationRegions.addAll(curAlterationRegions.getAlterationRegions()); |
2 |
26 Feb 07 |
jari |
3362 |
} |
2 |
26 Feb 07 |
jari |
3363 |
java.util.Collections.sort(allAlterationRegions, new AlterationRegionsComparator()); |
2 |
26 Feb 07 |
jari |
3364 |
return allAlterationRegions; |
2 |
26 Feb 07 |
jari |
3365 |
} |
2 |
26 Feb 07 |
jari |
3366 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Helper for getDataRegionsValues |
2 |
26 Feb 07 |
jari |
* @param flankingRegions |
2 |
26 Feb 07 |
jari |
* @param indices |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3372 |
*/ |
2 |
26 Feb 07 |
jari |
3373 |
private int getMinStartIndex(Vector flankingRegions, int[] indices){ |
2 |
26 Feb 07 |
jari |
3374 |
int min = Integer.MAX_VALUE; |
2 |
26 Feb 07 |
jari |
3375 |
for(int i = 0; i < indices.length; i++){ |
2 |
26 Feb 07 |
jari |
3376 |
Vector expRegions = (Vector) flankingRegions.get(i); |
2 |
26 Feb 07 |
jari |
3377 |
if(indices[i] < expRegions.size()){ |
2 |
26 Feb 07 |
jari |
3378 |
min = Math.min(min, ((FlankingRegion) expRegions.get(indices[i])).getStart()); |
2 |
26 Feb 07 |
jari |
3379 |
} |
2 |
26 Feb 07 |
jari |
3380 |
} |
2 |
26 Feb 07 |
jari |
3381 |
return min; |
2 |
26 Feb 07 |
jari |
3382 |
} |
2 |
26 Feb 07 |
jari |
3383 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Helper for getDataRegionsValues |
2 |
26 Feb 07 |
jari |
* @param flankingRegions |
2 |
26 Feb 07 |
jari |
* @param indices |
2 |
26 Feb 07 |
jari |
* @param minStartIndex |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3390 |
*/ |
2 |
26 Feb 07 |
jari |
3391 |
private int getMinEndIndex(Vector flankingRegions, int[] indices, int minStartIndex) { |
2 |
26 Feb 07 |
jari |
3392 |
int min = Integer.MAX_VALUE; |
2 |
26 Feb 07 |
jari |
3393 |
for(int i = 0; i < indices.length; i++){ |
2 |
26 Feb 07 |
jari |
3394 |
Vector expRegions = (Vector) flankingRegions.get(i); |
2 |
26 Feb 07 |
jari |
3395 |
if(indices[i] < expRegions.size()){ |
2 |
26 Feb 07 |
jari |
3396 |
int start = ((FlankingRegion) expRegions.get(indices[i])).getStart(); |
2 |
26 Feb 07 |
jari |
3397 |
if(start == minStartIndex){ |
2 |
26 Feb 07 |
jari |
3398 |
start = ((FlankingRegion) expRegions.get(indices[i])).getStop(); |
2 |
26 Feb 07 |
jari |
3399 |
} |
2 |
26 Feb 07 |
jari |
3400 |
min = Math.min(min, start); |
2 |
26 Feb 07 |
jari |
3401 |
} |
2 |
26 Feb 07 |
jari |
3402 |
} |
2 |
26 Feb 07 |
jari |
3403 |
return min; |
2 |
26 Feb 07 |
jari |
3404 |
} |
2 |
26 Feb 07 |
jari |
3405 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Getter for property clones. |
2 |
26 Feb 07 |
jari |
* @return Value of property clones. |
2 |
26 Feb 07 |
jari |
3408 |
*/ |
2 |
26 Feb 07 |
jari |
3409 |
public java.util.ArrayList getClones() { |
2 |
26 Feb 07 |
jari |
3410 |
return clones; |
2 |
26 Feb 07 |
jari |
3411 |
} |
2 |
26 Feb 07 |
jari |
3412 |
/** |
2 |
26 Feb 07 |
jari |
* CGH Setter for property clones. |
2 |
26 Feb 07 |
jari |
* @param clones New value of property clones. |
2 |
26 Feb 07 |
jari |
3415 |
*/ |
2 |
26 Feb 07 |
jari |
3416 |
public void setClones(java.util.ArrayList clones) { |
2 |
26 Feb 07 |
jari |
3417 |
this.clones = clones; |
2 |
26 Feb 07 |
jari |
3418 |
} |
2 |
26 Feb 07 |
jari |
3419 |
/** |
2 |
26 Feb 07 |
jari |
* CGH |
2 |
26 Feb 07 |
jari |
* Getter for property annotations. |
2 |
26 Feb 07 |
jari |
* @return Value of property annotations. |
2 |
26 Feb 07 |
jari |
3423 |
*/ |
2 |
26 Feb 07 |
jari |
3424 |
public ICGHDataRegion[][] getAnnotations() { |
2 |
26 Feb 07 |
jari |
3425 |
return this.annotations; |
2 |
26 Feb 07 |
jari |
3426 |
} |
2 |
26 Feb 07 |
jari |
3427 |
/** |
2 |
26 Feb 07 |
jari |
* CGH |
2 |
26 Feb 07 |
jari |
* Setter for property annotations. |
2 |
26 Feb 07 |
jari |
* @param annotations New value of property annotations. |
2 |
26 Feb 07 |
jari |
3431 |
*/ |
2 |
26 Feb 07 |
jari |
3432 |
public void setAnnotations(ICGHDataRegion[][] annotations) { |
2 |
26 Feb 07 |
jari |
3433 |
this.annotations = annotations; |
2 |
26 Feb 07 |
jari |
3434 |
} |
2 |
26 Feb 07 |
jari |
3435 |
/** |
2 |
26 Feb 07 |
jari |
* CGH |
2 |
26 Feb 07 |
jari |
* Getter for data swap status. |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3439 |
*/ |
2 |
26 Feb 07 |
jari |
3440 |
public boolean isHasDyeSwap() { |
2 |
26 Feb 07 |
jari |
3441 |
return this.hasDyeSwap; |
2 |
26 Feb 07 |
jari |
3442 |
} |
2 |
26 Feb 07 |
jari |
3443 |
/** |
2 |
26 Feb 07 |
jari |
* CGH |
2 |
26 Feb 07 |
jari |
* Setter for property hasDyeSwap. |
2 |
26 Feb 07 |
jari |
* @param hasDyeSwap New value of property hasDyeSwap. |
2 |
26 Feb 07 |
jari |
3447 |
*/ |
2 |
26 Feb 07 |
jari |
3448 |
public void setHasDyeSwap(boolean hasDyeSwap) { |
2 |
26 Feb 07 |
jari |
3449 |
this.hasDyeSwap = hasDyeSwap; |
2 |
26 Feb 07 |
jari |
3450 |
if(hasDyeSwap){ |
2 |
26 Feb 07 |
jari |
3451 |
copyNumberCalculator = new CGHCopyNumberCalculator(this); |
2 |
26 Feb 07 |
jari |
3452 |
}else{ |
2 |
26 Feb 07 |
jari |
3453 |
copyNumberCalculator = new CGHCopyNumberCalculatorNoDyeSwap(this); |
2 |
26 Feb 07 |
jari |
3454 |
} |
2 |
26 Feb 07 |
jari |
3455 |
} |
2 |
26 Feb 07 |
jari |
3456 |
/** |
2 |
26 Feb 07 |
jari |
* Data is set to CGH Type |
2 |
26 Feb 07 |
jari |
3458 |
*/ |
2 |
26 Feb 07 |
jari |
3459 |
public void setCGHData(){ |
2 |
26 Feb 07 |
jari |
3460 |
CGHData = true; |
2 |
26 Feb 07 |
jari |
3461 |
} |
2 |
26 Feb 07 |
jari |
3462 |
/** |
2 |
26 Feb 07 |
jari |
* Return true if data is CGH type |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3465 |
*/ |
2 |
26 Feb 07 |
jari |
3466 |
public boolean isCGHData() { |
2 |
26 Feb 07 |
jari |
3467 |
return CGHData; |
2 |
26 Feb 07 |
jari |
3468 |
} |
2 |
26 Feb 07 |
jari |
3469 |
/** |
2 |
26 Feb 07 |
jari |
* Data is set to CGH Type |
2 |
26 Feb 07 |
jari |
3471 |
*/ |
2 |
26 Feb 07 |
jari |
3472 |
public void setLog2Data(boolean isLog2){ |
2 |
26 Feb 07 |
jari |
3473 |
log2Data = isLog2; |
2 |
26 Feb 07 |
jari |
3474 |
} |
2 |
26 Feb 07 |
jari |
3475 |
/** |
2 |
26 Feb 07 |
jari |
* Return true if data is CGH type |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3478 |
*/ |
2 |
26 Feb 07 |
jari |
3479 |
public boolean isLog2Data() { |
2 |
26 Feb 07 |
jari |
3480 |
return log2Data; |
2 |
26 Feb 07 |
jari |
3481 |
} |
2 |
26 Feb 07 |
jari |
3482 |
/** |
2 |
26 Feb 07 |
jari |
* Setter for CGH Data. Species type. |
2 |
26 Feb 07 |
jari |
* @param species |
2 |
26 Feb 07 |
jari |
3485 |
*/ |
2 |
26 Feb 07 |
jari |
3486 |
public void setCGHSpecies(int species){ |
2 |
26 Feb 07 |
jari |
3487 |
if (species == TMEV.CGH_SPECIES_HS){ |
2 |
26 Feb 07 |
jari |
3488 |
CGH_SPECIES = TMEV.CGH_SPECIES_HS; |
2 |
26 Feb 07 |
jari |
3489 |
} else if (species == TMEV.CGH_SPECIES_MM){ |
2 |
26 Feb 07 |
jari |
3490 |
CGH_SPECIES = TMEV.CGH_SPECIES_MM; |
2 |
26 Feb 07 |
jari |
3491 |
} else { |
2 |
26 Feb 07 |
jari |
3492 |
CGH_SPECIES = TMEV.CGH_SPECIES_Undef; |
2 |
26 Feb 07 |
jari |
3493 |
} |
2 |
26 Feb 07 |
jari |
3494 |
} |
2 |
26 Feb 07 |
jari |
3495 |
/** |
2 |
26 Feb 07 |
jari |
* Return CGH data Species |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3498 |
*/ |
2 |
26 Feb 07 |
jari |
3499 |
public int getCGHSpecies(){ |
2 |
26 Feb 07 |
jari |
3500 |
return CGH_SPECIES; |
2 |
26 Feb 07 |
jari |
3501 |
} |
2 |
26 Feb 07 |
jari |
3502 |
public void setHasCloneDistribution(boolean cloneDistribution) { |
2 |
26 Feb 07 |
jari |
3503 |
hasCloneDistribution = cloneDistribution; |
2 |
26 Feb 07 |
jari |
3504 |
} |
2 |
26 Feb 07 |
jari |
3505 |
public boolean hasCloneDistribution() { |
2 |
26 Feb 07 |
jari |
3506 |
return hasCloneDistribution; |
2 |
26 Feb 07 |
jari |
3507 |
} |
2 |
26 Feb 07 |
jari |
3508 |
/******************************************************************************* |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* End CGH Functions |
2 |
26 Feb 07 |
jari |
3511 |
******************************************************************************/ |
2 |
26 Feb 07 |
jari |
3512 |
|
2 |
26 Feb 07 |
jari |
//EH state-saving |
2 |
26 Feb 07 |
jari |
3514 |
public String getCurrentSampleLabelKey() { |
2 |
26 Feb 07 |
jari |
3515 |
return ((ISlideData)featuresList.get(0)).getSlideDataName(); |
2 |
26 Feb 07 |
jari |
3516 |
} |
2 |
26 Feb 07 |
jari |
3517 |
public static PersistenceDelegate getPersistenceDelegate() { |
2 |
26 Feb 07 |
jari |
3518 |
return new MultipleArrayDataPersistenceDelegate(); |
2 |
26 Feb 07 |
jari |
3519 |
} |
2 |
26 Feb 07 |
jari |
3520 |
public ClusterRepository getExperimentClusterRepository() { |
2 |
26 Feb 07 |
jari |
3521 |
return expClusterRepository; |
2 |
26 Feb 07 |
jari |
3522 |
} |
2 |
26 Feb 07 |
jari |
3523 |
public ClusterRepository getGeneClusterRepository() { |
2 |
26 Feb 07 |
jari |
3524 |
return geneClusterRepository; |
2 |
26 Feb 07 |
jari |
3525 |
} |
2 |
26 Feb 07 |
jari |
3526 |
public MultipleArrayData(boolean useMainData) { |
2 |
26 Feb 07 |
jari |
3527 |
this.useMainData = useMainData; |
2 |
26 Feb 07 |
jari |
3528 |
} |
2 |
26 Feb 07 |
jari |
3529 |
public Experiment getAltExperiment() { |
2 |
26 Feb 07 |
jari |
3530 |
return alternateExperiment; |
2 |
26 Feb 07 |
jari |
3531 |
} |
2 |
26 Feb 07 |
jari |
3532 |
|
2 |
26 Feb 07 |
jari |
3533 |
public ArrayList getExperimentColorsSaved(){return experimentColors;} |
2 |
26 Feb 07 |
jari |
//EH end state-saving |
2 |
26 Feb 07 |
jari |
3535 |
/** |
2 |
26 Feb 07 |
jari |
* @return Returns the maxCy3. |
2 |
26 Feb 07 |
jari |
3537 |
*/ |
2 |
26 Feb 07 |
jari |
3538 |
public float getMaxCy3() { |
2 |
26 Feb 07 |
jari |
3539 |
return maxCy3; |
2 |
26 Feb 07 |
jari |
3540 |
} |
2 |
26 Feb 07 |
jari |
3541 |
/** |
2 |
26 Feb 07 |
jari |
* @param maxCy3 The maxCy3 to set. |
2 |
26 Feb 07 |
jari |
3543 |
*/ |
2 |
26 Feb 07 |
jari |
3544 |
public void setMaxCy3(float maxCy3) { |
2 |
26 Feb 07 |
jari |
3545 |
this.maxCy3 = maxCy3; |
2 |
26 Feb 07 |
jari |
3546 |
} |
2 |
26 Feb 07 |
jari |
3547 |
/** |
2 |
26 Feb 07 |
jari |
* @return Returns the maxCy5. |
2 |
26 Feb 07 |
jari |
3549 |
*/ |
2 |
26 Feb 07 |
jari |
3550 |
public float getMaxCy5() { |
2 |
26 Feb 07 |
jari |
3551 |
return maxCy5; |
2 |
26 Feb 07 |
jari |
3552 |
} |
2 |
26 Feb 07 |
jari |
3553 |
/** |
2 |
26 Feb 07 |
jari |
* @param maxCy5 The maxCy5 to set. |
2 |
26 Feb 07 |
jari |
3555 |
*/ |
2 |
26 Feb 07 |
jari |
3556 |
public void setMaxCy5(float maxCy5) { |
2 |
26 Feb 07 |
jari |
3557 |
this.maxCy5 = maxCy5; |
2 |
26 Feb 07 |
jari |
3558 |
} |
2 |
26 Feb 07 |
jari |
3559 |
|
2 |
26 Feb 07 |
jari |
3560 |
|
2 |
26 Feb 07 |
jari |
3561 |
} |