7 |
24 Aug 07 |
jari |
// $Id$ |
7 |
24 Aug 07 |
jari |
2 |
|
2 |
26 Feb 07 |
jari |
3 |
/* |
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 |
6 |
*/ |
2 |
26 Feb 07 |
jari |
7 |
/* |
2 |
26 Feb 07 |
jari |
* $RCSfile: MultipleArrayViewer.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.48 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/08/22 18:12:08 $ |
2 |
26 Feb 07 |
jari |
* $Author: eleanorahowe $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
13 |
*/ |
2 |
26 Feb 07 |
jari |
14 |
package org.tigr.microarray.mev; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.BorderLayout; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.Component; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.Cursor; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
20 |
import java.awt.Frame; |
2 |
26 Feb 07 |
jari |
21 |
import java.awt.Graphics; |
2 |
26 Feb 07 |
jari |
22 |
import java.awt.Graphics2D; |
2 |
26 Feb 07 |
jari |
23 |
import java.awt.GridBagConstraints; |
2 |
26 Feb 07 |
jari |
24 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
25 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
26 |
|
2 |
26 Feb 07 |
jari |
27 |
|
2 |
26 Feb 07 |
jari |
28 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
29 |
import java.awt.Point; |
2 |
26 Feb 07 |
jari |
30 |
import java.awt.Rectangle; |
2 |
26 Feb 07 |
jari |
31 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
32 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
33 |
import java.awt.event.KeyEvent; |
2 |
26 Feb 07 |
jari |
34 |
import java.awt.event.KeyListener; |
2 |
26 Feb 07 |
jari |
35 |
import java.awt.event.MouseAdapter; |
2 |
26 Feb 07 |
jari |
36 |
import java.awt.event.MouseEvent; |
2 |
26 Feb 07 |
jari |
37 |
import java.awt.event.WindowEvent; |
2 |
26 Feb 07 |
jari |
38 |
import java.awt.event.WindowListener; |
2 |
26 Feb 07 |
jari |
39 |
import java.awt.geom.AffineTransform; |
2 |
26 Feb 07 |
jari |
40 |
import java.awt.image.BufferedImage; |
2 |
26 Feb 07 |
jari |
41 |
import java.awt.print.PageFormat; |
2 |
26 Feb 07 |
jari |
42 |
import java.awt.print.Printable; |
2 |
26 Feb 07 |
jari |
43 |
import java.awt.print.PrinterException; |
2 |
26 Feb 07 |
jari |
44 |
import java.awt.print.PrinterJob; |
2 |
26 Feb 07 |
jari |
45 |
import java.io.DataInputStream; |
2 |
26 Feb 07 |
jari |
46 |
import java.io.File; |
2 |
26 Feb 07 |
jari |
47 |
import java.io.FileInputStream; |
2 |
26 Feb 07 |
jari |
48 |
import java.io.FileOutputStream; |
2 |
26 Feb 07 |
jari |
49 |
import java.io.*; |
2 |
26 Feb 07 |
jari |
50 |
import java.text.DateFormat; |
2 |
26 Feb 07 |
jari |
51 |
import java.text.DecimalFormat; |
2 |
26 Feb 07 |
jari |
52 |
import java.util.ArrayList; |
2 |
26 Feb 07 |
jari |
53 |
import java.util.Date; |
2 |
26 Feb 07 |
jari |
54 |
import java.util.Enumeration; |
2 |
26 Feb 07 |
jari |
55 |
import java.util.EventObject; |
2 |
26 Feb 07 |
jari |
56 |
import java.util.Hashtable; |
2 |
26 Feb 07 |
jari |
57 |
import java.util.Iterator; |
2 |
26 Feb 07 |
jari |
58 |
import java.util.Properties; |
2 |
26 Feb 07 |
jari |
59 |
import java.util.StringTokenizer; |
2 |
26 Feb 07 |
jari |
60 |
import java.util.TimeZone; |
2 |
26 Feb 07 |
jari |
61 |
import java.util.Vector; |
2 |
26 Feb 07 |
jari |
62 |
|
2 |
26 Feb 07 |
jari |
63 |
import javax.media.jai.JAI; |
2 |
26 Feb 07 |
jari |
64 |
import javax.swing.AbstractButton; |
2 |
26 Feb 07 |
jari |
65 |
import javax.swing.Action; |
2 |
26 Feb 07 |
jari |
66 |
import javax.swing.BorderFactory; |
2 |
26 Feb 07 |
jari |
67 |
import javax.swing.JCheckBoxMenuItem; |
2 |
26 Feb 07 |
jari |
68 |
import javax.swing.JComponent; |
2 |
26 Feb 07 |
jari |
69 |
import javax.swing.JDialog; |
2 |
26 Feb 07 |
jari |
70 |
import javax.swing.JFileChooser; |
2 |
26 Feb 07 |
jari |
71 |
import javax.swing.JFrame; |
2 |
26 Feb 07 |
jari |
72 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
73 |
import javax.swing.JMenuBar; |
2 |
26 Feb 07 |
jari |
74 |
import javax.swing.JMenuItem; |
2 |
26 Feb 07 |
jari |
75 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
76 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
77 |
import javax.swing.JPopupMenu; |
2 |
26 Feb 07 |
jari |
78 |
import javax.swing.JScrollBar; |
2 |
26 Feb 07 |
jari |
79 |
import javax.swing.JScrollPane; |
2 |
26 Feb 07 |
jari |
80 |
import javax.swing.JSplitPane; |
2 |
26 Feb 07 |
jari |
81 |
import javax.swing.JTree; |
2 |
26 Feb 07 |
jari |
82 |
import javax.swing.JViewport; |
2 |
26 Feb 07 |
jari |
83 |
import javax.swing.KeyStroke; |
2 |
26 Feb 07 |
jari |
84 |
import javax.swing.ToolTipManager; |
2 |
26 Feb 07 |
jari |
85 |
import javax.swing.event.TreeSelectionEvent; |
2 |
26 Feb 07 |
jari |
86 |
import javax.swing.event.TreeSelectionListener; |
2 |
26 Feb 07 |
jari |
87 |
import javax.swing.tree.DefaultMutableTreeNode; |
2 |
26 Feb 07 |
jari |
88 |
import javax.swing.tree.DefaultTreeModel; |
2 |
26 Feb 07 |
jari |
89 |
import javax.swing.tree.TreeNode; |
2 |
26 Feb 07 |
jari |
90 |
import javax.swing.tree.TreePath; |
2 |
26 Feb 07 |
jari |
91 |
import javax.swing.tree.TreeSelectionModel; |
2 |
26 Feb 07 |
jari |
92 |
|
2 |
26 Feb 07 |
jari |
93 |
import org.tigr.microarray.file.AnnFileParser; |
2 |
26 Feb 07 |
jari |
94 |
import org.tigr.microarray.mev.action.ActionManager; |
2 |
26 Feb 07 |
jari |
95 |
import org.tigr.microarray.mev.cgh.CGHAlgorithms.CGHAlgorithmFactory; |
2 |
26 Feb 07 |
jari |
96 |
import org.tigr.microarray.mev.cgh.CGHAlgorithms.AlterationsComparator.CompareExperiments; |
2 |
26 Feb 07 |
jari |
97 |
import org.tigr.microarray.mev.cgh.CGHAlgorithms.NumberOfAlterations.NumberOfAlterationsCalculator; |
2 |
26 Feb 07 |
jari |
98 |
import org.tigr.microarray.mev.cgh.CGHAlgorithms.NumberOfAlterations.GeneAlterations.LoadGeneList; |
2 |
26 Feb 07 |
jari |
99 |
import org.tigr.microarray.mev.cgh.CGHAlgorithms.NumberOfAlterations.GeneAlterations.GeneAmplifications; |
2 |
26 Feb 07 |
jari |
100 |
import org.tigr.microarray.mev.cgh.CGHAlgorithms.NumberOfAlterations.GeneAlterations.GeneDeletions; |
2 |
26 Feb 07 |
jari |
101 |
import org.tigr.microarray.mev.cgh.CGHDataGenerator.FlankingRegionCalculator; |
2 |
26 Feb 07 |
jari |
102 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHAnnotationsModel; |
2 |
26 Feb 07 |
jari |
103 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHChartDataModel; |
2 |
26 Feb 07 |
jari |
104 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHChartDataModelDyeSwap; |
2 |
26 Feb 07 |
jari |
105 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHChartDataModelNoDyeSwap; |
2 |
26 Feb 07 |
jari |
106 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHCircleViewerModel; |
2 |
26 Feb 07 |
jari |
107 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHPositionGraphDataModel; |
2 |
26 Feb 07 |
jari |
108 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHTableDataModel; |
2 |
26 Feb 07 |
jari |
109 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHTableDataModelDyeSwap; |
2 |
26 Feb 07 |
jari |
110 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CGHTableDataModelNoDyeSwap; |
2 |
26 Feb 07 |
jari |
111 |
import org.tigr.microarray.mev.cgh.CGHDataModel.CytoBandsModel; |
2 |
26 Feb 07 |
jari |
112 |
import org.tigr.microarray.mev.cgh.CGHDataObj.AlterationRegion; |
2 |
26 Feb 07 |
jari |
113 |
import org.tigr.microarray.mev.cgh.CGHDataObj.CGHDataRegionInfo; |
2 |
26 Feb 07 |
jari |
114 |
import org.tigr.microarray.mev.cgh.CGHDataObj.CytoBands; |
2 |
26 Feb 07 |
jari |
115 |
import org.tigr.microarray.mev.cgh.CGHDataObj.DataRegionGeneData; |
2 |
26 Feb 07 |
jari |
116 |
import org.tigr.microarray.mev.cgh.CGHDataObj.GeneDataSet; |
2 |
26 Feb 07 |
jari |
117 |
import org.tigr.microarray.mev.cgh.CGHDataObj.ICGHDataRegion; |
2 |
26 Feb 07 |
jari |
118 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.CGHDataValuesDisplay; |
2 |
26 Feb 07 |
jari |
119 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.CGHDisplayOrderChanger; |
2 |
26 Feb 07 |
jari |
120 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.CGHThresholdSetter; |
2 |
26 Feb 07 |
jari |
121 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.AlgorithmResultsViewers.NumberOfAlterationsViewers.NumberOfAlterationsViewer; |
2 |
26 Feb 07 |
jari |
122 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.AlgorithmResultsViewers.NumberOfAlterationsViewers.NumberOfDeletionsAmpilficationsDataModel; |
2 |
26 Feb 07 |
jari |
123 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.CGHBrowser.CGHBrowser; |
2 |
26 Feb 07 |
jari |
124 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.CGHCircleViewer.CGHCircleViewerPanel; |
2 |
26 Feb 07 |
jari |
125 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.CGHPositionGraph.CGHPositionGraphCombinedHeader; |
2 |
26 Feb 07 |
jari |
126 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.CGHPositionGraph.CGHPositionGraphViewer; |
2 |
26 Feb 07 |
jari |
127 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.GuiUtil.GuiUtil; |
2 |
26 Feb 07 |
jari |
128 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.GuiUtil.SingleValueSelectorDialog; |
2 |
26 Feb 07 |
jari |
129 |
import org.tigr.microarray.mev.cgh.CGHListenerObj.ICGHListener; |
2 |
26 Feb 07 |
jari |
130 |
import org.tigr.microarray.mev.cgh.CGHListenerObj.IDataRegionSelectionListener; |
2 |
26 Feb 07 |
jari |
131 |
import org.tigr.microarray.mev.cgh.CGHUtil.CGHUtility; |
2 |
26 Feb 07 |
jari |
132 |
import org.tigr.microarray.mev.cluster.algorithm.AbortException; |
2 |
26 Feb 07 |
jari |
133 |
import org.tigr.microarray.mev.cluster.algorithm.Algorithm; |
2 |
26 Feb 07 |
jari |
134 |
import org.tigr.microarray.mev.cluster.algorithm.AlgorithmData; |
2 |
26 Feb 07 |
jari |
135 |
import org.tigr.microarray.mev.cluster.algorithm.AlgorithmFactory; |
2 |
26 Feb 07 |
jari |
136 |
import org.tigr.microarray.mev.cluster.algorithm.AlgorithmParameters; |
2 |
26 Feb 07 |
jari |
137 |
import org.tigr.microarray.mev.cluster.clusterUtil.Cluster; |
2 |
26 Feb 07 |
jari |
138 |
import org.tigr.microarray.mev.cluster.clusterUtil.ClusterAttributesDialog; |
2 |
26 Feb 07 |
jari |
139 |
import org.tigr.microarray.mev.cluster.clusterUtil.ClusterRepository; |
2 |
26 Feb 07 |
jari |
140 |
import org.tigr.microarray.mev.cluster.clusterUtil.ClusterTable; |
2 |
26 Feb 07 |
jari |
141 |
import org.tigr.microarray.mev.cluster.gui.Experiment; |
2 |
26 Feb 07 |
jari |
142 |
import org.tigr.microarray.mev.cluster.gui.ICGHCloneValueMenu; |
2 |
26 Feb 07 |
jari |
143 |
import org.tigr.microarray.mev.cluster.gui.ICGHDisplayMenu; |
2 |
26 Feb 07 |
jari |
144 |
import org.tigr.microarray.mev.cluster.gui.ICGHViewer; |
2 |
26 Feb 07 |
jari |
145 |
import org.tigr.microarray.mev.cluster.gui.IClusterGUI; |
2 |
26 Feb 07 |
jari |
146 |
import org.tigr.microarray.mev.cluster.gui.IData; |
2 |
26 Feb 07 |
jari |
147 |
import org.tigr.microarray.mev.cluster.gui.IDisplayMenu; |
2 |
26 Feb 07 |
jari |
148 |
import org.tigr.microarray.mev.cluster.gui.IDistanceMenu; |
2 |
26 Feb 07 |
jari |
149 |
import org.tigr.microarray.mev.cluster.gui.IFramework; |
2 |
26 Feb 07 |
jari |
150 |
import org.tigr.microarray.mev.cluster.gui.IViewer; |
2 |
26 Feb 07 |
jari |
151 |
import org.tigr.microarray.mev.cluster.gui.LeafInfo; |
2 |
26 Feb 07 |
jari |
152 |
import org.tigr.microarray.mev.cluster.gui.helpers.CentroidUserObject; |
2 |
26 Feb 07 |
jari |
153 |
import org.tigr.microarray.mev.cluster.gui.helpers.ExperimentUtil; |
2 |
26 Feb 07 |
jari |
154 |
import org.tigr.microarray.mev.cluster.gui.helpers.ExperimentViewer; |
2 |
26 Feb 07 |
jari |
155 |
import org.tigr.microarray.mev.cluster.gui.helpers.TextViewer; |
2 |
26 Feb 07 |
jari |
156 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.HTMLMessageFileChooser; |
2 |
26 Feb 07 |
jari |
157 |
import org.tigr.microarray.mev.file.AnnFileFilter; |
2 |
26 Feb 07 |
jari |
158 |
import org.tigr.microarray.mev.file.CGHStanfordFileLoader; |
2 |
26 Feb 07 |
jari |
159 |
import org.tigr.microarray.mev.GenePixCutoffDialog; |
2 |
26 Feb 07 |
jari |
160 |
|
2 |
26 Feb 07 |
jari |
161 |
import org.tigr.microarray.mev.file.SuperExpressionFileLoader; |
2 |
26 Feb 07 |
jari |
162 |
import org.tigr.microarray.mev.r.Rama; |
2 |
26 Feb 07 |
jari |
163 |
import org.tigr.microarray.mev.script.ScriptManager; |
2 |
26 Feb 07 |
jari |
164 |
import org.tigr.microarray.util.awt.ColorSchemeSelectionDialog; |
2 |
26 Feb 07 |
jari |
165 |
import org.tigr.microarray.util.awt.SetElementSizeDialog; |
2 |
26 Feb 07 |
jari |
166 |
import org.tigr.microarray.util.awt.SetSlideFilenameDialog; |
2 |
26 Feb 07 |
jari |
167 |
import org.tigr.util.BrowserLauncher; |
2 |
26 Feb 07 |
jari |
168 |
import org.tigr.util.FloatMatrix; |
2 |
26 Feb 07 |
jari |
169 |
import org.tigr.util.QSort; |
2 |
26 Feb 07 |
jari |
170 |
import org.tigr.util.swing.BMPFileFilter; |
2 |
26 Feb 07 |
jari |
171 |
import org.tigr.util.swing.ImageFileFilter; |
2 |
26 Feb 07 |
jari |
172 |
import org.tigr.util.swing.JPGFileFilter; |
2 |
26 Feb 07 |
jari |
173 |
import org.tigr.util.swing.PNGFileFilter; |
2 |
26 Feb 07 |
jari |
174 |
import org.tigr.util.swing.TIFFFileFilter; |
2 |
26 Feb 07 |
jari |
175 |
|
2 |
26 Feb 07 |
jari |
//EH |
2 |
26 Feb 07 |
jari |
177 |
import java.beans.*; |
2 |
26 Feb 07 |
jari |
178 |
import java.util.zip.ZipEntry; |
2 |
26 Feb 07 |
jari |
179 |
import java.util.zip.ZipFile; |
2 |
26 Feb 07 |
jari |
180 |
import java.util.zip.ZipInputStream; |
2 |
26 Feb 07 |
jari |
181 |
import java.util.zip.ZipOutputStream; |
2 |
26 Feb 07 |
jari |
182 |
import org.tigr.microarray.mev.persistence.*; |
2 |
26 Feb 07 |
jari |
183 |
|
2 |
26 Feb 07 |
jari |
184 |
import com.sun.media.jai.codec.ImageEncodeParam; |
2 |
26 Feb 07 |
jari |
185 |
|
2 |
26 Feb 07 |
jari |
186 |
public class MultipleArrayViewer extends ArrayViewer implements Printable { |
2 |
26 Feb 07 |
jari |
187 |
|
2 |
26 Feb 07 |
jari |
188 |
private MultipleArrayMenubar menubar; |
2 |
26 Feb 07 |
jari |
189 |
private MultipleArrayToolbar toolbar; |
2 |
26 Feb 07 |
jari |
190 |
private JSplitPane splitPane; |
2 |
26 Feb 07 |
jari |
191 |
private JScrollPane viewScrollPane; |
2 |
26 Feb 07 |
jari |
192 |
private JLabel statusLabel; |
2 |
26 Feb 07 |
jari |
// the tree and special nodes and scroll pane |
2 |
26 Feb 07 |
jari |
194 |
private JScrollPane treeScrollPane; |
2 |
26 Feb 07 |
jari |
195 |
private ResultTree tree; |
2 |
26 Feb 07 |
jari |
196 |
private DefaultMutableTreeNode mainViewerNode; |
2 |
26 Feb 07 |
jari |
197 |
private DefaultMutableTreeNode clusterNode; |
2 |
26 Feb 07 |
jari |
198 |
private DefaultMutableTreeNode analysisNode; |
2 |
26 Feb 07 |
jari |
199 |
private DefaultMutableTreeNode scriptNode; |
2 |
26 Feb 07 |
jari |
200 |
private DefaultMutableTreeNode historyNode; |
2 |
26 Feb 07 |
jari |
// current viewer |
2 |
26 Feb 07 |
jari |
202 |
private IViewer viewer; |
2 |
26 Feb 07 |
jari |
// callback reference |
2 |
26 Feb 07 |
jari |
204 |
private IFramework framework = new FrameworkImpl(); |
2 |
26 Feb 07 |
jari |
// features data |
2 |
26 Feb 07 |
jari |
206 |
private MultipleArrayData data = new MultipleArrayData(); |
2 |
26 Feb 07 |
jari |
207 |
private float sortedValues[]; |
2 |
26 Feb 07 |
jari |
//Action Manager |
2 |
26 Feb 07 |
jari |
209 |
private ActionManager manager; |
2 |
26 Feb 07 |
jari |
210 |
|
2 |
26 Feb 07 |
jari |
211 |
private int resultCount = 1; |
2 |
26 Feb 07 |
jari |
212 |
private boolean auto_scale=false; |
2 |
26 Feb 07 |
jari |
213 |
private ClusterRepository geneClusterRepository; |
2 |
26 Feb 07 |
jari |
214 |
private ClusterRepository experimentClusterRepository; |
2 |
26 Feb 07 |
jari |
215 |
private ClusterTable geneClusterManager; |
2 |
26 Feb 07 |
jari |
216 |
private ClusterTable experimentClusterManager; |
2 |
26 Feb 07 |
jari |
217 |
private ScriptManager scriptManager; |
2 |
26 Feb 07 |
jari |
218 |
private HistoryViewer historyLog; |
2 |
26 Feb 07 |
jari |
219 |
|
2 |
26 Feb 07 |
jari |
220 |
private File currentAnalysisFile; |
2 |
26 Feb 07 |
jari |
221 |
private boolean modifiedResult = false; |
2 |
26 Feb 07 |
jari |
/* Raktim, CGH Model for Cytoband */ |
2 |
26 Feb 07 |
jari |
223 |
private CytoBandsModel cytoBandsModel; |
2 |
26 Feb 07 |
jari |
//EH state-saving |
2 |
26 Feb 07 |
jari |
225 |
XMLDecoder ois; |
2 |
26 Feb 07 |
jari |
226 |
DataInputStream dis; |
2 |
26 Feb 07 |
jari |
227 |
boolean keepRunning; |
2 |
26 Feb 07 |
jari |
228 |
StateSavingProgressPanel progressPanel; |
2 |
26 Feb 07 |
jari |
229 |
SessionMetaData smd; |
2 |
26 Feb 07 |
jari |
230 |
|
2 |
26 Feb 07 |
jari |
231 |
public static String CURRENT_TEMP_DIR = "mev_temp"; |
2 |
26 Feb 07 |
jari |
232 |
|
2 |
26 Feb 07 |
jari |
233 |
/** |
2 |
26 Feb 07 |
jari |
* Construct a <code>MultipleArrayViewer</code> with default title, |
2 |
26 Feb 07 |
jari |
* creates menu and tool bars from new instance of action manager, |
2 |
26 Feb 07 |
jari |
* creates the navigation tree and the scroll pane to be used to display |
2 |
26 Feb 07 |
jari |
* a calculation result, creates a status bar. |
2 |
26 Feb 07 |
jari |
238 |
*/ |
2 |
26 Feb 07 |
jari |
239 |
public MultipleArrayViewer() { |
2 |
26 Feb 07 |
jari |
240 |
super(new JFrame("Multiple Array Viewer")); |
2 |
26 Feb 07 |
jari |
241 |
|
2 |
26 Feb 07 |
jari |
242 |
initSessionMetaData(); |
2 |
26 Feb 07 |
jari |
243 |
|
2 |
26 Feb 07 |
jari |
// listener |
2 |
26 Feb 07 |
jari |
245 |
EventListener eventListener = new EventListener(); |
2 |
26 Feb 07 |
jari |
246 |
mainframe.addWindowListener(eventListener); |
2 |
26 Feb 07 |
jari |
// manager = new ActionManager(eventListener, TMEV.getFieldNames(), TMEV.getGUIFactory()); |
2 |
26 Feb 07 |
jari |
//EH |
2 |
26 Feb 07 |
jari |
249 |
/* |
2 |
26 Feb 07 |
jari |
* 06/27/05 moved FieldNames out of TMEV, so replacing |
2 |
26 Feb 07 |
jari |
* the argument with empty string array |
2 |
26 Feb 07 |
jari |
* The actionmanager should be recreated by MultipleArrayData when data is loaded |
2 |
26 Feb 07 |
jari |
* Field names should be given to that new manager. |
2 |
26 Feb 07 |
jari |
* manager = new ActionManager(eventListener, TMEV.getFieldNames(), TMEV.getGUIFactory()); |
2 |
26 Feb 07 |
jari |
255 |
*/ |
2 |
26 Feb 07 |
jari |
256 |
manager = new ActionManager(eventListener, new String[0], TMEV.getGUIFactory()); |
2 |
26 Feb 07 |
jari |
257 |
|
2 |
26 Feb 07 |
jari |
258 |
menubar = new MultipleArrayMenubar(manager); |
2 |
26 Feb 07 |
jari |
259 |
|
2 |
26 Feb 07 |
jari |
260 |
mainframe.setJMenuBar(menubar); |
2 |
26 Feb 07 |
jari |
261 |
|
2 |
26 Feb 07 |
jari |
262 |
toolbar = new MultipleArrayToolbar(manager); |
2 |
26 Feb 07 |
jari |
263 |
mainframe.getContentPane().add(toolbar, BorderLayout.NORTH); |
2 |
26 Feb 07 |
jari |
264 |
|
2 |
26 Feb 07 |
jari |
265 |
viewScrollPane = createViewScrollPane(eventListener); |
2 |
26 Feb 07 |
jari |
266 |
viewScrollPane.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
267 |
|
2 |
26 Feb 07 |
jari |
268 |
treeScrollPane = createTreeScrollPane(eventListener); |
2 |
26 Feb 07 |
jari |
269 |
|
2 |
26 Feb 07 |
jari |
270 |
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, viewScrollPane); |
2 |
26 Feb 07 |
jari |
271 |
splitPane.setOneTouchExpandable(true); |
2 |
26 Feb 07 |
jari |
272 |
mainframe.getContentPane().add(splitPane, BorderLayout.CENTER); |
2 |
26 Feb 07 |
jari |
273 |
|
2 |
26 Feb 07 |
jari |
274 |
statusLabel = new JLabel("MultiExperiment Viewer"); |
2 |
26 Feb 07 |
jari |
275 |
mainframe.getContentPane().add(statusLabel, BorderLayout.SOUTH); |
2 |
26 Feb 07 |
jari |
276 |
mainframe.pack(); |
2 |
26 Feb 07 |
jari |
277 |
splitPane.setDividerLocation(150); |
2 |
26 Feb 07 |
jari |
278 |
|
2 |
26 Feb 07 |
jari |
279 |
systemDisable(TMEV.DB_AVAILABLE); |
2 |
26 Feb 07 |
jari |
280 |
systemDisable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
281 |
} |
2 |
26 Feb 07 |
jari |
282 |
|
2 |
26 Feb 07 |
jari |
283 |
|
2 |
26 Feb 07 |
jari |
284 |
/** |
2 |
26 Feb 07 |
jari |
* Construct a <code>MultipleArrayViewer</code> with default title, |
2 |
26 Feb 07 |
jari |
* creates menu and tool bars from new instance of action manager, |
2 |
26 Feb 07 |
jari |
* creates the navigation tree and the scroll pane to be used to display |
2 |
26 Feb 07 |
jari |
* a calculation result, creates a status bar. |
2 |
26 Feb 07 |
jari |
289 |
*/ |
2 |
26 Feb 07 |
jari |
290 |
public MultipleArrayViewer(MultipleArrayData arrayData) { |
2 |
26 Feb 07 |
jari |
291 |
super(new JFrame("Multiple Array Viewer")); |
2 |
26 Feb 07 |
jari |
//EH |
2 |
26 Feb 07 |
jari |
293 |
initSessionMetaData(); |
2 |
26 Feb 07 |
jari |
294 |
|
2 |
26 Feb 07 |
jari |
// listener |
2 |
26 Feb 07 |
jari |
296 |
EventListener eventListener = new EventListener(); |
2 |
26 Feb 07 |
jari |
297 |
mainframe.addWindowListener(eventListener); |
2 |
26 Feb 07 |
jari |
298 |
manager = new ActionManager(eventListener, arrayData.getFieldNames(), TMEV.getGUIFactory()); |
2 |
26 Feb 07 |
jari |
299 |
|
2 |
26 Feb 07 |
jari |
300 |
data = arrayData; |
2 |
26 Feb 07 |
jari |
301 |
|
2 |
26 Feb 07 |
jari |
302 |
menubar = new MultipleArrayMenubar(manager); |
2 |
26 Feb 07 |
jari |
303 |
|
2 |
26 Feb 07 |
jari |
//jcb 7/10/06 the Manager constructor takes care of adding field names |
2 |
26 Feb 07 |
jari |
//arrayData now has field names but don't add them again |
2 |
26 Feb 07 |
jari |
//menubar.addLabelMenuItems(arrayData.getFieldNames()); |
2 |
26 Feb 07 |
jari |
307 |
|
2 |
26 Feb 07 |
jari |
//menubar.addLabelMenuItems(arrayData.getFieldNames()); |
2 |
26 Feb 07 |
jari |
309 |
|
2 |
26 Feb 07 |
jari |
//need to populate the experiment label menu items |
2 |
26 Feb 07 |
jari |
311 |
menubar.addExperimentLabelMenuItems(arrayData.getSlideNameKeyVectorUnion()); |
2 |
26 Feb 07 |
jari |
312 |
|
2 |
26 Feb 07 |
jari |
313 |
mainframe.setJMenuBar(menubar); |
2 |
26 Feb 07 |
jari |
314 |
|
2 |
26 Feb 07 |
jari |
315 |
toolbar = new MultipleArrayToolbar(manager); |
2 |
26 Feb 07 |
jari |
316 |
mainframe.getContentPane().add(toolbar, BorderLayout.NORTH); |
2 |
26 Feb 07 |
jari |
317 |
|
2 |
26 Feb 07 |
jari |
318 |
viewScrollPane = createViewScrollPane(eventListener); |
2 |
26 Feb 07 |
jari |
319 |
viewScrollPane.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
320 |
|
2 |
26 Feb 07 |
jari |
321 |
treeScrollPane = createTreeScrollPane(eventListener); |
2 |
26 Feb 07 |
jari |
322 |
|
2 |
26 Feb 07 |
jari |
//have the main scroll pane |
2 |
26 Feb 07 |
jari |
324 |
((MultipleArrayCanvas)this.viewer).addSortMenuItems(arrayData.getFieldNames()); |
2 |
26 Feb 07 |
jari |
325 |
|
2 |
26 Feb 07 |
jari |
//Add the time stamp node |
2 |
26 Feb 07 |
jari |
327 |
Date date = new Date(System.currentTimeMillis()); |
2 |
26 Feb 07 |
jari |
328 |
DateFormat format = DateFormat.getDateTimeInstance(); |
2 |
26 Feb 07 |
jari |
329 |
format.setTimeZone(TimeZone.getDefault()); |
2 |
26 Feb 07 |
jari |
330 |
DefaultMutableTreeNode node = new DefaultMutableTreeNode(format.format(date)); |
2 |
26 Feb 07 |
jari |
331 |
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
332 |
treeModel.insertNodeInto(node, analysisNode, analysisNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
333 |
|
2 |
26 Feb 07 |
jari |
334 |
setNormalizedState(arrayData.getNormalizationState()); |
2 |
26 Feb 07 |
jari |
335 |
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, viewScrollPane); |
2 |
26 Feb 07 |
jari |
336 |
splitPane.setOneTouchExpandable(true); |
2 |
26 Feb 07 |
jari |
337 |
mainframe.getContentPane().add(splitPane, BorderLayout.CENTER); |
2 |
26 Feb 07 |
jari |
338 |
|
2 |
26 Feb 07 |
jari |
339 |
statusLabel = new JLabel("MultiExperiment Viewer"); |
2 |
26 Feb 07 |
jari |
340 |
mainframe.getContentPane().add(statusLabel, BorderLayout.SOUTH); |
2 |
26 Feb 07 |
jari |
341 |
mainframe.pack(); |
2 |
26 Feb 07 |
jari |
342 |
splitPane.setDividerLocation(150); |
2 |
26 Feb 07 |
jari |
343 |
|
2 |
26 Feb 07 |
jari |
344 |
if (data.getDataType() == IData.DATA_TYPE_RATIO_ONLY || data.getDataType() == IData.DATA_TYPE_AFFY_ABS){ |
2 |
26 Feb 07 |
jari |
345 |
this.menubar.enableNormalizationMenu(false); |
2 |
26 Feb 07 |
jari |
346 |
} |
2 |
26 Feb 07 |
jari |
347 |
|
2 |
26 Feb 07 |
jari |
348 |
systemEnable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
349 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
350 |
|
2 |
26 Feb 07 |
jari |
//systemDisable(TMEV.DB_AVAILABLE); |
2 |
26 Feb 07 |
jari |
//systemDisable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
353 |
} |
2 |
26 Feb 07 |
jari |
354 |
|
2 |
26 Feb 07 |
jari |
355 |
/** |
2 |
26 Feb 07 |
jari |
* Construct a <code>MultipleArrayViewer</code> with default title, |
2 |
26 Feb 07 |
jari |
* creates menu and tool bars from new instance of action manager, |
2 |
26 Feb 07 |
jari |
* creates the navigation tree and the scroll pane to be used to display |
2 |
26 Feb 07 |
jari |
* a calculation result, creates a status bar. Uses passed MultipleArrayMenubar |
2 |
26 Feb 07 |
jari |
* to dictate initial settings. |
2 |
26 Feb 07 |
jari |
361 |
*/ |
2 |
26 Feb 07 |
jari |
362 |
public MultipleArrayViewer(MultipleArrayData arrayData, MultipleArrayMenubar origMenubar) { |
2 |
26 Feb 07 |
jari |
363 |
super(new JFrame("Multiple Array Viewer")); |
2 |
26 Feb 07 |
jari |
364 |
|
2 |
26 Feb 07 |
jari |
//EH |
2 |
26 Feb 07 |
jari |
366 |
initSessionMetaData(); |
2 |
26 Feb 07 |
jari |
367 |
|
2 |
26 Feb 07 |
jari |
// listener |
2 |
26 Feb 07 |
jari |
369 |
EventListener eventListener = new EventListener(); |
2 |
26 Feb 07 |
jari |
370 |
mainframe.addWindowListener(eventListener); |
2 |
26 Feb 07 |
jari |
371 |
manager = new ActionManager(eventListener, arrayData.getFieldNames(), TMEV.getGUIFactory()); |
2 |
26 Feb 07 |
jari |
372 |
|
2 |
26 Feb 07 |
jari |
373 |
data = arrayData; |
2 |
26 Feb 07 |
jari |
374 |
|
2 |
26 Feb 07 |
jari |
375 |
menubar = new MultipleArrayMenubar(origMenubar, manager); |
2 |
26 Feb 07 |
jari |
376 |
|
2 |
26 Feb 07 |
jari |
//jcb 7/10/06 the Manager constructor takes care of adding field names |
2 |
26 Feb 07 |
jari |
//arrayData now has field names but don't add them again |
2 |
26 Feb 07 |
jari |
//menubar.addLabelMenuItems(arrayData.getFieldNames()); |
2 |
26 Feb 07 |
jari |
380 |
|
2 |
26 Feb 07 |
jari |
381 |
menubar.synchronizeSettings(origMenubar); |
2 |
26 Feb 07 |
jari |
382 |
|
2 |
26 Feb 07 |
jari |
//need to populate the experiment label menu items |
2 |
26 Feb 07 |
jari |
384 |
menubar.addExperimentLabelMenuItems(arrayData.getSlideNameKeyVectorUnion()); |
2 |
26 Feb 07 |
jari |
385 |
|
2 |
26 Feb 07 |
jari |
386 |
mainframe.setJMenuBar(menubar); |
2 |
26 Feb 07 |
jari |
387 |
|
2 |
26 Feb 07 |
jari |
388 |
toolbar = new MultipleArrayToolbar(manager); |
2 |
26 Feb 07 |
jari |
389 |
mainframe.getContentPane().add(toolbar, BorderLayout.NORTH); |
2 |
26 Feb 07 |
jari |
390 |
|
2 |
26 Feb 07 |
jari |
391 |
viewScrollPane = createViewScrollPane(eventListener); |
2 |
26 Feb 07 |
jari |
392 |
viewScrollPane.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
393 |
|
2 |
26 Feb 07 |
jari |
394 |
treeScrollPane = createTreeScrollPane(eventListener); |
2 |
26 Feb 07 |
jari |
395 |
|
2 |
26 Feb 07 |
jari |
//have the main scroll pane |
2 |
26 Feb 07 |
jari |
397 |
((MultipleArrayCanvas)this.viewer).addSortMenuItems(arrayData.getFieldNames()); |
2 |
26 Feb 07 |
jari |
398 |
|
2 |
26 Feb 07 |
jari |
//Add the time stamp node |
2 |
26 Feb 07 |
jari |
400 |
Date date = new Date(System.currentTimeMillis()); |
2 |
26 Feb 07 |
jari |
401 |
DateFormat format = DateFormat.getDateTimeInstance(); |
2 |
26 Feb 07 |
jari |
402 |
format.setTimeZone(TimeZone.getDefault()); |
2 |
26 Feb 07 |
jari |
403 |
DefaultMutableTreeNode node = new DefaultMutableTreeNode(format.format(date)); |
2 |
26 Feb 07 |
jari |
404 |
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
405 |
treeModel.insertNodeInto(node, analysisNode, analysisNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
406 |
|
2 |
26 Feb 07 |
jari |
//set IData as primary and selected |
2 |
26 Feb 07 |
jari |
408 |
data.setUseMainData(true); |
2 |
26 Feb 07 |
jari |
409 |
((LeafInfo)(mainViewerNode.getUserObject())).setSelectedDataSource(true); |
2 |
26 Feb 07 |
jari |
//record main data as source |
2 |
26 Feb 07 |
jari |
411 |
createDataSelectionNode((DefaultMutableTreeNode)(tree.getRoot().getChildAt(0)), data.getExperiment(), data.getExperiment().getNumberOfGenes(), Cluster.GENE_CLUSTER); |
2 |
26 Feb 07 |
jari |
412 |
tree.repaint(); |
2 |
26 Feb 07 |
jari |
413 |
|
2 |
26 Feb 07 |
jari |
414 |
|
2 |
26 Feb 07 |
jari |
415 |
setNormalizedState(arrayData.getNormalizationState()); |
2 |
26 Feb 07 |
jari |
416 |
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, viewScrollPane); |
2 |
26 Feb 07 |
jari |
417 |
splitPane.setOneTouchExpandable(true); |
2 |
26 Feb 07 |
jari |
418 |
mainframe.getContentPane().add(splitPane, BorderLayout.CENTER); |
2 |
26 Feb 07 |
jari |
419 |
|
2 |
26 Feb 07 |
jari |
420 |
statusLabel = new JLabel("MultiExperiment Viewer"); |
2 |
26 Feb 07 |
jari |
421 |
mainframe.getContentPane().add(statusLabel, BorderLayout.SOUTH); |
2 |
26 Feb 07 |
jari |
422 |
mainframe.pack(); |
2 |
26 Feb 07 |
jari |
423 |
splitPane.setDividerLocation(150); |
2 |
26 Feb 07 |
jari |
424 |
|
2 |
26 Feb 07 |
jari |
425 |
if (data.getDataType() == IData.DATA_TYPE_RATIO_ONLY || data.getDataType() == IData.DATA_TYPE_AFFY_ABS){ |
2 |
26 Feb 07 |
jari |
426 |
this.menubar.enableNormalizationMenu(false); |
2 |
26 Feb 07 |
jari |
427 |
} |
2 |
26 Feb 07 |
jari |
428 |
|
2 |
26 Feb 07 |
jari |
429 |
systemEnable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
430 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
431 |
|
2 |
26 Feb 07 |
jari |
//systemDisable(TMEV.DB_AVAILABLE); |
2 |
26 Feb 07 |
jari |
//systemDisable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
434 |
} |
2 |
26 Feb 07 |
jari |
435 |
|
2 |
26 Feb 07 |
jari |
436 |
/** |
2 |
26 Feb 07 |
jari |
* Sets toolbar and menubar states. |
2 |
26 Feb 07 |
jari |
438 |
*/ |
2 |
26 Feb 07 |
jari |
439 |
public void systemDisable(int state) { |
2 |
26 Feb 07 |
jari |
440 |
menubar.systemDisable(state); |
2 |
26 Feb 07 |
jari |
441 |
toolbar.systemDisable(state); |
2 |
26 Feb 07 |
jari |
442 |
} |
2 |
26 Feb 07 |
jari |
443 |
|
2 |
26 Feb 07 |
jari |
444 |
/** |
2 |
26 Feb 07 |
jari |
* Sets toolbar and menubar states. |
2 |
26 Feb 07 |
jari |
446 |
*/ |
2 |
26 Feb 07 |
jari |
447 |
public void systemEnable(int state) { |
2 |
26 Feb 07 |
jari |
448 |
menubar.systemEnable(state); |
2 |
26 Feb 07 |
jari |
449 |
toolbar.systemEnable(state); |
2 |
26 Feb 07 |
jari |
450 |
} |
2 |
26 Feb 07 |
jari |
451 |
|
2 |
26 Feb 07 |
jari |
452 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a reference to an instance of algorithm factory. |
2 |
26 Feb 07 |
jari |
454 |
*/ |
2 |
26 Feb 07 |
jari |
455 |
public AlgorithmFactory getAlgorithmFactory() { |
2 |
26 Feb 07 |
jari |
456 |
return TMEV.getAlgorithmFactory(); |
2 |
26 Feb 07 |
jari |
457 |
} |
2 |
26 Feb 07 |
jari |
458 |
|
2 |
26 Feb 07 |
jari |
459 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a reference to an instance of microarrays data. |
2 |
26 Feb 07 |
jari |
461 |
*/ |
2 |
26 Feb 07 |
jari |
462 |
public IData getData() { |
2 |
26 Feb 07 |
jari |
463 |
return data; |
2 |
26 Feb 07 |
jari |
464 |
} |
2 |
26 Feb 07 |
jari |
465 |
|
2 |
26 Feb 07 |
jari |
466 |
/** |
2 |
26 Feb 07 |
jari |
* Runs a single array viewer for specified column. |
2 |
26 Feb 07 |
jari |
468 |
*/ |
2 |
26 Feb 07 |
jari |
469 |
private void displaySingleArrayViewer(int column) { |
2 |
26 Feb 07 |
jari |
470 |
Manager.createNewSingleArrayViewer(data.getFeature(column)); |
2 |
26 Feb 07 |
jari |
471 |
} |
2 |
26 Feb 07 |
jari |
472 |
|
2 |
26 Feb 07 |
jari |
473 |
/** |
2 |
26 Feb 07 |
jari |
* Runs a slide element info dialog for a specified spot. |
2 |
26 Feb 07 |
jari |
475 |
*/ |
2 |
26 Feb 07 |
jari |
476 |
private void displaySlideElementInfo(int column, int row) { |
2 |
26 Feb 07 |
jari |
477 |
Manager.displaySlideElementInfo(mainframe, data, column, row); |
2 |
26 Feb 07 |
jari |
478 |
} |
2 |
26 Feb 07 |
jari |
479 |
|
2 |
26 Feb 07 |
jari |
480 |
/********************************************* |
2 |
26 Feb 07 |
jari |
* This section of code defines methods to save the state of MeV |
2 |
26 Feb 07 |
jari |
* to file. |
2 |
26 Feb 07 |
jari |
483 |
* |
2 |
26 Feb 07 |
jari |
* Process: |
2 |
26 Feb 07 |
jari |
485 |
* |
2 |
26 Feb 07 |
jari |
* -Save a time stamp |
2 |
26 Feb 07 |
jari |
* -Save MultipleArrayData |
2 |
26 Feb 07 |
jari |
* -Save Analysis Counter |
2 |
26 Feb 07 |
jari |
* -Save the Analysis Node via ResultTree |
2 |
26 Feb 07 |
jari |
* -Save the ClusterRepositories |
2 |
26 Feb 07 |
jari |
* -Save the History Node via ResultTree |
2 |
26 Feb 07 |
jari |
492 |
* |
2 |
26 Feb 07 |
jari |
493 |
*/ |
2 |
26 Feb 07 |
jari |
494 |
public void saveAnalysisAs() { |
2 |
26 Feb 07 |
jari |
495 |
try { |
2 |
26 Feb 07 |
jari |
496 |
|
2 |
26 Feb 07 |
jari |
497 |
String dataPath = TMEV.getDataPath(); |
2 |
26 Feb 07 |
jari |
498 |
File fileLoc = TMEV.getFile("data/"); |
2 |
26 Feb 07 |
jari |
// if the data path is null go to default, if not null and not exist then to to default |
2 |
26 Feb 07 |
jari |
// else use the dataPath |
2 |
26 Feb 07 |
jari |
501 |
if(dataPath != null) { |
2 |
26 Feb 07 |
jari |
502 |
fileLoc = new File(dataPath); |
2 |
26 Feb 07 |
jari |
503 |
if(!fileLoc.exists()) { |
2 |
26 Feb 07 |
jari |
504 |
fileLoc = TMEV.getFile("data/"); |
2 |
26 Feb 07 |
jari |
505 |
} |
2 |
26 Feb 07 |
jari |
506 |
} |
2 |
26 Feb 07 |
jari |
507 |
final JFileChooser chooser = new JFileChooser(fileLoc); |
2 |
26 Feb 07 |
jari |
508 |
chooser.setFileView(new AnalysisFileView()); |
2 |
26 Feb 07 |
jari |
509 |
chooser.setFileFilter(new AnalysisFileFilter()); |
2 |
26 Feb 07 |
jari |
510 |
chooser.setApproveButtonText("Save"); |
2 |
26 Feb 07 |
jari |
511 |
JPanel panel = new JPanel(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
512 |
|
2 |
26 Feb 07 |
jari |
513 |
final javax.swing.JDialog dialog = new javax.swing.JDialog(getFrame(), "Save Dialog", true); |
2 |
26 Feb 07 |
jari |
514 |
|
2 |
26 Feb 07 |
jari |
515 |
chooser.addActionListener(new ActionListener() { |
2 |
26 Feb 07 |
jari |
516 |
public void actionPerformed(ActionEvent ae) { |
2 |
26 Feb 07 |
jari |
517 |
String cmd = ae.getActionCommand(); |
2 |
26 Feb 07 |
jari |
518 |
if(cmd.equals(JFileChooser.APPROVE_SELECTION)) { |
2 |
26 Feb 07 |
jari |
519 |
File file = chooser.getSelectedFile(); |
2 |
26 Feb 07 |
jari |
520 |
dialog.dispose(); |
2 |
26 Feb 07 |
jari |
521 |
try { |
2 |
26 Feb 07 |
jari |
522 |
AnalysisFileFilter filter = new AnalysisFileFilter(); |
2 |
26 Feb 07 |
jari |
523 |
String ext = filter.getExtension(file); |
2 |
26 Feb 07 |
jari |
524 |
|
2 |
26 Feb 07 |
jari |
525 |
if(ext == null) |
2 |
26 Feb 07 |
jari |
526 |
file = new File(file.getPath() + ".anl"); |
2 |
26 Feb 07 |
jari |
527 |
|
2 |
26 Feb 07 |
jari |
528 |
saveState(file); |
2 |
26 Feb 07 |
jari |
//set tmev.cfg path to match formatted path |
2 |
26 Feb 07 |
jari |
530 |
TMEV.updateDataPath(formatDataPath(file.getPath())); |
2 |
26 Feb 07 |
jari |
//set variable to OS specific path format |
2 |
26 Feb 07 |
jari |
532 |
TMEV.setDataPath(file.getParentFile().getPath()); |
2 |
26 Feb 07 |
jari |
533 |
} catch (IOException ioe) { |
2 |
26 Feb 07 |
jari |
534 |
JOptionPane.showMessageDialog(MultipleArrayViewer.this, "I/O Exception, Error saving analysis. File ("+(file != null ? file.getName() : "name unknown")+")", "Save Analysis", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
535 |
ioe.printStackTrace(); |
2 |
26 Feb 07 |
jari |
536 |
} |
2 |
26 Feb 07 |
jari |
537 |
} else { |
2 |
26 Feb 07 |
jari |
538 |
dialog.dispose(); |
2 |
26 Feb 07 |
jari |
539 |
} |
2 |
26 Feb 07 |
jari |
540 |
} |
2 |
26 Feb 07 |
jari |
541 |
}); |
2 |
26 Feb 07 |
jari |
542 |
|
2 |
26 Feb 07 |
jari |
543 |
|
2 |
26 Feb 07 |
jari |
544 |
javax.swing.JTextPane pane = new javax.swing.JTextPane(); |
2 |
26 Feb 07 |
jari |
545 |
pane.setContentType("text/html"); |
2 |
26 Feb 07 |
jari |
546 |
pane.setEditable(false); |
2 |
26 Feb 07 |
jari |
547 |
|
2 |
26 Feb 07 |
jari |
548 |
String text = "<html><body><font face=arial size=4><b><center>Analysis Save and Restoration Warning</center><b><hr size=3><br>";//<hr size=3>"; |
2 |
26 Feb 07 |
jari |
549 |
text += "<font face=arial size=4>Proper restoration of analysis files is dependent on the Java and Java Virtual Machine versions used to open the file. "; |
2 |
26 Feb 07 |
jari |
550 |
text += "Analysis files should be opened using Java and Java Virtual Machine versions that match the versions used to save the file.<br><br>"; |
2 |
26 Feb 07 |
jari |
551 |
|
2 |
26 Feb 07 |
jari |
552 |
text += "If version inconsistencies are found when loading an analysis file the saved and current versions " ; |
2 |
26 Feb 07 |
jari |
553 |
text += "will be reported at that time. This problem only arises when moving analysis files between computers "; |
2 |
26 Feb 07 |
jari |
554 |
text += "running different versions of Java.<br><br></body></html>"; |
2 |
26 Feb 07 |
jari |
555 |
|
2 |
26 Feb 07 |
jari |
556 |
pane.setMargin(new Insets(10,10,10,10)); |
2 |
26 Feb 07 |
jari |
557 |
pane.setFont(new java.awt.Font("arial", java.awt.Font.PLAIN, 4)); |
2 |
26 Feb 07 |
jari |
558 |
pane.setText(text); |
2 |
26 Feb 07 |
jari |
559 |
|
2 |
26 Feb 07 |
jari |
560 |
JPanel panePanel = new JPanel(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
561 |
panePanel.setBorder(BorderFactory.createLineBorder(Color.black)); |
2 |
26 Feb 07 |
jari |
562 |
panePanel.add(pane, new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2,2,2,2), 0, 0) ); |
2 |
26 Feb 07 |
jari |
563 |
panePanel.setPreferredSize(new Dimension(chooser.getPreferredSize().width,((int)(chooser.getPreferredSize().height/1.4)))); |
2 |
26 Feb 07 |
jari |
564 |
|
2 |
26 Feb 07 |
jari |
565 |
panel.add(panePanel, new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5,5,5,5), 0, 0)); |
2 |
26 Feb 07 |
jari |
566 |
panel.add(chooser, new GridBagConstraints(0,1,1,1,0,1,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5), 0, 0)); |
2 |
26 Feb 07 |
jari |
567 |
|
2 |
26 Feb 07 |
jari |
568 |
|
2 |
26 Feb 07 |
jari |
569 |
dialog.getContentPane().add(panel); |
2 |
26 Feb 07 |
jari |
570 |
dialog.pack(); |
2 |
26 Feb 07 |
jari |
571 |
|
2 |
26 Feb 07 |
jari |
572 |
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
573 |
dialog.setLocation((screenSize.width - dialog.getSize().width)/2, (screenSize.height - dialog.getSize().height)/2); |
2 |
26 Feb 07 |
jari |
574 |
dialog.show(); |
2 |
26 Feb 07 |
jari |
575 |
|
2 |
26 Feb 07 |
jari |
576 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
577 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
578 |
} |
2 |
26 Feb 07 |
jari |
579 |
} |
2 |
26 Feb 07 |
jari |
580 |
|
2 |
26 Feb 07 |
jari |
581 |
private String formatDataPath(String dataPath) { |
2 |
26 Feb 07 |
jari |
582 |
if(dataPath == null) |
2 |
26 Feb 07 |
jari |
583 |
return " "; |
2 |
26 Feb 07 |
jari |
584 |
|
2 |
26 Feb 07 |
jari |
585 |
String renderedSep = "/"; |
2 |
26 Feb 07 |
jari |
586 |
String renderedPath = new String(); |
2 |
26 Feb 07 |
jari |
587 |
|
2 |
26 Feb 07 |
jari |
588 |
String sep = System.getProperty("file.separator"); |
2 |
26 Feb 07 |
jari |
589 |
|
2 |
26 Feb 07 |
jari |
590 |
StringTokenizer stok = new StringTokenizer(dataPath, sep); |
2 |
26 Feb 07 |
jari |
591 |
|
2 |
26 Feb 07 |
jari |
592 |
String newDataPath = new String(); |
2 |
26 Feb 07 |
jari |
593 |
|
2 |
26 Feb 07 |
jari |
594 |
String str; |
2 |
26 Feb 07 |
jari |
595 |
while(stok.hasMoreTokens() && stok.countTokens() > 1){ |
2 |
26 Feb 07 |
jari |
596 |
str = stok.nextToken(); |
2 |
26 Feb 07 |
jari |
597 |
renderedPath += str + renderedSep; |
2 |
26 Feb 07 |
jari |
598 |
newDataPath += str + sep; |
2 |
26 Feb 07 |
jari |
599 |
} |
2 |
26 Feb 07 |
jari |
600 |
return renderedPath; |
2 |
26 Feb 07 |
jari |
601 |
} |
2 |
26 Feb 07 |
jari |
602 |
|
2 |
26 Feb 07 |
jari |
603 |
public void saveAnalysis() { |
2 |
26 Feb 07 |
jari |
604 |
if(this.currentAnalysisFile != null) { |
2 |
26 Feb 07 |
jari |
605 |
try { |
2 |
26 Feb 07 |
jari |
606 |
saveState(currentAnalysisFile); |
2 |
26 Feb 07 |
jari |
607 |
} catch (IOException e) { |
2 |
26 Feb 07 |
jari |
608 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
609 |
} |
2 |
26 Feb 07 |
jari |
610 |
} else { |
2 |
26 Feb 07 |
jari |
611 |
JOptionPane.showMessageDialog(this, "State was not saved. Error finding file to save. \n"+ |
2 |
26 Feb 07 |
jari |
612 |
"Please use the \"Save As...\" menu item.", "Save Error", JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
613 |
} |
2 |
26 Feb 07 |
jari |
614 |
} |
2 |
26 Feb 07 |
jari |
615 |
|
2 |
26 Feb 07 |
jari |
616 |
/** |
2 |
26 Feb 07 |
jari |
* Save MultipleArrayData state. |
2 |
26 Feb 07 |
jari |
* @param file |
2 |
26 Feb 07 |
jari |
* @throws FileNotFoundException |
2 |
26 Feb 07 |
jari |
* @throws IOException |
2 |
26 Feb 07 |
jari |
621 |
*/ |
2 |
26 Feb 07 |
jari |
622 |
private void saveState(File file) throws FileNotFoundException, IOException { |
2 |
26 Feb 07 |
jari |
// try { |
2 |
26 Feb 07 |
jari |
624 |
this.currentAnalysisFile = file; |
2 |
26 Feb 07 |
jari |
625 |
final boolean debug = true; |
2 |
26 Feb 07 |
jari |
626 |
String javaTempDir = System.getProperty("java.io.tmpdir"); |
2 |
26 Feb 07 |
jari |
627 |
if(!javaTempDir.endsWith(System.getProperty("file.separator"))) |
2 |
26 Feb 07 |
jari |
628 |
javaTempDir = javaTempDir + System.getProperty("file.separator"); |
2 |
26 Feb 07 |
jari |
629 |
|
2 |
26 Feb 07 |
jari |
630 |
final String tempFilePath = javaTempDir + MultipleArrayViewer.CURRENT_TEMP_DIR + System.getProperty("file.separator"); |
2 |
26 Feb 07 |
jari |
631 |
final File tempDir = new File(javaTempDir + MultipleArrayViewer.CURRENT_TEMP_DIR + System.getProperty("file.separator")); |
2 |
26 Feb 07 |
jari |
632 |
if (!tempDir.mkdir()) { |
2 |
26 Feb 07 |
jari |
633 |
System.out.println("Couldn't create directory for saving: " + tempFilePath); |
2 |
26 Feb 07 |
jari |
//TODO handle this better |
2 |
26 Feb 07 |
jari |
635 |
} |
2 |
26 Feb 07 |
jari |
636 |
File tmpXML = new File(tempFilePath + "mev_state" + ".xml"); |
2 |
26 Feb 07 |
jari |
// System.out.println("mev state file: " + tmpXML); |
2 |
26 Feb 07 |
jari |
638 |
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(tmpXML)); |
2 |
26 Feb 07 |
jari |
639 |
final XMLEncoder oos = XMLEncoderFactory.getMAVEncoder(new XMLEncoder(os), tree); |
2 |
26 Feb 07 |
jari |
640 |
if(!debug) |
2 |
26 Feb 07 |
jari |
641 |
tmpXML.deleteOnExit(); |
2 |
26 Feb 07 |
jari |
642 |
|
2 |
26 Feb 07 |
jari |
643 |
|
2 |
26 Feb 07 |
jari |
//Directs XMLEncoder errors to a log file. Very useful when debugging new |
2 |
26 Feb 07 |
jari |
//state-saving functions. |
2 |
26 Feb 07 |
jari |
646 |
System.out.println("Any save errors will be written to saving.log"); |
2 |
26 Feb 07 |
jari |
647 |
oos.setExceptionListener(new ExceptionListener() { |
2 |
26 Feb 07 |
jari |
648 |
public void exceptionThrown(Exception exception) { |
2 |
26 Feb 07 |
jari |
649 |
try { |
2 |
26 Feb 07 |
jari |
650 |
if(exception.toString().indexOf("Listener")==-1){ |
2 |
26 Feb 07 |
jari |
651 |
PrintStream log = new PrintStream(new FileOutputStream(new File("saving.log"), false));//OutputStream(new FileOutputStream(new File("log.log")))); |
2 |
26 Feb 07 |
jari |
652 |
log.println(new Date()); |
2 |
26 Feb 07 |
jari |
653 |
exception.printStackTrace(log); |
2 |
26 Feb 07 |
jari |
654 |
System.out.println(exception.toString()); |
2 |
26 Feb 07 |
jari |
655 |
} |
2 |
26 Feb 07 |
jari |
656 |
} catch (IOException ioe){ |
2 |
26 Feb 07 |
jari |
657 |
System.out.println("Could not open save log file."); |
2 |
26 Feb 07 |
jari |
658 |
} |
2 |
26 Feb 07 |
jari |
659 |
} |
2 |
26 Feb 07 |
jari |
660 |
}); |
2 |
26 Feb 07 |
jari |
661 |
|
2 |
26 Feb 07 |
jari |
662 |
progressPanel = new StateSavingProgressPanel("Saving Current Analysis", this); |
2 |
26 Feb 07 |
jari |
663 |
progressPanel.setLocationRelativeTo(mainframe); |
2 |
26 Feb 07 |
jari |
664 |
progressPanel.setVisible(true); |
2 |
26 Feb 07 |
jari |
665 |
|
2 |
26 Feb 07 |
jari |
666 |
prepSessionMetaData(smd.getMevSessionPrefs()); |
2 |
26 Feb 07 |
jari |
667 |
|
2 |
26 Feb 07 |
jari |
668 |
Thread thread = new Thread(new Runnable() { |
2 |
26 Feb 07 |
jari |
669 |
public void run() { |
2 |
26 Feb 07 |
jari |
670 |
try { |
2 |
26 Feb 07 |
jari |
671 |
setCursor(new Cursor(Cursor.WAIT_CURSOR)); |
2 |
26 Feb 07 |
jari |
672 |
|
2 |
26 Feb 07 |
jari |
673 |
progressPanel.update("Writing Metadata"); |
2 |
26 Feb 07 |
jari |
674 |
progressPanel.setIndeterminate(true); |
2 |
26 Feb 07 |
jari |
675 |
oos.writeObject(smd); |
2 |
26 Feb 07 |
jari |
676 |
|
2 |
26 Feb 07 |
jari |
677 |
progressPanel.update("Writing Intensities"); |
2 |
26 Feb 07 |
jari |
678 |
progressPanel.setIndeterminate(true); |
2 |
26 Feb 07 |
jari |
679 |
oos.writeObject(data); |
2 |
26 Feb 07 |
jari |
680 |
|
2 |
26 Feb 07 |
jari |
681 |
progressPanel.update("Writing Clusters"); |
2 |
26 Feb 07 |
jari |
682 |
saveClusterRepositories(oos); |
2 |
26 Feb 07 |
jari |
683 |
|
2 |
26 Feb 07 |
jari |
684 |
progressPanel.update("Writing Analysis Results"); |
2 |
26 Feb 07 |
jari |
685 |
oos.writeObject(tree.getAnalysisNode()); |
2 |
26 Feb 07 |
jari |
686 |
|
2 |
26 Feb 07 |
jari |
687 |
progressPanel.update("Writing History"); |
2 |
26 Feb 07 |
jari |
688 |
oos.writeObject(historyNode); |
2 |
26 Feb 07 |
jari |
689 |
|
2 |
26 Feb 07 |
jari |
690 |
oos.flush(); |
2 |
26 Feb 07 |
jari |
691 |
oos.close(); |
2 |
26 Feb 07 |
jari |
692 |
|
2 |
26 Feb 07 |
jari |
693 |
progressPanel.setIndeterminate(false); |
2 |
26 Feb 07 |
jari |
694 |
progressPanel.update("Compressing Data"); |
2 |
26 Feb 07 |
jari |
695 |
|
2 |
26 Feb 07 |
jari |
//Zip all files in temp saving directory (one xml file, many binary files) into final .anl file |
2 |
26 Feb 07 |
jari |
697 |
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(currentAnalysisFile)); |
2 |
26 Feb 07 |
jari |
698 |
zipTempFiles(zos, tempFilePath, tempDir); |
2 |
26 Feb 07 |
jari |
699 |
zos.close(); |
2 |
26 Feb 07 |
jari |
//End Zipping of temp files |
2 |
26 Feb 07 |
jari |
701 |
|
2 |
26 Feb 07 |
jari |
702 |
progressPanel.update("Cleaning Up"); |
2 |
26 Feb 07 |
jari |
703 |
progressPanel.setIndeterminate(false); |
2 |
26 Feb 07 |
jari |
//Delete all temp files, including temp folder |
2 |
26 Feb 07 |
jari |
705 |
File aFile; |
2 |
26 Feb 07 |
jari |
706 |
String[] files = tempDir.list(); |
2 |
26 Feb 07 |
jari |
707 |
for(int i=0; i<files.length; i++){ |
2 |
26 Feb 07 |
jari |
708 |
aFile = new File(tempFilePath + files[i]); |
2 |
26 Feb 07 |
jari |
709 |
aFile.deleteOnExit(); |
2 |
26 Feb 07 |
jari |
710 |
if(!(new File(tempFilePath + files[i]).delete())) |
2 |
26 Feb 07 |
jari |
711 |
System.out.println("Couldn't delete " + tempFilePath + files[i]); |
2 |
26 Feb 07 |
jari |
712 |
} |
2 |
26 Feb 07 |
jari |
713 |
tempDir.deleteOnExit(); |
2 |
26 Feb 07 |
jari |
714 |
if(!tempDir.delete()) |
2 |
26 Feb 07 |
jari |
715 |
System.out.println("Couldn't delete " + tempDir.toString()); |
2 |
26 Feb 07 |
jari |
716 |
|
2 |
26 Feb 07 |
jari |
717 |
progressPanel.dispose(); |
2 |
26 Feb 07 |
jari |
718 |
modifiedResult = false; |
2 |
26 Feb 07 |
jari |
719 |
} catch (IOException ioe){ |
2 |
26 Feb 07 |
jari |
720 |
setCursor(Cursor.DEFAULT_CURSOR); |
2 |
26 Feb 07 |
jari |
721 |
JOptionPane.showMessageDialog(MultipleArrayViewer.this, "Analysis was not saved. Error writing output file.", |
2 |
26 Feb 07 |
jari |
722 |
"Save Error", JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
723 |
ioe.printStackTrace(); |
2 |
26 Feb 07 |
jari |
724 |
TMEV.activeSave = false; |
2 |
26 Feb 07 |
jari |
725 |
/* |
2 |
26 Feb 07 |
jari |
} catch (Throwable t) { |
2 |
26 Feb 07 |
jari |
System.out.println("Catching throwable"); |
2 |
26 Feb 07 |
jari |
// thread.destroy(); |
2 |
26 Feb 07 |
jari |
//ShowThrowableDialog.show(MultipleArrayViewer.this, "Out of Memory", false, t); |
2 |
26 Feb 07 |
jari |
JOptionPane.showMessageDialog(MultipleArrayViewer.this, "Analysis was not saved. Not enough memory.", |
2 |
26 Feb 07 |
jari |
"Save Error", JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
732 |
|
2 |
26 Feb 07 |
jari |
733 |
*/ |
2 |
26 Feb 07 |
jari |
734 |
} |
2 |
26 Feb 07 |
jari |
735 |
} |
2 |
26 Feb 07 |
jari |
736 |
}); |
2 |
26 Feb 07 |
jari |
737 |
|
2 |
26 Feb 07 |
jari |
738 |
thread.setPriority(Thread.NORM_PRIORITY); |
2 |
26 Feb 07 |
jari |
739 |
thread.start(); |
2 |
26 Feb 07 |
jari |
/* } catch (Throwable t){ |
2 |
26 Feb 07 |
jari |
741 |
|
2 |
26 Feb 07 |
jari |
System.out.println("Catching outer throwable"); |
2 |
26 Feb 07 |
jari |
JOptionPane.showMessageDialog(MultipleArrayViewer.this, "Analysis was not saved. Not enough memory.", |
2 |
26 Feb 07 |
jari |
"Save Error", JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
progressPanel.dispose(); |
2 |
26 Feb 07 |
jari |
746 |
|
2 |
26 Feb 07 |
jari |
747 |
} |
2 |
26 Feb 07 |
jari |
748 |
*/ |
2 |
26 Feb 07 |
jari |
749 |
} |
2 |
26 Feb 07 |
jari |
750 |
|
2 |
26 Feb 07 |
jari |
751 |
|
2 |
26 Feb 07 |
jari |
752 |
|
2 |
26 Feb 07 |
jari |
753 |
private void zipTempFiles(ZipOutputStream zos, String tempFilePath, File tempDir) throws IOException{ |
2 |
26 Feb 07 |
jari |
754 |
byte[] buf = new byte[1024]; |
2 |
26 Feb 07 |
jari |
755 |
int len; |
2 |
26 Feb 07 |
jari |
//Zips all files in temp saving directory saveDir into a zip file specified by user |
2 |
26 Feb 07 |
jari |
757 |
ZipEntry entry; |
2 |
26 Feb 07 |
jari |
758 |
File aFile; |
2 |
26 Feb 07 |
jari |
759 |
FileInputStream fis; |
2 |
26 Feb 07 |
jari |
760 |
String[] fileNames = tempDir.list(); |
2 |
26 Feb 07 |
jari |
761 |
progressPanel.setMaximum(fileNames.length); |
2 |
26 Feb 07 |
jari |
762 |
|
2 |
26 Feb 07 |
jari |
763 |
for(int i=0; i<fileNames.length; i++){ |
2 |
26 Feb 07 |
jari |
764 |
aFile = new File(tempFilePath + fileNames[i]); |
2 |
26 Feb 07 |
jari |
765 |
entry = new ZipEntry(aFile.getName()); |
2 |
26 Feb 07 |
jari |
766 |
zos.putNextEntry(entry); |
2 |
26 Feb 07 |
jari |
767 |
fis = new FileInputStream(aFile); |
2 |
26 Feb 07 |
jari |
768 |
while ((len = fis.read(buf)) > 0) { |
2 |
26 Feb 07 |
jari |
769 |
zos.write(buf, 0, len); |
2 |
26 Feb 07 |
jari |
770 |
} |
2 |
26 Feb 07 |
jari |
771 |
zos.closeEntry(); |
2 |
26 Feb 07 |
jari |
772 |
fis.close(); |
2 |
26 Feb 07 |
jari |
773 |
progressPanel.increment(); |
2 |
26 Feb 07 |
jari |
774 |
|
2 |
26 Feb 07 |
jari |
775 |
} |
2 |
26 Feb 07 |
jari |
776 |
} |
2 |
26 Feb 07 |
jari |
777 |
|
2 |
26 Feb 07 |
jari |
778 |
/** |
2 |
26 Feb 07 |
jari |
* EH |
2 |
26 Feb 07 |
jari |
780 |
* |
2 |
26 Feb 07 |
jari |
781 |
*/ |
2 |
26 Feb 07 |
jari |
782 |
public void cancelLoadState(){ |
2 |
26 Feb 07 |
jari |
783 |
keepRunning = false; |
2 |
26 Feb 07 |
jari |
784 |
} |
2 |
26 Feb 07 |
jari |
785 |
/** |
2 |
26 Feb 07 |
jari |
* EH |
2 |
26 Feb 07 |
jari |
* Clean up the MultipleArrayViewer and return it to an empty state. |
2 |
26 Feb 07 |
jari |
788 |
* |
2 |
26 Feb 07 |
jari |
789 |
*/ |
2 |
26 Feb 07 |
jari |
790 |
private void cleanUp(){ |
2 |
26 Feb 07 |
jari |
791 |
this.data = new MultipleArrayData(); |
2 |
26 Feb 07 |
jari |
792 |
this.analysisNode.removeAllChildren(); |
2 |
26 Feb 07 |
jari |
793 |
this.geneClusterRepository = null; |
2 |
26 Feb 07 |
jari |
794 |
this.experimentClusterRepository = null; |
2 |
26 Feb 07 |
jari |
795 |
this.clusterNode.removeAllChildren(); |
2 |
26 Feb 07 |
jari |
796 |
this.experimentClusterManager = null; |
2 |
26 Feb 07 |
jari |
797 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
798 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
799 |
fireHeaderChanged(); |
2 |
26 Feb 07 |
jari |
800 |
progressPanel.dispose(); |
2 |
26 Feb 07 |
jari |
801 |
} |
2 |
26 Feb 07 |
jari |
802 |
|
2 |
26 Feb 07 |
jari |
803 |
|
2 |
26 Feb 07 |
jari |
804 |
private void loadHistoryNode(DefaultMutableTreeNode d) throws IOException, ClassNotFoundException { |
2 |
26 Feb 07 |
jari |
805 |
DefaultMutableTreeNode node = d; |
2 |
26 Feb 07 |
jari |
806 |
if(node != null){ |
2 |
26 Feb 07 |
jari |
807 |
tree.removeNode(historyNode); |
2 |
26 Feb 07 |
jari |
808 |
historyNode = node; |
2 |
26 Feb 07 |
jari |
809 |
tree.insertNode(historyNode, tree.getRoot(), tree.getRoot().getChildCount()); |
2 |
26 Feb 07 |
jari |
810 |
this.historyNode = node; |
2 |
26 Feb 07 |
jari |
811 |
historyLog = (HistoryViewer)(((LeafInfo)(((DefaultMutableTreeNode)historyNode.getChildAt(0)).getUserObject())).getViewer()); |
2 |
26 Feb 07 |
jari |
812 |
} |
2 |
26 Feb 07 |
jari |
813 |
} |
2 |
26 Feb 07 |
jari |
814 |
|
2 |
26 Feb 07 |
jari |
815 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim 4/25 |
2 |
26 Feb 07 |
jari |
* Initializes cgh menus when data loaded is cgh data |
2 |
26 Feb 07 |
jari |
* For State Saving |
2 |
26 Feb 07 |
jari |
819 |
*/ |
2 |
26 Feb 07 |
jari |
820 |
private void initializeCGH(){ |
2 |
26 Feb 07 |
jari |
821 |
System.out.println("data.isCGHData(): " + data.isCGHData()); |
2 |
26 Feb 07 |
jari |
822 |
if(data.isCGHData()) { |
2 |
26 Feb 07 |
jari |
823 |
this.data.setChromosomeIndices(CGHStanfordFileLoader.calculateChromosomeIndices(this.data.getClones())); |
2 |
26 Feb 07 |
jari |
824 |
this.data.setHasDyeSwap(this.data.isHasDyeSwap()); |
2 |
26 Feb 07 |
jari |
//this.data.setLog2Data(isLog2); |
2 |
26 Feb 07 |
jari |
//this.data.setHasCloneDistribution(false); |
2 |
26 Feb 07 |
jari |
//this.data.setCGHData(); |
2 |
26 Feb 07 |
jari |
//this.data.setCGHSpecies(species); |
2 |
26 Feb 07 |
jari |
829 |
|
2 |
26 Feb 07 |
jari |
//From FireDataLoaded |
2 |
26 Feb 07 |
jari |
831 |
loadCytoBandFile(); |
2 |
26 Feb 07 |
jari |
832 |
manager.initCghAnalysiActions(new org.tigr.microarray.mev.cgh.CGHAlgorithms.CGHAlgorithmFactory()); |
2 |
26 Feb 07 |
jari |
833 |
this.menubar.addCGHMenus(); |
2 |
26 Feb 07 |
jari |
834 |
mainframe.validate(); |
2 |
26 Feb 07 |
jari |
835 |
|
2 |
26 Feb 07 |
jari |
836 |
/* |
2 |
26 Feb 07 |
jari |
ExperimentsLoaded(); |
2 |
26 Feb 07 |
jari |
onFlankingRegionDeterminationChanged(); |
2 |
26 Feb 07 |
jari |
839 |
*/ |
2 |
26 Feb 07 |
jari |
840 |
} |
2 |
26 Feb 07 |
jari |
841 |
} |
2 |
26 Feb 07 |
jari |
842 |
|
2 |
26 Feb 07 |
jari |
843 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim CGH 4/26 |
2 |
26 Feb 07 |
jari |
* for State Saving |
2 |
26 Feb 07 |
jari |
846 |
*/ |
2 |
26 Feb 07 |
jari |
847 |
private void initializeCGHViews(){ |
2 |
26 Feb 07 |
jari |
848 |
ExperimentsLoaded(); |
2 |
26 Feb 07 |
jari |
849 |
onFlankingRegionDeterminationChanged(); |
2 |
26 Feb 07 |
jari |
850 |
} |
2 |
26 Feb 07 |
jari |
851 |
|
2 |
26 Feb 07 |
jari |
852 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim CGH 4/26 |
2 |
26 Feb 07 |
jari |
* for State Saving |
2 |
26 Feb 07 |
jari |
855 |
*/ |
2 |
26 Feb 07 |
jari |
856 |
private void createCGHAnalysisNodes(){ |
2 |
26 Feb 07 |
jari |
857 |
if (this.analysisNode == null) return; |
2 |
26 Feb 07 |
jari |
858 |
|
2 |
26 Feb 07 |
jari |
859 |
float ampThresh, ampThresh_T = 0.0f; |
2 |
26 Feb 07 |
jari |
860 |
float delThresh, delThresh_T = 0.0f; |
2 |
26 Feb 07 |
jari |
861 |
float ampThresh2Copy, ampThresh2Copy_T = 0.0f; |
2 |
26 Feb 07 |
jari |
862 |
float delThresh2Copy, delThresh2Copy_T = 0.0f; |
2 |
26 Feb 07 |
jari |
863 |
Vector extraParam = null; |
2 |
26 Feb 07 |
jari |
864 |
int index = -1; |
2 |
26 Feb 07 |
jari |
865 |
|
2 |
26 Feb 07 |
jari |
//For restoring later |
2 |
26 Feb 07 |
jari |
867 |
ICGHCloneValueMenu menu = framework.getCghCloneValueMenu(); |
2 |
26 Feb 07 |
jari |
868 |
ampThresh = menu.getAmpThresh(); |
2 |
26 Feb 07 |
jari |
869 |
delThresh = menu.getDelThresh(); |
2 |
26 Feb 07 |
jari |
870 |
ampThresh2Copy = menu.getAmpThresh2Copy(); |
2 |
26 Feb 07 |
jari |
871 |
delThresh2Copy = menu.getDelThresh2Copy(); |
2 |
26 Feb 07 |
jari |
872 |
|
2 |
26 Feb 07 |
jari |
873 |
DefaultMutableTreeNode analysisRoot; |
2 |
26 Feb 07 |
jari |
874 |
DefaultMutableTreeNode currentNode; |
2 |
26 Feb 07 |
jari |
875 |
Object object; |
2 |
26 Feb 07 |
jari |
876 |
|
2 |
26 Feb 07 |
jari |
877 |
int childCount = this.analysisNode.getChildCount(); |
2 |
26 Feb 07 |
jari |
878 |
System.out.println("analysisNode Child Count: " + childCount); |
2 |
26 Feb 07 |
jari |
879 |
String algName= ""; |
2 |
26 Feb 07 |
jari |
880 |
String trimName = ""; |
2 |
26 Feb 07 |
jari |
881 |
Enumeration treeEnum; |
2 |
26 Feb 07 |
jari |
882 |
|
2 |
26 Feb 07 |
jari |
883 |
for(int i = 0; i < childCount; i++){ |
2 |
26 Feb 07 |
jari |
884 |
index = -1; |
2 |
26 Feb 07 |
jari |
885 |
ampThresh_T = 0.0f; |
2 |
26 Feb 07 |
jari |
886 |
delThresh_T = 0.0f; |
2 |
26 Feb 07 |
jari |
887 |
ampThresh2Copy_T = 0.0f; |
2 |
26 Feb 07 |
jari |
888 |
delThresh2Copy_T = 0.0f; |
2 |
26 Feb 07 |
jari |
889 |
|
2 |
26 Feb 07 |
jari |
890 |
analysisRoot = ((DefaultMutableTreeNode)(analysisNode.getChildAt(i))); |
2 |
26 Feb 07 |
jari |
891 |
object = analysisRoot.getUserObject(); |
2 |
26 Feb 07 |
jari |
892 |
if(object != null){ |
2 |
26 Feb 07 |
jari |
893 |
if(object instanceof LeafInfo){ |
2 |
26 Feb 07 |
jari |
894 |
algName = ((LeafInfo)object).toString(); |
2 |
26 Feb 07 |
jari |
895 |
} else if(object instanceof String) { |
2 |
26 Feb 07 |
jari |
896 |
algName = (String)object; |
2 |
26 Feb 07 |
jari |
897 |
} |
2 |
26 Feb 07 |
jari |
898 |
System.out.println(algName); |
2 |
26 Feb 07 |
jari |
899 |
trimName = getCGHAlgoNameWihtoutIndex(algName); |
2 |
26 Feb 07 |
jari |
900 |
if(trimName != null) { |
2 |
26 Feb 07 |
jari |
901 |
index = findCGHAlgoIndexFromFactory(trimName); |
2 |
26 Feb 07 |
jari |
902 |
System.out.println("CGH Algo index: " + index); |
2 |
26 Feb 07 |
jari |
903 |
} |
2 |
26 Feb 07 |
jari |
904 |
|
2 |
26 Feb 07 |
jari |
905 |
if(index != -1) { |
2 |
26 Feb 07 |
jari |
906 |
extraParam = new Vector(); |
2 |
26 Feb 07 |
jari |
907 |
treeEnum = analysisRoot.depthFirstEnumeration(); |
2 |
26 Feb 07 |
jari |
908 |
while (treeEnum.hasMoreElements()){ |
2 |
26 Feb 07 |
jari |
909 |
currentNode = (DefaultMutableTreeNode)treeEnum.nextElement(); |
2 |
26 Feb 07 |
jari |
910 |
if(currentNode.getUserObject() instanceof LeafInfo){ |
2 |
26 Feb 07 |
jari |
//System.out.println("\tLeafInfo"); |
2 |
26 Feb 07 |
jari |
912 |
System.out.print("\t"); |
2 |
26 Feb 07 |
jari |
913 |
System.out.println(((LeafInfo)currentNode.getUserObject()).getName()); |
2 |
26 Feb 07 |
jari |
914 |
} else if(currentNode.getUserObject() instanceof String) { |
2 |
26 Feb 07 |
jari |
//System.out.println("\tString"); |
2 |
26 Feb 07 |
jari |
916 |
System.out.print("\t"); |
2 |
26 Feb 07 |
jari |
917 |
String nodeStr = (String)currentNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
918 |
System.out.println(nodeStr); |
2 |
26 Feb 07 |
jari |
919 |
int i_T = nodeStr.lastIndexOf(":"); |
2 |
26 Feb 07 |
jari |
920 |
if (i_T != -1) { |
2 |
26 Feb 07 |
jari |
921 |
String nodeSubStr = nodeStr.substring(0, i_T); |
2 |
26 Feb 07 |
jari |
922 |
float floatVal = 0.0f; |
2 |
26 Feb 07 |
jari |
923 |
boolean notFloat = false; |
2 |
26 Feb 07 |
jari |
924 |
try { |
2 |
26 Feb 07 |
jari |
925 |
floatVal = Float.parseFloat(nodeStr.substring(i_T+1, nodeStr.length()).trim()); |
2 |
26 Feb 07 |
jari |
926 |
} catch (NumberFormatException ne){ |
2 |
26 Feb 07 |
jari |
927 |
System.out.println("File Name or InValid parameter"); |
2 |
26 Feb 07 |
jari |
928 |
notFloat = true; |
2 |
26 Feb 07 |
jari |
929 |
if(index == 8 || index == 9) { |
2 |
26 Feb 07 |
jari |
930 |
extraParam.add((nodeStr.substring(i_T+1, nodeStr.length()).trim())); |
2 |
26 Feb 07 |
jari |
931 |
} |
2 |
26 Feb 07 |
jari |
932 |
} |
2 |
26 Feb 07 |
jari |
933 |
if(!notFloat) { |
2 |
26 Feb 07 |
jari |
934 |
if(nodeSubStr.equals("Amplification Threshold")){ |
2 |
26 Feb 07 |
jari |
935 |
ampThresh_T = floatVal; |
2 |
26 Feb 07 |
jari |
936 |
} else if (nodeSubStr.equals("Deletion Threshold")) { |
2 |
26 Feb 07 |
jari |
937 |
delThresh_T = floatVal; |
2 |
26 Feb 07 |
jari |
938 |
} else if (nodeSubStr.equals("Amplification 2 Copy Threshold")) { |
2 |
26 Feb 07 |
jari |
939 |
ampThresh2Copy_T = floatVal; |
2 |
26 Feb 07 |
jari |
940 |
} else if (nodeSubStr.equals("Deletion 2 Copy Threshold")) { |
2 |
26 Feb 07 |
jari |
941 |
delThresh2Copy_T = floatVal; |
2 |
26 Feb 07 |
jari |
942 |
} |
2 |
26 Feb 07 |
jari |
943 |
} |
2 |
26 Feb 07 |
jari |
944 |
} |
2 |
26 Feb 07 |
jari |
945 |
} |
2 |
26 Feb 07 |
jari |
946 |
} |
2 |
26 Feb 07 |
jari |
//Re-creating analysis node |
2 |
26 Feb 07 |
jari |
948 |
System.out.println(algName + " " + ampThresh_T + " " + delThresh_T + " " + ampThresh2Copy_T + " " + delThresh2Copy_T); |
2 |
26 Feb 07 |
jari |
949 |
menu.setAmpThresh(ampThresh_T); |
2 |
26 Feb 07 |
jari |
950 |
menu.setDelThresh(delThresh_T); |
2 |
26 Feb 07 |
jari |
951 |
menu.setAmpThresh2Copy(ampThresh2Copy_T); |
2 |
26 Feb 07 |
jari |
952 |
menu.setDelThresh2Copy(delThresh2Copy_T); |
2 |
26 Feb 07 |
jari |
953 |
data.onCopyDeterminationChanged(menu); |
2 |
26 Feb 07 |
jari |
954 |
|
2 |
26 Feb 07 |
jari |
955 |
Action action = manager.getAction(ActionManager.CGH_ANALYSIS_ACTION+String.valueOf(index)); |
2 |
26 Feb 07 |
jari |
956 |
if(index == 4 || index == 5 || index == 6 || index == 7 || index == 8){ |
2 |
26 Feb 07 |
jari |
957 |
onFlankingRegionDeterminationChanged(); |
2 |
26 Feb 07 |
jari |
958 |
} |
2 |
26 Feb 07 |
jari |
959 |
runCghAnalysis(action, algName, i, extraParam); |
2 |
26 Feb 07 |
jari |
960 |
|
2 |
26 Feb 07 |
jari |
//Restore original thresholds |
2 |
26 Feb 07 |
jari |
962 |
menu.setAmpThresh(ampThresh); |
2 |
26 Feb 07 |
jari |
963 |
menu.setDelThresh(delThresh); |
2 |
26 Feb 07 |
jari |
964 |
menu.setAmpThresh2Copy(ampThresh2Copy); |
2 |
26 Feb 07 |
jari |
965 |
menu.setDelThresh2Copy(delThresh2Copy); |
2 |
26 Feb 07 |
jari |
966 |
data.onCopyDeterminationChanged(menu); |
2 |
26 Feb 07 |
jari |
967 |
|
2 |
26 Feb 07 |
jari |
968 |
removeCGHAnalysisNode(analysisRoot); |
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 |
973 |
|
2 |
26 Feb 07 |
jari |
974 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim CGH 4/26 |
2 |
26 Feb 07 |
jari |
* for State Saving |
2 |
26 Feb 07 |
jari |
* @param name |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
979 |
*/ |
2 |
26 Feb 07 |
jari |
980 |
private String getCGHAlgoNameWihtoutIndex(String name) { |
2 |
26 Feb 07 |
jari |
981 |
int last_Ind = name.lastIndexOf("("); |
2 |
26 Feb 07 |
jari |
982 |
if (last_Ind == -1) return null; |
2 |
26 Feb 07 |
jari |
983 |
return name.substring(0,last_Ind-1).trim(); |
2 |
26 Feb 07 |
jari |
984 |
} |
2 |
26 Feb 07 |
jari |
985 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim CGH 4/26 |
2 |
26 Feb 07 |
jari |
* for State Saving |
2 |
26 Feb 07 |
jari |
* @param name |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
990 |
*/ |
2 |
26 Feb 07 |
jari |
991 |
private int findCGHAlgoIndexFromFactory(String name){ |
2 |
26 Feb 07 |
jari |
992 |
String algNames[] = CGHAlgorithmFactory.getAlgorithimNames(); |
2 |
26 Feb 07 |
jari |
993 |
int i = 0; |
2 |
26 Feb 07 |
jari |
994 |
for(;i < algNames.length; i++){ |
2 |
26 Feb 07 |
jari |
995 |
if (name.equals(algNames[i])) |
2 |
26 Feb 07 |
jari |
996 |
return i; |
2 |
26 Feb 07 |
jari |
997 |
} |
2 |
26 Feb 07 |
jari |
//Special case for "LoadGeneList" option in CGHAnalysis Menu |
2 |
26 Feb 07 |
jari |
999 |
if(name.equals("GeneAlterations")) return 8; |
2 |
26 Feb 07 |
jari |
1000 |
|
2 |
26 Feb 07 |
jari |
1001 |
return -1; |
2 |
26 Feb 07 |
jari |
1002 |
} |
2 |
26 Feb 07 |
jari |
1003 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim CGH 4.26 |
2 |
26 Feb 07 |
jari |
* Deletes a CGH Analysis node for re-creation. |
2 |
26 Feb 07 |
jari |
* For State Saving |
2 |
26 Feb 07 |
jari |
1007 |
*/ |
2 |
26 Feb 07 |
jari |
1008 |
private String removeCGHAnalysisNode(DefaultMutableTreeNode node) { |
2 |
26 Feb 07 |
jari |
1009 |
if (node == null || node.getParent() == null) { |
2 |
26 Feb 07 |
jari |
1010 |
return null; |
2 |
26 Feb 07 |
jari |
1011 |
} |
2 |
26 Feb 07 |
jari |
1012 |
|
2 |
26 Feb 07 |
jari |
1013 |
TreePath parentPath = new TreePath(((DefaultMutableTreeNode)node.getParent()).getPath()); |
2 |
26 Feb 07 |
jari |
1014 |
((DefaultTreeModel)tree.getModel()).removeNodeFromParent(node); |
2 |
26 Feb 07 |
jari |
1015 |
((TreeSelectionModel)tree.getSelectionModel()).setSelectionPath(parentPath); |
2 |
26 Feb 07 |
jari |
1016 |
tree.scrollPathToVisible(parentPath); |
2 |
26 Feb 07 |
jari |
1017 |
|
2 |
26 Feb 07 |
jari |
1018 |
String nodeName = " "; |
2 |
26 Feb 07 |
jari |
1019 |
Object object = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
1020 |
if(object instanceof LeafInfo) |
2 |
26 Feb 07 |
jari |
1021 |
nodeName = ((LeafInfo)object).toString(); |
2 |
26 Feb 07 |
jari |
1022 |
else if(object instanceof String) |
2 |
26 Feb 07 |
jari |
1023 |
nodeName = (String)object; |
2 |
26 Feb 07 |
jari |
1024 |
|
2 |
26 Feb 07 |
jari |
1025 |
return nodeName; |
2 |
26 Feb 07 |
jari |
1026 |
|
2 |
26 Feb 07 |
jari |
1027 |
} |
2 |
26 Feb 07 |
jari |
1028 |
|
2 |
26 Feb 07 |
jari |
1029 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim CGH 4/26 |
2 |
26 Feb 07 |
jari |
* Inserts a specified CGH Analysis node into the analysis node at a specific location. |
2 |
26 Feb 07 |
jari |
* For State Saving |
2 |
26 Feb 07 |
jari |
1033 |
*/ |
2 |
26 Feb 07 |
jari |
1034 |
public synchronized void insertAnalysisResult(DefaultMutableTreeNode node, String nodeTitle, int location) { |
2 |
26 Feb 07 |
jari |
1035 |
if (node == null) { |
2 |
26 Feb 07 |
jari |
1036 |
return; |
2 |
26 Feb 07 |
jari |
1037 |
} |
2 |
26 Feb 07 |
jari |
1038 |
|
2 |
26 Feb 07 |
jari |
1039 |
modifiedResult = true; |
2 |
26 Feb 07 |
jari |
1040 |
node.setUserObject(nodeTitle); |
2 |
26 Feb 07 |
jari |
1041 |
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
1042 |
treeModel.insertNodeInto(node, analysisNode, location); |
2 |
26 Feb 07 |
jari |
1043 |
TreeSelectionModel selModel = tree.getSelectionModel(); |
2 |
26 Feb 07 |
jari |
1044 |
TreePath treePath = new TreePath(node.getPath()); |
2 |
26 Feb 07 |
jari |
1045 |
selModel.setSelectionPath(treePath); |
2 |
26 Feb 07 |
jari |
1046 |
tree.scrollPathToVisible(treePath); |
2 |
26 Feb 07 |
jari |
1047 |
JScrollBar bar = this.treeScrollPane.getHorizontalScrollBar(); |
2 |
26 Feb 07 |
jari |
1048 |
if(bar != null) |
2 |
26 Feb 07 |
jari |
1049 |
bar.setValue(0); |
2 |
26 Feb 07 |
jari |
1050 |
} |
2 |
26 Feb 07 |
jari |
1051 |
|
2 |
26 Feb 07 |
jari |
1052 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim 4/25 |
2 |
26 Feb 07 |
jari |
* For State Saving |
2 |
26 Feb 07 |
jari |
* @param action |
2 |
26 Feb 07 |
jari |
1056 |
*/ |
2 |
26 Feb 07 |
jari |
1057 |
private void runCghAnalysis(Action action, String nodeName, int location, Vector paramBuff){ |
2 |
26 Feb 07 |
jari |
//System.out.println("onCghAnalysis "); |
2 |
26 Feb 07 |
jari |
1059 |
DefaultMutableTreeNode result = null; |
2 |
26 Feb 07 |
jari |
1060 |
String className = (String)action.getValue(ActionManager.PARAMETER); |
2 |
26 Feb 07 |
jari |
1061 |
try { |
2 |
26 Feb 07 |
jari |
1062 |
Class clazz = Class.forName(className); |
2 |
26 Feb 07 |
jari |
1063 |
NumberOfAlterationsCalculator gui = (NumberOfAlterationsCalculator)clazz.newInstance(); |
2 |
26 Feb 07 |
jari |
1064 |
if(gui instanceof LoadGeneList) { |
2 |
26 Feb 07 |
jari |
1065 |
File file = new File((String)paramBuff.get(0)); |
2 |
26 Feb 07 |
jari |
1066 |
result = ((LoadGeneList)gui).execute(framework, file); |
2 |
26 Feb 07 |
jari |
1067 |
} else if (gui instanceof CompareExperiments) { |
2 |
26 Feb 07 |
jari |
1068 |
int[] indices = {getSampleIndex((String)paramBuff.get(0)),getSampleIndex((String)paramBuff.get(1))}; |
2 |
26 Feb 07 |
jari |
1069 |
System.out.println("Exprs: " + (String)paramBuff.get(0) + " " + (String)paramBuff.get(1)); |
2 |
26 Feb 07 |
jari |
1070 |
System.out.println("Indices: " + indices[0] + " " + indices[1]); |
2 |
26 Feb 07 |
jari |
1071 |
result = ((CompareExperiments)gui).execute(framework, indices); |
2 |
26 Feb 07 |
jari |
1072 |
} else { |
2 |
26 Feb 07 |
jari |
1073 |
result = gui.execute(framework); |
2 |
26 Feb 07 |
jari |
1074 |
} |
2 |
26 Feb 07 |
jari |
1075 |
insertAnalysisResult(result, nodeName, location); |
2 |
26 Feb 07 |
jari |
//addAnalysisResult(result); |
2 |
26 Feb 07 |
jari |
1077 |
} catch (ClassCastException e) { |
2 |
26 Feb 07 |
jari |
1078 |
System.out.println("Error: org.tigr.microarray.mev.cluster.gui.IClusterGUI interface is expected."); |
2 |
26 Feb 07 |
jari |
1079 |
ShowThrowableDialog.show(mainframe, "Analysis Error", false, e); |
2 |
26 Feb 07 |
jari |
1080 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1081 |
ShowThrowableDialog.show(mainframe, "Analysis Error", false, e); |
2 |
26 Feb 07 |
jari |
1082 |
} |
2 |
26 Feb 07 |
jari |
1083 |
} |
2 |
26 Feb 07 |
jari |
1084 |
|
2 |
26 Feb 07 |
jari |
1085 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim 4/27 |
2 |
26 Feb 07 |
jari |
* @param sampleName |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
1089 |
*/ |
2 |
26 Feb 07 |
jari |
1090 |
private int getSampleIndex(String sampleName) { |
2 |
26 Feb 07 |
jari |
1091 |
if (data == null) return -1; |
2 |
26 Feb 07 |
jari |
1092 |
|
2 |
26 Feb 07 |
jari |
1093 |
ArrayList featuresList = data.getFeaturesList(); |
2 |
26 Feb 07 |
jari |
1094 |
for(int i = 0; i < featuresList.size(); i++){ |
2 |
26 Feb 07 |
jari |
1095 |
if (((ISlideData)featuresList.get(i)).getSlideDataName().equals(sampleName)) |
2 |
26 Feb 07 |
jari |
1096 |
return i; |
2 |
26 Feb 07 |
jari |
1097 |
} |
2 |
26 Feb 07 |
jari |
1098 |
return -1; |
2 |
26 Feb 07 |
jari |
1099 |
} |
2 |
26 Feb 07 |
jari |
1100 |
|
2 |
26 Feb 07 |
jari |
1101 |
private void saveClusterRepositories(XMLEncoder oos) throws IOException { |
2 |
26 Feb 07 |
jari |
1102 |
Boolean isGeneClusterRepository; |
2 |
26 Feb 07 |
jari |
1103 |
Boolean isExperimentClusterRepository; |
2 |
26 Feb 07 |
jari |
1104 |
|
2 |
26 Feb 07 |
jari |
1105 |
if(this.geneClusterRepository == null) { |
2 |
26 Feb 07 |
jari |
1106 |
isGeneClusterRepository = new Boolean(false); |
2 |
26 Feb 07 |
jari |
1107 |
oos.writeObject(isGeneClusterRepository); |
2 |
26 Feb 07 |
jari |
1108 |
} else { |
2 |
26 Feb 07 |
jari |
1109 |
isGeneClusterRepository = new Boolean(true); |
2 |
26 Feb 07 |
jari |
1110 |
oos.writeObject(isGeneClusterRepository); |
2 |
26 Feb 07 |
jari |
1111 |
oos.writeObject(this.geneClusterRepository); |
2 |
26 Feb 07 |
jari |
1112 |
} |
2 |
26 Feb 07 |
jari |
1113 |
if(this.experimentClusterRepository == null) { |
2 |
26 Feb 07 |
jari |
1114 |
isExperimentClusterRepository = new Boolean(false); |
2 |
26 Feb 07 |
jari |
1115 |
oos.writeObject(isExperimentClusterRepository); |
2 |
26 Feb 07 |
jari |
1116 |
} else{ |
2 |
26 Feb 07 |
jari |
1117 |
isExperimentClusterRepository = new Boolean(true); |
2 |
26 Feb 07 |
jari |
1118 |
oos.writeObject(isExperimentClusterRepository); |
2 |
26 Feb 07 |
jari |
1119 |
oos.writeObject(this.experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
1120 |
} |
2 |
26 Feb 07 |
jari |
1121 |
} |
2 |
26 Feb 07 |
jari |
1122 |
private void loadAnalysisFromFile(final File file) throws IOException, ClassNotFoundException { |
2 |
26 Feb 07 |
jari |
1123 |
|
2 |
26 Feb 07 |
jari |
1124 |
progressPanel = new StateSavingProgressPanel("Loading Saved Analysis", this); |
2 |
26 Feb 07 |
jari |
1125 |
progressPanel.setLocationRelativeTo(mainframe); |
2 |
26 Feb 07 |
jari |
1126 |
progressPanel.setVisible(true); |
2 |
26 Feb 07 |
jari |
1127 |
|
2 |
26 Feb 07 |
jari |
1128 |
Thread thread = new Thread( new Runnable(){ |
2 |
26 Feb 07 |
jari |
1129 |
public void run() { |
2 |
26 Feb 07 |
jari |
1130 |
try { |
2 |
26 Feb 07 |
jari |
1131 |
String javaTempDir = System.getProperty("java.io.tmpdir"); |
2 |
26 Feb 07 |
jari |
1132 |
if(!javaTempDir.endsWith(System.getProperty("file.separator"))) |
2 |
26 Feb 07 |
jari |
1133 |
javaTempDir = javaTempDir + System.getProperty("file.separator"); |
2 |
26 Feb 07 |
jari |
1134 |
File unzipDir = new File(javaTempDir + MultipleArrayViewer.CURRENT_TEMP_DIR); |
2 |
26 Feb 07 |
jari |
1135 |
if (!unzipDir.mkdir()) { |
2 |
26 Feb 07 |
jari |
1136 |
System.out.println("Couldn't create directory for unzipping:" + unzipDir); |
2 |
26 Feb 07 |
jari |
1137 |
} |
2 |
26 Feb 07 |
jari |
1138 |
|
2 |
26 Feb 07 |
jari |
1139 |
ZipFile zipFile = new ZipFile(file); |
2 |
26 Feb 07 |
jari |
1140 |
ZipInputStream zis = new ZipInputStream(new FileInputStream(file)); |
2 |
26 Feb 07 |
jari |
1141 |
File tmpXML = new File(unzipDir + System.getProperty("file.separator") + "mev_state.xml"); |
2 |
26 Feb 07 |
jari |
1142 |
tmpXML.deleteOnExit(); |
2 |
26 Feb 07 |
jari |
1143 |
|
2 |
26 Feb 07 |
jari |
1144 |
progressPanel.update("Uncompressing Data"); |
2 |
26 Feb 07 |
jari |
1145 |
progressPanel.setIndeterminate(false); |
2 |
26 Feb 07 |
jari |
1146 |
progressPanel.setMaximum(zipFile.size()); |
2 |
26 Feb 07 |
jari |
1147 |
int len; |
2 |
26 Feb 07 |
jari |
1148 |
byte[] buf = new byte[1024]; |
2 |
26 Feb 07 |
jari |
1149 |
ZipEntry entry; |
2 |
26 Feb 07 |
jari |
1150 |
while((entry = zis.getNextEntry()) != null){ |
2 |
26 Feb 07 |
jari |
1151 |
if(entry.getName().endsWith(".xml")){ //XML file is only ascii file in there. |
2 |
26 Feb 07 |
jari |
1152 |
InputStreamReader isr = new InputStreamReader(zis); |
2 |
26 Feb 07 |
jari |
1153 |
FileWriter fw = new FileWriter(tmpXML); |
2 |
26 Feb 07 |
jari |
1154 |
while ((len = isr.read()) != -1) { |
2 |
26 Feb 07 |
jari |
1155 |
fw.write(len); |
2 |
26 Feb 07 |
jari |
1156 |
} |
2 |
26 Feb 07 |
jari |
1157 |
fw.close(); |
2 |
26 Feb 07 |
jari |
1158 |
} else { |
2 |
26 Feb 07 |
jari |
1159 |
String outFile = unzipDir + System.getProperty("file.separator") + entry.getName(); |
2 |
26 Feb 07 |
jari |
1160 |
DataOutputStream dos = new DataOutputStream(new FileOutputStream(new File(outFile))); |
2 |
26 Feb 07 |
jari |
1161 |
while ((len = zis.read(buf)) > 0) { |
2 |
26 Feb 07 |
jari |
1162 |
dos.write(buf, 0, len); |
2 |
26 Feb 07 |
jari |
1163 |
} |
2 |
26 Feb 07 |
jari |
1164 |
dos.close(); |
2 |
26 Feb 07 |
jari |
1165 |
} |
2 |
26 Feb 07 |
jari |
1166 |
zis.closeEntry(); |
2 |
26 Feb 07 |
jari |
1167 |
progressPanel.increment(); |
2 |
26 Feb 07 |
jari |
1168 |
} |
2 |
26 Feb 07 |
jari |
1169 |
zis.close(); |
2 |
26 Feb 07 |
jari |
1170 |
zipFile.close(); |
2 |
26 Feb 07 |
jari |
1171 |
|
2 |
26 Feb 07 |
jari |
1172 |
BufferedInputStream ois = new BufferedInputStream(new FileInputStream(tmpXML)); |
2 |
26 Feb 07 |
jari |
1173 |
XMLDecoder xmld = new XMLDecoder(ois); |
2 |
26 Feb 07 |
jari |
1174 |
|
2 |
26 Feb 07 |
jari |
1175 |
|
2 |
26 Feb 07 |
jari |
1176 |
progressPanel.update("Loading Metadata"); |
2 |
26 Feb 07 |
jari |
1177 |
progressPanel.setIndeterminate(true); |
2 |
26 Feb 07 |
jari |
1178 |
|
2 |
26 Feb 07 |
jari |
1179 |
smd = (SessionMetaData)xmld.readObject(); |
2 |
26 Feb 07 |
jari |
1180 |
processMeVPrefs(smd.getMevSessionPrefs()); |
2 |
26 Feb 07 |
jari |
1181 |
|
2 |
26 Feb 07 |
jari |
1182 |
progressPanel.update("Loading Experiment Data"); |
2 |
26 Feb 07 |
jari |
1183 |
data = (MultipleArrayData)xmld.readObject(); |
2 |
26 Feb 07 |
jari |
1184 |
int data_type = data.getDataType(); |
2 |
26 Feb 07 |
jari |
1185 |
if (data_type!=0 || data_type!=1){ |
2 |
26 Feb 07 |
jari |
1186 |
TMEV.setDataType(TMEV.DATA_TYPE_AFFY); |
2 |
26 Feb 07 |
jari |
1187 |
} |
2 |
26 Feb 07 |
jari |
1188 |
|
2 |
26 Feb 07 |
jari |
1189 |
if(data.isCGHData()) { |
2 |
26 Feb 07 |
jari |
1190 |
initializeCGH(); |
2 |
26 Feb 07 |
jari |
1191 |
} |
2 |
26 Feb 07 |
jari |
1192 |
|
2 |
26 Feb 07 |
jari |
1193 |
progressPanel.update("Loading Clusters"); |
2 |
26 Feb 07 |
jari |
1194 |
if(((Boolean)xmld.readObject()).booleanValue()){ |
2 |
26 Feb 07 |
jari |
1195 |
geneClusterRepository = (ClusterRepository)xmld.readObject(); |
2 |
26 Feb 07 |
jari |
1196 |
data.setGeneClusterRepository(geneClusterRepository); |
2 |
26 Feb 07 |
jari |
1197 |
geneClusterRepository.setFramework(framework); |
2 |
26 Feb 07 |
jari |
1198 |
geneClusterManager = new ClusterTable(geneClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
1199 |
DefaultMutableTreeNode genesNode = new DefaultMutableTreeNode(new LeafInfo("Gene Clusters", geneClusterManager), false); |
2 |
26 Feb 07 |
jari |
1200 |
addNode(clusterNode, genesNode); |
2 |
26 Feb 07 |
jari |
1201 |
|
2 |
26 Feb 07 |
jari |
1202 |
} |
2 |
26 Feb 07 |
jari |
1203 |
if(((Boolean)xmld.readObject()).booleanValue()){ |
2 |
26 Feb 07 |
jari |
1204 |
experimentClusterRepository = (ClusterRepository)xmld.readObject(); |
2 |
26 Feb 07 |
jari |
1205 |
data.setExperimentClusterRepository(experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
1206 |
experimentClusterRepository.setFramework(framework); |
2 |
26 Feb 07 |
jari |
1207 |
|
2 |
26 Feb 07 |
jari |
1208 |
experimentClusterManager = new ClusterTable(experimentClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
1209 |
DefaultMutableTreeNode experimentNode = new DefaultMutableTreeNode(new LeafInfo("Sample Clusters", experimentClusterManager), false); |
2 |
26 Feb 07 |
jari |
1210 |
addNode(clusterNode, experimentNode); |
2 |
26 Feb 07 |
jari |
1211 |
} |
2 |
26 Feb 07 |
jari |
1212 |
|
2 |
26 Feb 07 |
jari |
1213 |
|
2 |
26 Feb 07 |
jari |
1214 |
progressPanel.update("Loading Analysis Results"); |
2 |
26 Feb 07 |
jari |
1215 |
int location = tree.getModel().getIndexOfChild(tree.getRoot(), analysisNode); |
2 |
26 Feb 07 |
jari |
1216 |
tree.removeNode(analysisNode); |
2 |
26 Feb 07 |
jari |
1217 |
analysisNode = (DefaultMutableTreeNode)xmld.readObject(); |
2 |
26 Feb 07 |
jari |
1218 |
tree.insertNode(analysisNode, tree.getRoot(), location); |
2 |
26 Feb 07 |
jari |
1219 |
tree.setAnalysisNode(analysisNode); |
2 |
26 Feb 07 |
jari |
1220 |
|
2 |
26 Feb 07 |
jari |
1221 |
loadHistoryNode((DefaultMutableTreeNode)xmld.readObject()); |
2 |
26 Feb 07 |
jari |
1222 |
|
2 |
26 Feb 07 |
jari |
1223 |
if(data.isCGHData()) { |
2 |
26 Feb 07 |
jari |
1224 |
initializeCGH(); |
2 |
26 Feb 07 |
jari |
1225 |
} |
2 |
26 Feb 07 |
jari |
1226 |
|
2 |
26 Feb 07 |
jari |
//Refresh views, etc |
2 |
26 Feb 07 |
jari |
1228 |
data.updateSpotColors(); |
2 |
26 Feb 07 |
jari |
1229 |
data.updateExperimentColors(); |
2 |
26 Feb 07 |
jari |
1230 |
|
2 |
26 Feb 07 |
jari |
//get the experiment label keys |
2 |
26 Feb 07 |
jari |
1232 |
menubar.replaceExperimentLabelMenuItems(data.getSlideNameKeyArray()); |
2 |
26 Feb 07 |
jari |
1233 |
data.setSampleLabelKey(MultipleArrayData.DEFAULT_SAMPLE_ANNOTATION_KEY); |
2 |
26 Feb 07 |
jari |
//populate the display menu |
2 |
26 Feb 07 |
jari |
1235 |
menubar.replaceLabelMenuItems(data.getFieldNames()); |
2 |
26 Feb 07 |
jari |
1236 |
menubar.replaceSortMenuItems(data.getFieldNames()); |
2 |
26 Feb 07 |
jari |
1237 |
|
2 |
26 Feb 07 |
jari |
1238 |
if(data.isCGHData()) { |
2 |
26 Feb 07 |
jari |
1239 |
createCGHAnalysisNodes(); |
2 |
26 Feb 07 |
jari |
1240 |
initializeCGHViews(); |
2 |
26 Feb 07 |
jari |
1241 |
} |
2 |
26 Feb 07 |
jari |
1242 |
|
2 |
26 Feb 07 |
jari |
1243 |
setMaxCY3AndCY5(); |
2 |
26 Feb 07 |
jari |
1244 |
systemEnable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
1245 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
1246 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
1247 |
fireHeaderChanged(); |
2 |
26 Feb 07 |
jari |
1248 |
|
2 |
26 Feb 07 |
jari |
1249 |
|
2 |
26 Feb 07 |
jari |
//Add time node to the analysis node |
2 |
26 Feb 07 |
jari |
1251 |
Date date = new Date(System.currentTimeMillis()); |
2 |
26 Feb 07 |
jari |
1252 |
DateFormat format = DateFormat.getDateTimeInstance(); |
2 |
26 Feb 07 |
jari |
1253 |
|
2 |
26 Feb 07 |
jari |
1254 |
format.setTimeZone(TimeZone.getDefault()); |
2 |
26 Feb 07 |
jari |
1255 |
DefaultMutableTreeNode node = new DefaultMutableTreeNode(format.format(date)); |
2 |
26 Feb 07 |
jari |
1256 |
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
1257 |
treeModel.insertNodeInto(node, analysisNode, analysisNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
1258 |
|
2 |
26 Feb 07 |
jari |
1259 |
TreePath path = new TreePath(((DefaultTreeModel)tree.getModel()).getPathToRoot(analysisNode)); |
2 |
26 Feb 07 |
jari |
1260 |
tree.expandPath(path); |
2 |
26 Feb 07 |
jari |
1261 |
path = new TreePath(((DefaultTreeModel)tree.getModel()).getPathToRoot(historyNode)); |
2 |
26 Feb 07 |
jari |
1262 |
tree.expandPath(path); |
2 |
26 Feb 07 |
jari |
1263 |
|
2 |
26 Feb 07 |
jari |
//signal mev analysis loaded |
2 |
26 Feb 07 |
jari |
1265 |
menubar.systemEnable(TMEV.ANALYSIS_LOADED); |
2 |
26 Feb 07 |
jari |
1266 |
|
2 |
26 Feb 07 |
jari |
//pcahan |
2 |
26 Feb 07 |
jari |
1268 |
if(TMEV.getDataType() == TMEV.DATA_TYPE_AFFY){ |
2 |
26 Feb 07 |
jari |
1269 |
menubar.addAffyFilterMenuItems(); |
2 |
26 Feb 07 |
jari |
1270 |
} |
2 |
26 Feb 07 |
jari |
1271 |
|
2 |
26 Feb 07 |
jari |
//signal mev analysis loaded |
2 |
26 Feb 07 |
jari |
1273 |
menubar.systemEnable(TMEV.ANALYSIS_LOADED); |
2 |
26 Feb 07 |
jari |
1274 |
|
2 |
26 Feb 07 |
jari |
//pcahan |
2 |
26 Feb 07 |
jari |
1276 |
if(TMEV.getDataType() == TMEV.DATA_TYPE_AFFY){ |
2 |
26 Feb 07 |
jari |
1277 |
menubar.addAffyFilterMenuItems(); |
2 |
26 Feb 07 |
jari |
1278 |
} |
2 |
26 Feb 07 |
jari |
1279 |
progressPanel.setIndeterminate(false); |
2 |
26 Feb 07 |
jari |
1280 |
((HistoryViewer)(((LeafInfo)(((DefaultMutableTreeNode)historyNode.getChildAt(0)).getUserObject())).getViewer())).addHistory("Load analysis: " + currentAnalysisFile); |
2 |
26 Feb 07 |
jari |
1281 |
|
2 |
26 Feb 07 |
jari |
1282 |
ois.close(); |
2 |
26 Feb 07 |
jari |
1283 |
xmld.close(); |
2 |
26 Feb 07 |
jari |
1284 |
|
2 |
26 Feb 07 |
jari |
1285 |
currentAnalysisFile = file; |
2 |
26 Feb 07 |
jari |
//set tmev.cfg to formatted path |
2 |
26 Feb 07 |
jari |
1287 |
TMEV.updateDataPath(formatDataPath(file.getPath())); |
2 |
26 Feb 07 |
jari |
//set variable to OS format path |
2 |
26 Feb 07 |
jari |
1289 |
TMEV.setDataPath(file.getParentFile().getPath()); |
2 |
26 Feb 07 |
jari |
1290 |
|
2 |
26 Feb 07 |
jari |
1291 |
String[] files = unzipDir.list(); |
2 |
26 Feb 07 |
jari |
1292 |
for(int i=0; i<files.length; i++){ |
2 |
26 Feb 07 |
jari |
1293 |
if(!new File(unzipDir + System.getProperty("file.separator") + files[i]).delete()) |
2 |
26 Feb 07 |
jari |
1294 |
System.out.println("Can't delete " + unzipDir + System.getProperty("file.separator") + files[i]); |
2 |
26 Feb 07 |
jari |
1295 |
} |
2 |
26 Feb 07 |
jari |
1296 |
if(!unzipDir.delete()) |
2 |
26 Feb 07 |
jari |
1297 |
System.out.println("Couldn't delete " + unzipDir.toString()); |
2 |
26 Feb 07 |
jari |
1298 |
|
2 |
26 Feb 07 |
jari |
1299 |
((HistoryViewer)(((LeafInfo)(((DefaultMutableTreeNode)historyNode.getChildAt(0)).getUserObject())).getViewer())).addHistory("Load analysis: " + file); |
2 |
26 Feb 07 |
jari |
1300 |
|
2 |
26 Feb 07 |
jari |
1301 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1302 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
1303 |
cleanUp(); |
2 |
26 Feb 07 |
jari |
1304 |
JOptionPane.showMessageDialog(MultipleArrayViewer.this, "Analysis was not loaded. Error reading input file.", |
2 |
26 Feb 07 |
jari |
1305 |
"Load Analysis Error", JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
1306 |
System.out.println(e.getMessage()); |
2 |
26 Feb 07 |
jari |
1307 |
} |
2 |
26 Feb 07 |
jari |
1308 |
progressPanel.dispose(); |
2 |
26 Feb 07 |
jari |
1309 |
} |
2 |
26 Feb 07 |
jari |
1310 |
}); |
2 |
26 Feb 07 |
jari |
1311 |
thread.setPriority(Thread.MIN_PRIORITY); |
2 |
26 Feb 07 |
jari |
1312 |
thread.start(); |
2 |
26 Feb 07 |
jari |
1313 |
} |
2 |
26 Feb 07 |
jari |
1314 |
/** |
2 |
26 Feb 07 |
jari |
* Store MultipleArrayViewer graphical preferences here. |
2 |
26 Feb 07 |
jari |
1316 |
*/ |
2 |
26 Feb 07 |
jari |
1317 |
private void prepSessionMetaData(MEVSessionPrefs msp) { |
2 |
26 Feb 07 |
jari |
1318 |
try { |
2 |
26 Feb 07 |
jari |
1319 |
msp.setMaxRatioScale(menubar.getDisplayMenu().getMaxRatioScale()); |
2 |
26 Feb 07 |
jari |
1320 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1321 |
try { |
2 |
26 Feb 07 |
jari |
1322 |
msp.setMinRatioScale(menubar.getDisplayMenu().getMinRatioScale()); |
2 |
26 Feb 07 |
jari |
1323 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1324 |
try { |
2 |
26 Feb 07 |
jari |
1325 |
msp.setMidRatioScale(menubar.getDisplayMenu().getMidRatioValue()); |
2 |
26 Feb 07 |
jari |
1326 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1327 |
try { |
2 |
26 Feb 07 |
jari |
1328 |
msp.setMaxCY3(menubar.getDisplayMenu().getMaxCY3Scale()); |
2 |
26 Feb 07 |
jari |
1329 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1330 |
try { |
2 |
26 Feb 07 |
jari |
1331 |
msp.setMaxCY5(menubar.getDisplayMenu().getMaxCY5Scale()); |
2 |
26 Feb 07 |
jari |
1332 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1333 |
try { |
2 |
26 Feb 07 |
jari |
1334 |
msp.setColorGradientState(menubar.getDisplayMenu().getColorGradientState()); |
2 |
26 Feb 07 |
jari |
1335 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1336 |
try { |
2 |
26 Feb 07 |
jari |
1337 |
msp.setColorScheme(menubar.getColorScheme()); |
2 |
26 Feb 07 |
jari |
1338 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1339 |
try { |
2 |
26 Feb 07 |
jari |
1340 |
msp.setPositiveGradientImageWrapper(new BufferedImageWrapper(menubar.getDisplayMenu().getPositiveGradientImage())); |
2 |
26 Feb 07 |
jari |
1341 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1342 |
try { |
2 |
26 Feb 07 |
jari |
1343 |
msp.setNegativeGradientImageWrapper(new BufferedImageWrapper(menubar.getDisplayMenu().getNegativeGradientImage())); |
2 |
26 Feb 07 |
jari |
1344 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1345 |
try { |
2 |
26 Feb 07 |
jari |
1346 |
msp.setAutoScale(auto_scale); |
2 |
26 Feb 07 |
jari |
1347 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1348 |
try { |
2 |
26 Feb 07 |
jari |
1349 |
msp.setElementSize(menubar.getDisplayMenu().getElementSize()); |
2 |
26 Feb 07 |
jari |
1350 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1351 |
} |
2 |
26 Feb 07 |
jari |
1352 |
private void processMeVPrefs(MEVSessionPrefs msp) { |
2 |
26 Feb 07 |
jari |
1353 |
try { |
2 |
26 Feb 07 |
jari |
1354 |
menubar.setMaxRatioScale(msp.getMaxRatioScale()); |
2 |
26 Feb 07 |
jari |
1355 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1356 |
try { |
2 |
26 Feb 07 |
jari |
1357 |
menubar.setMidRatioValue(msp.getMidRatioScale()); |
2 |
26 Feb 07 |
jari |
1358 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1359 |
try { |
2 |
26 Feb 07 |
jari |
1360 |
menubar.setMinRatioScale(msp.getMinRatioScale()); |
2 |
26 Feb 07 |
jari |
1361 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1362 |
try { |
2 |
26 Feb 07 |
jari |
1363 |
this.menubar.setMaxCY3Scale(msp.getMaxCY3()); |
2 |
26 Feb 07 |
jari |
1364 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1365 |
try { |
2 |
26 Feb 07 |
jari |
1366 |
this.menubar.setMaxCY5Scale(msp.getMaxCY5()); |
2 |
26 Feb 07 |
jari |
1367 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1368 |
try { |
2 |
26 Feb 07 |
jari |
1369 |
this.menubar.setColorGradientState(msp.isColorGradientState()); |
2 |
26 Feb 07 |
jari |
1370 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1371 |
try { |
2 |
26 Feb 07 |
jari |
1372 |
this.menubar.setColorSchemeIndex(msp.getColorScheme()); |
2 |
26 Feb 07 |
jari |
1373 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1374 |
try { |
2 |
26 Feb 07 |
jari |
1375 |
this.menubar.setPositiveCustomGradient(msp.getPositiveGradientImageWrapper().getBufferedImage()); |
2 |
26 Feb 07 |
jari |
1376 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1377 |
try { |
2 |
26 Feb 07 |
jari |
1378 |
this.menubar.setNegativeCustomGradient(msp.getNegativeGradientImageWrapper().getBufferedImage()); |
2 |
26 Feb 07 |
jari |
1379 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1380 |
try { |
2 |
26 Feb 07 |
jari |
1381 |
this.auto_scale = msp.isAutoScale(); |
2 |
26 Feb 07 |
jari |
1382 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1383 |
try { |
2 |
26 Feb 07 |
jari |
1384 |
this.menubar.setElementSize(msp.getElementSize().width, msp.getElementSize().height); |
2 |
26 Feb 07 |
jari |
1385 |
} catch (NullPointerException npe){npe.printStackTrace();} |
2 |
26 Feb 07 |
jari |
1386 |
|
2 |
26 Feb 07 |
jari |
1387 |
} |
2 |
26 Feb 07 |
jari |
1388 |
|
2 |
26 Feb 07 |
jari |
1389 |
private void loadAnalysis() { |
2 |
26 Feb 07 |
jari |
1390 |
String dataPath = TMEV.getDataPath(); |
2 |
26 Feb 07 |
jari |
1391 |
File pathFile = TMEV.getFile("data/"); |
2 |
26 Feb 07 |
jari |
1392 |
|
2 |
26 Feb 07 |
jari |
1393 |
if(dataPath != null) { |
2 |
26 Feb 07 |
jari |
1394 |
pathFile = new File(dataPath); |
2 |
26 Feb 07 |
jari |
1395 |
if(!pathFile.exists()) |
2 |
26 Feb 07 |
jari |
1396 |
pathFile = TMEV.getFile("data/"); |
2 |
26 Feb 07 |
jari |
1397 |
} |
2 |
26 Feb 07 |
jari |
1398 |
|
2 |
26 Feb 07 |
jari |
1399 |
File file; |
2 |
26 Feb 07 |
jari |
1400 |
try { |
2 |
26 Feb 07 |
jari |
1401 |
|
2 |
26 Feb 07 |
jari |
//opens a single zip file, unzips it, and reads from |
2 |
26 Feb 07 |
jari |
//the resulting files |
2 |
26 Feb 07 |
jari |
1404 |
JFileChooser chooser = new JFileChooser(pathFile); |
2 |
26 Feb 07 |
jari |
1405 |
chooser.setFileView(new AnalysisFileView()); |
2 |
26 Feb 07 |
jari |
1406 |
chooser.setFileFilter(new AnalysisFileFilter()); |
2 |
26 Feb 07 |
jari |
1407 |
|
2 |
26 Feb 07 |
jari |
1408 |
if(chooser.showOpenDialog(this) == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
1409 |
file = chooser.getSelectedFile(); |
2 |
26 Feb 07 |
jari |
1410 |
loadAnalysisFromFile(file); |
2 |
26 Feb 07 |
jari |
1411 |
} |
2 |
26 Feb 07 |
jari |
1412 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1413 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
1414 |
} |
2 |
26 Feb 07 |
jari |
1415 |
} |
2 |
26 Feb 07 |
jari |
1416 |
|
2 |
26 Feb 07 |
jari |
1417 |
/***************************** |
2 |
26 Feb 07 |
jari |
1418 |
* |
2 |
26 Feb 07 |
jari |
* Script code |
2 |
26 Feb 07 |
jari |
1420 |
*/ |
2 |
26 Feb 07 |
jari |
1421 |
private void onNewScript() { |
2 |
26 Feb 07 |
jari |
1422 |
if(this.scriptManager == null) { |
2 |
26 Feb 07 |
jari |
1423 |
scriptManager = new ScriptManager(framework, scriptNode, manager); |
2 |
26 Feb 07 |
jari |
1424 |
} |
2 |
26 Feb 07 |
jari |
1425 |
scriptManager.addNewScript(); |
2 |
26 Feb 07 |
jari |
1426 |
} |
2 |
26 Feb 07 |
jari |
1427 |
|
2 |
26 Feb 07 |
jari |
1428 |
private void onLoadScript() { |
2 |
26 Feb 07 |
jari |
1429 |
if(this.scriptManager == null) { |
2 |
26 Feb 07 |
jari |
1430 |
scriptManager = new ScriptManager(framework, scriptNode, manager); |
2 |
26 Feb 07 |
jari |
1431 |
} |
2 |
26 Feb 07 |
jari |
1432 |
scriptManager.loadScript(); |
2 |
26 Feb 07 |
jari |
1433 |
} |
2 |
26 Feb 07 |
jari |
1434 |
|
2 |
26 Feb 07 |
jari |
1435 |
|
2 |
26 Feb 07 |
jari |
1436 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the status bar text. |
2 |
26 Feb 07 |
jari |
1438 |
*/ |
2 |
26 Feb 07 |
jari |
1439 |
private String getStatusText() { |
2 |
26 Feb 07 |
jari |
1440 |
if(statusLabel == null) |
2 |
26 Feb 07 |
jari |
1441 |
return " "; |
2 |
26 Feb 07 |
jari |
1442 |
return statusLabel.getText(); |
2 |
26 Feb 07 |
jari |
1443 |
} |
2 |
26 Feb 07 |
jari |
1444 |
|
2 |
26 Feb 07 |
jari |
1445 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the status bar text. |
2 |
26 Feb 07 |
jari |
1447 |
*/ |
2 |
26 Feb 07 |
jari |
1448 |
private void setStatusText(String text) { |
2 |
26 Feb 07 |
jari |
1449 |
statusLabel.setText(text); |
2 |
26 Feb 07 |
jari |
1450 |
} |
2 |
26 Feb 07 |
jari |
1451 |
|
2 |
26 Feb 07 |
jari |
1452 |
/** |
2 |
26 Feb 07 |
jari |
* Returns an user object of a selected LeafInfo. |
2 |
26 Feb 07 |
jari |
1454 |
*/ |
2 |
26 Feb 07 |
jari |
1455 |
private Object getUserObject() { |
2 |
26 Feb 07 |
jari |
1456 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); |
2 |
26 Feb 07 |
jari |
1457 |
if (node == null) { |
2 |
26 Feb 07 |
jari |
1458 |
return null; |
2 |
26 Feb 07 |
jari |
1459 |
} |
2 |
26 Feb 07 |
jari |
1460 |
Object leaf = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
1461 |
if (!(leaf instanceof LeafInfo)) { |
2 |
26 Feb 07 |
jari |
1462 |
return null; |
2 |
26 Feb 07 |
jari |
1463 |
} |
2 |
26 Feb 07 |
jari |
1464 |
return((LeafInfo)leaf).getUserObject(); |
2 |
26 Feb 07 |
jari |
1465 |
} |
2 |
26 Feb 07 |
jari |
1466 |
|
2 |
26 Feb 07 |
jari |
1467 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the framework main frame. |
2 |
26 Feb 07 |
jari |
1469 |
*/ |
2 |
26 Feb 07 |
jari |
1470 |
public JFrame getFrame() { |
2 |
26 Feb 07 |
jari |
1471 |
return mainframe; |
2 |
26 Feb 07 |
jari |
1472 |
} |
2 |
26 Feb 07 |
jari |
1473 |
|
2 |
26 Feb 07 |
jari |
1474 |
/** |
2 |
26 Feb 07 |
jari |
* Moves the scroll pane content into specified coordinaties. |
2 |
26 Feb 07 |
jari |
1476 |
*/ |
2 |
26 Feb 07 |
jari |
1477 |
public void setContentLocation(int x, int y) { |
2 |
26 Feb 07 |
jari |
1478 |
Dimension viewSize = viewScrollPane.getViewport().getViewSize(); |
2 |
26 Feb 07 |
jari |
1479 |
Dimension extSize = viewScrollPane.getViewport().getExtentSize(); |
2 |
26 Feb 07 |
jari |
1480 |
if (extSize.height+y > viewSize.height) { |
2 |
26 Feb 07 |
jari |
1481 |
y = viewSize.height - extSize.height; |
2 |
26 Feb 07 |
jari |
1482 |
} |
2 |
26 Feb 07 |
jari |
1483 |
viewScrollPane.getViewport().setViewPosition(new Point(x, y)); |
2 |
26 Feb 07 |
jari |
1484 |
} |
2 |
26 Feb 07 |
jari |
1485 |
|
2 |
26 Feb 07 |
jari |
1486 |
/** |
2 |
26 Feb 07 |
jari |
* Creates the navigation tree. |
2 |
26 Feb 07 |
jari |
1488 |
*/ |
2 |
26 Feb 07 |
jari |
1489 |
private JScrollPane createTreeScrollPane(EventListener listener) { |
2 |
26 Feb 07 |
jari |
1490 |
DefaultMutableTreeNode root = new DefaultMutableTreeNode("MultipleExperimentViewer"); |
2 |
26 Feb 07 |
jari |
1491 |
|
2 |
26 Feb 07 |
jari |
1492 |
this.viewer = new MultipleArrayCanvas(this.framework, new Insets(0, 10, 0, 20)); |
2 |
26 Feb 07 |
jari |
1493 |
|
2 |
26 Feb 07 |
jari |
1494 |
LeafInfo mainViewLeafInfo = new LeafInfo("Main View", viewer); |
2 |
26 Feb 07 |
jari |
//mainViewerNode = new DefaultMutableTreeNode(mainViewLeafInfo, false); |
2 |
26 Feb 07 |
jari |
1496 |
mainViewerNode = new DefaultMutableTreeNode(mainViewLeafInfo, true); /* To add new nodes at this level */ |
2 |
26 Feb 07 |
jari |
1497 |
|
2 |
26 Feb 07 |
jari |
1498 |
root.add(mainViewerNode); |
2 |
26 Feb 07 |
jari |
1499 |
|
2 |
26 Feb 07 |
jari |
1500 |
clusterNode = new DefaultMutableTreeNode(new LeafInfo("Cluster Manager")); |
2 |
26 Feb 07 |
jari |
1501 |
root.add(clusterNode); |
2 |
26 Feb 07 |
jari |
1502 |
|
2 |
26 Feb 07 |
jari |
1503 |
analysisNode = new DefaultMutableTreeNode(new LeafInfo("Analysis Results")); |
2 |
26 Feb 07 |
jari |
1504 |
root.add(analysisNode); |
2 |
26 Feb 07 |
jari |
1505 |
|
2 |
26 Feb 07 |
jari |
1506 |
scriptNode = new DefaultMutableTreeNode(new LeafInfo("Script Manager")); |
2 |
26 Feb 07 |
jari |
1507 |
root.add(scriptNode); |
2 |
26 Feb 07 |
jari |
1508 |
|
2 |
26 Feb 07 |
jari |
1509 |
historyNode = new DefaultMutableTreeNode(new LeafInfo("History")); |
2 |
26 Feb 07 |
jari |
1510 |
root.add(historyNode); |
2 |
26 Feb 07 |
jari |
1511 |
historyLog = new HistoryViewer(); |
2 |
26 Feb 07 |
jari |
1512 |
historyNode.add(new DefaultMutableTreeNode(new LeafInfo("History Log", historyLog))); |
2 |
26 Feb 07 |
jari |
1513 |
|
2 |
26 Feb 07 |
jari |
1514 |
tree = new ResultTree(root); |
2 |
26 Feb 07 |
jari |
1515 |
tree.setAnalysisNode(analysisNode); |
2 |
26 Feb 07 |
jari |
1516 |
|
2 |
26 Feb 07 |
jari |
1517 |
tree.addTreeSelectionListener(listener); |
2 |
26 Feb 07 |
jari |
1518 |
tree.addMouseListener(listener); |
2 |
26 Feb 07 |
jari |
1519 |
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); |
2 |
26 Feb 07 |
jari |
1520 |
tree.setSelectionPath(new TreePath(mainViewerNode.getPath())); |
2 |
26 Feb 07 |
jari |
1521 |
tree.setEditable(false); |
2 |
26 Feb 07 |
jari |
1522 |
|
2 |
26 Feb 07 |
jari |
1523 |
ToolTipManager.sharedInstance().registerComponent(tree); |
2 |
26 Feb 07 |
jari |
1524 |
|
2 |
26 Feb 07 |
jari |
1525 |
|
2 |
26 Feb 07 |
jari |
1526 |
|
2 |
26 Feb 07 |
jari |
1527 |
return new JScrollPane(tree); |
2 |
26 Feb 07 |
jari |
1528 |
} |
2 |
26 Feb 07 |
jari |
1529 |
|
2 |
26 Feb 07 |
jari |
1530 |
/** |
2 |
26 Feb 07 |
jari |
* Creates the scroll pane to display calculation results. |
2 |
26 Feb 07 |
jari |
1532 |
*/ |
2 |
26 Feb 07 |
jari |
1533 |
private JScrollPane createViewScrollPane(EventListener listener) { |
2 |
26 Feb 07 |
jari |
1534 |
JScrollPane scrollPane = new JScrollPane(); |
2 |
26 Feb 07 |
jari |
//scrollPane.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE); |
2 |
26 Feb 07 |
jari |
1536 |
|
2 |
26 Feb 07 |
jari |
1537 |
scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); |
2 |
26 Feb 07 |
jari |
//scrollPane.getVerticalScrollBar().setToolTipText("Use up/down/pgup/pgdown to scroll image"); |
2 |
26 Feb 07 |
jari |
1539 |
KeyStroke up = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP, 0); |
2 |
26 Feb 07 |
jari |
1540 |
KeyStroke down = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN, 0); |
2 |
26 Feb 07 |
jari |
1541 |
KeyStroke pgup = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_UP, 0); |
2 |
26 Feb 07 |
jari |
1542 |
KeyStroke pgdown = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_DOWN, 0); |
2 |
26 Feb 07 |
jari |
1543 |
scrollPane.registerKeyboardAction(listener, "lineup", up, JComponent.WHEN_IN_FOCUSED_WINDOW); |
2 |
26 Feb 07 |
jari |
1544 |
scrollPane.registerKeyboardAction(listener, "linedown", down, JComponent.WHEN_IN_FOCUSED_WINDOW); |
2 |
26 Feb 07 |
jari |
1545 |
scrollPane.registerKeyboardAction(listener, "pageup", pgup, JComponent.WHEN_IN_FOCUSED_WINDOW); |
2 |
26 Feb 07 |
jari |
1546 |
scrollPane.registerKeyboardAction(listener, "pagedown", pgdown, JComponent.WHEN_IN_FOCUSED_WINDOW); |
2 |
26 Feb 07 |
jari |
1547 |
return scrollPane; |
2 |
26 Feb 07 |
jari |
1548 |
} |
2 |
26 Feb 07 |
jari |
1549 |
|
2 |
26 Feb 07 |
jari |
1550 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a current viewer. The viewer content will be inserted |
2 |
26 Feb 07 |
jari |
* into the scroll pane view port and the viewer header will |
2 |
26 Feb 07 |
jari |
* be used as the scroll pane header view. |
2 |
26 Feb 07 |
jari |
1554 |
*/ |
2 |
26 Feb 07 |
jari |
/*private void setCurrentViewer(IViewer viewer) { |
2 |
26 Feb 07 |
jari |
if (viewer == null || viewer.getContentComponent() == null) { |
2 |
26 Feb 07 |
jari |
return; |
2 |
26 Feb 07 |
jari |
1558 |
} |
2 |
26 Feb 07 |
jari |
if (this.viewer != null) { |
2 |
26 Feb 07 |
jari |
this.viewer.onDeselected(); |
2 |
26 Feb 07 |
jari |
1561 |
} |
2 |
26 Feb 07 |
jari |
this.viewer = viewer; |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setViewportView(this.viewer.getContentComponent()); |
2 |
26 Feb 07 |
jari |
1564 |
|
2 |
26 Feb 07 |
jari |
JPanel emptycorner = new JPanel(); |
2 |
26 Feb 07 |
jari |
emptycorner.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
emptycorner.setOpaque(true); |
2 |
26 Feb 07 |
jari |
1568 |
|
2 |
26 Feb 07 |
jari |
if (viewer instanceof GDMGeneViewer == true) { |
2 |
26 Feb 07 |
jari |
1570 |
|
2 |
26 Feb 07 |
jari |
GDMGeneViewer gdmV = (GDMGeneViewer)viewer; |
2 |
26 Feb 07 |
jari |
1572 |
|
2 |
26 Feb 07 |
jari |
gdmV.setMultipleArrayData(data); |
2 |
26 Feb 07 |
jari |
1574 |
|
2 |
26 Feb 07 |
jari |
gdmV.setMainFrame(mainframe); |
2 |
26 Feb 07 |
jari |
1576 |
|
2 |
26 Feb 07 |
jari |
JComponent colHeader = gdmV.getColumnHeaderComponent(); |
2 |
26 Feb 07 |
jari |
if (colHeader != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setColumnHeaderView(colHeader); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setColumnHeader(null); |
2 |
26 Feb 07 |
jari |
1582 |
} |
2 |
26 Feb 07 |
jari |
1583 |
|
2 |
26 Feb 07 |
jari |
JComponent rowHeader = gdmV.getRowHeaderComponent(); |
2 |
26 Feb 07 |
jari |
if (rowHeader != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setRowHeaderView(rowHeader); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setRowHeader(null); |
2 |
26 Feb 07 |
jari |
1589 |
} |
2 |
26 Feb 07 |
jari |
1590 |
|
2 |
26 Feb 07 |
jari |
JComponent upperRightCornerSB = gdmV.getUpperRightCornerSB(); |
2 |
26 Feb 07 |
jari |
if (upperRightCornerSB != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, upperRightCornerSB); |
2 |
26 Feb 07 |
jari |
1594 |
} |
2 |
26 Feb 07 |
jari |
1595 |
|
2 |
26 Feb 07 |
jari |
JComponent lowerLeftCornerSB = gdmV.getLowerLeftCornerSB(); |
2 |
26 Feb 07 |
jari |
if (lowerLeftCornerSB != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, lowerLeftCornerSB); |
2 |
26 Feb 07 |
jari |
1599 |
} |
2 |
26 Feb 07 |
jari |
1600 |
|
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
2 |
26 Feb 07 |
jari |
1603 |
|
2 |
26 Feb 07 |
jari |
} else if (viewer instanceof GDMExpViewer == true) { |
2 |
26 Feb 07 |
jari |
1605 |
|
2 |
26 Feb 07 |
jari |
GDMExpViewer gdmV = (GDMExpViewer)viewer; |
2 |
26 Feb 07 |
jari |
1607 |
|
2 |
26 Feb 07 |
jari |
gdmV.setMultipleArrayData(data); |
2 |
26 Feb 07 |
jari |
1609 |
|
2 |
26 Feb 07 |
jari |
gdmV.setMainFrame(mainframe); |
2 |
26 Feb 07 |
jari |
1611 |
|
2 |
26 Feb 07 |
jari |
JComponent colHeader = gdmV.getColumnHeaderComponent(); |
2 |
26 Feb 07 |
jari |
if (colHeader != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setColumnHeaderView(colHeader); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setColumnHeader(null); |
2 |
26 Feb 07 |
jari |
1617 |
} |
2 |
26 Feb 07 |
jari |
1618 |
|
2 |
26 Feb 07 |
jari |
JComponent rowHeader = gdmV.getRowHeaderComponent(); |
2 |
26 Feb 07 |
jari |
if (rowHeader != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setRowHeaderView(rowHeader); |
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setRowHeader(null); |
2 |
26 Feb 07 |
jari |
1624 |
} |
2 |
26 Feb 07 |
jari |
1625 |
|
2 |
26 Feb 07 |
jari |
JComponent upperRightCornerSB = gdmV.getUpperRightCornerSB(); |
2 |
26 Feb 07 |
jari |
if (upperRightCornerSB != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, upperRightCornerSB); |
2 |
26 Feb 07 |
jari |
1629 |
} |
2 |
26 Feb 07 |
jari |
1630 |
|
2 |
26 Feb 07 |
jari |
JComponent lowerLeftCornerSB = gdmV.getLowerLeftCornerSB(); |
2 |
26 Feb 07 |
jari |
if (lowerLeftCornerSB != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, lowerLeftCornerSB); |
2 |
26 Feb 07 |
jari |
1634 |
} |
2 |
26 Feb 07 |
jari |
1635 |
|
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
2 |
26 Feb 07 |
jari |
1638 |
|
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
1640 |
|
2 |
26 Feb 07 |
jari |
JComponent header = viewer.getHeaderComponent(); |
2 |
26 Feb 07 |
jari |
if (header != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setColumnHeaderView(header); |
2 |
26 Feb 07 |
jari |
1644 |
|
2 |
26 Feb 07 |
jari |
if (this.viewScrollPane.getCorner(JScrollPane.UPPER_RIGHT_CORNER) != null) { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, emptycorner); |
2 |
26 Feb 07 |
jari |
1647 |
} |
2 |
26 Feb 07 |
jari |
1648 |
|
2 |
26 Feb 07 |
jari |
} else { |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setColumnHeader(null); |
2 |
26 Feb 07 |
jari |
1651 |
} |
2 |
26 Feb 07 |
jari |
this.viewScrollPane.setRowHeader(null); |
2 |
26 Feb 07 |
jari |
1653 |
|
2 |
26 Feb 07 |
jari |
1654 |
} |
2 |
26 Feb 07 |
jari |
1655 |
|
2 |
26 Feb 07 |
jari |
this.viewer.onSelected(framework); |
2 |
26 Feb 07 |
jari |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
handleThumbnailButton(this.viewer); |
2 |
26 Feb 07 |
jari |
1659 |
} |
2 |
26 Feb 07 |
jari |
1660 |
*/ |
2 |
26 Feb 07 |
jari |
1661 |
|
2 |
26 Feb 07 |
jari |
1662 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a current viewer. The viewer content will be inserted |
2 |
26 Feb 07 |
jari |
* into the scroll pane view port and the viewer header will |
2 |
26 Feb 07 |
jari |
* be used as the scroll pane header view. |
2 |
26 Feb 07 |
jari |
1666 |
*/ |
2 |
26 Feb 07 |
jari |
1667 |
|
2 |
26 Feb 07 |
jari |
1668 |
private void setCurrentViewer(IViewer viewer) { |
2 |
26 Feb 07 |
jari |
1669 |
|
2 |
26 Feb 07 |
jari |
1670 |
/* |
2 |
26 Feb 07 |
jari |
if (viewer == null || viewer.getContentComponent() == null) { |
2 |
26 Feb 07 |
jari |
return; |
2 |
26 Feb 07 |
jari |
1673 |
} |
2 |
26 Feb 07 |
jari |
1674 |
* |
2 |
26 Feb 07 |
jari |
1675 |
* |
2 |
26 Feb 07 |
jari |
* Above wascode changed to support nodes that have viewers with null content |
2 |
26 Feb 07 |
jari |
* These 'viewers' still implement onSelected for the sake of initialization |
2 |
26 Feb 07 |
jari |
* of node-based popups created after deserialization (loading an analysis) |
2 |
26 Feb 07 |
jari |
1679 |
* |
2 |
26 Feb 07 |
jari |
* The new corresponding code is in two blocks below marked by '&&'. |
2 |
26 Feb 07 |
jari |
1681 |
* |
2 |
26 Feb 07 |
jari |
* 12.16.2004 implemented for this purpose to handle new menus in PCA |
2 |
26 Feb 07 |
jari |
* for selection of displayed components. |
2 |
26 Feb 07 |
jari |
1684 |
*/ |
2 |
26 Feb 07 |
jari |
1685 |
|
2 |
26 Feb 07 |
jari |
// && handles the cases where selected node does not have an IViewer |
2 |
26 Feb 07 |
jari |
1687 |
if(viewer == null) { |
2 |
26 Feb 07 |
jari |
1688 |
return; |
2 |
26 Feb 07 |
jari |
1689 |
} |
2 |
26 Feb 07 |
jari |
1690 |
|
2 |
26 Feb 07 |
jari |
// && handles viewers that contain a null content component, *See Above* |
2 |
26 Feb 07 |
jari |
1692 |
if(viewer.getContentComponent() == null) { |
2 |
26 Feb 07 |
jari |
1693 |
viewer.onSelected(framework); |
2 |
26 Feb 07 |
jari |
1694 |
return; |
2 |
26 Feb 07 |
jari |
1695 |
} |
2 |
26 Feb 07 |
jari |
1696 |
|
2 |
26 Feb 07 |
jari |
1697 |
if (this.viewer != null) { |
2 |
26 Feb 07 |
jari |
1698 |
this.viewer.onDeselected(); |
2 |
26 Feb 07 |
jari |
1699 |
} |
2 |
26 Feb 07 |
jari |
1700 |
this.viewer = viewer; |
2 |
26 Feb 07 |
jari |
/* Raktim Nov 15, 2005 - CGH Specific |
2 |
26 Feb 07 |
jari |
* Special case to handle CGHPositionGraphViewer. |
2 |
26 Feb 07 |
jari |
* CGHPositionGraphViewer needs onSelected called before setting the viewport |
2 |
26 Feb 07 |
jari |
1704 |
*/ |
2 |
26 Feb 07 |
jari |
1705 |
if (this.viewer instanceof CGHPositionGraphViewer) { |
2 |
26 Feb 07 |
jari |
1706 |
this.viewer.onSelected(framework); |
2 |
26 Feb 07 |
jari |
1707 |
} |
2 |
26 Feb 07 |
jari |
1708 |
|
2 |
26 Feb 07 |
jari |
1709 |
this.viewScrollPane.setViewportView(this.viewer.getContentComponent()); |
2 |
26 Feb 07 |
jari |
1710 |
|
2 |
26 Feb 07 |
jari |
//Top Header (column header) |
2 |
26 Feb 07 |
jari |
1712 |
JComponent header = viewer.getHeaderComponent(); |
2 |
26 Feb 07 |
jari |
1713 |
if (header != null) { |
2 |
26 Feb 07 |
jari |
1714 |
this.viewScrollPane.setColumnHeaderView(header); |
2 |
26 Feb 07 |
jari |
1715 |
} else { |
2 |
26 Feb 07 |
jari |
1716 |
this.viewScrollPane.setColumnHeader(null); |
2 |
26 Feb 07 |
jari |
1717 |
} |
2 |
26 Feb 07 |
jari |
1718 |
|
2 |
26 Feb 07 |
jari |
//Left header (row header) |
2 |
26 Feb 07 |
jari |
1720 |
JComponent rowHeader = viewer.getRowHeaderComponent(); |
2 |
26 Feb 07 |
jari |
1721 |
if (rowHeader != null) { |
2 |
26 Feb 07 |
jari |
1722 |
this.viewScrollPane.setRowHeaderView(rowHeader); |
2 |
26 Feb 07 |
jari |
1723 |
} else { |
2 |
26 Feb 07 |
jari |
1724 |
this.viewScrollPane.setRowHeader(null); |
2 |
26 Feb 07 |
jari |
1725 |
} |
2 |
26 Feb 07 |
jari |
1726 |
|
2 |
26 Feb 07 |
jari |
//Corner components |
2 |
26 Feb 07 |
jari |
1728 |
JComponent cornerComponent = viewer.getCornerComponent(IViewer.UPPER_LEFT_CORNER); |
2 |
26 Feb 07 |
jari |
1729 |
if (cornerComponent != null) |
2 |
26 Feb 07 |
jari |
1730 |
this.viewScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, cornerComponent); |
2 |
26 Feb 07 |
jari |
1731 |
|
2 |
26 Feb 07 |
jari |
1732 |
cornerComponent = viewer.getCornerComponent(IViewer.UPPER_RIGHT_CORNER); |
2 |
26 Feb 07 |
jari |
1733 |
if (cornerComponent != null) |
2 |
26 Feb 07 |
jari |
1734 |
this.viewScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, cornerComponent); |
2 |
26 Feb 07 |
jari |
1735 |
|
2 |
26 Feb 07 |
jari |
1736 |
cornerComponent = viewer.getCornerComponent(IViewer.LOWER_LEFT_CORNER); |
2 |
26 Feb 07 |
jari |
1737 |
if (cornerComponent != null) |
2 |
26 Feb 07 |
jari |
1738 |
this.viewScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, cornerComponent); |
2 |
26 Feb 07 |
jari |
1739 |
|
2 |
26 Feb 07 |
jari |
//this.viewer.onSelected(framework); |
2 |
26 Feb 07 |
jari |
/* Raktim Nov 15, 2005 - CGH Specific |
2 |
26 Feb 07 |
jari |
* New if condition. |
2 |
26 Feb 07 |
jari |
* Do not call onSelected if viewer id of type CGHPositionGraphViewer |
2 |
26 Feb 07 |
jari |
1744 |
*/ |
2 |
26 Feb 07 |
jari |
1745 |
if (!(this.viewer instanceof CGHPositionGraphViewer)) { |
2 |
26 Feb 07 |
jari |
1746 |
this.viewer.onSelected(framework); |
2 |
26 Feb 07 |
jari |
1747 |
} |
2 |
26 Feb 07 |
jari |
1748 |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
1749 |
} |
2 |
26 Feb 07 |
jari |
1750 |
|
2 |
26 Feb 07 |
jari |
1751 |
|
2 |
26 Feb 07 |
jari |
1752 |
/** |
2 |
26 Feb 07 |
jari |
* Returns a current viewer. |
2 |
26 Feb 07 |
jari |
1754 |
*/ |
2 |
26 Feb 07 |
jari |
1755 |
private IViewer getCurrentViewer() { |
2 |
26 Feb 07 |
jari |
1756 |
return viewer; |
2 |
26 Feb 07 |
jari |
1757 |
} |
2 |
26 Feb 07 |
jari |
1758 |
|
2 |
26 Feb 07 |
jari |
1759 |
/** |
2 |
26 Feb 07 |
jari |
* Invokes onClose method for all the viewers when the framework is |
2 |
26 Feb 07 |
jari |
* going to be closed. |
2 |
26 Feb 07 |
jari |
1762 |
*/ |
2 |
26 Feb 07 |
jari |
1763 |
private void fireOnCloseEvent(DefaultMutableTreeNode node) { |
2 |
26 Feb 07 |
jari |
1764 |
Object userObject = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
1765 |
if (userObject instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
1766 |
LeafInfo leafInfo = (LeafInfo)userObject; |
2 |
26 Feb 07 |
jari |
1767 |
IViewer viewer = leafInfo.getViewer(); |
2 |
26 Feb 07 |
jari |
1768 |
if (viewer != null) { |
2 |
26 Feb 07 |
jari |
1769 |
viewer.onClosed(); |
2 |
26 Feb 07 |
jari |
1770 |
} |
2 |
26 Feb 07 |
jari |
1771 |
} |
2 |
26 Feb 07 |
jari |
1772 |
for (int i=0; i<node.getChildCount(); i++) { |
2 |
26 Feb 07 |
jari |
1773 |
fireOnCloseEvent((DefaultMutableTreeNode)node.getChildAt(i)); |
2 |
26 Feb 07 |
jari |
1774 |
} |
2 |
26 Feb 07 |
jari |
1775 |
} |
2 |
26 Feb 07 |
jari |
1776 |
|
2 |
26 Feb 07 |
jari |
1777 |
/** |
2 |
26 Feb 07 |
jari |
* Invoked by a window listener when frame close button was pressed. |
2 |
26 Feb 07 |
jari |
1779 |
*/ |
2 |
26 Feb 07 |
jari |
1780 |
private void onClose() { |
2 |
26 Feb 07 |
jari |
1781 |
onSaveCheck(); |
2 |
26 Feb 07 |
jari |
1782 |
|
2 |
26 Feb 07 |
jari |
1783 |
addHistory("Close Viewer"); |
2 |
26 Feb 07 |
jari |
1784 |
|
2 |
26 Feb 07 |
jari |
1785 |
TMEV.setDataType(TMEV.DATA_TYPE_TWO_DYE); //default type |
2 |
26 Feb 07 |
jari |
1786 |
DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
1787 |
fireOnCloseEvent((DefaultMutableTreeNode)model.getRoot()); |
2 |
26 Feb 07 |
jari |
1788 |
mainframe.dispose(); |
2 |
26 Feb 07 |
jari |
1789 |
Manager.removeComponent(this); |
2 |
26 Feb 07 |
jari |
1790 |
} |
2 |
26 Feb 07 |
jari |
1791 |
|
2 |
26 Feb 07 |
jari |
1792 |
/** |
2 |
26 Feb 07 |
jari |
* Checks to see if the session should be saved |
2 |
26 Feb 07 |
jari |
1794 |
*/ |
2 |
26 Feb 07 |
jari |
1795 |
private void onSaveCheck() { |
2 |
26 Feb 07 |
jari |
//meets three criteria, has data loaded, result is modified, allowed to prompt |
2 |
26 Feb 07 |
jari |
1797 |
if(this.modifiedResult && this.data != null && TMEV.permitSavePrompt){ |
2 |
26 Feb 07 |
jari |
1798 |
AnalysisSaveDialog dialog = new AnalysisSaveDialog(this.getFrame()); |
2 |
26 Feb 07 |
jari |
1799 |
int result = dialog.showModal(); |
2 |
26 Feb 07 |
jari |
1800 |
boolean permitSave = dialog.askAgain(); |
2 |
26 Feb 07 |
jari |
1801 |
if(result == JOptionPane.YES_OPTION){ |
2 |
26 Feb 07 |
jari |
1802 |
saveAnalysisAs(); |
2 |
26 Feb 07 |
jari |
1803 |
} |
2 |
26 Feb 07 |
jari |
1804 |
if(TMEV.permitSavePrompt != permitSave) { |
2 |
26 Feb 07 |
jari |
1805 |
TMEV.setPermitPrompt(permitSave); |
2 |
26 Feb 07 |
jari |
1806 |
} |
2 |
26 Feb 07 |
jari |
1807 |
} |
2 |
26 Feb 07 |
jari |
1808 |
} |
2 |
26 Feb 07 |
jari |
1809 |
|
2 |
26 Feb 07 |
jari |
1810 |
/** |
2 |
26 Feb 07 |
jari |
* Creates an image for specified viewer. |
2 |
26 Feb 07 |
jari |
1812 |
*/ |
2 |
26 Feb 07 |
jari |
1813 |
private BufferedImage createDefaultImage(IViewer viewer) { |
2 |
26 Feb 07 |
jari |
1814 |
JComponent content = viewer.getContentComponent(); |
2 |
26 Feb 07 |
jari |
1815 |
JComponent header = viewer.getHeaderComponent(); |
2 |
26 Feb 07 |
jari |
1816 |
int width = content.getWidth(); |
2 |
26 Feb 07 |
jari |
1817 |
int height = content.getHeight(); |
2 |
26 Feb 07 |
jari |
1818 |
if (header != null) { |
2 |
26 Feb 07 |
jari |
1819 |
width = Math.max(width, header.getWidth()); |
2 |
26 Feb 07 |
jari |
1820 |
height += header.getHeight(); |
2 |
26 Feb 07 |
jari |
1821 |
} |
2 |
26 Feb 07 |
jari |
// BufferedImage image = (BufferedImage)java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(256,1); |
2 |
26 Feb 07 |
jari |
1823 |
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); //need to use this type for image creation |
2 |
26 Feb 07 |
jari |
1824 |
Graphics2D g = image.createGraphics(); |
2 |
26 Feb 07 |
jari |
1825 |
g.setColor(Color.white); |
2 |
26 Feb 07 |
jari |
1826 |
g.fillRect(0, 0, image.getWidth(), image.getHeight()); |
2 |
26 Feb 07 |
jari |
1827 |
|
2 |
26 Feb 07 |
jari |
1828 |
if (header != null) { |
2 |
26 Feb 07 |
jari |
1829 |
int headerHeight = header.getHeight(); |
2 |
26 Feb 07 |
jari |
1830 |
g.setClip(0, 0, width, headerHeight); |
2 |
26 Feb 07 |
jari |
1831 |
header.paint(g); |
2 |
26 Feb 07 |
jari |
1832 |
g.translate(0, headerHeight); |
2 |
26 Feb 07 |
jari |
1833 |
g.setClip(0, 0, width, height-headerHeight); |
2 |
26 Feb 07 |
jari |
1834 |
} else { |
2 |
26 Feb 07 |
jari |
1835 |
g.setClip(0, 0, width, height); |
2 |
26 Feb 07 |
jari |
1836 |
} |
2 |
26 Feb 07 |
jari |
1837 |
content.paint(g); |
2 |
26 Feb 07 |
jari |
1838 |
return image; |
2 |
26 Feb 07 |
jari |
1839 |
} |
2 |
26 Feb 07 |
jari |
1840 |
|
2 |
26 Feb 07 |
jari |
1841 |
/** |
2 |
26 Feb 07 |
jari |
* Saves a current viewer image into the user specified file. |
2 |
26 Feb 07 |
jari |
1843 |
*/ |
2 |
26 Feb 07 |
jari |
1844 |
private void onSaveImage() { |
2 |
26 Feb 07 |
jari |
1845 |
String dataPath = TMEV.getDataPath(); |
2 |
26 Feb 07 |
jari |
1846 |
File fileLoc = TMEV.getFile("data/"); |
2 |
26 Feb 07 |
jari |
1847 |
|
2 |
26 Feb 07 |
jari |
// if the data path is null go to default, if not null and not exist then to to default |
2 |
26 Feb 07 |
jari |
// else use the dataPath |
2 |
26 Feb 07 |
jari |
1850 |
|
2 |
26 Feb 07 |
jari |
1851 |
if(dataPath != null) { |
2 |
26 Feb 07 |
jari |
1852 |
fileLoc = new File(dataPath); |
2 |
26 Feb 07 |
jari |
1853 |
|
2 |
26 Feb 07 |
jari |
1854 |
if(!fileLoc.exists()) { |
2 |
26 Feb 07 |
jari |
1855 |
fileLoc = TMEV.getFile("data/"); |
2 |
26 Feb 07 |
jari |
1856 |
} |
2 |
26 Feb 07 |
jari |
1857 |
} |
2 |
26 Feb 07 |
jari |
1858 |
|
2 |
26 Feb 07 |
jari |
1859 |
final JFileChooser chooser = new JFileChooser(fileLoc); |
2 |
26 Feb 07 |
jari |
1860 |
chooser.setAcceptAllFileFilterUsed(false); |
2 |
26 Feb 07 |
jari |
1861 |
chooser.addChoosableFileFilter(new BMPFileFilter()); |
2 |
26 Feb 07 |
jari |
1862 |
chooser.addChoosableFileFilter(new JPGFileFilter()); |
2 |
26 Feb 07 |
jari |
1863 |
chooser.addChoosableFileFilter(new PNGFileFilter()); |
2 |
26 Feb 07 |
jari |
1864 |
chooser.addChoosableFileFilter(new TIFFFileFilter()); |
2 |
26 Feb 07 |
jari |
1865 |
int chooserState = chooser.showSaveDialog(getFrame()); |
2 |
26 Feb 07 |
jari |
1866 |
if (chooserState == JFileChooser.APPROVE_OPTION) { |
2 |
26 Feb 07 |
jari |
1867 |
IViewer viewer = getCurrentViewer(); |
2 |
26 Feb 07 |
jari |
1868 |
BufferedImage image = viewer.getImage(); |
2 |
26 Feb 07 |
jari |
1869 |
if (image == null) { |
2 |
26 Feb 07 |
jari |
1870 |
image = createDefaultImage(viewer); |
2 |
26 Feb 07 |
jari |
1871 |
} |
2 |
26 Feb 07 |
jari |
1872 |
final File fFile = chooser.getSelectedFile(); |
2 |
26 Feb 07 |
jari |
1873 |
final BufferedImage fImage = image; |
2 |
26 Feb 07 |
jari |
1874 |
final String fFormat = ((ImageFileFilter)chooser.getFileFilter()).getFileFormat(); |
2 |
26 Feb 07 |
jari |
1875 |
final ImageEncodeParam fParam = ((ImageFileFilter)chooser.getFileFilter()).getImageEncodeParam(); |
2 |
26 Feb 07 |
jari |
1876 |
try { |
2 |
26 Feb 07 |
jari |
1877 |
Thread thread = new Thread() { |
2 |
26 Feb 07 |
jari |
1878 |
public void run() { |
2 |
26 Feb 07 |
jari |
1879 |
JAI.create("filestore", fImage, fFile.getPath(), fFormat, fParam); |
2 |
26 Feb 07 |
jari |
1880 |
Manager.message(getFrame(), "Image saved: "+fFile.getPath()); |
2 |
26 Feb 07 |
jari |
1881 |
} |
2 |
26 Feb 07 |
jari |
1882 |
}; |
2 |
26 Feb 07 |
jari |
1883 |
thread.setPriority(Thread.MIN_PRIORITY); |
2 |
26 Feb 07 |
jari |
1884 |
thread.start(); |
2 |
26 Feb 07 |
jari |
1885 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1886 |
Manager.message(getFrame(), e); |
2 |
26 Feb 07 |
jari |
1887 |
} |
2 |
26 Feb 07 |
jari |
1888 |
} |
2 |
26 Feb 07 |
jari |
1889 |
} |
2 |
26 Feb 07 |
jari |
1890 |
|
2 |
26 Feb 07 |
jari |
//wwang customized MAV |
2 |
26 Feb 07 |
jari |
1892 |
private void onNewMultipleArrayViewer(){ |
2 |
26 Feb 07 |
jari |
1893 |
MultipleArrayViewer mav; |
2 |
26 Feb 07 |
jari |
1894 |
CustomToolbarInitDialog ctg=new CustomToolbarInitDialog(manager); |
2 |
26 Feb 07 |
jari |
1895 |
if (ctg.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
1896 |
TMEV.setCustomerStatSave(); |
2 |
26 Feb 07 |
jari |
1897 |
mav = new MultipleArrayViewer(); |
2 |
26 Feb 07 |
jari |
1898 |
onClose(); |
2 |
26 Feb 07 |
jari |
1899 |
|
2 |
26 Feb 07 |
jari |
1900 |
Manager.addComponent(mav); |
2 |
26 Feb 07 |
jari |
1901 |
|
2 |
26 Feb 07 |
jari |
//TMEV.clearFieldNames(); |
2 |
26 Feb 07 |
jari |
//Remove the next two lines (about DB system enabling) |
2 |
26 Feb 07 |
jari |
//mav.systemEnable(TMEV.DB_AVAILABLE); |
2 |
26 Feb 07 |
jari |
//mav.systemEnable(TMEV.DB_LOGIN); |
2 |
26 Feb 07 |
jari |
1906 |
mav.getFrame().setSize(1150, 700); |
2 |
26 Feb 07 |
jari |
1907 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
1908 |
mav.getFrame().setLocation((screenSize.width - mav.getFrame().getSize().width)/2, (screenSize.height - mav.getFrame().getSize().height)/2); |
2 |
26 Feb 07 |
jari |
1909 |
mav.getFrame().setVisible(true); |
2 |
26 Feb 07 |
jari |
1910 |
} |
2 |
26 Feb 07 |
jari |
1911 |
} |
2 |
26 Feb 07 |
jari |
1912 |
/** |
2 |
26 Feb 07 |
jari |
* Loads file with a microarray data. |
2 |
26 Feb 07 |
jari |
1914 |
*/ |
2 |
26 Feb 07 |
jari |
1915 |
private void onLoadFile() { |
2 |
26 Feb 07 |
jari |
1916 |
try { |
2 |
26 Feb 07 |
jari |
1917 |
ISlideData slideData = loadSlideData(data.getSlideMetaData()); |
2 |
26 Feb 07 |
jari |
1918 |
if (slideData != null){ |
2 |
26 Feb 07 |
jari |
1919 |
addFeature(slideData); |
2 |
26 Feb 07 |
jari |
1920 |
setMaxCY3AndCY5(); |
2 |
26 Feb 07 |
jari |
1921 |
} |
2 |
26 Feb 07 |
jari |
1922 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1923 |
ShowThrowableDialog.show(mainframe, "Load File Error", e); |
2 |
26 Feb 07 |
jari |
1924 |
} |
2 |
26 Feb 07 |
jari |
1925 |
} |
2 |
26 Feb 07 |
jari |
1926 |
|
2 |
26 Feb 07 |
jari |
1927 |
/** |
2 |
26 Feb 07 |
jari |
* Loads microarrays data from cluster formatted file. |
2 |
26 Feb 07 |
jari |
1929 |
*/ |
2 |
26 Feb 07 |
jari |
1930 |
private void onLoadCluster() { |
2 |
26 Feb 07 |
jari |
1931 |
loadFromStanfordFile("Select a Cluster File to Open"); |
2 |
26 Feb 07 |
jari |
1932 |
} |
2 |
26 Feb 07 |
jari |
1933 |
|
2 |
26 Feb 07 |
jari |
1934 |
/** |
2 |
26 Feb 07 |
jari |
* Loads microarrays data from stanford formatted file. |
2 |
26 Feb 07 |
jari |
1936 |
*/ |
2 |
26 Feb 07 |
jari |
1937 |
private void onLoadStanford() { |
2 |
26 Feb 07 |
jari |
1938 |
loadFromStanfordFile("Select a Stanford File to Open"); |
2 |
26 Feb 07 |
jari |
1939 |
} |
2 |
26 Feb 07 |
jari |
1940 |
|
2 |
26 Feb 07 |
jari |
1941 |
/** |
2 |
26 Feb 07 |
jari |
* Loads microarrays data from a database. |
2 |
26 Feb 07 |
jari |
1943 |
* |
2 |
26 Feb 07 |
jari |
* Note: does'nt implemented at the moment. |
2 |
26 Feb 07 |
jari |
1945 |
*/ |
2 |
26 Feb 07 |
jari |
1946 |
private void onLoadDatabase() { |
2 |
26 Feb 07 |
jari |
1947 |
SetDatabaseDialog sdd = new SetDatabaseDialog(getFrame()); |
2 |
26 Feb 07 |
jari |
1948 |
if (sdd.showModal() != JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
1949 |
return; |
2 |
26 Feb 07 |
jari |
1950 |
} |
2 |
26 Feb 07 |
jari |
1951 |
String database = sdd.getDatabase(); |
2 |
26 Feb 07 |
jari |
1952 |
|
2 |
26 Feb 07 |
jari |
// STUB: file names shold be loaded from the 'database' |
2 |
26 Feb 07 |
jari |
1954 |
String[] files = new String[] {"L4A1", "L4A2", "L4A3"}; |
2 |
26 Feb 07 |
jari |
1955 |
|
2 |
26 Feb 07 |
jari |
1956 |
SetSlideFilenameDialog ssfd = new SetSlideFilenameDialog(getFrame(), files); |
2 |
26 Feb 07 |
jari |
1957 |
if (ssfd.showModal() != JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
1958 |
return; |
2 |
26 Feb 07 |
jari |
1959 |
} |
2 |
26 Feb 07 |
jari |
1960 |
String filename = ssfd.getFileName(); |
2 |
26 Feb 07 |
jari |
1961 |
System.out.println("db : "+database); |
2 |
26 Feb 07 |
jari |
1962 |
System.out.println("file: "+filename); |
2 |
26 Feb 07 |
jari |
1963 |
} |
2 |
26 Feb 07 |
jari |
1964 |
|
2 |
26 Feb 07 |
jari |
1965 |
/** |
2 |
26 Feb 07 |
jari |
* Loads stanford file. |
2 |
26 Feb 07 |
jari |
* @param title the title for standard file chooser dialog. |
2 |
26 Feb 07 |
jari |
1968 |
*/ |
2 |
26 Feb 07 |
jari |
1969 |
private void loadFromStanfordFile(String title) { |
2 |
26 Feb 07 |
jari |
1970 |
try { |
2 |
26 Feb 07 |
jari |
1971 |
ISlideData[] slideData = super.loadStanfordFile(title); |
2 |
26 Feb 07 |
jari |
1972 |
if (slideData != null) { |
2 |
26 Feb 07 |
jari |
1973 |
addFeatures(slideData); |
2 |
26 Feb 07 |
jari |
1974 |
setMaxCY3AndCY5(); |
2 |
26 Feb 07 |
jari |
1975 |
} |
2 |
26 Feb 07 |
jari |
1976 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1977 |
ShowThrowableDialog.show(mainframe, "Load Data Error", e); |
2 |
26 Feb 07 |
jari |
1978 |
} |
2 |
26 Feb 07 |
jari |
1979 |
} |
2 |
26 Feb 07 |
jari |
1980 |
|
2 |
26 Feb 07 |
jari |
1981 |
/** |
2 |
26 Feb 07 |
jari |
* Loads data from the user specified directory. |
2 |
26 Feb 07 |
jari |
1983 |
*/ |
2 |
26 Feb 07 |
jari |
1984 |
private void onLoadDirectory() { |
2 |
26 Feb 07 |
jari |
1985 |
try { |
2 |
26 Feb 07 |
jari |
1986 |
ISlideData[] slideData = loadDirectory(data.getSlideMetaData()); |
2 |
26 Feb 07 |
jari |
1987 |
if (slideData != null) { |
2 |
26 Feb 07 |
jari |
1988 |
addFeatures(slideData); |
2 |
26 Feb 07 |
jari |
1989 |
setMaxCY3AndCY5(); |
2 |
26 Feb 07 |
jari |
1990 |
} |
2 |
26 Feb 07 |
jari |
1991 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
1992 |
ShowThrowableDialog.show(mainframe, "Load Directory Error", e); |
2 |
26 Feb 07 |
jari |
1993 |
} |
2 |
26 Feb 07 |
jari |
1994 |
} |
2 |
26 Feb 07 |
jari |
1995 |
|
2 |
26 Feb 07 |
jari |
1996 |
/** |
2 |
26 Feb 07 |
jari |
* Sets Initial Max CY3 and CY5 in menu |
2 |
26 Feb 07 |
jari |
1998 |
*/ |
2 |
26 Feb 07 |
jari |
1999 |
private void setMaxCY3AndCY5(){ |
2 |
26 Feb 07 |
jari |
2000 |
this.menubar.setMaxCY3Scale(data.getMaxCY3()); |
2 |
26 Feb 07 |
jari |
2001 |
this.menubar.setMaxCY5Scale(data.getMaxCY5()); |
2 |
26 Feb 07 |
jari |
2002 |
} |
2 |
26 Feb 07 |
jari |
2003 |
|
2 |
26 Feb 07 |
jari |
2004 |
/** |
2 |
26 Feb 07 |
jari |
* Invoked when a label menu item is selected. |
2 |
26 Feb 07 |
jari |
2006 |
*/ |
2 |
26 Feb 07 |
jari |
2007 |
private void onLabelChanged(Action action) { |
2 |
26 Feb 07 |
jari |
2008 |
String index = (String)action.getValue(ActionManager.PARAMETER); |
2 |
26 Feb 07 |
jari |
2009 |
menubar.setLabelIndex(Integer.parseInt(index)); |
2 |
26 Feb 07 |
jari |
2010 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
2011 |
} |
2 |
26 Feb 07 |
jari |
2012 |
|
2 |
26 Feb 07 |
jari |
2013 |
/** |
2 |
26 Feb 07 |
jari |
* Invoked when a label menu item is selected. |
2 |
26 Feb 07 |
jari |
2015 |
*/ |
2 |
26 Feb 07 |
jari |
2016 |
private void onExperimentLabelChanged(Action action) { |
2 |
26 Feb 07 |
jari |
2017 |
String key = (String)action.getValue(ActionManager.PARAMETER); |
2 |
26 Feb 07 |
jari |
//menubar.setExperimentLabelIndex(Integer.parseInt(index)); |
2 |
26 Feb 07 |
jari |
2019 |
this.data.setSampleLabelKey(key); |
2 |
26 Feb 07 |
jari |
2020 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
2021 |
} |
2 |
26 Feb 07 |
jari |
2022 |
|
2 |
26 Feb 07 |
jari |
2023 |
|
2 |
26 Feb 07 |
jari |
2024 |
private void onExperimentLabelAdded() { |
2 |
26 Feb 07 |
jari |
2025 |
|
2 |
26 Feb 07 |
jari |
2026 |
boolean safeToReorderExperiments = false; |
2 |
26 Feb 07 |
jari |
2027 |
|
2 |
26 Feb 07 |
jari |
//make sure no results exist and cluster repositories are null, then safe to reorder. |
2 |
26 Feb 07 |
jari |
//note that result counter starts at 1 and holds the index for the next result |
2 |
26 Feb 07 |
jari |
2030 |
safeToReorderExperiments = (this.resultCount < 2 && this.geneClusterRepository == null && this.experimentClusterRepository == null); |
2 |
26 Feb 07 |
jari |
2031 |
|
2 |
26 Feb 07 |
jari |
//get the longest key set from loaded samples |
2 |
26 Feb 07 |
jari |
2033 |
Vector featureAttributes = this.data.getSlideNameKeyVectorUnion(); |
2 |
26 Feb 07 |
jari |
2034 |
|
2 |
26 Feb 07 |
jari |
2035 |
|
2 |
26 Feb 07 |
jari |
2036 |
ExperimentLabelEditor editor = new ExperimentLabelEditor(this.getFrame(), featureAttributes, this.data, safeToReorderExperiments); |
2 |
26 Feb 07 |
jari |
2037 |
|
2 |
26 Feb 07 |
jari |
//return if not OK |
2 |
26 Feb 07 |
jari |
2039 |
if(editor.showModal() != JOptionPane.OK_OPTION) |
2 |
26 Feb 07 |
jari |
2040 |
return; |
2 |
26 Feb 07 |
jari |
2041 |
|
2 |
26 Feb 07 |
jari |
//get data and keys |
2 |
26 Feb 07 |
jari |
2043 |
String [][] data = editor.getLabelDataWithoutKeys(); |
2 |
26 Feb 07 |
jari |
2044 |
String [] keys = editor.getLabelKeys(); |
2 |
26 Feb 07 |
jari |
2045 |
|
2 |
26 Feb 07 |
jari |
//add/update features |
2 |
26 Feb 07 |
jari |
2047 |
for(int i=0; i < keys.length; i++) |
2 |
26 Feb 07 |
jari |
2048 |
this.data.addNewExperimentLabel(keys[i], data[i]); |
2 |
26 Feb 07 |
jari |
2049 |
|
2 |
26 Feb 07 |
jari |
//add the new label to the experiment label menu |
2 |
26 Feb 07 |
jari |
2051 |
this.menubar.replaceExperimentLabelMenuItems(keys); |
2 |
26 Feb 07 |
jari |
2052 |
|
2 |
26 Feb 07 |
jari |
//now the data has been updated, check for reordering request |
2 |
26 Feb 07 |
jari |
2054 |
if(safeToReorderExperiments && editor.isReorderedSelected()) { |
2 |
26 Feb 07 |
jari |
2055 |
int [] order = editor.getNewOrderScheme(); |
2 |
26 Feb 07 |
jari |
2056 |
ArrayList featuresList = new ArrayList(order.length); |
2 |
26 Feb 07 |
jari |
2057 |
for(int i = 0; i < order.length; i++) { |
2 |
26 Feb 07 |
jari |
2058 |
featuresList.add(this.data.getFeature(order[i])); |
2 |
26 Feb 07 |
jari |
2059 |
} |
2 |
26 Feb 07 |
jari |
//set new features list |
2 |
26 Feb 07 |
jari |
2061 |
this.data.setFeaturesList(featuresList); |
2 |
26 Feb 07 |
jari |
2062 |
} |
2 |
26 Feb 07 |
jari |
2063 |
this.fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2064 |
} |
2 |
26 Feb 07 |
jari |
2065 |
|
2 |
26 Feb 07 |
jari |
2066 |
/** |
2 |
26 Feb 07 |
jari |
* Adds a microarray data into the framework. |
2 |
26 Feb 07 |
jari |
2068 |
*/ |
2 |
26 Feb 07 |
jari |
2069 |
private void addFeature(ISlideData slideData) { |
2 |
26 Feb 07 |
jari |
2070 |
data.addFeature(slideData); |
2 |
26 Feb 07 |
jari |
2071 |
systemEnable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
2072 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2073 |
} |
2 |
26 Feb 07 |
jari |
2074 |
|
2 |
26 Feb 07 |
jari |
2075 |
/** |
2 |
26 Feb 07 |
jari |
* Adds an array of microarrays data into the framework. |
2 |
26 Feb 07 |
jari |
2077 |
*/ |
2 |
26 Feb 07 |
jari |
2078 |
private void addFeatures(ISlideData[] slideData) { |
2 |
26 Feb 07 |
jari |
2079 |
data.addFeatures(slideData); |
2 |
26 Feb 07 |
jari |
2080 |
systemEnable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
2081 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2082 |
} |
2 |
26 Feb 07 |
jari |
2083 |
|
2 |
26 Feb 07 |
jari |
2084 |
/** |
2 |
26 Feb 07 |
jari |
* Notifies a current viewer what the framework data is changed. |
2 |
26 Feb 07 |
jari |
2086 |
*/ |
2 |
26 Feb 07 |
jari |
2087 |
public void fireDataChanged() { |
2 |
26 Feb 07 |
jari |
2088 |
IViewer viewer = getCurrentViewer(); |
2 |
26 Feb 07 |
jari |
2089 |
if (viewer == null) { |
2 |
26 Feb 07 |
jari |
2090 |
return; |
2 |
26 Feb 07 |
jari |
2091 |
} |
2 |
26 Feb 07 |
jari |
2092 |
viewer.onDataChanged(data); |
2 |
26 Feb 07 |
jari |
2093 |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
2094 |
} |
2 |
26 Feb 07 |
jari |
2095 |
|
2 |
26 Feb 07 |
jari |
2096 |
/** |
2 |
26 Feb 07 |
jari |
* Notifies a current viewer what the framework menu is changed. |
2 |
26 Feb 07 |
jari |
2098 |
*/ |
2 |
26 Feb 07 |
jari |
2099 |
private void fireMenuChanged() { |
2 |
26 Feb 07 |
jari |
2100 |
IViewer viewer = getCurrentViewer(); |
2 |
26 Feb 07 |
jari |
2101 |
if (viewer == null) { |
2 |
26 Feb 07 |
jari |
2102 |
return; |
2 |
26 Feb 07 |
jari |
2103 |
} |
2 |
26 Feb 07 |
jari |
/* Raktim, Handle differently for CGH Menu */ |
2 |
26 Feb 07 |
jari |
2105 |
if(viewer instanceof ICGHViewer){ |
2 |
26 Feb 07 |
jari |
2106 |
((ICGHViewer)viewer).onMenuChanged(menubar.getCghDisplayMenu()); |
2 |
26 Feb 07 |
jari |
2107 |
((ICGHViewer)viewer).onMenuChanged(menubar.getDisplayMenu()); |
2 |
26 Feb 07 |
jari |
2108 |
} else { |
2 |
26 Feb 07 |
jari |
2109 |
viewer.onMenuChanged(menubar.getDisplayMenu()); |
2 |
26 Feb 07 |
jari |
2110 |
} |
2 |
26 Feb 07 |
jari |
2111 |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
2112 |
} |
2 |
26 Feb 07 |
jari |
2113 |
|
2 |
26 Feb 07 |
jari |
2114 |
|
2 |
26 Feb 07 |
jari |
2115 |
/** |
2 |
26 Feb 07 |
jari |
* Invoked when the header name is truncated or expanded. |
2 |
26 Feb 07 |
jari |
2117 |
*/ |
2 |
26 Feb 07 |
jari |
2118 |
private void fireHeaderChanged() { |
2 |
26 Feb 07 |
jari |
2119 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); |
2 |
26 Feb 07 |
jari |
2120 |
if (node == null) { |
2 |
26 Feb 07 |
jari |
2121 |
return; |
2 |
26 Feb 07 |
jari |
2122 |
} |
2 |
26 Feb 07 |
jari |
2123 |
Object userObject = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
2124 |
if (!(userObject instanceof LeafInfo)) { |
2 |
26 Feb 07 |
jari |
2125 |
return; |
2 |
26 Feb 07 |
jari |
2126 |
} |
2 |
26 Feb 07 |
jari |
2127 |
setCurrentViewer(((LeafInfo)userObject).getViewer()); |
2 |
26 Feb 07 |
jari |
2128 |
} |
2 |
26 Feb 07 |
jari |
2129 |
|
2 |
26 Feb 07 |
jari |
2130 |
/** |
2 |
26 Feb 07 |
jari |
* Updates the scroll pane size according to a current |
2 |
26 Feb 07 |
jari |
* viewer one. |
2 |
26 Feb 07 |
jari |
2133 |
*/ |
2 |
26 Feb 07 |
jari |
2134 |
private void doViewLayout() { |
2 |
26 Feb 07 |
jari |
2135 |
JViewport header = viewScrollPane.getColumnHeader(); |
2 |
26 Feb 07 |
jari |
2136 |
if (header != null) { |
2 |
26 Feb 07 |
jari |
2137 |
header.doLayout(); |
2 |
26 Feb 07 |
jari |
2138 |
} |
2 |
26 Feb 07 |
jari |
2139 |
viewScrollPane.getViewport().doLayout(); |
2 |
26 Feb 07 |
jari |
2140 |
viewScrollPane.doLayout(); |
2 |
26 Feb 07 |
jari |
2141 |
viewScrollPane.repaint(); |
2 |
26 Feb 07 |
jari |
2142 |
} |
2 |
26 Feb 07 |
jari |
2143 |
|
2 |
26 Feb 07 |
jari |
2144 |
/** |
2 |
26 Feb 07 |
jari |
* Normalize the framework data with specified mode. |
2 |
26 Feb 07 |
jari |
2146 |
*/ |
2 |
26 Feb 07 |
jari |
2147 |
private void onNormalizeData(int mode) { |
2 |
26 Feb 07 |
jari |
2148 |
setCursor(Cursor.WAIT_CURSOR); |
2 |
26 Feb 07 |
jari |
2149 |
data.normalize(mode, this); |
2 |
26 Feb 07 |
jari |
2150 |
addHistory("Normalization State: "+SlideData.normalizationString(mode)); |
2 |
26 Feb 07 |
jari |
2151 |
setCursor(Cursor.DEFAULT_CURSOR); |
2 |
26 Feb 07 |
jari |
2152 |
} |
2 |
26 Feb 07 |
jari |
2153 |
|
2 |
26 Feb 07 |
jari |
2154 |
/** |
2 |
26 Feb 07 |
jari |
* Normalize the framework data with specified mode. |
2 |
26 Feb 07 |
jari |
2156 |
*/ |
2 |
26 Feb 07 |
jari |
2157 |
private void onNormalizeDataList(int mode) { |
2 |
26 Feb 07 |
jari |
2158 |
setCursor(Cursor.WAIT_CURSOR); |
2 |
26 Feb 07 |
jari |
2159 |
data.normalizeList(mode); |
2 |
26 Feb 07 |
jari |
2160 |
addHistory(SlideData.normalizationString(mode)); |
2 |
26 Feb 07 |
jari |
2161 |
setCursor(Cursor.DEFAULT_CURSOR); |
2 |
26 Feb 07 |
jari |
2162 |
} |
2 |
26 Feb 07 |
jari |
2163 |
|
2 |
26 Feb 07 |
jari |
2164 |
/** |
2 |
26 Feb 07 |
jari |
* Invoked when the navigation tree node is changed. |
2 |
26 Feb 07 |
jari |
2166 |
*/ |
2 |
26 Feb 07 |
jari |
2167 |
private void onNodeChanged(TreeSelectionEvent event) { |
2 |
26 Feb 07 |
jari |
2168 |
JTree tree = (JTree)event.getSource(); |
2 |
26 Feb 07 |
jari |
2169 |
TreePath path = event.getPath(); |
2 |
26 Feb 07 |
jari |
2170 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); |
2 |
26 Feb 07 |
jari |
2171 |
if (node == null) { |
2 |
26 Feb 07 |
jari |
2172 |
return; |
2 |
26 Feb 07 |
jari |
2173 |
} |
2 |
26 Feb 07 |
jari |
2174 |
Object userObject = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
2175 |
if (!(userObject instanceof LeafInfo)) { |
2 |
26 Feb 07 |
jari |
2176 |
return; |
2 |
26 Feb 07 |
jari |
2177 |
} |
2 |
26 Feb 07 |
jari |
2178 |
setCurrentViewer(((LeafInfo)userObject).getViewer()); |
2 |
26 Feb 07 |
jari |
2179 |
} |
2 |
26 Feb 07 |
jari |
2180 |
|
2 |
26 Feb 07 |
jari |
2181 |
/** |
2 |
26 Feb 07 |
jari |
* Sets a spot size. |
2 |
26 Feb 07 |
jari |
2183 |
*/ |
2 |
26 Feb 07 |
jari |
2184 |
private void onElementSizeChanged(int width, int height) { |
2 |
26 Feb 07 |
jari |
2185 |
menubar.setElementSize(width, height); |
2 |
26 Feb 07 |
jari |
2186 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
2187 |
} |
2 |
26 Feb 07 |
jari |
2188 |
|
2 |
26 Feb 07 |
jari |
2189 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the user specified spot size. |
2 |
26 Feb 07 |
jari |
2191 |
*/ |
2 |
26 Feb 07 |
jari |
2192 |
private void onElementSizeChanged() { |
2 |
26 Feb 07 |
jari |
2193 |
SetElementSizeDialog sesd = new SetElementSizeDialog(getFrame(), menubar.getDisplayMenu().getElementSize()); |
2 |
26 Feb 07 |
jari |
2194 |
if (sesd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2195 |
Dimension size = sesd.getElementSize(); |
2 |
26 Feb 07 |
jari |
2196 |
onElementSizeChanged(size.width, size.height); |
2 |
26 Feb 07 |
jari |
2197 |
} |
2 |
26 Feb 07 |
jari |
2198 |
} |
2 |
26 Feb 07 |
jari |
2199 |
|
2 |
26 Feb 07 |
jari |
2200 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the color pallete colors |
2 |
26 Feb 07 |
jari |
2202 |
*/ |
2 |
26 Feb 07 |
jari |
2203 |
private void onColorSchemeChange(int colorScheme){ |
2 |
26 Feb 07 |
jari |
2204 |
int initColorScheme = menubar.getColorScheme(); |
2 |
26 Feb 07 |
jari |
2205 |
if(colorScheme == IDisplayMenu.GREEN_RED_SCHEME || colorScheme == IDisplayMenu.BLUE_YELLOW_SCHEME || colorScheme == IDisplayMenu.RAINBOW_COLOR_SCHEME) { |
2 |
26 Feb 07 |
jari |
2206 |
this.menubar.setColorSchemeIndex(colorScheme); |
2 |
26 Feb 07 |
jari |
2207 |
if(colorScheme == IDisplayMenu.RAINBOW_COLOR_SCHEME) { |
2 |
26 Feb 07 |
jari |
2208 |
this.menubar.setUseDoubleGradient(false); //rainbow uses single gradient (pos) |
2 |
26 Feb 07 |
jari |
2209 |
} else { |
2 |
26 Feb 07 |
jari |
2210 |
this.menubar.setUseDoubleGradient(true); //use double gradient |
2 |
26 Feb 07 |
jari |
2211 |
} |
2 |
26 Feb 07 |
jari |
2212 |
} else { |
2 |
26 Feb 07 |
jari |
//select a custom color scheme |
2 |
26 Feb 07 |
jari |
2214 |
|
2 |
26 Feb 07 |
jari |
// using rainbow scheme set current to standard green/black/red first |
2 |
26 Feb 07 |
jari |
2216 |
boolean rainbowScheme = (initColorScheme == IDisplayMenu.RAINBOW_COLOR_SCHEME); |
2 |
26 Feb 07 |
jari |
2217 |
if(rainbowScheme) { |
2 |
26 Feb 07 |
jari |
2218 |
menubar.setColorSchemeIndex(IDisplayMenu.GREEN_RED_SCHEME); |
2 |
26 Feb 07 |
jari |
2219 |
menubar.setUseDoubleGradient(true); |
2 |
26 Feb 07 |
jari |
2220 |
} |
2 |
26 Feb 07 |
jari |
2221 |
ColorSchemeSelectionDialog dialog = new ColorSchemeSelectionDialog((Frame)getFrame(), true, menubar.getNegativeGradientImage(), menubar.getPositiveGradientImage(), this.menubar.getDisplayMenu().getUseDoubleGradient()); |
2 |
26 Feb 07 |
jari |
2222 |
if(dialog.showModal() != JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
//if not ok and using rainbow, set back |
2 |
26 Feb 07 |
jari |
2224 |
if(rainbowScheme) { |
2 |
26 Feb 07 |
jari |
2225 |
menubar.setColorSchemeIndex(IDisplayMenu.RAINBOW_COLOR_SCHEME); |
2 |
26 Feb 07 |
jari |
2226 |
menubar.setUseDoubleGradient(false); |
2 |
26 Feb 07 |
jari |
2227 |
} |
2 |
26 Feb 07 |
jari |
2228 |
return; |
2 |
26 Feb 07 |
jari |
2229 |
} |
2 |
26 Feb 07 |
jari |
2230 |
this.menubar.setPositiveCustomGradient(dialog.getPositiveGradient()); |
2 |
26 Feb 07 |
jari |
2231 |
this.menubar.setNegativeCustomGradient(dialog.getNegativeGradient()); |
2 |
26 Feb 07 |
jari |
2232 |
this.menubar.setColorSchemeIndex(colorScheme); |
2 |
26 Feb 07 |
jari |
2233 |
this.menubar.setUseDoubleGradient(dialog.getUseDoubleGradient()); |
2 |
26 Feb 07 |
jari |
2234 |
} |
2 |
26 Feb 07 |
jari |
2235 |
|
2 |
26 Feb 07 |
jari |
2236 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
2237 |
} |
2 |
26 Feb 07 |
jari |
2238 |
|
2 |
26 Feb 07 |
jari |
2239 |
|
2 |
26 Feb 07 |
jari |
2240 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the current (selected) state of gradient use |
2 |
26 Feb 07 |
jari |
2242 |
*/ |
2 |
26 Feb 07 |
jari |
2243 |
private void onColorGradientChange(boolean gradientState){ |
2 |
26 Feb 07 |
jari |
2244 |
menubar.setColorGradientState(gradientState); |
2 |
26 Feb 07 |
jari |
2245 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
2246 |
} |
2 |
26 Feb 07 |
jari |
2247 |
|
2 |
26 Feb 07 |
jari |
2248 |
|
2 |
26 Feb 07 |
jari |
2249 |
/** |
2 |
26 Feb 07 |
jari |
* Invoked when draw borders menu item is changed. |
2 |
26 Feb 07 |
jari |
2251 |
*/ |
2 |
26 Feb 07 |
jari |
2252 |
private void onDrawBorders() { |
2 |
26 Feb 07 |
jari |
2253 |
menubar.setDrawBorders(!menubar.getDisplayMenu().isDrawingBorder()); |
2 |
26 Feb 07 |
jari |
2254 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
2255 |
} |
2 |
26 Feb 07 |
jari |
2256 |
|
2 |
26 Feb 07 |
jari |
2257 |
|
2 |
26 Feb 07 |
jari |
2258 |
/** |
2 |
26 Feb 07 |
jari |
* Shows the system info dialog. |
2 |
26 Feb 07 |
jari |
2260 |
*/ |
2 |
26 Feb 07 |
jari |
2261 |
private void onSystemInfo() { |
2 |
26 Feb 07 |
jari |
2262 |
int width = 640, height = 550; |
2 |
26 Feb 07 |
jari |
2263 |
InformationPanel infoPanel = new InformationPanel(); |
2 |
26 Feb 07 |
jari |
2264 |
JFrame frame = new JFrame("System Information"); |
2 |
26 Feb 07 |
jari |
2265 |
frame.getContentPane().add(infoPanel); |
2 |
26 Feb 07 |
jari |
2266 |
frame.setSize(width, height); |
2 |
26 Feb 07 |
jari |
2267 |
Dimension screenSize = getToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
2268 |
frame.setLocation(screenSize.width/2 - width/2, screenSize.height/2 - height/2); |
2 |
26 Feb 07 |
jari |
2269 |
frame.setResizable(false); |
2 |
26 Feb 07 |
jari |
2270 |
frame.setVisible(true); |
2 |
26 Feb 07 |
jari |
2271 |
infoPanel.Start(); |
2 |
26 Feb 07 |
jari |
2272 |
} |
2 |
26 Feb 07 |
jari |
2273 |
|
2 |
26 Feb 07 |
jari |
2274 |
/** |
2 |
26 Feb 07 |
jari |
* Shows algorithms default distance functions. |
2 |
26 Feb 07 |
jari |
2276 |
*/ |
2 |
26 Feb 07 |
jari |
2277 |
private void onDefaultDistance() { |
2 |
26 Feb 07 |
jari |
2278 |
String defaultText = "<html>"+ |
2 |
26 Feb 07 |
jari |
2279 |
"<font color=\"#000000\"><b><u>Default Distances</u></b></font>"+ |
2 |
26 Feb 07 |
jari |
2280 |
"<p>"+ |
2 |
26 Feb 07 |
jari |
2281 |
"<table border=20 cellspacing=10 cellpadding = 10 width= 380 height= 400>"+ |
2 |
26 Feb 07 |
jari |
2282 |
"<tr><th><u><center><width=200>Algorithm</center></u></th><th width = 150><u><center>Default Metric</center></u></th></tr>"+ |
2 |
26 Feb 07 |
jari |
2283 |
"<tr><td><center>HCL, ST, SOTA, KMC, KMS, SOM, CAST, GSH, FOM</center></td><td><center>Euclidean</center></td></tr>"+ |
2 |
26 Feb 07 |
jari |
// "<tr><td></td></td><td></td></tr>"+ |
2 |
26 Feb 07 |
jari |
//"<tr>"+ |
2 |
26 Feb 07 |
jari |
2286 |
"<tr><td><center>PCA</center></td><td><center>Covariance</center></td></tr>"+ |
2 |
26 Feb 07 |
jari |
2287 |
"<tr><td><center>SVM</center></td><td><center>Dot Product</center></td></tr>"+ |
2 |
26 Feb 07 |
jari |
2288 |
"<tr><td><center>RN, QTC, PTM</center></td><td><center>Pearson Correlation</center></td></tr>"+ |
2 |
26 Feb 07 |
jari |
2289 |
"</center></table>"+ |
2 |
26 Feb 07 |
jari |
2290 |
"</html>"; |
2 |
26 Feb 07 |
jari |
2291 |
JOptionPane.showMessageDialog(getFrame(), new JLabel(defaultText), "Default Distances", JOptionPane.PLAIN_MESSAGE); |
2 |
26 Feb 07 |
jari |
2292 |
} |
2 |
26 Feb 07 |
jari |
2293 |
|
2 |
26 Feb 07 |
jari |
2294 |
private void setNormalizedState(int originalMode){ |
2 |
26 Feb 07 |
jari |
2295 |
if(originalMode == ISlideData.NO_NORMALIZATION){ |
2 |
26 Feb 07 |
jari |
2296 |
menubar.setNormalizedButtonState(5); |
2 |
26 Feb 07 |
jari |
2297 |
} else { |
2 |
26 Feb 07 |
jari |
2298 |
addHistory(SlideData.normalizationString(originalMode)); |
2 |
26 Feb 07 |
jari |
2299 |
if(originalMode == ISlideData.TOTAL_INTENSITY){ |
2 |
26 Feb 07 |
jari |
2300 |
menubar.setNormalizedButtonState(0); |
2 |
26 Feb 07 |
jari |
2301 |
} else if(originalMode == ISlideData.LINEAR_REGRESSION){ |
2 |
26 Feb 07 |
jari |
2302 |
menubar.setNormalizedButtonState(1); |
2 |
26 Feb 07 |
jari |
2303 |
} else if(originalMode == ISlideData.RATIO_STATISTICS_95 || |
2 |
26 Feb 07 |
jari |
2304 |
originalMode == ISlideData.RATIO_STATISTICS_99){ |
2 |
26 Feb 07 |
jari |
2305 |
menubar.setNormalizedButtonState(2); |
2 |
26 Feb 07 |
jari |
2306 |
} else if(originalMode == ISlideData.ITERATIVE_LOG){ |
2 |
26 Feb 07 |
jari |
2307 |
menubar.setNormalizedButtonState(3); |
2 |
26 Feb 07 |
jari |
2308 |
} |
2 |
26 Feb 07 |
jari |
2309 |
} |
2 |
26 Feb 07 |
jari |
2310 |
} |
2 |
26 Feb 07 |
jari |
2311 |
|
2 |
26 Feb 07 |
jari |
2312 |
/** |
2 |
26 Feb 07 |
jari |
* Normalize the framework data. |
2 |
26 Feb 07 |
jari |
2314 |
*/ |
2 |
26 Feb 07 |
jari |
2315 |
private void onNormalize(int mode) { |
2 |
26 Feb 07 |
jari |
2316 |
final int originalMode = data.getFeature(0).getNormalizedState(); |
2 |
26 Feb 07 |
jari |
2317 |
final int Mode = mode; |
2 |
26 Feb 07 |
jari |
2318 |
setCursor(Cursor.WAIT_CURSOR); |
2 |
26 Feb 07 |
jari |
2319 |
try{ |
2 |
26 Feb 07 |
jari |
2320 |
Thread thread = new Thread(new Runnable(){ |
2 |
26 Feb 07 |
jari |
2321 |
public void run(){ |
2 |
26 Feb 07 |
jari |
2322 |
String result = data.normalize(Mode, MultipleArrayViewer.this); |
2 |
26 Feb 07 |
jari |
2323 |
if(!result.equals("no_change")){ // if not aborted in dialog before start |
2 |
26 Feb 07 |
jari |
2324 |
if(result.equals("normalized")) // if normalized |
2 |
26 Feb 07 |
jari |
2325 |
addHistory(SlideData.normalizationString(Mode)); |
2 |
26 Feb 07 |
jari |
2326 |
else if(result.equals("process_abort_reset")){ // if process started then aborted, reset to no norm. |
2 |
26 Feb 07 |
jari |
2327 |
addHistory("Norm. aborted, reset to raw state"); |
2 |
26 Feb 07 |
jari |
2328 |
menubar.setNormalizedButtonState(5); //move radio button |
2 |
26 Feb 07 |
jari |
2329 |
} |
2 |
26 Feb 07 |
jari |
2330 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2331 |
setCursor(Cursor.DEFAULT_CURSOR); |
2 |
26 Feb 07 |
jari |
2332 |
} else { |
2 |
26 Feb 07 |
jari |
// process aborted before it starts no change in data, return button state |
2 |
26 Feb 07 |
jari |
2334 |
if(originalMode == ISlideData.NO_NORMALIZATION) |
2 |
26 Feb 07 |
jari |
2335 |
menubar.setNormalizedButtonState(5); |
2 |
26 Feb 07 |
jari |
2336 |
else if(originalMode == ISlideData.TOTAL_INTENSITY) |
2 |
26 Feb 07 |
jari |
2337 |
menubar.setNormalizedButtonState(0); |
2 |
26 Feb 07 |
jari |
2338 |
else if(originalMode == ISlideData.LINEAR_REGRESSION) |
2 |
26 Feb 07 |
jari |
2339 |
menubar.setNormalizedButtonState(1); |
2 |
26 Feb 07 |
jari |
2340 |
else if(originalMode == ISlideData.RATIO_STATISTICS_95 || |
2 |
26 Feb 07 |
jari |
2341 |
originalMode == ISlideData.RATIO_STATISTICS_99) |
2 |
26 Feb 07 |
jari |
2342 |
menubar.setNormalizedButtonState(2); |
2 |
26 Feb 07 |
jari |
2343 |
else if(originalMode == ISlideData.ITERATIVE_LOG) |
2 |
26 Feb 07 |
jari |
2344 |
menubar.setNormalizedButtonState(3); |
2 |
26 Feb 07 |
jari |
2345 |
} |
2 |
26 Feb 07 |
jari |
2346 |
} |
2 |
26 Feb 07 |
jari |
2347 |
}); |
2 |
26 Feb 07 |
jari |
2348 |
thread.setPriority(Thread.MIN_PRIORITY); |
2 |
26 Feb 07 |
jari |
2349 |
thread.start(); |
2 |
26 Feb 07 |
jari |
2350 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
2351 |
e.printStackTrace(); } |
2 |
26 Feb 07 |
jari |
2352 |
setCursor(Cursor.DEFAULT_CURSOR); |
2 |
26 Feb 07 |
jari |
2353 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2354 |
} |
2 |
26 Feb 07 |
jari |
2355 |
|
2 |
26 Feb 07 |
jari |
2356 |
|
2 |
26 Feb 07 |
jari |
2357 |
/** |
2 |
26 Feb 07 |
jari |
* Normalize the framework data. |
2 |
26 Feb 07 |
jari |
2359 |
*/ |
2 |
26 Feb 07 |
jari |
2360 |
private void onNormalizeList(int mode) { |
2 |
26 Feb 07 |
jari |
2361 |
setCursor(Cursor.WAIT_CURSOR); |
2 |
26 Feb 07 |
jari |
2362 |
data.normalizeList(mode); |
2 |
26 Feb 07 |
jari |
2363 |
addHistory(SlideData.normalizationString(mode)); |
2 |
26 Feb 07 |
jari |
2364 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2365 |
setCursor(Cursor.DEFAULT_CURSOR); |
2 |
26 Feb 07 |
jari |
2366 |
} |
2 |
26 Feb 07 |
jari |
2367 |
|
2 |
26 Feb 07 |
jari |
2368 |
/** |
2 |
26 Feb 07 |
jari |
* Runs a printer job. |
2 |
26 Feb 07 |
jari |
2370 |
*/ |
2 |
26 Feb 07 |
jari |
2371 |
private void onPrintImage() { |
2 |
26 Feb 07 |
jari |
2372 |
PrinterJob pj = PrinterJob.getPrinterJob(); |
2 |
26 Feb 07 |
jari |
2373 |
pj.setPrintable(this, pj.defaultPage()); |
2 |
26 Feb 07 |
jari |
2374 |
if (pj.printDialog()) { |
2 |
26 Feb 07 |
jari |
2375 |
try { |
2 |
26 Feb 07 |
jari |
2376 |
pj.print(); |
2 |
26 Feb 07 |
jari |
2377 |
} catch (PrinterException pe) { |
2 |
26 Feb 07 |
jari |
2378 |
pe.printStackTrace(); |
2 |
26 Feb 07 |
jari |
2379 |
} |
2 |
26 Feb 07 |
jari |
2380 |
} |
2 |
26 Feb 07 |
jari |
2381 |
} |
2 |
26 Feb 07 |
jari |
2382 |
|
2 |
26 Feb 07 |
jari |
2383 |
/** |
2 |
26 Feb 07 |
jari |
* Prints a current viewer image. |
2 |
26 Feb 07 |
jari |
2385 |
*/ |
2 |
26 Feb 07 |
jari |
2386 |
public int print(Graphics g, PageFormat pf, int pi) throws PrinterException { |
2 |
26 Feb 07 |
jari |
2387 |
if (pi >= 1) { |
2 |
26 Feb 07 |
jari |
2388 |
return Printable.NO_SUCH_PAGE; |
2 |
26 Feb 07 |
jari |
2389 |
} |
2 |
26 Feb 07 |
jari |
2390 |
IViewer viewer = getCurrentViewer(); |
2 |
26 Feb 07 |
jari |
2391 |
BufferedImage bImage = viewer.getImage(); |
2 |
26 Feb 07 |
jari |
2392 |
if (bImage == null) { |
2 |
26 Feb 07 |
jari |
2393 |
bImage = createDefaultImage(viewer); |
2 |
26 Feb 07 |
jari |
2394 |
} |
2 |
26 Feb 07 |
jari |
2395 |
Graphics2D g2 = (Graphics2D) g; |
2 |
26 Feb 07 |
jari |
2396 |
AffineTransform t2d = new AffineTransform(); |
2 |
26 Feb 07 |
jari |
2397 |
t2d.translate(pf.getImageableX(), pf.getImageableY()); |
2 |
26 Feb 07 |
jari |
2398 |
double xscale = pf.getImageableWidth() / (double)bImage.getWidth(); |
2 |
26 Feb 07 |
jari |
2399 |
double yscale = pf.getImageableHeight() / (double)bImage.getHeight(); |
2 |
26 Feb 07 |
jari |
2400 |
double scale = Math.min(xscale, yscale); |
2 |
26 Feb 07 |
jari |
2401 |
t2d.scale(scale, scale); |
2 |
26 Feb 07 |
jari |
2402 |
try { |
2 |
26 Feb 07 |
jari |
2403 |
g2.drawImage(bImage, t2d, this); |
2 |
26 Feb 07 |
jari |
2404 |
} catch (Exception ex) { |
2 |
26 Feb 07 |
jari |
2405 |
ex.printStackTrace(); |
2 |
26 Feb 07 |
jari |
2406 |
return Printable.NO_SUCH_PAGE; |
2 |
26 Feb 07 |
jari |
2407 |
} |
2 |
26 Feb 07 |
jari |
2408 |
return Printable.PAGE_EXISTS; |
2 |
26 Feb 07 |
jari |
2409 |
} |
2 |
26 Feb 07 |
jari |
2410 |
|
2 |
26 Feb 07 |
jari |
2411 |
/** |
2 |
26 Feb 07 |
jari |
* Adds a specified node into the analysis node. |
2 |
26 Feb 07 |
jari |
2413 |
*/ |
2 |
26 Feb 07 |
jari |
2414 |
public synchronized void addAnalysisResult(DefaultMutableTreeNode node) { |
2 |
26 Feb 07 |
jari |
2415 |
if (node == null) { |
2 |
26 Feb 07 |
jari |
2416 |
return; |
2 |
26 Feb 07 |
jari |
2417 |
} |
2 |
26 Feb 07 |
jari |
2418 |
String nodeTitle = (String) node.getUserObject(); |
2 |
26 Feb 07 |
jari |
2419 |
nodeTitle += " ("+resultCount+")"; |
2 |
26 Feb 07 |
jari |
2420 |
resultCount++; |
2 |
26 Feb 07 |
jari |
2421 |
modifiedResult = true; |
2 |
26 Feb 07 |
jari |
2422 |
node.setUserObject(nodeTitle); |
2 |
26 Feb 07 |
jari |
2423 |
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
2424 |
treeModel.insertNodeInto(node, analysisNode, analysisNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
2425 |
TreeSelectionModel selModel = tree.getSelectionModel(); |
2 |
26 Feb 07 |
jari |
2426 |
TreePath treePath = new TreePath(node.getPath()); |
2 |
26 Feb 07 |
jari |
2427 |
selModel.setSelectionPath(treePath); |
2 |
26 Feb 07 |
jari |
2428 |
tree.scrollPathToVisible(treePath); |
2 |
26 Feb 07 |
jari |
2429 |
JScrollBar bar = this.treeScrollPane.getHorizontalScrollBar(); |
2 |
26 Feb 07 |
jari |
2430 |
if(bar != null) |
2 |
26 Feb 07 |
jari |
2431 |
bar.setValue(0); |
2 |
26 Feb 07 |
jari |
2432 |
|
2 |
26 Feb 07 |
jari |
2433 |
addHistory("Analysis Result: "+nodeTitle); |
2 |
26 Feb 07 |
jari |
/// this.saveAnalysis(); |
2 |
26 Feb 07 |
jari |
// this.loadAnalysis(); |
2 |
26 Feb 07 |
jari |
/* try{ |
2 |
26 Feb 07 |
jari |
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("c:/Temp/out.out")); |
2 |
26 Feb 07 |
jari |
tree.writeResults(oos); |
2 |
26 Feb 07 |
jari |
oos.flush(); |
2 |
26 Feb 07 |
jari |
oos.close(); |
2 |
26 Feb 07 |
jari |
2441 |
|
2 |
26 Feb 07 |
jari |
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("c:/Temp/out.out")); |
2 |
26 Feb 07 |
jari |
2443 |
|
2 |
26 Feb 07 |
jari |
treeModel.insertNodeInto(tree.loadResults(ois), analysisNode, analysisNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
2445 |
|
2 |
26 Feb 07 |
jari |
} catch (Exception e) { e.printStackTrace();} |
2 |
26 Feb 07 |
jari |
2447 |
**/ |
2 |
26 Feb 07 |
jari |
2448 |
} |
2 |
26 Feb 07 |
jari |
2449 |
|
2 |
26 Feb 07 |
jari |
2450 |
/** |
2 |
26 Feb 07 |
jari |
* Adds info into the history node. |
2 |
26 Feb 07 |
jari |
2452 |
*/ |
2 |
26 Feb 07 |
jari |
2453 |
private void addHistory(String info) { |
2 |
26 Feb 07 |
jari |
2454 |
historyLog.addHistory(info); |
2 |
26 Feb 07 |
jari |
2455 |
} |
2 |
26 Feb 07 |
jari |
2456 |
|
2 |
26 Feb 07 |
jari |
2457 |
/** |
2 |
26 Feb 07 |
jari |
* Runs an analysis task and inserts its result into the analysis node. |
2 |
26 Feb 07 |
jari |
2459 |
*/ |
2 |
26 Feb 07 |
jari |
2460 |
private void onAnalysis(Action action) { |
2 |
26 Feb 07 |
jari |
2461 |
String className = (String)action.getValue(ActionManager.PARAMETER); |
2 |
26 Feb 07 |
jari |
2462 |
try { |
2 |
26 Feb 07 |
jari |
2463 |
Class clazz = Class.forName(className); |
2 |
26 Feb 07 |
jari |
2464 |
final IClusterGUI gui = (IClusterGUI)clazz.newInstance(); |
2 |
26 Feb 07 |
jari |
2465 |
Thread thread = new Thread(new Runnable() { |
2 |
26 Feb 07 |
jari |
2466 |
public void run() { |
2 |
26 Feb 07 |
jari |
2467 |
try { |
2 |
26 Feb 07 |
jari |
2468 |
DefaultMutableTreeNode result = gui.execute(framework); |
2 |
26 Feb 07 |
jari |
2469 |
addAnalysisResult(result); |
2 |
26 Feb 07 |
jari |
2470 |
} catch (AbortException e) { |
2 |
26 Feb 07 |
jari |
// analysis was canceled by the user |
2 |
26 Feb 07 |
jari |
2472 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
2473 |
ShowThrowableDialog.show(mainframe, "Analysis Error", false, e); |
2 |
26 Feb 07 |
jari |
2474 |
} catch (Throwable t) { |
2 |
26 Feb 07 |
jari |
2475 |
ShowThrowableDialog.show(mainframe, "Out of Memory", false, t); |
2 |
26 Feb 07 |
jari |
2476 |
} |
2 |
26 Feb 07 |
jari |
2477 |
} |
2 |
26 Feb 07 |
jari |
2478 |
}); |
2 |
26 Feb 07 |
jari |
2479 |
thread.setPriority(Thread.MIN_PRIORITY); |
2 |
26 Feb 07 |
jari |
2480 |
thread.start(); |
2 |
26 Feb 07 |
jari |
2481 |
} catch (ClassCastException e) { |
2 |
26 Feb 07 |
jari |
2482 |
System.out.println("Error: org.tigr.microarray.mev.cluster.gui.IClusterGUI interface is expected."); |
2 |
26 Feb 07 |
jari |
2483 |
ShowThrowableDialog.show(mainframe, "Analysis Error", false, e); |
2 |
26 Feb 07 |
jari |
2484 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
2485 |
ShowThrowableDialog.show(mainframe, "Analysis Error", false, e); |
2 |
26 Feb 07 |
jari |
2486 |
} |
2 |
26 Feb 07 |
jari |
2487 |
} |
2 |
26 Feb 07 |
jari |
2488 |
|
2 |
26 Feb 07 |
jari |
2489 |
/** |
2 |
26 Feb 07 |
jari |
* Deletes a selected navigation tree node. |
2 |
26 Feb 07 |
jari |
2491 |
*/ |
2 |
26 Feb 07 |
jari |
2492 |
private void onDeleteNode() { |
2 |
26 Feb 07 |
jari |
2493 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); |
2 |
26 Feb 07 |
jari |
2494 |
if (node == null || node.getParent() == null) { |
2 |
26 Feb 07 |
jari |
2495 |
return; |
2 |
26 Feb 07 |
jari |
2496 |
} |
2 |
26 Feb 07 |
jari |
2497 |
fireOnCloseEvent(node); |
2 |
26 Feb 07 |
jari |
2498 |
TreePath parentPath = new TreePath(((DefaultMutableTreeNode)node.getParent()).getPath()); |
2 |
26 Feb 07 |
jari |
2499 |
((DefaultTreeModel)tree.getModel()).removeNodeFromParent(node); |
2 |
26 Feb 07 |
jari |
2500 |
((TreeSelectionModel)tree.getSelectionModel()).setSelectionPath(parentPath); |
2 |
26 Feb 07 |
jari |
2501 |
tree.scrollPathToVisible(parentPath); |
2 |
26 Feb 07 |
jari |
2502 |
|
2 |
26 Feb 07 |
jari |
2503 |
String nodeName = " "; |
2 |
26 Feb 07 |
jari |
2504 |
Object object = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
2505 |
if(object instanceof LeafInfo) |
2 |
26 Feb 07 |
jari |
2506 |
nodeName = ((LeafInfo)object).toString(); |
2 |
26 Feb 07 |
jari |
2507 |
else if(object instanceof String) |
2 |
26 Feb 07 |
jari |
2508 |
nodeName = (String)object; |
2 |
26 Feb 07 |
jari |
2509 |
addHistory("Deleted Node: "+nodeName); |
2 |
26 Feb 07 |
jari |
2510 |
|
2 |
26 Feb 07 |
jari |
2511 |
} |
2 |
26 Feb 07 |
jari |
2512 |
|
2 |
26 Feb 07 |
jari |
2513 |
/** |
2 |
26 Feb 07 |
jari |
2514 |
* |
2 |
26 Feb 07 |
jari |
2515 |
*/ |
2 |
26 Feb 07 |
jari |
2516 |
private void onSetData(boolean isSelected) { |
2 |
26 Feb 07 |
jari |
2517 |
boolean selected = isSelected; |
2 |
26 Feb 07 |
jari |
2518 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); |
2 |
26 Feb 07 |
jari |
2519 |
Object object = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
2520 |
String nodeName; |
2 |
26 Feb 07 |
jari |
2521 |
Experiment experiment; |
2 |
26 Feb 07 |
jari |
2522 |
int [][] clusters; |
2 |
26 Feb 07 |
jari |
2523 |
LeafInfo leafInfo; |
2 |
26 Feb 07 |
jari |
2524 |
int index = 0; |
2 |
26 Feb 07 |
jari |
2525 |
int viewerType; |
2 |
26 Feb 07 |
jari |
2526 |
|
2 |
26 Feb 07 |
jari |
2527 |
if (node == null || node.getParent() == null) { |
2 |
26 Feb 07 |
jari |
2528 |
return; |
2 |
26 Feb 07 |
jari |
2529 |
} |
2 |
26 Feb 07 |
jari |
2530 |
|
2 |
26 Feb 07 |
jari |
2531 |
if(object instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
2532 |
leafInfo = (LeafInfo)object; |
2 |
26 Feb 07 |
jari |
2533 |
|
2 |
26 Feb 07 |
jari |
2534 |
IViewer viewer = leafInfo.getViewer(); |
2 |
26 Feb 07 |
jari |
2535 |
if(viewer != null) { |
2 |
26 Feb 07 |
jari |
2536 |
experiment = viewer.getExperiment(); |
2 |
26 Feb 07 |
jari |
2537 |
clusters = viewer.getClusters(); |
2 |
26 Feb 07 |
jari |
2538 |
|
2 |
26 Feb 07 |
jari |
//special case, reset to main view data |
2 |
26 Feb 07 |
jari |
2540 |
if(leafInfo.toString().equals("Main View")) { |
2 |
26 Feb 07 |
jari |
2541 |
tree.clearDataSelection(); |
2 |
26 Feb 07 |
jari |
2542 |
leafInfo.setSelectedDataSource(isSelected); |
2 |
26 Feb 07 |
jari |
2543 |
data.setUseMainData(true); |
2 |
26 Feb 07 |
jari |
//createDataSelectionNode((DefaultMutableTreeNode)(tree.getRoot().getChildAt(0)), data.getExperiment()); |
2 |
26 Feb 07 |
jari |
2545 |
createDataSelectionNode((DefaultMutableTreeNode)(tree.getRoot().getChildAt(0)), data.getExperiment(), data.getExperiment().getNumberOfGenes(), Cluster.GENE_CLUSTER); |
2 |
26 Feb 07 |
jari |
2546 |
tree.repaint(); |
2 |
26 Feb 07 |
jari |
2547 |
return; |
2 |
26 Feb 07 |
jari |
2548 |
} |
2 |
26 Feb 07 |
jari |
2549 |
|
2 |
26 Feb 07 |
jari |
2550 |
if(experiment == null || clusters == null) |
2 |
26 Feb 07 |
jari |
2551 |
return; |
2 |
26 Feb 07 |
jari |
2552 |
|
2 |
26 Feb 07 |
jari |
2553 |
Object leafUserObject = leafInfo.getUserObject(); |
2 |
26 Feb 07 |
jari |
2554 |
if(leafUserObject instanceof Integer) { |
2 |
26 Feb 07 |
jari |
2555 |
index = ((Integer)leafUserObject).intValue(); |
2 |
26 Feb 07 |
jari |
2556 |
} else if (leafUserObject instanceof CentroidUserObject) { |
2 |
26 Feb 07 |
jari |
2557 |
index = ((CentroidUserObject)leafUserObject).getClusterIndex(); |
2 |
26 Feb 07 |
jari |
2558 |
} else { |
2 |
26 Feb 07 |
jari |
//need to consider status of check box, log report |
2 |
26 Feb 07 |
jari |
2560 |
return; |
2 |
26 Feb 07 |
jari |
2561 |
} |
2 |
26 Feb 07 |
jari |
2562 |
|
2 |
26 Feb 07 |
jari |
2563 |
viewerType = viewer.getViewerType(); |
2 |
26 Feb 07 |
jari |
2564 |
|
2 |
26 Feb 07 |
jari |
2565 |
if(viewerType == -1) |
2 |
26 Feb 07 |
jari |
2566 |
return; |
2 |
26 Feb 07 |
jari |
2567 |
|
2 |
26 Feb 07 |
jari |
//have clusters, experiment, cluster index, and viewer type |
2 |
26 Feb 07 |
jari |
2569 |
|
2 |
26 Feb 07 |
jari |
//Need to traverse result tree and set all LeafInfo selections to false. |
2 |
26 Feb 07 |
jari |
2571 |
tree.clearDataSelection(); |
2 |
26 Feb 07 |
jari |
2572 |
|
2 |
26 Feb 07 |
jari |
//set as selected data source |
2 |
26 Feb 07 |
jari |
2574 |
leafInfo.setSelectedDataSource(isSelected); |
2 |
26 Feb 07 |
jari |
2575 |
|
2 |
26 Feb 07 |
jari |
2576 |
if(isSelected) { |
2 |
26 Feb 07 |
jari |
2577 |
data.constructAndSetAlternateExperiment(experiment, clusters[index], viewerType); |
2 |
26 Feb 07 |
jari |
2578 |
createDataSelectionNode(node, experiment, clusters[index].length, viewerType); |
2 |
26 Feb 07 |
jari |
2579 |
} else { |
2 |
26 Feb 07 |
jari |
//reset to main data set due to de-selection of node |
2 |
26 Feb 07 |
jari |
2581 |
data.setUseMainData(true); |
2 |
26 Feb 07 |
jari |
2582 |
((LeafInfo)((DefaultMutableTreeNode)(tree.getRoot().getChildAt(0))).getUserObject()).setSelectedDataSource(true); |
2 |
26 Feb 07 |
jari |
2583 |
createDataSelectionNode((DefaultMutableTreeNode)(tree.getRoot().getChildAt(0)), data.getExperiment(), data.getExperiment().getNumberOfGenes(), Cluster.GENE_CLUSTER); |
2 |
26 Feb 07 |
jari |
2584 |
} |
2 |
26 Feb 07 |
jari |
2585 |
} |
2 |
26 Feb 07 |
jari |
2586 |
} |
2 |
26 Feb 07 |
jari |
2587 |
tree.repaint(); |
2 |
26 Feb 07 |
jari |
2588 |
} |
2 |
26 Feb 07 |
jari |
2589 |
|
2 |
26 Feb 07 |
jari |
2590 |
private void createDataSelectionNode(DefaultMutableTreeNode node, Experiment experiment, int clusterSize, int clusterType) { |
2 |
26 Feb 07 |
jari |
2591 |
int numGenes; |
2 |
26 Feb 07 |
jari |
2592 |
int numSamples; |
2 |
26 Feb 07 |
jari |
2593 |
String dataSourcePath = ""; |
2 |
26 Feb 07 |
jari |
2594 |
String msg = "<html><body>"; |
2 |
26 Feb 07 |
jari |
2595 |
|
2 |
26 Feb 07 |
jari |
2596 |
msg += "<h1>Data Source Selection Information</h1>"; |
2 |
26 Feb 07 |
jari |
2597 |
msg += "<table align=left>"; |
2 |
26 Feb 07 |
jari |
2598 |
|
2 |
26 Feb 07 |
jari |
2599 |
TreeNode [] path = node.getPath(); |
2 |
26 Feb 07 |
jari |
2600 |
String indent = " "; |
2 |
26 Feb 07 |
jari |
2601 |
|
2 |
26 Feb 07 |
jari |
2602 |
msg += "<tr><td><b>Data Source Path:</b></td><td>"; |
2 |
26 Feb 07 |
jari |
2603 |
dataSourcePath += "Data Source Path: "; |
2 |
26 Feb 07 |
jari |
2604 |
|
2 |
26 Feb 07 |
jari |
2605 |
for(int i = 1; i < path.length-1; i++) { |
2 |
26 Feb 07 |
jari |
2606 |
msg+= path[i].toString(); |
2 |
26 Feb 07 |
jari |
2607 |
msg+=" : "; |
2 |
26 Feb 07 |
jari |
2608 |
|
2 |
26 Feb 07 |
jari |
2609 |
dataSourcePath += path[i].toString(); |
2 |
26 Feb 07 |
jari |
2610 |
dataSourcePath += " : "; |
2 |
26 Feb 07 |
jari |
2611 |
} |
2 |
26 Feb 07 |
jari |
2612 |
|
2 |
26 Feb 07 |
jari |
2613 |
msg += path[path.length-1]+"</td></tr>"; |
2 |
26 Feb 07 |
jari |
2614 |
dataSourcePath += path[path.length-1]; |
2 |
26 Feb 07 |
jari |
2615 |
|
2 |
26 Feb 07 |
jari |
2616 |
if(clusterType == Cluster.GENE_CLUSTER) { |
2 |
26 Feb 07 |
jari |
2617 |
numGenes = clusterSize; |
2 |
26 Feb 07 |
jari |
2618 |
numSamples = experiment.getNumberOfSamples(); |
2 |
26 Feb 07 |
jari |
2619 |
msg += "<tr><td><b>Number of Genes:</b></td><td>"+clusterSize+"</td></tr>"; |
2 |
26 Feb 07 |
jari |
2620 |
msg += "<tr><td><b>Number of Samples:</b></td><td>"+experiment.getNumberOfSamples()+"</td></tr>"; |
2 |
26 Feb 07 |
jari |
2621 |
} else { |
2 |
26 Feb 07 |
jari |
2622 |
numGenes = experiment.getNumberOfGenes(); |
2 |
26 Feb 07 |
jari |
2623 |
numSamples = clusterSize; |
2 |
26 Feb 07 |
jari |
2624 |
msg += "<tr><td><b>Number of Genes:</b></td><td>"+experiment.getNumberOfGenes()+"</td></tr>"; |
2 |
26 Feb 07 |
jari |
2625 |
msg += "<tr><td><b>Number of Samples:</b></td><td>"+clusterSize+"</td></tr>"; |
2 |
26 Feb 07 |
jari |
2626 |
} |
2 |
26 Feb 07 |
jari |
2627 |
|
2 |
26 Feb 07 |
jari |
2628 |
msg += "</table></body></html>"; |
2 |
26 Feb 07 |
jari |
2629 |
|
2 |
26 Feb 07 |
jari |
2630 |
DefaultMutableTreeNode dataInfoNode = new DefaultMutableTreeNode(new LeafInfo("Data Source Selection", new TextViewer(msg))); |
2 |
26 Feb 07 |
jari |
2631 |
addNode(this.analysisNode, dataInfoNode); |
2 |
26 Feb 07 |
jari |
// tree.scrollToVisible(dataInfoNode); |
2 |
26 Feb 07 |
jari |
2633 |
String historyString = "Data Source Selection\n"; |
2 |
26 Feb 07 |
jari |
2634 |
historyString += "=====================\n"; |
2 |
26 Feb 07 |
jari |
2635 |
historyString += dataSourcePath + "\n"; |
2 |
26 Feb 07 |
jari |
2636 |
historyString += "Number of Genes: "+String.valueOf(numGenes)+"\n"; |
2 |
26 Feb 07 |
jari |
2637 |
historyString += "Number of Samples: "+String.valueOf(numSamples); |
2 |
26 Feb 07 |
jari |
2638 |
addHistory(historyString); |
2 |
26 Feb 07 |
jari |
2639 |
} |
2 |
26 Feb 07 |
jari |
//vu 7.22.05 |
2 |
26 Feb 07 |
jari |
2641 |
private void onRama() { |
2 |
26 Feb 07 |
jari |
//to modularize code as much as possible, will create object here that |
2 |
26 Feb 07 |
jari |
//handles rama stuff |
2 |
26 Feb 07 |
jari |
2644 |
Rama rama = new Rama(this, this.menubar); |
2 |
26 Feb 07 |
jari |
2645 |
} |
2 |
26 Feb 07 |
jari |
2646 |
private void onRamaDoc() { |
2 |
26 Feb 07 |
jari |
2647 |
try { |
2 |
26 Feb 07 |
jari |
2648 |
BrowserLauncher.openURL( "http://www.expression.washington.edu/ramaDoc/MeV-R_Documentation.html" ); |
2 |
26 Feb 07 |
jari |
//BrowserLauncher.openURL( "http://192.168.200.50:8080/ramaDoc/MeV-R_Documentation.html" ); |
2 |
26 Feb 07 |
jari |
2650 |
} catch( IOException e ) { |
2 |
26 Feb 07 |
jari |
2651 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
//BrowserLauncher doesn't work on this system, display dialog |
2 |
26 Feb 07 |
jari |
2653 |
JOptionPane.showMessageDialog( framework.getFrame(), |
2 |
26 Feb 07 |
jari |
2654 |
"Please see MeV-R_Documentation.html in the documentation folder", |
2 |
26 Feb 07 |
jari |
2655 |
"Input Error", JOptionPane.ERROR_MESSAGE ); |
2 |
26 Feb 07 |
jari |
2656 |
} |
2 |
26 Feb 07 |
jari |
2657 |
} |
2 |
26 Feb 07 |
jari |
/** pcahan |
2 |
26 Feb 07 |
jari |
* Sets the user specified Detection Filter. |
2 |
26 Feb 07 |
jari |
2660 |
*/ |
2 |
26 Feb 07 |
jari |
2661 |
private void onSetDetectionFilter() { |
2 |
26 Feb 07 |
jari |
//SetDetectionFilterDialog sdfd = new SetDetectionFilterDialog(getFrame(), data.getDetectionFilter() ); |
2 |
26 Feb 07 |
jari |
2663 |
|
2 |
26 Feb 07 |
jari |
2664 |
int num_samples = data.getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
2665 |
String[] sample_names = new String[num_samples]; |
2 |
26 Feb 07 |
jari |
2666 |
for (int i = 0; i < num_samples; i++){ |
2 |
26 Feb 07 |
jari |
2667 |
sample_names[i] = data.getFullSampleName(i); |
2 |
26 Feb 07 |
jari |
2668 |
} |
2 |
26 Feb 07 |
jari |
2669 |
SetDetectionFilterDialog sdfd; |
2 |
26 Feb 07 |
jari |
2670 |
if ( data.getdfSet() ) { |
2 |
26 Feb 07 |
jari |
2671 |
sdfd = new SetDetectionFilterDialog(getFrame(), sample_names, data.getDetectionFilter() ); |
2 |
26 Feb 07 |
jari |
2672 |
} |
2 |
26 Feb 07 |
jari |
2673 |
else { |
2 |
26 Feb 07 |
jari |
2674 |
sdfd = new SetDetectionFilterDialog(getFrame(), |
2 |
26 Feb 07 |
jari |
2675 |
sample_names); |
2 |
26 Feb 07 |
jari |
2676 |
data.setdfSet(true); |
2 |
26 Feb 07 |
jari |
2677 |
} |
2 |
26 Feb 07 |
jari |
//SetDetectionFilterDialog sdfd = new SetDetectionFilterDialog(getFrame(), data.getDetectionFilter() ); |
2 |
26 Feb 07 |
jari |
2679 |
if (sdfd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2680 |
data.setDetectionFilter(sdfd.getDetectionFilter()); |
2 |
26 Feb 07 |
jari |
2681 |
if (data.isDetectionFilter()) { |
2 |
26 Feb 07 |
jari |
2682 |
addHistory("Detection Filter (" + data.getDetectionFilter() + ")"); |
2 |
26 Feb 07 |
jari |
2683 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2684 |
} |
2 |
26 Feb 07 |
jari |
2685 |
} |
2 |
26 Feb 07 |
jari |
2686 |
} |
2 |
26 Feb 07 |
jari |
2687 |
|
2 |
26 Feb 07 |
jari |
2688 |
|
2 |
26 Feb 07 |
jari |
2689 |
private void onSetFoldFilter() { |
2 |
26 Feb 07 |
jari |
2690 |
SetFoldFilterDialog ffd; |
2 |
26 Feb 07 |
jari |
2691 |
int num_samples = data.getFeaturesCount(); |
2 |
26 Feb 07 |
jari |
2692 |
String[] sample_names = new String[num_samples]; |
2 |
26 Feb 07 |
jari |
2693 |
for (int i = 0; i < num_samples; i++){ |
2 |
26 Feb 07 |
jari |
2694 |
sample_names[i] = data.getFullSampleName(i); |
2 |
26 Feb 07 |
jari |
2695 |
} |
2 |
26 Feb 07 |
jari |
2696 |
|
2 |
26 Feb 07 |
jari |
2697 |
if ( data.getffSet() ) { |
2 |
26 Feb 07 |
jari |
2698 |
ffd = new SetFoldFilterDialog(getFrame(),sample_names); |
2 |
26 Feb 07 |
jari |
2699 |
} |
2 |
26 Feb 07 |
jari |
2700 |
else{ |
2 |
26 Feb 07 |
jari |
2701 |
ffd = new SetFoldFilterDialog(getFrame(),sample_names); |
2 |
26 Feb 07 |
jari |
2702 |
data.setffSet(true); |
2 |
26 Feb 07 |
jari |
2703 |
} |
2 |
26 Feb 07 |
jari |
2704 |
|
2 |
26 Feb 07 |
jari |
2705 |
if (ffd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2706 |
data.setFoldFilter(ffd.getFoldFilter()); |
2 |
26 Feb 07 |
jari |
2707 |
if (data.isFoldFilter()) { |
2 |
26 Feb 07 |
jari |
2708 |
addHistory("Fold Filter (" + data.getFoldFilter().toString() + ")"); |
2 |
26 Feb 07 |
jari |
2709 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2710 |
|
2 |
26 Feb 07 |
jari |
2711 |
} |
2 |
26 Feb 07 |
jari |
2712 |
} |
2 |
26 Feb 07 |
jari |
2713 |
} |
2 |
26 Feb 07 |
jari |
2714 |
|
2 |
26 Feb 07 |
jari |
2715 |
|
2 |
26 Feb 07 |
jari |
2716 |
/** |
2 |
26 Feb 07 |
jari |
* Applys the percentage cutoff filter for cDNA |
2 |
26 Feb 07 |
jari |
2718 |
*/ |
2 |
26 Feb 07 |
jari |
2719 |
private void applyLowerCutoffs() { |
2 |
26 Feb 07 |
jari |
2720 |
SetLowerCutoffsDialog slcd = new SetLowerCutoffsDialog(getFrame(), data.getLowerCY3Cutoff(), data.getLowerCY5Cutoff()); |
2 |
26 Feb 07 |
jari |
2721 |
if (slcd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2722 |
|
2 |
26 Feb 07 |
jari |
2723 |
boolean useCutoff = slcd.isLowerCutoffEnabled(); |
2 |
26 Feb 07 |
jari |
2724 |
|
2 |
26 Feb 07 |
jari |
2725 |
data.setUseLowerCutoffs(useCutoff); |
2 |
26 Feb 07 |
jari |
2726 |
data.setLowerCutoffs(slcd.getLowerCY3Cutoff(), slcd.getLowerCY5Cutoff()); |
2 |
26 Feb 07 |
jari |
2727 |
Properties props = new Properties(); |
2 |
26 Feb 07 |
jari |
2728 |
props.setProperty("CY3 Cutoff", Float.toString(slcd.getLowerCY3Cutoff())); |
2 |
26 Feb 07 |
jari |
2729 |
props.setProperty("CY5 Cutoff", Float.toString(slcd.getLowerCY5Cutoff())); |
2 |
26 Feb 07 |
jari |
2730 |
|
2 |
26 Feb 07 |
jari |
2731 |
if (data.isLowerCutoffs()) { |
2 |
26 Feb 07 |
jari |
2732 |
addAdjustmentResultNodes("Data Filter - Low Intensity Cutoff Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2733 |
addHistory("Low Intensity Cutoff Filter is ON ( cy3= " +Float.toString(slcd.getLowerCY3Cutoff())+" cy5 ="+Float.toString(slcd.getLowerCY5Cutoff())+" )"); |
2 |
26 Feb 07 |
jari |
2734 |
} else { |
2 |
26 Feb 07 |
jari |
2735 |
addHistory("Low Intensity Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2736 |
} |
2 |
26 Feb 07 |
jari |
2737 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2738 |
} |
2 |
26 Feb 07 |
jari |
2739 |
} |
2 |
26 Feb 07 |
jari |
2740 |
|
2 |
26 Feb 07 |
jari |
2741 |
/** |
2 |
26 Feb 07 |
jari |
* Applys the percentage cutoff filter for affy cy3=0.0 |
2 |
26 Feb 07 |
jari |
2743 |
*/ |
2 |
26 Feb 07 |
jari |
2744 |
private void applySingleLowerCutoffs() { |
2 |
26 Feb 07 |
jari |
2745 |
SetSingleLowerCutoffsDialog slcd = new SetSingleLowerCutoffsDialog(getFrame(),data.getLowerCY5Cutoff()); |
2 |
26 Feb 07 |
jari |
2746 |
if (slcd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2747 |
|
2 |
26 Feb 07 |
jari |
2748 |
boolean useCutoff = slcd.isLowerCutoffEnabled(); |
2 |
26 Feb 07 |
jari |
2749 |
|
2 |
26 Feb 07 |
jari |
2750 |
data.setUseLowerCutoffs(useCutoff); |
2 |
26 Feb 07 |
jari |
2751 |
data.setLowerCutoffs(0.0f, slcd.getLowerCY5Cutoff()); |
2 |
26 Feb 07 |
jari |
2752 |
Properties props = new Properties(); |
2 |
26 Feb 07 |
jari |
//props.setProperty("CY3 Cutoff", Float.toString(slcd.getLowerCY3Cutoff())); |
2 |
26 Feb 07 |
jari |
2754 |
props.setProperty("CY5 Cutoff", Float.toString(slcd.getLowerCY5Cutoff())); |
2 |
26 Feb 07 |
jari |
2755 |
|
2 |
26 Feb 07 |
jari |
2756 |
if (data.isLowerCutoffs()) { |
2 |
26 Feb 07 |
jari |
2757 |
addAdjustmentResultNodes("Data Filter - Low Intensity Cutoff Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2758 |
addHistory("Low Intensity Cutoff Filter is ON ( thresholds = " +Float.toString(slcd.getLowerCY5Cutoff())+" )"); |
2 |
26 Feb 07 |
jari |
2759 |
} else { |
2 |
26 Feb 07 |
jari |
2760 |
addHistory("Low Intensity Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2761 |
} |
2 |
26 Feb 07 |
jari |
2762 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2763 |
} |
2 |
26 Feb 07 |
jari |
2764 |
} |
2 |
26 Feb 07 |
jari |
2765 |
/** |
2 |
26 Feb 07 |
jari |
* Applys the percentage cutoff filter |
2 |
26 Feb 07 |
jari |
2767 |
*/ |
2 |
26 Feb 07 |
jari |
2768 |
private void applyPercentageCutoffs() { |
2 |
26 Feb 07 |
jari |
2769 |
SetPercentageCutoffsDialog spcd = new SetPercentageCutoffsDialog(getFrame(), data.getPercentageCutoff()); |
2 |
26 Feb 07 |
jari |
2770 |
if (spcd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2771 |
boolean useCutoff = spcd.isCutoffFilterEnabled(); |
2 |
26 Feb 07 |
jari |
2772 |
float percent = spcd.getPercentageCutoff(); |
2 |
26 Feb 07 |
jari |
2773 |
|
2 |
26 Feb 07 |
jari |
2774 |
data.setUsePercentageCutoff(useCutoff); |
2 |
26 Feb 07 |
jari |
2775 |
data.setPercentageCutoff(percent); |
2 |
26 Feb 07 |
jari |
2776 |
|
2 |
26 Feb 07 |
jari |
2777 |
Properties props = new Properties(); |
2 |
26 Feb 07 |
jari |
2778 |
props.setProperty("Percentage", Float.toString(percent)); |
2 |
26 Feb 07 |
jari |
2779 |
|
2 |
26 Feb 07 |
jari |
2780 |
if (data.isPercentageCutoff()) { |
2 |
26 Feb 07 |
jari |
2781 |
addAdjustmentResultNodes("Data Filter - Percentage Cutoff Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2782 |
addHistory("Percentage Cutoff Filter is ON ( percent = " +Float.toString(percent)+" )"); |
2 |
26 Feb 07 |
jari |
2783 |
} else { |
2 |
26 Feb 07 |
jari |
2784 |
addHistory("Percentage Cutoff Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2785 |
} |
2 |
26 Feb 07 |
jari |
2786 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2787 |
} |
2 |
26 Feb 07 |
jari |
2788 |
} |
2 |
26 Feb 07 |
jari |
//add present call noise filter by wwang |
2 |
26 Feb 07 |
jari |
2790 |
private void applyPresentCallFilter(){ |
2 |
26 Feb 07 |
jari |
2791 |
SetPresentCallDialog spcd = new SetPresentCallDialog(getFrame(), data.getPercentageCutoff()); |
2 |
26 Feb 07 |
jari |
2792 |
if (spcd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2793 |
boolean useCutoff = spcd.isCutoffFilterEnabled(); |
2 |
26 Feb 07 |
jari |
2794 |
float percent = spcd.getPercentageCutoff(); |
2 |
26 Feb 07 |
jari |
2795 |
|
2 |
26 Feb 07 |
jari |
2796 |
data.setUsePresentCutoff(useCutoff); |
2 |
26 Feb 07 |
jari |
2797 |
data.setPercentageCutoff(percent); |
2 |
26 Feb 07 |
jari |
2798 |
|
2 |
26 Feb 07 |
jari |
2799 |
Properties props = new Properties(); |
2 |
26 Feb 07 |
jari |
2800 |
props.setProperty("Percentage", Float.toString(percent)); |
2 |
26 Feb 07 |
jari |
2801 |
|
2 |
26 Feb 07 |
jari |
2802 |
if (data.isPresentCallCutoff()) { |
2 |
26 Feb 07 |
jari |
2803 |
addAdjustmentResultNodes("Data Filter - Percentage Cutoff Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2804 |
addHistory("Percentage Cutoff Filter is ON ( percent = " +Float.toString(percent)+" )"); |
2 |
26 Feb 07 |
jari |
2805 |
} else { |
2 |
26 Feb 07 |
jari |
2806 |
addHistory("Percentage Cutoff Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2807 |
} |
2 |
26 Feb 07 |
jari |
2808 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2809 |
} |
2 |
26 Feb 07 |
jari |
2810 |
|
2 |
26 Feb 07 |
jari |
2811 |
} |
2 |
26 Feb 07 |
jari |
// add genepix flags filter by wwang |
2 |
26 Feb 07 |
jari |
2813 |
private void applyGenePixFlagsFilter(){ |
2 |
26 Feb 07 |
jari |
2814 |
GenePixCutoffDialog spcd = new GenePixCutoffDialog(mainframe,data.getPercentageCutoff() ); |
2 |
26 Feb 07 |
jari |
2815 |
if (spcd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2816 |
boolean useCutoff = spcd.isCutoffFilterEnabled(); |
2 |
26 Feb 07 |
jari |
2817 |
float percent = spcd.getPercentageCutoff(); |
2 |
26 Feb 07 |
jari |
2818 |
|
2 |
26 Feb 07 |
jari |
2819 |
data.setUseGenePixCutoff(useCutoff); |
2 |
26 Feb 07 |
jari |
2820 |
data.setGenePixCutoff(percent); |
2 |
26 Feb 07 |
jari |
2821 |
|
2 |
26 Feb 07 |
jari |
2822 |
Properties props = new Properties(); |
2 |
26 Feb 07 |
jari |
2823 |
props.setProperty("Percentage", Float.toString(percent)); |
2 |
26 Feb 07 |
jari |
2824 |
|
2 |
26 Feb 07 |
jari |
2825 |
if (data.isGenePixFilter()) { |
2 |
26 Feb 07 |
jari |
2826 |
addAdjustmentResultNodes("Data Filter - GenePix Flags Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2827 |
addHistory("GenePix Flags Filter is ON ( percent = " +Float.toString(percent)+" )"); |
2 |
26 Feb 07 |
jari |
2828 |
} else { |
2 |
26 Feb 07 |
jari |
2829 |
addHistory("GenePix Flags Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2830 |
} |
2 |
26 Feb 07 |
jari |
2831 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2832 |
} |
2 |
26 Feb 07 |
jari |
2833 |
|
2 |
26 Feb 07 |
jari |
2834 |
} |
2 |
26 Feb 07 |
jari |
2835 |
|
2 |
26 Feb 07 |
jari |
2836 |
|
2 |
26 Feb 07 |
jari |
//add present call noise filter by wwang |
2 |
26 Feb 07 |
jari |
2838 |
private void applyGCOSPercentageFilter(){ |
2 |
26 Feb 07 |
jari |
2839 |
SetPresentCallDialog spcd = new SetPresentCallDialog(getFrame(), data.getPercentageCutoff()); |
2 |
26 Feb 07 |
jari |
2840 |
if (spcd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2841 |
boolean useCutoff = spcd.isCutoffFilterEnabled(); |
2 |
26 Feb 07 |
jari |
2842 |
float percent = spcd.getPercentageCutoff(); |
2 |
26 Feb 07 |
jari |
2843 |
|
2 |
26 Feb 07 |
jari |
2844 |
data.setUseGCOSPercentageCutoff(useCutoff); |
2 |
26 Feb 07 |
jari |
2845 |
data.setPercentageCutoff(percent); |
2 |
26 Feb 07 |
jari |
2846 |
|
2 |
26 Feb 07 |
jari |
2847 |
Properties props = new Properties(); |
2 |
26 Feb 07 |
jari |
2848 |
props.setProperty("Percentage", Float.toString(percent)); |
2 |
26 Feb 07 |
jari |
2849 |
|
2 |
26 Feb 07 |
jari |
2850 |
if (data.isGCOSPercentCutoff()) { |
2 |
26 Feb 07 |
jari |
2851 |
addAdjustmentResultNodes("Data Filter - Percentage Cutoff Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2852 |
addHistory("Percentage Cutoff Filter is ON ( percent = " +Float.toString(percent)+" )"); |
2 |
26 Feb 07 |
jari |
2853 |
} else { |
2 |
26 Feb 07 |
jari |
2854 |
addHistory("Percentage Cutoff Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2855 |
} |
2 |
26 Feb 07 |
jari |
2856 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2857 |
} |
2 |
26 Feb 07 |
jari |
2858 |
|
2 |
26 Feb 07 |
jari |
2859 |
} |
2 |
26 Feb 07 |
jari |
2860 |
|
2 |
26 Feb 07 |
jari |
//add p-value filter |
2 |
26 Feb 07 |
jari |
2862 |
private void applyPvaluePercentageFilter(){ |
2 |
26 Feb 07 |
jari |
//SetPresentCallDialog spcd = new SetPresentCallDialog(getFrame(), data.getPercentageCutoff()); |
2 |
26 Feb 07 |
jari |
//if (spcd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2865 |
boolean pvalueCutoff = true; |
2 |
26 Feb 07 |
jari |
2866 |
float percent = 80.0f; |
2 |
26 Feb 07 |
jari |
2867 |
|
2 |
26 Feb 07 |
jari |
2868 |
data.setUsePvaluePercentageCutoff(pvalueCutoff); |
2 |
26 Feb 07 |
jari |
2869 |
data.setPvaluePercentageCutoff(percent); |
2 |
26 Feb 07 |
jari |
2870 |
|
2 |
26 Feb 07 |
jari |
2871 |
Properties props = new Properties(); |
2 |
26 Feb 07 |
jari |
2872 |
props.setProperty("Percentage", Float.toString(percent)); |
2 |
26 Feb 07 |
jari |
2873 |
|
2 |
26 Feb 07 |
jari |
//if (data.isGCOSPercentCutoff()) { |
2 |
26 Feb 07 |
jari |
2875 |
addAdjustmentResultNodes("Data Filter - Percentage Cutoff Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2876 |
addHistory("P-value Percentage Cutoff Filter is ON ( percent = 80%)"); |
2 |
26 Feb 07 |
jari |
//} else { |
2 |
26 Feb 07 |
jari |
// addHistory("Percentage Cutoff Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2879 |
//} |
2 |
26 Feb 07 |
jari |
2880 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2881 |
// } |
2 |
26 Feb 07 |
jari |
2882 |
|
2 |
26 Feb 07 |
jari |
2883 |
} |
2 |
26 Feb 07 |
jari |
/* Applies a variance filter |
2 |
26 Feb 07 |
jari |
2885 |
*/ |
2 |
26 Feb 07 |
jari |
2886 |
private void applyVarianceFilter() { |
2 |
26 Feb 07 |
jari |
2887 |
VarianceFilterDialog dialog = new VarianceFilterDialog(getFrame()); |
2 |
26 Feb 07 |
jari |
2888 |
if(dialog.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
2889 |
Properties props = dialog.getProperties(); |
2 |
26 Feb 07 |
jari |
2890 |
data.setVarianceFilter(props); |
2 |
26 Feb 07 |
jari |
2891 |
|
2 |
26 Feb 07 |
jari |
2892 |
if (data.isVarianceFilter()) { |
2 |
26 Feb 07 |
jari |
2893 |
addAdjustmentResultNodes("Data Filter - Variance Filter", data.getExperiment(), props); |
2 |
26 Feb 07 |
jari |
2894 |
addHistory("Variance Filter is ON ( mode= " + props.getProperty("Filter Mode")+ " value= "+ props.getProperty("Value")+" )"); |
2 |
26 Feb 07 |
jari |
2895 |
} else { |
2 |
26 Feb 07 |
jari |
2896 |
addHistory("Variance Filter is OFF"); |
2 |
26 Feb 07 |
jari |
2897 |
} |
2 |
26 Feb 07 |
jari |
2898 |
|
2 |
26 Feb 07 |
jari |
2899 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2900 |
} |
2 |
26 Feb 07 |
jari |
2901 |
} |
2 |
26 Feb 07 |
jari |
2902 |
|
2 |
26 Feb 07 |
jari |
2903 |
private void addAdjustmentResultNodes(String mainTitle, Experiment experiment, Properties props) { |
2 |
26 Feb 07 |
jari |
2904 |
DefaultMutableTreeNode filterNode = new DefaultMutableTreeNode(mainTitle); |
2 |
26 Feb 07 |
jari |
2905 |
int [][] cluster = new int[1][experiment.getNumberOfGenes()]; |
2 |
26 Feb 07 |
jari |
2906 |
|
2 |
26 Feb 07 |
jari |
//default indices for viewer, experiment will handle mapping |
2 |
26 Feb 07 |
jari |
2908 |
for(int i = 0; i < cluster[0].length; i++) |
2 |
26 Feb 07 |
jari |
2909 |
cluster[0][i] = i; |
2 |
26 Feb 07 |
jari |
2910 |
|
2 |
26 Feb 07 |
jari |
2911 |
DefaultMutableTreeNode expressionNode = new DefaultMutableTreeNode(new LeafInfo("Expression Image", new ExperimentViewer(experiment, cluster), new Integer(0))); |
2 |
26 Feb 07 |
jari |
2912 |
|
2 |
26 Feb 07 |
jari |
2913 |
filterNode.add(expressionNode); |
2 |
26 Feb 07 |
jari |
2914 |
filterNode.add(new DefaultMutableTreeNode("Gene/Row Count: "+cluster[0].length)); |
2 |
26 Feb 07 |
jari |
2915 |
|
2 |
26 Feb 07 |
jari |
2916 |
if(props.size() > 0) { |
2 |
26 Feb 07 |
jari |
2917 |
String label = "Parameter"; |
2 |
26 Feb 07 |
jari |
2918 |
if(props.size() > 1) |
2 |
26 Feb 07 |
jari |
2919 |
label += "s"; |
2 |
26 Feb 07 |
jari |
2920 |
DefaultMutableTreeNode parameterNode = new DefaultMutableTreeNode(label); |
2 |
26 Feb 07 |
jari |
2921 |
Enumeration _enum = props.keys(); |
2 |
26 Feb 07 |
jari |
2922 |
String key; |
2 |
26 Feb 07 |
jari |
2923 |
while(_enum.hasMoreElements()) { |
2 |
26 Feb 07 |
jari |
2924 |
key = (String)_enum.nextElement(); |
2 |
26 Feb 07 |
jari |
2925 |
parameterNode.add(new DefaultMutableTreeNode(key+ ": " + (String)(props.get(key)))); |
2 |
26 Feb 07 |
jari |
2926 |
} |
2 |
26 Feb 07 |
jari |
2927 |
filterNode.add(parameterNode); |
2 |
26 Feb 07 |
jari |
2928 |
} |
2 |
26 Feb 07 |
jari |
2929 |
|
2 |
26 Feb 07 |
jari |
2930 |
this.addNode(analysisNode, filterNode); |
2 |
26 Feb 07 |
jari |
2931 |
|
2 |
26 Feb 07 |
jari |
2932 |
Object [] path = new Object[3]; |
2 |
26 Feb 07 |
jari |
2933 |
path[0] = tree.getRoot(); |
2 |
26 Feb 07 |
jari |
2934 |
path[1] = analysisNode; |
2 |
26 Feb 07 |
jari |
2935 |
path[2] = filterNode; |
2 |
26 Feb 07 |
jari |
2936 |
tree.scrollPathToVisible(new TreePath(path)); |
2 |
26 Feb 07 |
jari |
//this.addAnalysisResult(filterNode); |
2 |
26 Feb 07 |
jari |
2938 |
} |
2 |
26 Feb 07 |
jari |
2939 |
|
2 |
26 Feb 07 |
jari |
2940 |
|
2 |
26 Feb 07 |
jari |
2941 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the user specified use detection filter flag. |
2 |
26 Feb 07 |
jari |
* pcahan |
2 |
26 Feb 07 |
jari |
2944 |
*/ |
2 |
26 Feb 07 |
jari |
2945 |
private void onUseDetectionFilter(AbstractButton item) { |
2 |
26 Feb 07 |
jari |
2946 |
data.setUseDetectionFilter(item.isSelected()); |
2 |
26 Feb 07 |
jari |
2947 |
if (data.isDetectionFilter()) { |
2 |
26 Feb 07 |
jari |
2948 |
addHistory("Detection Filter (" + data.getDetectionFilter() + ")"); |
2 |
26 Feb 07 |
jari |
2949 |
addAdjustmentResultNodes("Data Filter - Affy Detection Filter", data.getExperiment(), new Properties()); |
2 |
26 Feb 07 |
jari |
2950 |
} else { |
2 |
26 Feb 07 |
jari |
2951 |
addHistory("Detection Filter not used."); |
2 |
26 Feb 07 |
jari |
2952 |
} |
2 |
26 Feb 07 |
jari |
2953 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2954 |
} |
2 |
26 Feb 07 |
jari |
2955 |
|
2 |
26 Feb 07 |
jari |
2956 |
private void onUseFoldFilter(AbstractButton item) { |
2 |
26 Feb 07 |
jari |
2957 |
data.setUseFoldFilter(item.isSelected()); |
2 |
26 Feb 07 |
jari |
2958 |
if (data.isFoldFilter()) { |
2 |
26 Feb 07 |
jari |
2959 |
addHistory("Fold Filter (" + data.getDetectionFilter() + ")"); |
2 |
26 Feb 07 |
jari |
2960 |
addAdjustmentResultNodes("Data Filter - Affy Fold Filter", data.getExperiment(), new Properties()); |
2 |
26 Feb 07 |
jari |
2961 |
} else { |
2 |
26 Feb 07 |
jari |
2962 |
addHistory("Fold Filter not used."); |
2 |
26 Feb 07 |
jari |
2963 |
} |
2 |
26 Feb 07 |
jari |
2964 |
addHistory(data.getExperiment().getNumberOfGenes() + " genes will be used in subsequent analyses"); |
2 |
26 Feb 07 |
jari |
2965 |
} |
2 |
26 Feb 07 |
jari |
2966 |
|
2 |
26 Feb 07 |
jari |
2967 |
//////////////////////////////////////////////// |
2 |
26 Feb 07 |
jari |
2968 |
// // |
2 |
26 Feb 07 |
jari |
// Some methods to adjust the framework data. // |
2 |
26 Feb 07 |
jari |
2970 |
// // |
2 |
26 Feb 07 |
jari |
2971 |
//////////////////////////////////////////////// |
2 |
26 Feb 07 |
jari |
2972 |
|
2 |
26 Feb 07 |
jari |
2973 |
private void onLog2Transform() { |
2 |
26 Feb 07 |
jari |
//data.log10toLog2(); |
2 |
26 Feb 07 |
jari |
2975 |
data.log2Transform(); |
2 |
26 Feb 07 |
jari |
2976 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2977 |
addHistory("Log2 Transform"); |
2 |
26 Feb 07 |
jari |
2978 |
} |
2 |
26 Feb 07 |
jari |
2979 |
private void onUnLog2Transform() { |
2 |
26 Feb 07 |
jari |
//data.log10toLog2(); |
2 |
26 Feb 07 |
jari |
2981 |
data.unlog2Transform(); |
2 |
26 Feb 07 |
jari |
2982 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2983 |
addHistory("Unlog2 Transform"); |
2 |
26 Feb 07 |
jari |
2984 |
} |
2 |
26 Feb 07 |
jari |
2985 |
private void onNormalizeSpots() { |
2 |
26 Feb 07 |
jari |
2986 |
data.normalizeSpots(); |
2 |
26 Feb 07 |
jari |
2987 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2988 |
addHistory("Normalize Gene/Row Vectors"); |
2 |
26 Feb 07 |
jari |
2989 |
} |
2 |
26 Feb 07 |
jari |
2990 |
|
2 |
26 Feb 07 |
jari |
2991 |
private void onDivideSpotsRMS() { |
2 |
26 Feb 07 |
jari |
2992 |
data.divideSpotsRMS(); |
2 |
26 Feb 07 |
jari |
2993 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
2994 |
addHistory("Divide by Gene/Row RMS"); |
2 |
26 Feb 07 |
jari |
2995 |
} |
2 |
26 Feb 07 |
jari |
2996 |
|
2 |
26 Feb 07 |
jari |
2997 |
private void onDivideSpotsSD() { |
2 |
26 Feb 07 |
jari |
2998 |
data.divideSpotsSD(); |
2 |
26 Feb 07 |
jari |
2999 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3000 |
addHistory("Divide by Gene/Row SD"); |
2 |
26 Feb 07 |
jari |
3001 |
} |
2 |
26 Feb 07 |
jari |
3002 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
3004 |
private void onDivideGenesMedian() { |
2 |
26 Feb 07 |
jari |
3005 |
data.divideGenesMedian(); |
2 |
26 Feb 07 |
jari |
3006 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3007 |
addHistory("Divide by Gene/Row Median"); |
2 |
26 Feb 07 |
jari |
3008 |
} |
2 |
26 Feb 07 |
jari |
3009 |
|
2 |
26 Feb 07 |
jari |
3010 |
private void onDivideGenesMean() { |
2 |
26 Feb 07 |
jari |
3011 |
data.divideGenesMean(); |
2 |
26 Feb 07 |
jari |
3012 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3013 |
addHistory("Divide by Gene/Row Mean"); |
2 |
26 Feb 07 |
jari |
3014 |
} |
2 |
26 Feb 07 |
jari |
3015 |
|
2 |
26 Feb 07 |
jari |
3016 |
private void onMeanCenterSpots() { |
2 |
26 Feb 07 |
jari |
3017 |
data.meanCenterSpots(); |
2 |
26 Feb 07 |
jari |
3018 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3019 |
addHistory("Mean Center by Gene/Row Mean"); |
2 |
26 Feb 07 |
jari |
3020 |
} |
2 |
26 Feb 07 |
jari |
3021 |
|
2 |
26 Feb 07 |
jari |
3022 |
private void onMedianCenterSpots() { |
2 |
26 Feb 07 |
jari |
3023 |
data.medianCenterSpots(); |
2 |
26 Feb 07 |
jari |
3024 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3025 |
addHistory("Median Center by Gene/Row Median"); |
2 |
26 Feb 07 |
jari |
3026 |
} |
2 |
26 Feb 07 |
jari |
3027 |
|
2 |
26 Feb 07 |
jari |
3028 |
private void onDigitalSpots() { |
2 |
26 Feb 07 |
jari |
3029 |
data.digitalSpots(); |
2 |
26 Feb 07 |
jari |
3030 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3031 |
addHistory("Digital Rows"); |
2 |
26 Feb 07 |
jari |
3032 |
} |
2 |
26 Feb 07 |
jari |
3033 |
|
2 |
26 Feb 07 |
jari |
3034 |
private void onNormalizeExperiments() { |
2 |
26 Feb 07 |
jari |
3035 |
data.normalizeExperiments(); |
2 |
26 Feb 07 |
jari |
3036 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3037 |
addHistory("Normalize Sample/Column Vectors"); |
2 |
26 Feb 07 |
jari |
3038 |
} |
2 |
26 Feb 07 |
jari |
3039 |
|
2 |
26 Feb 07 |
jari |
3040 |
private void onDivideExperimentsRMS() { |
2 |
26 Feb 07 |
jari |
3041 |
data.divideExperimentsRMS(); |
2 |
26 Feb 07 |
jari |
3042 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3043 |
addHistory("Divide by Sample/Column RMS"); |
2 |
26 Feb 07 |
jari |
3044 |
} |
2 |
26 Feb 07 |
jari |
3045 |
|
2 |
26 Feb 07 |
jari |
3046 |
private void onDivideExperimentsSD() { |
2 |
26 Feb 07 |
jari |
3047 |
data.divideExperimentsSD(); |
2 |
26 Feb 07 |
jari |
3048 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3049 |
addHistory("Divide by Sample/Column SD"); |
2 |
26 Feb 07 |
jari |
3050 |
} |
2 |
26 Feb 07 |
jari |
3051 |
|
2 |
26 Feb 07 |
jari |
3052 |
private void onMeanCenterExperiments() { |
2 |
26 Feb 07 |
jari |
3053 |
data.meanCenterExperiments(); |
2 |
26 Feb 07 |
jari |
3054 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3055 |
addHistory("Mean Center by Column/Sample Mean"); |
2 |
26 Feb 07 |
jari |
3056 |
} |
2 |
26 Feb 07 |
jari |
3057 |
|
2 |
26 Feb 07 |
jari |
3058 |
private void onMedianCenterExperiments() { |
2 |
26 Feb 07 |
jari |
3059 |
data.medianCenterExperiments(); |
2 |
26 Feb 07 |
jari |
3060 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3061 |
addHistory("Median Center by Sample/Column Median"); |
2 |
26 Feb 07 |
jari |
3062 |
} |
2 |
26 Feb 07 |
jari |
3063 |
|
2 |
26 Feb 07 |
jari |
3064 |
private void onDigitalExperiments() { |
2 |
26 Feb 07 |
jari |
3065 |
data.digitalExperiments(); |
2 |
26 Feb 07 |
jari |
3066 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3067 |
addHistory("Digital Samples"); |
2 |
26 Feb 07 |
jari |
3068 |
} |
2 |
26 Feb 07 |
jari |
3069 |
|
2 |
26 Feb 07 |
jari |
3070 |
private void onLog10toLog2() { |
2 |
26 Feb 07 |
jari |
3071 |
data.log10toLog2(); |
2 |
26 Feb 07 |
jari |
3072 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3073 |
addHistory("Log10 to Log2"); |
2 |
26 Feb 07 |
jari |
3074 |
} |
2 |
26 Feb 07 |
jari |
3075 |
private void onLog2toLog10() { |
2 |
26 Feb 07 |
jari |
3076 |
data.log2toLog10(); |
2 |
26 Feb 07 |
jari |
3077 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3078 |
addHistory("Log2 to Log10"); |
2 |
26 Feb 07 |
jari |
3079 |
} |
2 |
26 Feb 07 |
jari |
3080 |
private void onAdjustIntensities(AbstractButton item) { |
2 |
26 Feb 07 |
jari |
3081 |
data.setNonZero(item.isSelected()); |
2 |
26 Feb 07 |
jari |
3082 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3083 |
} |
2 |
26 Feb 07 |
jari |
3084 |
|
2 |
26 Feb 07 |
jari |
3085 |
/** |
2 |
26 Feb 07 |
jari |
* Saves the framework data ratio values. |
2 |
26 Feb 07 |
jari |
3087 |
*/ |
2 |
26 Feb 07 |
jari |
3088 |
private void onSaveMatrix() { |
2 |
26 Feb 07 |
jari |
3089 |
try { |
2 |
26 Feb 07 |
jari |
3090 |
ExperimentUtil.saveExperiment(mainframe, data.getExperiment(), data); |
2 |
26 Feb 07 |
jari |
3091 |
addHistory("Save Data Matrix to File"); |
2 |
26 Feb 07 |
jari |
3092 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
3093 |
JOptionPane.showMessageDialog(mainframe, "Can not save matrix!", e.toString(), JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
3094 |
e.printStackTrace(); |
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 |
3099 |
/** |
2 |
26 Feb 07 |
jari |
* Sets the user specified ratio scale. |
2 |
26 Feb 07 |
jari |
3101 |
*/ |
2 |
26 Feb 07 |
jari |
3102 |
private void onSetRatioScale() { |
2 |
26 Feb 07 |
jari |
3103 |
IDisplayMenu menu = menubar.getDisplayMenu(); |
2 |
26 Feb 07 |
jari |
3104 |
SetRatioScaleDialog srsd = new SetRatioScaleDialog(mainframe, framework, menubar, menu.getMaxRatioScale(), menu.getMinRatioScale(), menu.getMidRatioValue(), menu.getUseDoubleGradient()); |
2 |
26 Feb 07 |
jari |
3105 |
if (srsd.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
3106 |
menubar.setMaxRatioScale(srsd.getUpperLimit()); |
2 |
26 Feb 07 |
jari |
3107 |
menubar.setMinRatioScale(srsd.getLowerLimit()); |
2 |
26 Feb 07 |
jari |
3108 |
menubar.setMidRatioValue(srsd.getMidValue()); |
2 |
26 Feb 07 |
jari |
3109 |
menubar.setUseDoubleGradient(srsd.getUseDoubleGradient()); |
2 |
26 Feb 07 |
jari |
3110 |
|
2 |
26 Feb 07 |
jari |
3111 |
if(srsd.isGradientStyleAltered() && srsd.getUseDoubleGradient()) |
2 |
26 Feb 07 |
jari |
3112 |
this.menubar.setPositiveCustomGradient(srsd.getPosImage()); |
2 |
26 Feb 07 |
jari |
3113 |
|
2 |
26 Feb 07 |
jari |
3114 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
3115 |
} |
2 |
26 Feb 07 |
jari |
3116 |
addHistory("Color Sat. Limits Set: Lower = "+ srsd.getLowerLimit() +" Upper = "+ srsd.getUpperLimit()); |
2 |
26 Feb 07 |
jari |
3117 |
} |
2 |
26 Feb 07 |
jari |
3118 |
|
2 |
26 Feb 07 |
jari |
3119 |
/** |
2 |
26 Feb 07 |
jari |
* Removes all published clusters. |
2 |
26 Feb 07 |
jari |
3121 |
*/ |
2 |
26 Feb 07 |
jari |
3122 |
private void onDeleteAll() { |
2 |
26 Feb 07 |
jari |
3123 |
data.deleteColors(); |
2 |
26 Feb 07 |
jari |
3124 |
if(this.geneClusterManager != null) |
2 |
26 Feb 07 |
jari |
3125 |
this.geneClusterManager.deleteAllClusters(); |
2 |
26 Feb 07 |
jari |
3126 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3127 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
3128 |
addHistory("Deleted All Gene Clusters"); |
2 |
26 Feb 07 |
jari |
3129 |
} |
2 |
26 Feb 07 |
jari |
3130 |
|
2 |
26 Feb 07 |
jari |
3131 |
/** |
2 |
26 Feb 07 |
jari |
* Removes all published Experiment clusters |
2 |
26 Feb 07 |
jari |
3133 |
*/ |
2 |
26 Feb 07 |
jari |
3134 |
private void onDeleteAllExperimentClusters() { |
2 |
26 Feb 07 |
jari |
3135 |
data.deleteExperimentColors(); |
2 |
26 Feb 07 |
jari |
3136 |
if(this.experimentClusterManager != null) |
2 |
26 Feb 07 |
jari |
3137 |
this.experimentClusterManager.deleteAllClusters(); |
2 |
26 Feb 07 |
jari |
3138 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3139 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
3140 |
addHistory("Deleted All Sample Clusters"); |
2 |
26 Feb 07 |
jari |
3141 |
} |
2 |
26 Feb 07 |
jari |
3142 |
|
2 |
26 Feb 07 |
jari |
3143 |
|
2 |
26 Feb 07 |
jari |
3144 |
private void selectNode(DefaultMutableTreeNode node) { |
2 |
26 Feb 07 |
jari |
3145 |
this.tree.setSelectionPath(new TreePath(node.getPath())); |
2 |
26 Feb 07 |
jari |
3146 |
} |
2 |
26 Feb 07 |
jari |
3147 |
|
2 |
26 Feb 07 |
jari |
3148 |
/** |
2 |
26 Feb 07 |
jari |
* Allows node additions to tree from objects with a framework reference |
2 |
26 Feb 07 |
jari |
3150 |
*/ |
2 |
26 Feb 07 |
jari |
3151 |
private void addNode(DefaultMutableTreeNode parent, DefaultMutableTreeNode child){ |
2 |
26 Feb 07 |
jari |
3152 |
DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
3153 |
model.insertNodeInto(child,parent, parent.getChildCount()); |
2 |
26 Feb 07 |
jari |
3154 |
this.treeScrollPane.getHorizontalScrollBar().setValue(0); |
2 |
26 Feb 07 |
jari |
3155 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3156 |
} |
2 |
26 Feb 07 |
jari |
3157 |
|
2 |
26 Feb 07 |
jari |
3158 |
/*********** |
2 |
26 Feb 07 |
jari |
3159 |
* |
2 |
26 Feb 07 |
jari |
* Cluster saving and repository code |
2 |
26 Feb 07 |
jari |
3161 |
* |
2 |
26 Feb 07 |
jari |
3162 |
*/ |
2 |
26 Feb 07 |
jari |
3163 |
|
2 |
26 Feb 07 |
jari |
3164 |
/** |
2 |
26 Feb 07 |
jari |
* Stores a cluster with specified indices. |
2 |
26 Feb 07 |
jari |
3166 |
*/ |
2 |
26 Feb 07 |
jari |
3167 |
private Color storeCluster(int [] indices, Experiment experiment, int clusterType){ |
2 |
26 Feb 07 |
jari |
3168 |
DefaultTreeModel model = (DefaultTreeModel) this.tree.getModel(); |
2 |
26 Feb 07 |
jari |
3169 |
TreePath path = this.tree.getSelectionPath(); |
2 |
26 Feb 07 |
jari |
3170 |
DefaultMutableTreeNode clusterNode = (DefaultMutableTreeNode)path.getLastPathComponent(); |
2 |
26 Feb 07 |
jari |
3171 |
Object leafInfo = clusterNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3172 |
if(!(leafInfo instanceof LeafInfo)) |
2 |
26 Feb 07 |
jari |
3173 |
return null; |
2 |
26 Feb 07 |
jari |
3174 |
if(path.getPathCount() < 3) |
2 |
26 Feb 07 |
jari |
3175 |
return null; |
2 |
26 Feb 07 |
jari |
3176 |
Cluster cluster; |
2 |
26 Feb 07 |
jari |
3177 |
Color clusterColor = null; |
2 |
26 Feb 07 |
jari |
3178 |
String clusterID = ((LeafInfo)clusterNode.getUserObject()).toString(); |
2 |
26 Feb 07 |
jari |
3179 |
DefaultMutableTreeNode algorithmNode = (DefaultMutableTreeNode)path.getPathComponent(2); |
2 |
26 Feb 07 |
jari |
3180 |
String algorithmName = (String)algorithmNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3181 |
if(clusterType == ClusterRepository.GENE_CLUSTER){ |
2 |
26 Feb 07 |
jari |
3182 |
if(this.geneClusterRepository == null){ |
2 |
26 Feb 07 |
jari |
3183 |
this.geneClusterRepository = new ClusterRepository(data.getFeaturesSize(), framework, true); |
2 |
26 Feb 07 |
jari |
3184 |
this.data.setGeneClusterRepository(this.geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3185 |
} |
2 |
26 Feb 07 |
jari |
3186 |
cluster = geneClusterRepository.storeCluster(this.resultCount-1, algorithmName, clusterID, indices, clusterNode, experiment); |
2 |
26 Feb 07 |
jari |
3187 |
if(cluster != null) { |
2 |
26 Feb 07 |
jari |
3188 |
clusterColor = cluster.getClusterColor(); |
2 |
26 Feb 07 |
jari |
3189 |
if(geneClusterManager == null){ |
2 |
26 Feb 07 |
jari |
3190 |
this.geneClusterManager = new ClusterTable(this.geneClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
3191 |
DefaultMutableTreeNode genesNode = new DefaultMutableTreeNode(new LeafInfo("Gene Clusters", this.geneClusterManager), false); |
2 |
26 Feb 07 |
jari |
3192 |
addNode(this.clusterNode, genesNode); |
2 |
26 Feb 07 |
jari |
3193 |
} else { |
2 |
26 Feb 07 |
jari |
3194 |
geneClusterManager.onRepositoryChanged(geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3195 |
} |
2 |
26 Feb 07 |
jari |
3196 |
} |
2 |
26 Feb 07 |
jari |
3197 |
geneClusterRepository.printRepository(); |
2 |
26 Feb 07 |
jari |
3198 |
} else { |
2 |
26 Feb 07 |
jari |
3199 |
if(this.experimentClusterRepository == null){ |
2 |
26 Feb 07 |
jari |
3200 |
this.experimentClusterRepository = new ClusterRepository(data.getFeaturesCount(), framework); |
2 |
26 Feb 07 |
jari |
3201 |
this.data.setExperimentClusterRepository(this.experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3202 |
} |
2 |
26 Feb 07 |
jari |
3203 |
cluster = experimentClusterRepository.storeCluster(this.resultCount-1, algorithmName, clusterID, indices, clusterNode, experiment); |
2 |
26 Feb 07 |
jari |
3204 |
if(cluster != null) { |
2 |
26 Feb 07 |
jari |
3205 |
clusterColor = cluster.getClusterColor(); |
2 |
26 Feb 07 |
jari |
3206 |
if(experimentClusterManager == null){ |
2 |
26 Feb 07 |
jari |
3207 |
this.experimentClusterManager = new ClusterTable(this.experimentClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
3208 |
DefaultMutableTreeNode experimentNode = new DefaultMutableTreeNode(new LeafInfo("Sample Clusters", this.experimentClusterManager), false); |
2 |
26 Feb 07 |
jari |
3209 |
addNode(this.clusterNode, experimentNode); |
2 |
26 Feb 07 |
jari |
3210 |
} else { |
2 |
26 Feb 07 |
jari |
3211 |
experimentClusterManager.onRepositoryChanged(experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3212 |
} |
2 |
26 Feb 07 |
jari |
3213 |
} |
2 |
26 Feb 07 |
jari |
3214 |
experimentClusterRepository.printRepository(); |
2 |
26 Feb 07 |
jari |
3215 |
} |
2 |
26 Feb 07 |
jari |
3216 |
|
2 |
26 Feb 07 |
jari |
3217 |
if(cluster != null) { |
2 |
26 Feb 07 |
jari |
3218 |
int serNum = cluster.getSerialNumber(); |
2 |
26 Feb 07 |
jari |
3219 |
String algName = cluster.getAlgorithmName(); |
2 |
26 Feb 07 |
jari |
3220 |
|
2 |
26 Feb 07 |
jari |
3221 |
if(clusterType == Cluster.GENE_CLUSTER) |
2 |
26 Feb 07 |
jari |
3222 |
addHistory("Save Gene Cluster: Serial #: "+String.valueOf(serNum)+", Algorithm: "+ |
2 |
26 Feb 07 |
jari |
3223 |
algName+", Cluster: "+clusterID); |
2 |
26 Feb 07 |
jari |
3224 |
else |
2 |
26 Feb 07 |
jari |
3225 |
addHistory("Save Experiment Cluster: Serial #: "+String.valueOf(serNum)+", Algorithm: "+ |
2 |
26 Feb 07 |
jari |
3226 |
algName+", Cluster: "+clusterID); |
2 |
26 Feb 07 |
jari |
3227 |
} |
2 |
26 Feb 07 |
jari |
3228 |
|
2 |
26 Feb 07 |
jari |
3229 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3230 |
tree.repaint(); |
2 |
26 Feb 07 |
jari |
3231 |
return clusterColor; |
2 |
26 Feb 07 |
jari |
3232 |
} |
2 |
26 Feb 07 |
jari |
3233 |
|
2 |
26 Feb 07 |
jari |
3234 |
/** |
2 |
26 Feb 07 |
jari |
* Stores cluster with provieded indices, allows storage if indices are a subset of |
2 |
26 Feb 07 |
jari |
* the displayed clusters (as in <code>HCLViewer</code> |
2 |
26 Feb 07 |
jari |
3237 |
*/ |
2 |
26 Feb 07 |
jari |
3238 |
private Color storeSubCluster(int [] indices, Experiment experiment, int clusterType){ |
2 |
26 Feb 07 |
jari |
3239 |
DefaultTreeModel model = (DefaultTreeModel) this.tree.getModel(); |
2 |
26 Feb 07 |
jari |
3240 |
TreePath path = this.tree.getSelectionPath(); |
2 |
26 Feb 07 |
jari |
3241 |
DefaultMutableTreeNode clusterNode = (DefaultMutableTreeNode)path.getLastPathComponent(); |
2 |
26 Feb 07 |
jari |
3242 |
Object leafInfo = clusterNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3243 |
if(!(leafInfo instanceof LeafInfo)) |
2 |
26 Feb 07 |
jari |
3244 |
return null; |
2 |
26 Feb 07 |
jari |
3245 |
if(path.getPathCount() < 3) |
2 |
26 Feb 07 |
jari |
3246 |
return null; |
2 |
26 Feb 07 |
jari |
3247 |
Cluster cluster; |
2 |
26 Feb 07 |
jari |
3248 |
Color clusterColor = null; |
2 |
26 Feb 07 |
jari |
3249 |
String clusterID = ((LeafInfo)clusterNode.getUserObject()).toString(); |
2 |
26 Feb 07 |
jari |
3250 |
DefaultMutableTreeNode algorithmNode = (DefaultMutableTreeNode)path.getPathComponent(2); |
2 |
26 Feb 07 |
jari |
3251 |
String algorithmName = (String)algorithmNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3252 |
if(clusterType == ClusterRepository.GENE_CLUSTER){ |
2 |
26 Feb 07 |
jari |
3253 |
if(this.geneClusterRepository == null){ |
2 |
26 Feb 07 |
jari |
3254 |
this.geneClusterRepository = new ClusterRepository(data.getFeaturesSize(), framework, true); |
2 |
26 Feb 07 |
jari |
3255 |
this.data.setGeneClusterRepository(this.geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3256 |
} |
2 |
26 Feb 07 |
jari |
3257 |
cluster = geneClusterRepository.storeSubCluster(this.resultCount-1, algorithmName, clusterID, indices, clusterNode, experiment); |
2 |
26 Feb 07 |
jari |
3258 |
if(cluster != null){ |
2 |
26 Feb 07 |
jari |
3259 |
clusterColor = cluster.getClusterColor(); |
2 |
26 Feb 07 |
jari |
3260 |
if(geneClusterManager == null){ |
2 |
26 Feb 07 |
jari |
3261 |
this.geneClusterManager = new ClusterTable(this.geneClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
3262 |
DefaultMutableTreeNode genesNode = new DefaultMutableTreeNode(new LeafInfo("Gene Clusters", this.geneClusterManager), false); |
2 |
26 Feb 07 |
jari |
3263 |
addNode(this.clusterNode, genesNode); |
2 |
26 Feb 07 |
jari |
3264 |
} else{ |
2 |
26 Feb 07 |
jari |
3265 |
geneClusterManager.onRepositoryChanged(geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3266 |
} |
2 |
26 Feb 07 |
jari |
3267 |
} |
2 |
26 Feb 07 |
jari |
3268 |
geneClusterRepository.printRepository(); |
2 |
26 Feb 07 |
jari |
3269 |
} else { |
2 |
26 Feb 07 |
jari |
3270 |
if(this.experimentClusterRepository == null){ |
2 |
26 Feb 07 |
jari |
3271 |
this.experimentClusterRepository = new ClusterRepository(data.getFeaturesCount(), framework); |
2 |
26 Feb 07 |
jari |
3272 |
this.data.setExperimentClusterRepository(this.experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3273 |
} |
2 |
26 Feb 07 |
jari |
3274 |
cluster = experimentClusterRepository.storeSubCluster(this.resultCount-1, algorithmName, clusterID, indices, clusterNode, experiment); |
2 |
26 Feb 07 |
jari |
3275 |
if(cluster != null){ |
2 |
26 Feb 07 |
jari |
3276 |
clusterColor = cluster.getClusterColor(); |
2 |
26 Feb 07 |
jari |
3277 |
if(experimentClusterManager == null){ |
2 |
26 Feb 07 |
jari |
3278 |
this.experimentClusterManager = new ClusterTable(this.experimentClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
3279 |
DefaultMutableTreeNode experimentNode = new DefaultMutableTreeNode(new LeafInfo("Sample Clusters", this.experimentClusterManager), false); |
2 |
26 Feb 07 |
jari |
3280 |
addNode(this.clusterNode, experimentNode); |
2 |
26 Feb 07 |
jari |
3281 |
} else{ |
2 |
26 Feb 07 |
jari |
3282 |
experimentClusterManager.onRepositoryChanged(experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3283 |
} |
2 |
26 Feb 07 |
jari |
3284 |
} |
2 |
26 Feb 07 |
jari |
3285 |
experimentClusterRepository.printRepository(); |
2 |
26 Feb 07 |
jari |
3286 |
} |
2 |
26 Feb 07 |
jari |
//Record history |
2 |
26 Feb 07 |
jari |
3288 |
if(cluster != null) { |
2 |
26 Feb 07 |
jari |
3289 |
int serNum = cluster.getSerialNumber(); |
2 |
26 Feb 07 |
jari |
3290 |
String algName = cluster.getAlgorithmName(); |
2 |
26 Feb 07 |
jari |
3291 |
|
2 |
26 Feb 07 |
jari |
3292 |
if(clusterType == Cluster.GENE_CLUSTER) |
2 |
26 Feb 07 |
jari |
3293 |
addHistory("Save Gene Cluster: Serial #: "+String.valueOf(serNum)+", Algorithm: "+ |
2 |
26 Feb 07 |
jari |
3294 |
algName+", Cluster: "+clusterID); |
2 |
26 Feb 07 |
jari |
3295 |
else |
2 |
26 Feb 07 |
jari |
3296 |
addHistory("Save Experiment Cluster: Serial #: "+String.valueOf(serNum)+", Algorithm: "+ |
2 |
26 Feb 07 |
jari |
3297 |
algName+", Cluster: "+clusterID); |
2 |
26 Feb 07 |
jari |
3298 |
} |
2 |
26 Feb 07 |
jari |
3299 |
|
2 |
26 Feb 07 |
jari |
3300 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3301 |
tree.repaint(); |
2 |
26 Feb 07 |
jari |
3302 |
return clusterColor; |
2 |
26 Feb 07 |
jari |
3303 |
} |
2 |
26 Feb 07 |
jari |
3304 |
|
2 |
26 Feb 07 |
jari |
3305 |
/** |
2 |
26 Feb 07 |
jari |
* Stores cluster to manager but doesn't link to a particular viewer node. |
2 |
26 Feb 07 |
jari |
3307 |
*/ |
2 |
26 Feb 07 |
jari |
3308 |
public void storeOperationCluster(String source, String clusterID, int [] indices, boolean geneCluster){ |
2 |
26 Feb 07 |
jari |
3309 |
|
2 |
26 Feb 07 |
jari |
3310 |
ClusterRepository repository; |
2 |
26 Feb 07 |
jari |
3311 |
Cluster cluster; |
2 |
26 Feb 07 |
jari |
3312 |
|
2 |
26 Feb 07 |
jari |
3313 |
ClusterAttributesDialog dialog = new ClusterAttributesDialog("Store Cluster Attributes", source, clusterID); |
2 |
26 Feb 07 |
jari |
3314 |
|
2 |
26 Feb 07 |
jari |
3315 |
if(dialog.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
3316 |
Experiment experiment; |
2 |
26 Feb 07 |
jari |
3317 |
if (geneCluster) { |
2 |
26 Feb 07 |
jari |
3318 |
FloatMatrix matrix = data.getFullExperiment().getMatrix(); |
2 |
26 Feb 07 |
jari |
3319 |
experiment = new Experiment(matrix, indices); |
2 |
26 Feb 07 |
jari |
3320 |
repository = getClusterRepository(Cluster.GENE_CLUSTER); |
2 |
26 Feb 07 |
jari |
3321 |
cluster = new Cluster(indices, source, dialog.getLabel(), clusterID, "", dialog.getDescription(), -1, repository.takeNextClusterSerialNumber(), dialog.getColor(), experiment); |
2 |
26 Feb 07 |
jari |
3322 |
repository.addCluster(repository.getClusterOperationsList(), cluster); |
2 |
26 Feb 07 |
jari |
//geneClusterManager.onRepositoryChanged(geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3324 |
geneClusterManager.addCluster(cluster); |
2 |
26 Feb 07 |
jari |
3325 |
|
2 |
26 Feb 07 |
jari |
3326 |
} else { |
2 |
26 Feb 07 |
jari |
3327 |
experiment = data.getFullExperiment(); |
2 |
26 Feb 07 |
jari |
3328 |
repository = getClusterRepository(Cluster.EXPERIMENT_CLUSTER); |
2 |
26 Feb 07 |
jari |
3329 |
cluster = new Cluster(indices, "Search Result", dialog.getLabel(), "Selected Samples", "", dialog.getDescription(), -1, repository.takeNextClusterSerialNumber(), dialog.getColor(), experiment); |
2 |
26 Feb 07 |
jari |
3330 |
repository.addCluster(repository.getClusterOperationsList(), cluster); |
2 |
26 Feb 07 |
jari |
//experimentClusterManager.onRepositoryChanged(experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3332 |
experimentClusterManager.addCluster(cluster); |
2 |
26 Feb 07 |
jari |
3333 |
} |
2 |
26 Feb 07 |
jari |
3334 |
|
2 |
26 Feb 07 |
jari |
3335 |
if(cluster != null) { |
2 |
26 Feb 07 |
jari |
3336 |
int serNum = cluster.getSerialNumber(); |
2 |
26 Feb 07 |
jari |
3337 |
String algName = cluster.getAlgorithmName(); |
2 |
26 Feb 07 |
jari |
3338 |
|
2 |
26 Feb 07 |
jari |
3339 |
if(geneCluster) |
2 |
26 Feb 07 |
jari |
3340 |
addHistory("Save Gene Cluster: Serial #: "+String.valueOf(serNum)+", Algorithm: "+ |
2 |
26 Feb 07 |
jari |
3341 |
algName+", Cluster: "+clusterID); |
2 |
26 Feb 07 |
jari |
3342 |
else |
2 |
26 Feb 07 |
jari |
3343 |
addHistory("Save Experiment Cluster: Serial #: "+String.valueOf(serNum)+", Algorithm: "+ |
2 |
26 Feb 07 |
jari |
3344 |
algName+", Cluster: "+clusterID); |
2 |
26 Feb 07 |
jari |
3345 |
} |
2 |
26 Feb 07 |
jari |
3346 |
} |
2 |
26 Feb 07 |
jari |
3347 |
refreshCurrentViewer(); |
2 |
26 Feb 07 |
jari |
3348 |
} |
2 |
26 Feb 07 |
jari |
3349 |
|
2 |
26 Feb 07 |
jari |
/** Removes a cluster based on indices, Experiment, and cluster type. |
2 |
26 Feb 07 |
jari |
* Returns true if found and removed. |
2 |
26 Feb 07 |
jari |
3352 |
*/ |
2 |
26 Feb 07 |
jari |
3353 |
public boolean removeCluster(int [] indices, Experiment experiment, int clusterType){ |
2 |
26 Feb 07 |
jari |
3354 |
DefaultTreeModel model = (DefaultTreeModel) this.tree.getModel(); |
2 |
26 Feb 07 |
jari |
3355 |
TreePath path = this.tree.getSelectionPath(); |
2 |
26 Feb 07 |
jari |
3356 |
DefaultMutableTreeNode clusterNode = (DefaultMutableTreeNode)path.getLastPathComponent(); |
2 |
26 Feb 07 |
jari |
3357 |
Object leafInfo = clusterNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3358 |
boolean removed = false; |
2 |
26 Feb 07 |
jari |
3359 |
if(!(leafInfo instanceof LeafInfo)) |
2 |
26 Feb 07 |
jari |
3360 |
return removed; |
2 |
26 Feb 07 |
jari |
3361 |
if(path.getPathCount() < 3) |
2 |
26 Feb 07 |
jari |
3362 |
return removed; |
2 |
26 Feb 07 |
jari |
3363 |
String clusterID = ((LeafInfo)clusterNode.getUserObject()).toString(); |
2 |
26 Feb 07 |
jari |
3364 |
DefaultMutableTreeNode algorithmNode = (DefaultMutableTreeNode)path.getPathComponent(2); |
2 |
26 Feb 07 |
jari |
3365 |
String algorithmName = (String)algorithmNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3366 |
|
2 |
26 Feb 07 |
jari |
3367 |
if(clusterType == ClusterRepository.GENE_CLUSTER){ |
2 |
26 Feb 07 |
jari |
3368 |
if(this.geneClusterRepository == null) |
2 |
26 Feb 07 |
jari |
3369 |
return removed; |
2 |
26 Feb 07 |
jari |
3370 |
removed = this.geneClusterRepository.removeCluster(indices, algorithmName, clusterID); |
2 |
26 Feb 07 |
jari |
3371 |
this.geneClusterManager.onRepositoryChanged(this.geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3372 |
} else { |
2 |
26 Feb 07 |
jari |
3373 |
if(this.experimentClusterRepository == null) |
2 |
26 Feb 07 |
jari |
3374 |
return removed; |
2 |
26 Feb 07 |
jari |
3375 |
removed = this.experimentClusterRepository.removeCluster(indices, algorithmName, clusterID); |
2 |
26 Feb 07 |
jari |
3376 |
this.experimentClusterManager.onRepositoryChanged(this.experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3377 |
} |
2 |
26 Feb 07 |
jari |
3378 |
if(removed) |
2 |
26 Feb 07 |
jari |
3379 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3380 |
|
2 |
26 Feb 07 |
jari |
3381 |
return removed; |
2 |
26 Feb 07 |
jari |
3382 |
} |
2 |
26 Feb 07 |
jari |
3383 |
|
2 |
26 Feb 07 |
jari |
3384 |
|
2 |
26 Feb 07 |
jari |
3385 |
public boolean removeSubCluster(int [] indices, Experiment experiment, int clusterType){ |
2 |
26 Feb 07 |
jari |
3386 |
DefaultTreeModel model = (DefaultTreeModel) this.tree.getModel(); |
2 |
26 Feb 07 |
jari |
3387 |
TreePath path = this.tree.getSelectionPath(); |
2 |
26 Feb 07 |
jari |
3388 |
DefaultMutableTreeNode clusterNode = (DefaultMutableTreeNode)path.getLastPathComponent(); |
2 |
26 Feb 07 |
jari |
3389 |
Object leafInfo = clusterNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3390 |
boolean removed = false; |
2 |
26 Feb 07 |
jari |
3391 |
if(!(leafInfo instanceof LeafInfo)) |
2 |
26 Feb 07 |
jari |
3392 |
return removed; |
2 |
26 Feb 07 |
jari |
3393 |
if(path.getPathCount() < 3) |
2 |
26 Feb 07 |
jari |
3394 |
return removed; |
2 |
26 Feb 07 |
jari |
3395 |
String clusterID = ((LeafInfo)clusterNode.getUserObject()).toString(); |
2 |
26 Feb 07 |
jari |
3396 |
DefaultMutableTreeNode algorithmNode = (DefaultMutableTreeNode)path.getPathComponent(2); |
2 |
26 Feb 07 |
jari |
3397 |
String algorithmName = (String)algorithmNode.getUserObject(); |
2 |
26 Feb 07 |
jari |
3398 |
|
2 |
26 Feb 07 |
jari |
3399 |
if(clusterType == ClusterRepository.GENE_CLUSTER){ |
2 |
26 Feb 07 |
jari |
3400 |
if(this.geneClusterRepository == null) |
2 |
26 Feb 07 |
jari |
3401 |
return removed; |
2 |
26 Feb 07 |
jari |
3402 |
removed = this.geneClusterRepository.removeSubCluster(indices, algorithmName, clusterID); |
2 |
26 Feb 07 |
jari |
3403 |
this.geneClusterManager.onRepositoryChanged(this.geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3404 |
} else { |
2 |
26 Feb 07 |
jari |
3405 |
if(this.experimentClusterRepository == null) |
2 |
26 Feb 07 |
jari |
3406 |
return removed; |
2 |
26 Feb 07 |
jari |
3407 |
removed = this.experimentClusterRepository.removeSubCluster(indices, algorithmName, clusterID); |
2 |
26 Feb 07 |
jari |
3408 |
this.experimentClusterManager.onRepositoryChanged(this.experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3409 |
} |
2 |
26 Feb 07 |
jari |
3410 |
if(removed) |
2 |
26 Feb 07 |
jari |
3411 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3412 |
|
2 |
26 Feb 07 |
jari |
3413 |
return removed; |
2 |
26 Feb 07 |
jari |
3414 |
} |
2 |
26 Feb 07 |
jari |
3415 |
|
2 |
26 Feb 07 |
jari |
/** Launches a new MultipleArrayViewer containing the indexed items, Experiment, and cluster type. |
2 |
26 Feb 07 |
jari |
* clusterType specifies whether the indices relate to genes or samples |
2 |
26 Feb 07 |
jari |
3418 |
*/ |
2 |
26 Feb 07 |
jari |
3419 |
private void launchNewMAV(int [] indices, Experiment experiment, String label, int clusterType){ |
2 |
26 Feb 07 |
jari |
3420 |
MultipleArrayData newData; |
2 |
26 Feb 07 |
jari |
3421 |
if(indices.length < 1){ |
2 |
26 Feb 07 |
jari |
3422 |
JOptionPane.showMessageDialog(this.getFrame(), "The selected cluster does not contain any members. The new viewer session has been aborted.", "New Session Abort", JOptionPane.WARNING_MESSAGE); |
2 |
26 Feb 07 |
jari |
3423 |
return; |
2 |
26 Feb 07 |
jari |
3424 |
} |
2 |
26 Feb 07 |
jari |
3425 |
|
2 |
26 Feb 07 |
jari |
3426 |
if(clusterType == Cluster.GENE_CLUSTER){ |
2 |
26 Feb 07 |
jari |
3427 |
newData = this.data.getDataSubset(indices); |
2 |
26 Feb 07 |
jari |
3428 |
} else { |
2 |
26 Feb 07 |
jari |
3429 |
newData = this.data.getDataSubset(indices, experiment.getRowMappingArrayCopy()); |
2 |
26 Feb 07 |
jari |
3430 |
} |
2 |
26 Feb 07 |
jari |
3431 |
|
2 |
26 Feb 07 |
jari |
//String [] f = newData.getFieldNames(); |
2 |
26 Feb 07 |
jari |
3433 |
|
2 |
26 Feb 07 |
jari |
// for(int i = 0; i < f.length; i++) |
2 |
26 Feb 07 |
jari |
// System.out.println("f "+1+" "+f[i]); |
2 |
26 Feb 07 |
jari |
3436 |
|
2 |
26 Feb 07 |
jari |
3437 |
Manager.createNewMultipleArrayViewer(this.menubar, newData, label); |
2 |
26 Feb 07 |
jari |
3438 |
|
2 |
26 Feb 07 |
jari |
3439 |
addHistory("Launch New MAV: "+label); |
2 |
26 Feb 07 |
jari |
3440 |
} |
2 |
26 Feb 07 |
jari |
3441 |
|
2 |
26 Feb 07 |
jari |
/** Opens the specified cluster node based on parent algorithm name and the cluster's node name |
2 |
26 Feb 07 |
jari |
3443 |
*/ |
2 |
26 Feb 07 |
jari |
3444 |
private void openClusterNode(String algorithmNode, String clusterNode){ |
2 |
26 Feb 07 |
jari |
3445 |
DefaultMutableTreeNode node = findNode(algorithmNode, clusterNode); |
2 |
26 Feb 07 |
jari |
3446 |
if(node == null){ |
2 |
26 Feb 07 |
jari |
3447 |
return; |
2 |
26 Feb 07 |
jari |
3448 |
} |
2 |
26 Feb 07 |
jari |
3449 |
selectNode(node); |
2 |
26 Feb 07 |
jari |
3450 |
} |
2 |
26 Feb 07 |
jari |
3451 |
|
2 |
26 Feb 07 |
jari |
3452 |
|
2 |
26 Feb 07 |
jari |
/** Finds the specified child node given node name (child) and the parent's name. |
2 |
26 Feb 07 |
jari |
3454 |
*/ |
2 |
26 Feb 07 |
jari |
3455 |
private DefaultMutableTreeNode findNode(String parent, String child){ |
2 |
26 Feb 07 |
jari |
3456 |
int childCount = this.analysisNode.getChildCount(); |
2 |
26 Feb 07 |
jari |
3457 |
DefaultMutableTreeNode curr = this.analysisNode; |
2 |
26 Feb 07 |
jari |
3458 |
DefaultMutableTreeNode target = null; |
2 |
26 Feb 07 |
jari |
3459 |
for(int i = 0; i < childCount; i++){ |
2 |
26 Feb 07 |
jari |
3460 |
curr = (DefaultMutableTreeNode)(analysisNode.getChildAt(i)); |
2 |
26 Feb 07 |
jari |
3461 |
Object userObject = curr.getUserObject(); |
2 |
26 Feb 07 |
jari |
3462 |
if(userObject instanceof String && ((String)userObject).equals(parent)){ |
2 |
26 Feb 07 |
jari |
3463 |
target = curr; |
2 |
26 Feb 07 |
jari |
3464 |
break; |
2 |
26 Feb 07 |
jari |
3465 |
} |
2 |
26 Feb 07 |
jari |
3466 |
else if(userObject instanceof LeafInfo && (((LeafInfo)userObject).toString()).equals(parent)){ |
2 |
26 Feb 07 |
jari |
3467 |
target = curr; |
2 |
26 Feb 07 |
jari |
3468 |
break; |
2 |
26 Feb 07 |
jari |
3469 |
} |
2 |
26 Feb 07 |
jari |
3470 |
} |
2 |
26 Feb 07 |
jari |
3471 |
|
2 |
26 Feb 07 |
jari |
3472 |
if(target == null) |
2 |
26 Feb 07 |
jari |
3473 |
return null; |
2 |
26 Feb 07 |
jari |
3474 |
|
2 |
26 Feb 07 |
jari |
3475 |
childCount = target.getChildCount(); |
2 |
26 Feb 07 |
jari |
3476 |
|
2 |
26 Feb 07 |
jari |
3477 |
for(int i = 0; i < childCount; i++){ |
2 |
26 Feb 07 |
jari |
3478 |
curr = (DefaultMutableTreeNode)(target.getChildAt(i)); |
2 |
26 Feb 07 |
jari |
3479 |
Object userObject = curr.getUserObject(); |
2 |
26 Feb 07 |
jari |
3480 |
if(userObject instanceof String && ((String)userObject).equals(child)){ |
2 |
26 Feb 07 |
jari |
3481 |
target = curr; |
2 |
26 Feb 07 |
jari |
3482 |
break; |
2 |
26 Feb 07 |
jari |
3483 |
} |
2 |
26 Feb 07 |
jari |
3484 |
else if(userObject instanceof LeafInfo && (((LeafInfo)userObject).toString()).equals(parent)){ |
2 |
26 Feb 07 |
jari |
3485 |
target = curr; |
2 |
26 Feb 07 |
jari |
3486 |
break; |
2 |
26 Feb 07 |
jari |
3487 |
} |
2 |
26 Feb 07 |
jari |
3488 |
} |
2 |
26 Feb 07 |
jari |
3489 |
|
2 |
26 Feb 07 |
jari |
3490 |
if(target != curr) |
2 |
26 Feb 07 |
jari |
3491 |
return null; |
2 |
26 Feb 07 |
jari |
3492 |
|
2 |
26 Feb 07 |
jari |
3493 |
return (DefaultMutableTreeNode)curr; |
2 |
26 Feb 07 |
jari |
3494 |
} |
2 |
26 Feb 07 |
jari |
3495 |
|
2 |
26 Feb 07 |
jari |
/** Returns the currently selected node |
2 |
26 Feb 07 |
jari |
3497 |
*/ |
2 |
26 Feb 07 |
jari |
3498 |
public DefaultMutableTreeNode getCurrentNode(){ |
2 |
26 Feb 07 |
jari |
3499 |
TreePath path = this.tree.getSelectionPath(); |
2 |
26 Feb 07 |
jari |
3500 |
if(path == null) |
2 |
26 Feb 07 |
jari |
3501 |
return null; |
2 |
26 Feb 07 |
jari |
3502 |
return (DefaultMutableTreeNode)path.getLastPathComponent(); |
2 |
26 Feb 07 |
jari |
3503 |
} |
2 |
26 Feb 07 |
jari |
3504 |
|
2 |
26 Feb 07 |
jari |
3505 |
public DefaultMutableTreeNode getNode(Object object) { |
2 |
26 Feb 07 |
jari |
3506 |
return this.tree.getNode(object); |
2 |
26 Feb 07 |
jari |
3507 |
} |
2 |
26 Feb 07 |
jari |
/** add for sort MAD for auto-color scale |
2 |
26 Feb 07 |
jari |
* by wwang |
2 |
26 Feb 07 |
jari |
* @param m |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3512 |
*/ |
2 |
26 Feb 07 |
jari |
3513 |
public float [] initSortedValues(FloatMatrix m) { |
2 |
26 Feb 07 |
jari |
3514 |
float [] vals = m.getColumnPackedCopy(); |
2 |
26 Feb 07 |
jari |
3515 |
QSort qsort = new QSort(vals, QSort.ASCENDING); |
2 |
26 Feb 07 |
jari |
3516 |
vals = qsort.getSorted(); |
2 |
26 Feb 07 |
jari |
3517 |
|
2 |
26 Feb 07 |
jari |
3518 |
int numberNaN = 0; |
2 |
26 Feb 07 |
jari |
3519 |
|
2 |
26 Feb 07 |
jari |
3520 |
for(int i = 0; i < vals.length; i++) { |
2 |
26 Feb 07 |
jari |
3521 |
if(Float.isNaN(vals[i])) |
2 |
26 Feb 07 |
jari |
3522 |
numberNaN++; |
2 |
26 Feb 07 |
jari |
3523 |
else |
2 |
26 Feb 07 |
jari |
3524 |
break; |
2 |
26 Feb 07 |
jari |
3525 |
} |
2 |
26 Feb 07 |
jari |
3526 |
|
2 |
26 Feb 07 |
jari |
3527 |
int validN = vals.length-numberNaN; |
2 |
26 Feb 07 |
jari |
3528 |
|
2 |
26 Feb 07 |
jari |
3529 |
float [] values = new float[validN]; |
2 |
26 Feb 07 |
jari |
3530 |
|
2 |
26 Feb 07 |
jari |
3531 |
for(int i = 0; i < values.length; i++) { |
2 |
26 Feb 07 |
jari |
3532 |
values[i] = vals[i+numberNaN]; |
2 |
26 Feb 07 |
jari |
3533 |
} |
2 |
26 Feb 07 |
jari |
3534 |
|
2 |
26 Feb 07 |
jari |
3535 |
return values; |
2 |
26 Feb 07 |
jari |
3536 |
|
2 |
26 Feb 07 |
jari |
3537 |
} |
2 |
26 Feb 07 |
jari |
3538 |
public boolean autoScale(float[] val){ |
2 |
26 Feb 07 |
jari |
3539 |
int count=0; |
2 |
26 Feb 07 |
jari |
3540 |
for(int i=0;i<val.length;i++) |
2 |
26 Feb 07 |
jari |
3541 |
if(val[i]>0) |
2 |
26 Feb 07 |
jari |
3542 |
count++; |
2 |
26 Feb 07 |
jari |
3543 |
if((count*1.0)/(val.length*1.0)>0.8){ |
2 |
26 Feb 07 |
jari |
3544 |
auto_scale=true; |
2 |
26 Feb 07 |
jari |
3545 |
} |
2 |
26 Feb 07 |
jari |
3546 |
return auto_scale; |
2 |
26 Feb 07 |
jari |
3547 |
} |
2 |
26 Feb 07 |
jari |
3548 |
|
2 |
26 Feb 07 |
jari |
/** by wwang |
2 |
26 Feb 07 |
jari |
* returns the median from the sorted array |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3552 |
*/ |
2 |
26 Feb 07 |
jari |
3553 |
public float getMedian() { |
2 |
26 Feb 07 |
jari |
3554 |
float median; |
2 |
26 Feb 07 |
jari |
3555 |
if(sortedValues.length % 2 == 0) |
2 |
26 Feb 07 |
jari |
3556 |
median = (sortedValues[sortedValues.length/2] + sortedValues[sortedValues.length/2 + 1])/2.0f; |
2 |
26 Feb 07 |
jari |
3557 |
else |
2 |
26 Feb 07 |
jari |
3558 |
median = sortedValues[sortedValues.length/2 + 1]; |
2 |
26 Feb 07 |
jari |
3559 |
return median; |
2 |
26 Feb 07 |
jari |
3560 |
} |
2 |
26 Feb 07 |
jari |
3561 |
|
2 |
26 Feb 07 |
jari |
/** by wwang |
2 |
26 Feb 07 |
jari |
* returns the maxScale(80% of total data)from the sorted array |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
3565 |
*/ |
2 |
26 Feb 07 |
jari |
3566 |
public float getMaxScale() { |
2 |
26 Feb 07 |
jari |
3567 |
int index=(int)Math.floor(sortedValues.length*0.8); |
2 |
26 Feb 07 |
jari |
3568 |
float max=sortedValues[index]; |
2 |
26 Feb 07 |
jari |
3569 |
return max; |
2 |
26 Feb 07 |
jari |
3570 |
} |
2 |
26 Feb 07 |
jari |
3571 |
|
2 |
26 Feb 07 |
jari |
3572 |
|
2 |
26 Feb 07 |
jari |
3573 |
/** |
2 |
26 Feb 07 |
jari |
* Handles new data load. Vector contains ISlideData objects. |
2 |
26 Feb 07 |
jari |
3575 |
*/ |
2 |
26 Feb 07 |
jari |
3576 |
public void fireDataLoaded(ISlideData [] features, int dataType){ |
2 |
26 Feb 07 |
jari |
//add for auto-color scaling format(onedecimalformat) |
2 |
26 Feb 07 |
jari |
3578 |
DecimalFormat oneDecimalFormat = new DecimalFormat(); |
2 |
26 Feb 07 |
jari |
3579 |
oneDecimalFormat.setMaximumFractionDigits(1); |
2 |
26 Feb 07 |
jari |
//oneDecimalFormat.setMaximumIntegerDigits(5); |
2 |
26 Feb 07 |
jari |
3581 |
if(features == null || features.length < 1) |
2 |
26 Feb 07 |
jari |
3582 |
return; |
2 |
26 Feb 07 |
jari |
3583 |
data.addFeatures(features); |
2 |
26 Feb 07 |
jari |
3584 |
data.setDataType(dataType); |
2 |
26 Feb 07 |
jari |
3585 |
if(this.data.getFieldNames() != null && this.data.getFeaturesCount() > 0){ |
2 |
26 Feb 07 |
jari |
3586 |
this.menubar.addLabelMenuItems(this.data.getFieldNames()); |
2 |
26 Feb 07 |
jari |
//add the experiment key vector that is longest |
2 |
26 Feb 07 |
jari |
3588 |
this.menubar.addExperimentLabelMenuItems(getSlideNameKeyVectorUnion(features)); |
2 |
26 Feb 07 |
jari |
//this.menubar.addSortMenuItems(this.data.getFieldNames()); |
2 |
26 Feb 07 |
jari |
3590 |
|
2 |
26 Feb 07 |
jari |
//have the main scroll pane and canvas |
2 |
26 Feb 07 |
jari |
3592 |
((MultipleArrayCanvas)this.viewer).addSortMenuItems(data.getFieldNames()); |
2 |
26 Feb 07 |
jari |
3593 |
|
2 |
26 Feb 07 |
jari |
3594 |
this.menubar.setLabelIndex(0); |
2 |
26 Feb 07 |
jari |
3595 |
|
2 |
26 Feb 07 |
jari |
//pcahan |
2 |
26 Feb 07 |
jari |
//TODO change this to get the Data Type from an IData |
2 |
26 Feb 07 |
jari |
//first need to make sure that IData has that information. Don't know yet. |
2 |
26 Feb 07 |
jari |
3599 |
if (TMEV.getDataType() == TMEV.DATA_TYPE_AFFY){ |
2 |
26 Feb 07 |
jari |
3600 |
this.menubar.addAffyFilterMenuItems(); |
2 |
26 Feb 07 |
jari |
3601 |
} |
2 |
26 Feb 07 |
jari |
3602 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Place to load CytoBand Information |
2 |
26 Feb 07 |
jari |
* Place to add CGH Menus if datatype is of such type |
2 |
26 Feb 07 |
jari |
* Load CGH Analysis factory here |
2 |
26 Feb 07 |
jari |
3607 |
*/ |
2 |
26 Feb 07 |
jari |
3608 |
if(data.isCGHData()) { |
2 |
26 Feb 07 |
jari |
3609 |
loadCytoBandFile(); |
2 |
26 Feb 07 |
jari |
3610 |
manager.initCghAnalysiActions(new org.tigr.microarray.mev.cgh.CGHAlgorithms.CGHAlgorithmFactory()); |
2 |
26 Feb 07 |
jari |
3611 |
this.menubar.addCGHMenus(); |
2 |
26 Feb 07 |
jari |
3612 |
mainframe.validate(); |
2 |
26 Feb 07 |
jari |
3613 |
} |
2 |
26 Feb 07 |
jari |
3614 |
} |
2 |
26 Feb 07 |
jari |
3615 |
|
2 |
26 Feb 07 |
jari |
// by wwang add for auto color scaling(for affy data) |
2 |
26 Feb 07 |
jari |
3617 |
sortedValues=initSortedValues(data.getExperiment().getMatrix()); |
2 |
26 Feb 07 |
jari |
3618 |
auto_scale=autoScale(sortedValues); |
2 |
26 Feb 07 |
jari |
3619 |
if(data.getDataType() == IData.DATA_TYPE_AFFY_ABS || auto_scale==true){ |
2 |
26 Feb 07 |
jari |
3620 |
this.menubar.setMinRatioScale(0f); |
2 |
26 Feb 07 |
jari |
3621 |
this.menubar.setMidRatioValue(getMedian()); |
2 |
26 Feb 07 |
jari |
3622 |
this.menubar.setMaxRatioScale(getMaxScale()); |
2 |
26 Feb 07 |
jari |
//EH added so the data are considered affy data whenever they are scaled as |
2 |
26 Feb 07 |
jari |
//affy data. |
2 |
26 Feb 07 |
jari |
3625 |
data.setDataType(IData.DATA_TYPE_AFFY_ABS); |
2 |
26 Feb 07 |
jari |
3626 |
} |
2 |
26 Feb 07 |
jari |
3627 |
|
2 |
26 Feb 07 |
jari |
// pcahan - convoluted but it works |
2 |
26 Feb 07 |
jari |
3629 |
if ( (TMEV.getDataType() == TMEV.DATA_TYPE_AFFY) && |
2 |
26 Feb 07 |
jari |
3630 |
(data.getDataType() == IData.DATA_TYPE_AFFY_ABS) && |
2 |
26 Feb 07 |
jari |
3631 |
(!this.menubar.get_affyNormAdded())) { |
2 |
26 Feb 07 |
jari |
3632 |
this.menubar.addAffyNormMenuItems(); |
2 |
26 Feb 07 |
jari |
3633 |
} |
2 |
26 Feb 07 |
jari |
3634 |
|
2 |
26 Feb 07 |
jari |
3635 |
if (data.getDataType() == IData.DATA_TYPE_RATIO_ONLY || data.getDataType() == IData.DATA_TYPE_AFFY_ABS){ |
2 |
26 Feb 07 |
jari |
3636 |
this.menubar.enableNormalizationMenu(false); |
2 |
26 Feb 07 |
jari |
3637 |
} |
2 |
26 Feb 07 |
jari |
3638 |
|
2 |
26 Feb 07 |
jari |
//set IData as primary and selected |
2 |
26 Feb 07 |
jari |
3640 |
data.setUseMainData(true); |
2 |
26 Feb 07 |
jari |
3641 |
((LeafInfo)(mainViewerNode.getUserObject())).setSelectedDataSource(true); |
2 |
26 Feb 07 |
jari |
//record main data as source |
2 |
26 Feb 07 |
jari |
3643 |
createDataSelectionNode((DefaultMutableTreeNode)(tree.getRoot().getChildAt(0)), data.getExperiment(), data.getExperiment().getNumberOfGenes(), Cluster.GENE_CLUSTER); |
2 |
26 Feb 07 |
jari |
3644 |
tree.repaint(); |
2 |
26 Feb 07 |
jari |
3645 |
/** |
2 |
26 Feb 07 |
jari |
* Add CGH Specific Views & Menus |
2 |
26 Feb 07 |
jari |
3647 |
*/ |
2 |
26 Feb 07 |
jari |
3648 |
if(data.isCGHData()) { |
2 |
26 Feb 07 |
jari |
3649 |
ExperimentsLoaded(); |
2 |
26 Feb 07 |
jari |
3650 |
onFlankingRegionDeterminationChanged(); |
2 |
26 Feb 07 |
jari |
3651 |
} |
2 |
26 Feb 07 |
jari |
3652 |
|
2 |
26 Feb 07 |
jari |
3653 |
setMaxCY3AndCY5(); |
2 |
26 Feb 07 |
jari |
3654 |
systemEnable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
3655 |
this.viewer.onSelected(framework); |
2 |
26 Feb 07 |
jari |
3656 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
3657 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
3658 |
fireHeaderChanged(); |
2 |
26 Feb 07 |
jari |
3659 |
|
2 |
26 Feb 07 |
jari |
// record it for history's sake |
2 |
26 Feb 07 |
jari |
3661 |
String [] featureNames = new String[features.length]; |
2 |
26 Feb 07 |
jari |
3662 |
for(int i = 0; i < features.length; i++){ |
2 |
26 Feb 07 |
jari |
3663 |
featureNames[i] = features[i].getSlideFileName(); |
2 |
26 Feb 07 |
jari |
3664 |
if(i == 0) |
2 |
26 Feb 07 |
jari |
3665 |
addHistory("Load Data File: "+featureNames[i]); |
2 |
26 Feb 07 |
jari |
3666 |
else { |
2 |
26 Feb 07 |
jari |
3667 |
if(featureNames[i].equals(featureNames[i-1])) |
2 |
26 Feb 07 |
jari |
3668 |
break; |
2 |
26 Feb 07 |
jari |
3669 |
addHistory("Load Data File: "+featureNames[i]); |
2 |
26 Feb 07 |
jari |
3670 |
} |
2 |
26 Feb 07 |
jari |
3671 |
} |
2 |
26 Feb 07 |
jari |
3672 |
if(features.length > 1) |
2 |
26 Feb 07 |
jari |
3673 |
addHistory(features.length+" samples loaded."); |
2 |
26 Feb 07 |
jari |
3674 |
else |
2 |
26 Feb 07 |
jari |
3675 |
addHistory("1 sample loaded."); |
2 |
26 Feb 07 |
jari |
3676 |
|
2 |
26 Feb 07 |
jari |
3677 |
if(features.length > 0) |
2 |
26 Feb 07 |
jari |
3678 |
addHistory(features[0].getSize()+" genes loaded."); |
2 |
26 Feb 07 |
jari |
3679 |
} |
2 |
26 Feb 07 |
jari |
3680 |
|
2 |
26 Feb 07 |
jari |
3681 |
|
2 |
26 Feb 07 |
jari |
3682 |
|
2 |
26 Feb 07 |
jari |
3683 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the key vector for the sample with the longest sample name key list |
2 |
26 Feb 07 |
jari |
3685 |
*/ |
2 |
26 Feb 07 |
jari |
3686 |
private Vector getSlideNameKeyVectorUnion(ISlideData [] features) { |
2 |
26 Feb 07 |
jari |
3687 |
Vector keyVector; |
2 |
26 Feb 07 |
jari |
3688 |
Vector fullKeyVector = new Vector(); |
2 |
26 Feb 07 |
jari |
3689 |
String key; |
2 |
26 Feb 07 |
jari |
3690 |
for( int i = 0; i < features.length; i++) { |
2 |
26 Feb 07 |
jari |
3691 |
keyVector = features[i].getSlideDataKeys(); |
2 |
26 Feb 07 |
jari |
3692 |
for(int j = 0; j < keyVector.size(); j++) { |
2 |
26 Feb 07 |
jari |
3693 |
key = (String)(keyVector.elementAt(j)); |
2 |
26 Feb 07 |
jari |
3694 |
if(!fullKeyVector.contains(key)) |
2 |
26 Feb 07 |
jari |
3695 |
fullKeyVector.addElement(key); |
2 |
26 Feb 07 |
jari |
3696 |
} |
2 |
26 Feb 07 |
jari |
3697 |
} |
2 |
26 Feb 07 |
jari |
3698 |
return fullKeyVector; |
2 |
26 Feb 07 |
jari |
3699 |
} |
2 |
26 Feb 07 |
jari |
3700 |
|
2 |
26 Feb 07 |
jari |
3701 |
/** |
2 |
26 Feb 07 |
jari |
* Loads data using <code>SuperExpressionFileLoader</code>. |
2 |
26 Feb 07 |
jari |
3703 |
*/ |
7 |
24 Aug 07 |
jari |
3704 |
public void loadData(){ |
2 |
26 Feb 07 |
jari |
3705 |
SuperExpressionFileLoader loader = new SuperExpressionFileLoader(this); |
2 |
26 Feb 07 |
jari |
3706 |
|
2 |
26 Feb 07 |
jari |
//Add time node to the analysis node |
2 |
26 Feb 07 |
jari |
3708 |
Date date = new Date(System.currentTimeMillis()); |
2 |
26 Feb 07 |
jari |
3709 |
DateFormat format = DateFormat.getDateTimeInstance(); |
2 |
26 Feb 07 |
jari |
3710 |
format.setTimeZone(TimeZone.getDefault()); |
2 |
26 Feb 07 |
jari |
3711 |
DefaultMutableTreeNode node = new DefaultMutableTreeNode(format.format(date)); |
2 |
26 Feb 07 |
jari |
3712 |
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
3713 |
treeModel.insertNodeInto(node, analysisNode, analysisNode.getChildCount()); |
7 |
24 Aug 07 |
jari |
3714 |
loader.onLoad(); |
2 |
26 Feb 07 |
jari |
3715 |
} |
2 |
26 Feb 07 |
jari |
3716 |
|
2 |
26 Feb 07 |
jari |
3717 |
/** |
2 |
26 Feb 07 |
jari |
* Returns specfied the cluster repository, possibly null |
2 |
26 Feb 07 |
jari |
3719 |
*/ |
2 |
26 Feb 07 |
jari |
3720 |
protected ClusterRepository getClusterRepository(int clusterType){ |
2 |
26 Feb 07 |
jari |
3721 |
if(clusterType == Cluster.GENE_CLUSTER) { |
2 |
26 Feb 07 |
jari |
3722 |
if(this.geneClusterRepository == null) { |
2 |
26 Feb 07 |
jari |
3723 |
this.geneClusterRepository = new ClusterRepository(data.getFeaturesSize(), framework, true); |
2 |
26 Feb 07 |
jari |
3724 |
this.data.setGeneClusterRepository(this.geneClusterRepository); |
2 |
26 Feb 07 |
jari |
3725 |
} |
2 |
26 Feb 07 |
jari |
3726 |
|
2 |
26 Feb 07 |
jari |
3727 |
|
2 |
26 Feb 07 |
jari |
3728 |
if(geneClusterManager == null){ |
2 |
26 Feb 07 |
jari |
3729 |
this.geneClusterManager = new ClusterTable(this.geneClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
3730 |
DefaultMutableTreeNode genesNode = new DefaultMutableTreeNode(new LeafInfo("Gene Clusters", this.geneClusterManager), false); |
2 |
26 Feb 07 |
jari |
3731 |
addNode(this.clusterNode, genesNode); |
2 |
26 Feb 07 |
jari |
3732 |
|
2 |
26 Feb 07 |
jari |
3733 |
} |
2 |
26 Feb 07 |
jari |
3734 |
return this.geneClusterRepository; |
2 |
26 Feb 07 |
jari |
3735 |
|
2 |
26 Feb 07 |
jari |
3736 |
} else { |
2 |
26 Feb 07 |
jari |
3737 |
if(this.experimentClusterRepository == null) { |
2 |
26 Feb 07 |
jari |
3738 |
this.experimentClusterRepository = new ClusterRepository(data.getFeaturesCount(), framework); |
2 |
26 Feb 07 |
jari |
3739 |
this.data.setExperimentClusterRepository(this.experimentClusterRepository); |
2 |
26 Feb 07 |
jari |
3740 |
} |
2 |
26 Feb 07 |
jari |
3741 |
if(experimentClusterManager == null) { |
2 |
26 Feb 07 |
jari |
3742 |
this.experimentClusterManager = new ClusterTable(this.experimentClusterRepository, framework); |
2 |
26 Feb 07 |
jari |
3743 |
DefaultMutableTreeNode experimentNode = new DefaultMutableTreeNode(new LeafInfo("Sample Clusters", this.experimentClusterManager), false); |
2 |
26 Feb 07 |
jari |
3744 |
addNode(this.clusterNode, experimentNode); |
2 |
26 Feb 07 |
jari |
3745 |
} |
2 |
26 Feb 07 |
jari |
3746 |
return this.experimentClusterRepository; |
2 |
26 Feb 07 |
jari |
3747 |
} |
2 |
26 Feb 07 |
jari |
3748 |
} |
2 |
26 Feb 07 |
jari |
3749 |
|
2 |
26 Feb 07 |
jari |
3750 |
/** |
2 |
26 Feb 07 |
jari |
* Returns the <CODE>ResultTree</CODE> object |
2 |
26 Feb 07 |
jari |
3752 |
*/ |
2 |
26 Feb 07 |
jari |
3753 |
protected ResultTree getResultTree() { |
2 |
26 Feb 07 |
jari |
3754 |
return this.tree; |
2 |
26 Feb 07 |
jari |
3755 |
} |
2 |
26 Feb 07 |
jari |
3756 |
|
2 |
26 Feb 07 |
jari |
3757 |
|
2 |
26 Feb 07 |
jari |
3758 |
/** |
2 |
26 Feb 07 |
jari |
* Perform a search for elements based on keys |
2 |
26 Feb 07 |
jari |
3760 |
*/ |
2 |
26 Feb 07 |
jari |
3761 |
private void search() { |
2 |
26 Feb 07 |
jari |
3762 |
SearchDialog dialog = new SearchDialog(this.getFrame(), this.data.getFieldNames(), this.data.getSlideNameKeyArray()); |
2 |
26 Feb 07 |
jari |
3763 |
if( dialog.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
3764 |
AlgorithmData searchParameters = dialog.getSearchCriteria(); |
2 |
26 Feb 07 |
jari |
3765 |
|
2 |
26 Feb 07 |
jari |
3766 |
AlgorithmParameters params = searchParameters.getParams(); |
2 |
26 Feb 07 |
jari |
3767 |
boolean geneSearch = params.getBoolean("gene-search"); |
2 |
26 Feb 07 |
jari |
3768 |
boolean caseSens = params.getBoolean("case-sensitive"); |
2 |
26 Feb 07 |
jari |
3769 |
boolean fullTerm = params.getBoolean("full-term"); |
2 |
26 Feb 07 |
jari |
3770 |
String searchTerm = params.getString("search-term"); |
2 |
26 Feb 07 |
jari |
3771 |
String [] fields = searchParameters.getStringArray("field-names"); |
2 |
26 Feb 07 |
jari |
3772 |
|
2 |
26 Feb 07 |
jari |
3773 |
ResultTree resultTree = framework.getResultTree(); |
2 |
26 Feb 07 |
jari |
3774 |
|
2 |
26 Feb 07 |
jari |
//get IData indices |
2 |
26 Feb 07 |
jari |
3776 |
int [] indices = data.search(searchParameters); |
2 |
26 Feb 07 |
jari |
3777 |
|
2 |
26 Feb 07 |
jari |
3778 |
if(indices.length > 0) { |
2 |
26 Feb 07 |
jari |
3779 |
|
2 |
26 Feb 07 |
jari |
//returns Vector of result objects (Vector, Hashtable, Hashtable), #0 ExperimentViewers, #2 TableViewers |
2 |
26 Feb 07 |
jari |
3781 |
Vector result = resultTree.findViewerCollection(indices, searchParameters.getParams().getBoolean("gene-search")); |
2 |
26 Feb 07 |
jari |
3782 |
|
2 |
26 Feb 07 |
jari |
3783 |
if(result != null) { |
2 |
26 Feb 07 |
jari |
3784 |
|
2 |
26 Feb 07 |
jari |
3785 |
Vector primaryNodes = (Vector)(result.elementAt(0)); |
2 |
26 Feb 07 |
jari |
3786 |
Hashtable expViewHash = (Hashtable)(result.elementAt(1)); |
2 |
26 Feb 07 |
jari |
3787 |
Hashtable tableViewHash = (Hashtable)(result.elementAt(2)); |
2 |
26 Feb 07 |
jari |
3788 |
|
2 |
26 Feb 07 |
jari |
3789 |
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Search Result Shortcuts"); |
2 |
26 Feb 07 |
jari |
3790 |
for(int i = 0; i < primaryNodes.size(); i++) { |
2 |
26 Feb 07 |
jari |
3791 |
root.add((DefaultMutableTreeNode)(primaryNodes.elementAt(i))); |
2 |
26 Feb 07 |
jari |
3792 |
} |
2 |
26 Feb 07 |
jari |
3793 |
JTree tree = new JTree(root); |
2 |
26 Feb 07 |
jari |
3794 |
tree.setCellRenderer(resultTree.getCellRenderer()); |
2 |
26 Feb 07 |
jari |
3795 |
|
2 |
26 Feb 07 |
jari |
3796 |
SearchResultDialog resultDialog = new SearchResultDialog(this.framework, searchParameters, tree, expViewHash, tableViewHash, indices); |
2 |
26 Feb 07 |
jari |
3797 |
resultDialog.showModal(); |
2 |
26 Feb 07 |
jari |
3798 |
} else { |
2 |
26 Feb 07 |
jari |
3799 |
SearchResultDialog resultDialog = new SearchResultDialog(this.framework, searchParameters, indices); |
2 |
26 Feb 07 |
jari |
3800 |
resultDialog.showModal(); |
2 |
26 Feb 07 |
jari |
3801 |
} |
2 |
26 Feb 07 |
jari |
3802 |
|
2 |
26 Feb 07 |
jari |
3803 |
|
2 |
26 Feb 07 |
jari |
3804 |
} else { |
2 |
26 Feb 07 |
jari |
3805 |
if(geneSearch) |
2 |
26 Feb 07 |
jari |
3806 |
JOptionPane.showMessageDialog(framework.getFrame(), "No genes matching the search criteria were found.", "Empty Search Result", JOptionPane.INFORMATION_MESSAGE); |
2 |
26 Feb 07 |
jari |
3807 |
else |
2 |
26 Feb 07 |
jari |
3808 |
JOptionPane.showMessageDialog(framework.getFrame(), "No samples matching the search criteria were found.", "Empty Search Result", JOptionPane.INFORMATION_MESSAGE); |
2 |
26 Feb 07 |
jari |
3809 |
return; |
2 |
26 Feb 07 |
jari |
3810 |
} |
2 |
26 Feb 07 |
jari |
3811 |
} |
2 |
26 Feb 07 |
jari |
3812 |
} |
2 |
26 Feb 07 |
jari |
3813 |
|
2 |
26 Feb 07 |
jari |
/** Refreshes the current viewer by calling <code>IViewer</code> onSelected(IFramework) |
2 |
26 Feb 07 |
jari |
3815 |
*/ |
2 |
26 Feb 07 |
jari |
3816 |
private void refreshCurrentViewer() { |
2 |
26 Feb 07 |
jari |
3817 |
TreePath path = tree.getSelectionPath(); |
2 |
26 Feb 07 |
jari |
3818 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); |
2 |
26 Feb 07 |
jari |
3819 |
|
2 |
26 Feb 07 |
jari |
3820 |
Object leafInfo = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
3821 |
|
2 |
26 Feb 07 |
jari |
3822 |
if(leafInfo instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
3823 |
IViewer viewer = ((LeafInfo)leafInfo).getViewer(); |
2 |
26 Feb 07 |
jari |
3824 |
if(viewer != null) { |
2 |
26 Feb 07 |
jari |
3825 |
viewer.onSelected(framework); |
2 |
26 Feb 07 |
jari |
3826 |
} |
2 |
26 Feb 07 |
jari |
3827 |
} |
2 |
26 Feb 07 |
jari |
3828 |
} |
2 |
26 Feb 07 |
jari |
3829 |
|
2 |
26 Feb 07 |
jari |
/** Imports a list of gene or sample identifiers based on matching an annotation key |
2 |
26 Feb 07 |
jari |
* Imported cluster will be added to the proper repository. |
2 |
26 Feb 07 |
jari |
3832 |
*/ |
2 |
26 Feb 07 |
jari |
3833 |
private void onImportList(int clusterType) { |
2 |
26 Feb 07 |
jari |
3834 |
ClusterRepository cr = getClusterRepository(clusterType); |
2 |
26 Feb 07 |
jari |
3835 |
|
2 |
26 Feb 07 |
jari |
3836 |
Cluster cluster = cr.createClusterFromList(); |
2 |
26 Feb 07 |
jari |
3837 |
|
2 |
26 Feb 07 |
jari |
3838 |
if(cluster != null) { |
2 |
26 Feb 07 |
jari |
3839 |
if(clusterType == Cluster.GENE_CLUSTER) { |
2 |
26 Feb 07 |
jari |
3840 |
this.geneClusterManager.onRepositoryChanged(cr); |
2 |
26 Feb 07 |
jari |
3841 |
addHistory("Save Gene Cluster: Serial #: "+cluster.getSerialNumber()+", Source: List Import"); |
2 |
26 Feb 07 |
jari |
3842 |
} else { |
2 |
26 Feb 07 |
jari |
3843 |
this.experimentClusterManager.onRepositoryChanged(cr); |
2 |
26 Feb 07 |
jari |
3844 |
addHistory("Save Sample Cluster: Serial #: "+cluster.getSerialNumber()+", Source: List Import"); |
2 |
26 Feb 07 |
jari |
3845 |
} |
2 |
26 Feb 07 |
jari |
3846 |
refreshCurrentViewer(); |
2 |
26 Feb 07 |
jari |
3847 |
} |
2 |
26 Feb 07 |
jari |
3848 |
} |
2 |
26 Feb 07 |
jari |
3849 |
|
2 |
26 Feb 07 |
jari |
/** Appends Sample annoation. Loads annoation using the loaded order. |
2 |
26 Feb 07 |
jari |
3851 |
*/ |
2 |
26 Feb 07 |
jari |
3852 |
private void appendSampleAnnotation() { |
2 |
26 Feb 07 |
jari |
3853 |
|
2 |
26 Feb 07 |
jari |
3854 |
String msg = "<html><center><h1>Import Sample Annotation</h1></center>"; |
2 |
26 Feb 07 |
jari |
3855 |
msg += "The sample annotation file should be a tab-delimited text file containing one header row for annotation labels (field names)."; |
2 |
26 Feb 07 |
jari |
3856 |
msg += "The file may contain multiple columns of annotation with each column containing a header entry that indicates the nature of the annotation."; |
2 |
26 Feb 07 |
jari |
3857 |
msg += "The annotation for each sample is organized in rows corresponding to the order of the loaded samples."; |
2 |
26 Feb 07 |
jari |
3858 |
msg += "If annotation is missing for a sample the entry in that sample row may be left blank. Please see the manual appendix on file formats for more information. </html>"; |
2 |
26 Feb 07 |
jari |
3859 |
|
2 |
26 Feb 07 |
jari |
3860 |
HTMLMessageFileChooser dialog = new HTMLMessageFileChooser(getFrame(), "Sample Annotation File Selection", msg, TMEV.getFile("data"), true); |
2 |
26 Feb 07 |
jari |
3861 |
dialog.setApproveButtonText("Load"); |
2 |
26 Feb 07 |
jari |
3862 |
dialog.setSize(500, 600); |
2 |
26 Feb 07 |
jari |
3863 |
if(dialog.showModal() == JFileChooser.APPROVE_OPTION) { |
2 |
26 Feb 07 |
jari |
3864 |
File file = dialog.getSelectedFile(); |
2 |
26 Feb 07 |
jari |
3865 |
try { |
2 |
26 Feb 07 |
jari |
3866 |
if(data.addNewSampleLabels(getFrame(), file)) { |
2 |
26 Feb 07 |
jari |
//add the new label to the experiment label menu |
2 |
26 Feb 07 |
jari |
3868 |
this.menubar.replaceExperimentLabelMenuItems(data.getSlideNameKeyArray()); |
2 |
26 Feb 07 |
jari |
3869 |
} |
2 |
26 Feb 07 |
jari |
3870 |
} catch (IOException ioe) { |
2 |
26 Feb 07 |
jari |
3871 |
JOptionPane.showMessageDialog(getFrame(), "Error processing sample annotation file. Check file format.", "Sample Annotation Input Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
3872 |
} |
2 |
26 Feb 07 |
jari |
3873 |
} |
2 |
26 Feb 07 |
jari |
3874 |
} |
2 |
26 Feb 07 |
jari |
3875 |
|
2 |
26 Feb 07 |
jari |
3876 |
|
2 |
26 Feb 07 |
jari |
/** Appends gene annoation from an annotation file. Mapping depends on a key selected from the loaded data |
2 |
26 Feb 07 |
jari |
3878 |
* |
2 |
26 Feb 07 |
jari |
* and a second key selected from the annotation file. These keys map annoation to genes. |
2 |
26 Feb 07 |
jari |
3880 |
*/ |
2 |
26 Feb 07 |
jari |
3881 |
private void appendGeneAnnotation() { |
2 |
26 Feb 07 |
jari |
3882 |
|
2 |
26 Feb 07 |
jari |
3883 |
String msg = "<html><center><h1>Import Gene Annotation</h1></center>"; |
2 |
26 Feb 07 |
jari |
3884 |
msg += "Please select an annotation file to import. The file should contain a column that can be used "; |
2 |
26 Feb 07 |
jari |
3885 |
msg += "to map annotation in the file to the proper genes. After file selection you will be asked to identify "; |
2 |
26 Feb 07 |
jari |
3886 |
msg += "a key from the data and from the input file to be used to insure proper mapping of annotation. "; |
2 |
26 Feb 07 |
jari |
3887 |
msg += "Note that this file format should conform the MeV annotation file format conventions (.ann) file "; |
2 |
26 Feb 07 |
jari |
3888 |
msg += "described in the appendix of the manual</html>"; |
2 |
26 Feb 07 |
jari |
3889 |
|
2 |
26 Feb 07 |
jari |
3890 |
HTMLMessageFileChooser dialog = new HTMLMessageFileChooser(getFrame(), "Gene Annotation File Selection", msg, TMEV.getFile("data"), true); |
2 |
26 Feb 07 |
jari |
3891 |
dialog.setFileFilter(new AnnFileFilter()); |
2 |
26 Feb 07 |
jari |
3892 |
dialog.setApproveButtonText("Load"); |
2 |
26 Feb 07 |
jari |
3893 |
dialog.setSize(500, 600); |
2 |
26 Feb 07 |
jari |
3894 |
|
2 |
26 Feb 07 |
jari |
3895 |
if(dialog.showModal() == JFileChooser.APPROVE_OPTION) { |
2 |
26 Feb 07 |
jari |
3896 |
File file = dialog.getSelectedFile(); |
2 |
26 Feb 07 |
jari |
3897 |
try { |
2 |
26 Feb 07 |
jari |
3898 |
|
2 |
26 Feb 07 |
jari |
//parse the file |
2 |
26 Feb 07 |
jari |
3900 |
AnnFileParser parser = new AnnFileParser(); |
2 |
26 Feb 07 |
jari |
3901 |
parser.loadFile(file); |
2 |
26 Feb 07 |
jari |
3902 |
Vector headerVector; |
2 |
26 Feb 07 |
jari |
3903 |
String [] headers; |
2 |
26 Feb 07 |
jari |
3904 |
String [][] annMatrix = null; |
2 |
26 Feb 07 |
jari |
3905 |
if(parser.isAnnFileLoaded()) { |
2 |
26 Feb 07 |
jari |
3906 |
headerVector = parser.getColumnHeaders(); |
2 |
26 Feb 07 |
jari |
3907 |
annMatrix = parser.getDataMatrix(true); |
2 |
26 Feb 07 |
jari |
3908 |
} else { |
2 |
26 Feb 07 |
jari |
3909 |
JOptionPane.showMessageDialog(getFrame(), "Error processing gene annotation file. Please check file format.", "Sample Annotation Input Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
3910 |
return; |
2 |
26 Feb 07 |
jari |
3911 |
} |
2 |
26 Feb 07 |
jari |
3912 |
|
2 |
26 Feb 07 |
jari |
//get field names from current data and add UID as an option |
2 |
26 Feb 07 |
jari |
3914 |
String [] dataFieldNames = data.getFieldNames(); |
2 |
26 Feb 07 |
jari |
3915 |
String [] fieldNamesWithUID = new String[dataFieldNames.length+1]; |
2 |
26 Feb 07 |
jari |
3916 |
fieldNamesWithUID[0] = "UID"; |
2 |
26 Feb 07 |
jari |
3917 |
for(int i = 0; i < dataFieldNames.length; i++) { |
2 |
26 Feb 07 |
jari |
3918 |
fieldNamesWithUID[i+1] = dataFieldNames[i]; |
2 |
26 Feb 07 |
jari |
3919 |
} |
2 |
26 Feb 07 |
jari |
3920 |
|
2 |
26 Feb 07 |
jari |
//get annotation keys for mapping |
2 |
26 Feb 07 |
jari |
3922 |
GeneAnnotationImportDialog importDialog = new GeneAnnotationImportDialog(getFrame(), fieldNamesWithUID, annMatrix[0]); |
2 |
26 Feb 07 |
jari |
3923 |
|
2 |
26 Feb 07 |
jari |
//select columns of annoation to append |
2 |
26 Feb 07 |
jari |
3925 |
|
2 |
26 Feb 07 |
jari |
3926 |
|
2 |
26 Feb 07 |
jari |
3927 |
if(importDialog.showModal() == JOptionPane.OK_OPTION) { |
2 |
26 Feb 07 |
jari |
3928 |
|
2 |
26 Feb 07 |
jari |
3929 |
String [] newFields = importDialog.getSelectedAnnotationFields(); |
2 |
26 Feb 07 |
jari |
3930 |
|
2 |
26 Feb 07 |
jari |
3931 |
int updateCount = data.addNewGeneAnnotation(annMatrix, importDialog.getDataAnnotationKey(), importDialog.getFileAnnotationKey(), newFields); |
2 |
26 Feb 07 |
jari |
3932 |
|
2 |
26 Feb 07 |
jari |
3933 |
if(updateCount > 0) { |
2 |
26 Feb 07 |
jari |
3934 |
|
2 |
26 Feb 07 |
jari |
//update menubar and TMEV field names |
2 |
26 Feb 07 |
jari |
3936 |
|
2 |
26 Feb 07 |
jari |
//EH - moved field names to IData class instead of TMEV |
2 |
26 Feb 07 |
jari |
// TMEV.appendFieldNames(newFields); |
2 |
26 Feb 07 |
jari |
3939 |
data.getSlideMetaData().appendFieldNames(newFields); |
2 |
26 Feb 07 |
jari |
3940 |
|
2 |
26 Feb 07 |
jari |
3941 |
menubar.replaceLabelMenuItems(data.getFieldNames()); |
2 |
26 Feb 07 |
jari |
3942 |
|
2 |
26 Feb 07 |
jari |
//add event to history log |
2 |
26 Feb 07 |
jari |
3944 |
String historyMsg = "New Gene Annotation\n"; |
2 |
26 Feb 07 |
jari |
3945 |
historyMsg += "Annotation File = " + file.getAbsolutePath() + "\n"; |
2 |
26 Feb 07 |
jari |
3946 |
historyMsg += "New Annotation Fields: "; |
2 |
26 Feb 07 |
jari |
3947 |
for(int i = 0; i < newFields.length; i++) { |
2 |
26 Feb 07 |
jari |
3948 |
historyMsg += newFields[i]; |
2 |
26 Feb 07 |
jari |
3949 |
if(i < newFields.length-1) |
2 |
26 Feb 07 |
jari |
3950 |
historyMsg += ", "; |
2 |
26 Feb 07 |
jari |
3951 |
} |
2 |
26 Feb 07 |
jari |
3952 |
addHistory(historyMsg); |
2 |
26 Feb 07 |
jari |
3953 |
|
2 |
26 Feb 07 |
jari |
3954 |
JOptionPane.showMessageDialog(getFrame(), "<html>Gene annotation has been successfully added.<br>Check the history node for field information.</html>", "Append Gene Annotation", JOptionPane.INFORMATION_MESSAGE); |
2 |
26 Feb 07 |
jari |
3955 |
|
2 |
26 Feb 07 |
jari |
3956 |
} else { |
2 |
26 Feb 07 |
jari |
3957 |
String eMsg = "<html>Gene annotation addition has failed. The identifying keys in the loaded data ("+importDialog.getDataAnnotationKey()+")<br>"; |
2 |
26 Feb 07 |
jari |
3958 |
eMsg += "and the keys in the file ("+importDialog.getFileAnnotationKey()+") did not have any matches.<br<br>The new annotation could not be mapped to the data.</html>"; |
2 |
26 Feb 07 |
jari |
3959 |
JOptionPane.showMessageDialog(getFrame(), eMsg, "Append Gene Annotation", JOptionPane.INFORMATION_MESSAGE); |
2 |
26 Feb 07 |
jari |
3960 |
} |
2 |
26 Feb 07 |
jari |
3961 |
} |
2 |
26 Feb 07 |
jari |
3962 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
3963 |
JOptionPane.showMessageDialog(getFrame(), "Error processing gene annotation file. Please check file format.", "Sample Annotation Input Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
3964 |
e.printStackTrace(); |
2 |
26 Feb 07 |
jari |
3965 |
} |
2 |
26 Feb 07 |
jari |
3966 |
} |
2 |
26 Feb 07 |
jari |
3967 |
} |
2 |
26 Feb 07 |
jari |
/* Start CGH Functions */ |
2 |
26 Feb 07 |
jari |
3969 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Nov 11, 05 |
2 |
26 Feb 07 |
jari |
* Adding CGH Listener Functions |
2 |
26 Feb 07 |
jari |
3972 |
*/ |
2 |
26 Feb 07 |
jari |
3973 |
public void onSetShowFlankingRegions(boolean show){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onSetShowFlankingRegions " + show); |
2 |
26 Feb 07 |
jari |
3975 |
menubar.setShowFlankingRegions(show); |
2 |
26 Feb 07 |
jari |
//fireCghMenuChanged(); |
2 |
26 Feb 07 |
jari |
3977 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
3978 |
} |
2 |
26 Feb 07 |
jari |
3979 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH display element change |
2 |
26 Feb 07 |
jari |
3982 |
*/ |
2 |
26 Feb 07 |
jari |
3983 |
private void onChangeCghElementLength(double length){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onChangeCghElementLength " + length); |
2 |
26 Feb 07 |
jari |
3985 |
menubar.setCghElementLength(length); |
2 |
26 Feb 07 |
jari |
//fireCghMenuChanged(); |
2 |
26 Feb 07 |
jari |
3987 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
3988 |
} |
2 |
26 Feb 07 |
jari |
3989 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH display element change |
2 |
26 Feb 07 |
jari |
3992 |
*/ |
2 |
26 Feb 07 |
jari |
3993 |
private void onChangeCghElementLengthOther(){ |
2 |
26 Feb 07 |
jari |
3994 |
String s = (String)JOptionPane.showInputDialog( |
2 |
26 Feb 07 |
jari |
3995 |
new JFrame(), "Enter Element Length", "Element Length", JOptionPane.PLAIN_MESSAGE); |
2 |
26 Feb 07 |
jari |
3996 |
if(s == null || s.length() == 0){ |
2 |
26 Feb 07 |
jari |
3997 |
return; |
2 |
26 Feb 07 |
jari |
3998 |
} |
2 |
26 Feb 07 |
jari |
3999 |
try{ |
2 |
26 Feb 07 |
jari |
4000 |
int val = Integer.parseInt(s); |
2 |
26 Feb 07 |
jari |
4001 |
onChangeCghElementLength(val); |
2 |
26 Feb 07 |
jari |
4002 |
}catch (NumberFormatException e){ |
2 |
26 Feb 07 |
jari |
4003 |
JOptionPane.showMessageDialog(null, "Input Must Be An Integer", "Number Format Error", JOptionPane.PLAIN_MESSAGE); |
2 |
26 Feb 07 |
jari |
4004 |
} |
2 |
26 Feb 07 |
jari |
4005 |
} |
2 |
26 Feb 07 |
jari |
4006 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH display element change |
2 |
26 Feb 07 |
jari |
4009 |
*/ |
2 |
26 Feb 07 |
jari |
4010 |
private void onChangeCghElementWidth(int width){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onChangeCghElementWidth " + width); |
2 |
26 Feb 07 |
jari |
4012 |
menubar.setCghElementWidth(width); |
2 |
26 Feb 07 |
jari |
//fireCghMenuChanged(); |
2 |
26 Feb 07 |
jari |
4014 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
4015 |
} |
2 |
26 Feb 07 |
jari |
4016 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH display element change |
2 |
26 Feb 07 |
jari |
4019 |
*/ |
2 |
26 Feb 07 |
jari |
4020 |
private void onChangeCghElementWidthOther(){ |
2 |
26 Feb 07 |
jari |
//System.out.println("onChangeCghElementWidthOther "); |
2 |
26 Feb 07 |
jari |
4022 |
String s = (String)JOptionPane.showInputDialog( |
2 |
26 Feb 07 |
jari |
4023 |
new JFrame(), "Enter Element Width", "Element Width", JOptionPane.PLAIN_MESSAGE); |
2 |
26 Feb 07 |
jari |
4024 |
if(s == null || s.length() == 0){ return; } |
2 |
26 Feb 07 |
jari |
4025 |
try{ |
2 |
26 Feb 07 |
jari |
4026 |
int val = Integer.parseInt(s); |
2 |
26 Feb 07 |
jari |
4027 |
onChangeCghElementWidth(val); |
2 |
26 Feb 07 |
jari |
4028 |
}catch (NumberFormatException e){ |
2 |
26 Feb 07 |
jari |
4029 |
JOptionPane.showMessageDialog(null, "Input Must Be An Integer", "Number Format Error", JOptionPane.PLAIN_MESSAGE); |
2 |
26 Feb 07 |
jari |
4030 |
} |
2 |
26 Feb 07 |
jari |
4031 |
} |
2 |
26 Feb 07 |
jari |
4032 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH display type change |
2 |
26 Feb 07 |
jari |
4035 |
*/ |
2 |
26 Feb 07 |
jari |
4036 |
private void onChangeCghDisplayType(int displayType){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onChangeCghDisplayType " + displayType); |
2 |
26 Feb 07 |
jari |
4038 |
menubar.setCghDisplayType(displayType); |
2 |
26 Feb 07 |
jari |
//fireCghMenuChanged(); |
2 |
26 Feb 07 |
jari |
4040 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
4041 |
/** |
2 |
26 Feb 07 |
jari |
* Remember to change setCurrentViewer function |
2 |
26 Feb 07 |
jari |
4043 |
*/ |
2 |
26 Feb 07 |
jari |
4044 |
setCurrentViewer(getCurrentViewer()); |
2 |
26 Feb 07 |
jari |
4045 |
} |
2 |
26 Feb 07 |
jari |
4046 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH display label change |
2 |
26 Feb 07 |
jari |
4049 |
*/ |
2 |
26 Feb 07 |
jari |
4050 |
private void onChangeDisplayLabelType(int displayLabelType){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onChangeDisplayLabelType " + displayLabelType); |
2 |
26 Feb 07 |
jari |
4052 |
menubar.setCghDisplayLabelType(displayLabelType); |
2 |
26 Feb 07 |
jari |
//fireCghMenuChanged(); |
2 |
26 Feb 07 |
jari |
4054 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
4055 |
} |
2 |
26 Feb 07 |
jari |
4056 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Sets the p-value threshold for deeming probes as aberrant if using the |
2 |
26 Feb 07 |
jari |
* probe value distribution method of copy number determination |
2 |
26 Feb 07 |
jari |
4060 |
*/ |
2 |
26 Feb 07 |
jari |
4061 |
public void onSetClonePThresh(){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onSetClonePThresh "); |
2 |
26 Feb 07 |
jari |
4063 |
SingleValueSelectorDialog dlg = new SingleValueSelectorDialog(framework.getFrame(), menubar.getCloneValueMenu().getClonePThresh() + ""); |
2 |
26 Feb 07 |
jari |
4064 |
if(dlg.showModal() == JOptionPane.OK_OPTION){ |
2 |
26 Feb 07 |
jari |
4065 |
String value = dlg.getValue(); |
2 |
26 Feb 07 |
jari |
4066 |
try{ |
2 |
26 Feb 07 |
jari |
4067 |
float val = Float.parseFloat(value); |
2 |
26 Feb 07 |
jari |
4068 |
menubar.setClonePThresh(val); |
2 |
26 Feb 07 |
jari |
4069 |
}catch (NumberFormatException e){ |
2 |
26 Feb 07 |
jari |
4070 |
JOptionPane.showMessageDialog(null, "Input Must Be An Number", "Number Format Error", JOptionPane.PLAIN_MESSAGE); |
2 |
26 Feb 07 |
jari |
4071 |
} |
2 |
26 Feb 07 |
jari |
4072 |
fireThresholdsChanged(); |
2 |
26 Feb 07 |
jari |
4073 |
} |
2 |
26 Feb 07 |
jari |
4074 |
} |
2 |
26 Feb 07 |
jari |
4075 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* On CGH threshold change |
2 |
26 Feb 07 |
jari |
4078 |
*/ |
2 |
26 Feb 07 |
jari |
4079 |
private void fireThresholdsChanged(){ |
2 |
26 Feb 07 |
jari |
4080 |
onThresholdsChanged(); |
2 |
26 Feb 07 |
jari |
4081 |
IViewer viewer = getCurrentViewer(); |
2 |
26 Feb 07 |
jari |
4082 |
if (viewer == null) { |
2 |
26 Feb 07 |
jari |
4083 |
return; |
2 |
26 Feb 07 |
jari |
4084 |
} |
2 |
26 Feb 07 |
jari |
4085 |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
4086 |
} |
2 |
26 Feb 07 |
jari |
4087 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Event processed when the probe copy determination thresholds |
2 |
26 Feb 07 |
jari |
* have changed |
2 |
26 Feb 07 |
jari |
4091 |
*/ |
2 |
26 Feb 07 |
jari |
4092 |
public void onThresholdsChanged(){ |
2 |
26 Feb 07 |
jari |
4093 |
ICGHCloneValueMenu menu = framework.getCghCloneValueMenu(); |
2 |
26 Feb 07 |
jari |
4094 |
data.onCopyDeterminationChanged(menu); |
2 |
26 Feb 07 |
jari |
4095 |
onFlankingRegionDeterminationChanged(); |
2 |
26 Feb 07 |
jari |
4096 |
} |
2 |
26 Feb 07 |
jari |
4097 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* event that is processed when the method of calculating |
2 |
26 Feb 07 |
jari |
* flanking regions has changed |
2 |
26 Feb 07 |
jari |
4101 |
*/ |
2 |
26 Feb 07 |
jari |
4102 |
public void onFlankingRegionDeterminationChanged(){ |
2 |
26 Feb 07 |
jari |
4103 |
int flankingRegionType = framework.getCghCloneValueMenu().getFlankingRegionType(); |
2 |
26 Feb 07 |
jari |
4104 |
calculateFlankingRegions(flankingRegionType); |
2 |
26 Feb 07 |
jari |
4105 |
} |
2 |
26 Feb 07 |
jari |
4106 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Calculates flanking regions for the data |
2 |
26 Feb 07 |
jari |
* @param flankingRegionType the copy number determination method used to |
2 |
26 Feb 07 |
jari |
* calculate the flanking regions |
2 |
26 Feb 07 |
jari |
4111 |
*/ |
2 |
26 Feb 07 |
jari |
4112 |
public void calculateFlankingRegions(int flankingRegionType){ |
2 |
26 Feb 07 |
jari |
4113 |
FlankingRegionCalculator flCalc = new FlankingRegionCalculator(); |
2 |
26 Feb 07 |
jari |
4114 |
flCalc.setExperiments(data.getFeaturesList()); |
2 |
26 Feb 07 |
jari |
4115 |
flCalc.setData(data); |
2 |
26 Feb 07 |
jari |
4116 |
flCalc.setCopyDeterminationType(flankingRegionType); |
2 |
26 Feb 07 |
jari |
4117 |
flCalc.calculateFlankingRegions(); |
2 |
26 Feb 07 |
jari |
4118 |
} |
2 |
26 Feb 07 |
jari |
4119 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* If CGH circle viewer background changes |
2 |
26 Feb 07 |
jari |
4122 |
*/ |
2 |
26 Feb 07 |
jari |
4123 |
private void onSetCircleViewerBackground(){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onSetCircleViewerBackground "); |
2 |
26 Feb 07 |
jari |
4125 |
Color newColor = javax.swing.JColorChooser.showDialog( |
2 |
26 Feb 07 |
jari |
4126 |
new JFrame(), "Choose Background Color", Color.black); |
2 |
26 Feb 07 |
jari |
4127 |
menubar.setCircleViewerBackgroundColor(newColor); |
2 |
26 Feb 07 |
jari |
//fireCghMenuChanged(); |
2 |
26 Feb 07 |
jari |
4129 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
4130 |
} |
2 |
26 Feb 07 |
jari |
4131 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Changes the order in which experiments are displayed in the |
2 |
26 Feb 07 |
jari |
* position graph |
2 |
26 Feb 07 |
jari |
4135 |
*/ |
2 |
26 Feb 07 |
jari |
4136 |
private void onChangeCghDisplayOrder(){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onChangeCghDisplayOrder "); |
2 |
26 Feb 07 |
jari |
4138 |
CGHDisplayOrderChanger changer = new CGHDisplayOrderChanger(data, framework.getFrame(), true); |
2 |
26 Feb 07 |
jari |
4139 |
changer.show(true); |
2 |
26 Feb 07 |
jari |
4140 |
if (changer.isCancelled()) |
2 |
26 Feb 07 |
jari |
4141 |
return; |
2 |
26 Feb 07 |
jari |
4142 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
4143 |
} |
2 |
26 Feb 07 |
jari |
4144 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* UN-Used |
2 |
26 Feb 07 |
jari |
* Need to carefully take care of removing samples. |
2 |
26 Feb 07 |
jari |
* Remember to revisit. |
2 |
26 Feb 07 |
jari |
4149 |
*/ |
2 |
26 Feb 07 |
jari |
4150 |
private void onDeleteSample(){ |
2 |
26 Feb 07 |
jari |
4151 |
System.out.println("CGH onDeleteSample. Code ready not validated"); |
2 |
26 Feb 07 |
jari |
//ctl.onDeleteSample(); |
2 |
26 Feb 07 |
jari |
4153 |
/* |
2 |
26 Feb 07 |
jari |
CGHSampleDeleter deleter = new CGHSampleDeleter(data, framework.getFrame(), true); |
2 |
26 Feb 07 |
jari |
if(deleter.showModal() == JOptionPane.OK_OPTION){ |
2 |
26 Feb 07 |
jari |
int deletedSampleIndex = deleter.getDeletedIndex(); |
2 |
26 Feb 07 |
jari |
if(deletedSampleIndex != -1){ |
2 |
26 Feb 07 |
jari |
deleteSample(deletedSampleIndex); |
2 |
26 Feb 07 |
jari |
4159 |
} |
2 |
26 Feb 07 |
jari |
4160 |
} |
2 |
26 Feb 07 |
jari |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
4162 |
*/ |
2 |
26 Feb 07 |
jari |
4163 |
} |
2 |
26 Feb 07 |
jari |
4164 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* UN-Used |
2 |
26 Feb 07 |
jari |
* Need to revisit for syncing |
2 |
26 Feb 07 |
jari |
* @param sampleIndex |
2 |
26 Feb 07 |
jari |
4169 |
*/ |
2 |
26 Feb 07 |
jari |
4170 |
private void deleteSample(int sampleIndex){ |
2 |
26 Feb 07 |
jari |
4171 |
int[] indicesOrder = data.getSamplesOrder(); |
2 |
26 Feb 07 |
jari |
4172 |
int deletedSampleIndex = indicesOrder[sampleIndex]; |
2 |
26 Feb 07 |
jari |
4173 |
data.getFeaturesList().remove(deletedSampleIndex); |
2 |
26 Feb 07 |
jari |
4174 |
int[] newIndicesOrder = new int[indicesOrder.length - 1]; |
2 |
26 Feb 07 |
jari |
4175 |
int curIndex = 0; |
2 |
26 Feb 07 |
jari |
4176 |
for(int i = 0; i < indicesOrder.length; i++){ |
2 |
26 Feb 07 |
jari |
4177 |
if(i != sampleIndex){ |
2 |
26 Feb 07 |
jari |
4178 |
if(indicesOrder[i] > deletedSampleIndex){ |
2 |
26 Feb 07 |
jari |
4179 |
newIndicesOrder[curIndex] = indicesOrder[i] - 1; |
2 |
26 Feb 07 |
jari |
4180 |
}else{ |
2 |
26 Feb 07 |
jari |
4181 |
newIndicesOrder[curIndex] = indicesOrder[i]; |
2 |
26 Feb 07 |
jari |
4182 |
} |
2 |
26 Feb 07 |
jari |
4183 |
curIndex++; |
2 |
26 Feb 07 |
jari |
4184 |
} |
2 |
26 Feb 07 |
jari |
4185 |
} |
2 |
26 Feb 07 |
jari |
4186 |
data.setSamplesOrder(newIndicesOrder); |
2 |
26 Feb 07 |
jari |
4187 |
} |
2 |
26 Feb 07 |
jari |
4188 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Clear annotations if any from CGH views |
2 |
26 Feb 07 |
jari |
4191 |
*/ |
2 |
26 Feb 07 |
jari |
4192 |
private void onClearAnnotations(){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onClearAnnotations "); |
2 |
26 Feb 07 |
jari |
//ctl.onClearAnnotations(); |
2 |
26 Feb 07 |
jari |
4195 |
data.setAnnotations(new ICGHDataRegion[0][0]); |
2 |
26 Feb 07 |
jari |
4196 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
4197 |
} |
2 |
26 Feb 07 |
jari |
4198 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Changes the method of calculating probe values |
2 |
26 Feb 07 |
jari |
* @param cloneValueType |
2 |
26 Feb 07 |
jari |
4202 |
*/ |
2 |
26 Feb 07 |
jari |
4203 |
public void onChangeCloneValueType(int cloneValueType){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onChangeCloneValueType " + cloneValueType); |
2 |
26 Feb 07 |
jari |
4205 |
menubar.setCloneValueType(cloneValueType); |
2 |
26 Feb 07 |
jari |
//onChangeCloneValueType(cloneValueType); |
2 |
26 Feb 07 |
jari |
4207 |
fireCloneValuesChanged(); |
2 |
26 Feb 07 |
jari |
4208 |
} |
2 |
26 Feb 07 |
jari |
4209 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Changes the method of calculating flanking regions |
2 |
26 Feb 07 |
jari |
* @param flankingRegionType |
2 |
26 Feb 07 |
jari |
4213 |
*/ |
2 |
26 Feb 07 |
jari |
4214 |
public void onChangeFlankingRegionType(int flankingRegionType){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onChangeFlankingRegionType " + flankingRegionType); |
2 |
26 Feb 07 |
jari |
4216 |
menubar.setFlankingRegionType(flankingRegionType); |
2 |
26 Feb 07 |
jari |
4217 |
onFlankingRegionDeterminationChanged(); |
2 |
26 Feb 07 |
jari |
4218 |
fireCloneValuesChanged(); |
2 |
26 Feb 07 |
jari |
4219 |
} |
2 |
26 Feb 07 |
jari |
4220 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Sets the threshold parameters for copy number determination based |
2 |
26 Feb 07 |
jari |
* on probe value thresholds |
2 |
26 Feb 07 |
jari |
4224 |
*/ |
2 |
26 Feb 07 |
jari |
4225 |
private void onCghSetThresholds(){ |
2 |
26 Feb 07 |
jari |
//System.out.println("CGH onCghSetThresholds "); |
2 |
26 Feb 07 |
jari |
4227 |
ICGHCloneValueMenu menu = menubar.getCloneValueMenu(); |
2 |
26 Feb 07 |
jari |
4228 |
CGHThresholdSetter setter = new CGHThresholdSetter(getFrame(), menu.getAmpThresh(), |
2 |
26 Feb 07 |
jari |
4229 |
menu.getDelThresh(), menu.getAmpThresh2Copy(), menu.getDelThresh2Copy()); |
2 |
26 Feb 07 |
jari |
4230 |
if(setter.showModal() == JOptionPane.OK_OPTION){ |
2 |
26 Feb 07 |
jari |
4231 |
menubar.setAmpThresh(setter.getAmpThresh()); |
2 |
26 Feb 07 |
jari |
4232 |
menubar.setDelThresh(setter.getDelThresh()); |
2 |
26 Feb 07 |
jari |
4233 |
menubar.setAmpThresh2Copy(setter.getAmpThresh2Copy()); |
2 |
26 Feb 07 |
jari |
4234 |
menubar.setDelThresh2Copy(setter.getDelThresh2Copy()); |
2 |
26 Feb 07 |
jari |
4235 |
fireThresholdsChanged(); |
2 |
26 Feb 07 |
jari |
4236 |
} |
2 |
26 Feb 07 |
jari |
4237 |
} |
2 |
26 Feb 07 |
jari |
4238 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Renames a selected navigation tree node. |
2 |
26 Feb 07 |
jari |
4241 |
*/ |
2 |
26 Feb 07 |
jari |
4242 |
private void onRenameNode() { |
2 |
26 Feb 07 |
jari |
4243 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); |
2 |
26 Feb 07 |
jari |
4244 |
if (node == null || node.getParent() == null) { |
2 |
26 Feb 07 |
jari |
4245 |
return; |
2 |
26 Feb 07 |
jari |
4246 |
} |
2 |
26 Feb 07 |
jari |
4247 |
if(node.getUserObject() instanceof org.tigr.microarray.mev.cluster.gui.LeafInfo){ |
2 |
26 Feb 07 |
jari |
4248 |
String name = JOptionPane.showInputDialog(getFrame(), "Enter New Name"); |
2 |
26 Feb 07 |
jari |
4249 |
if(name != null && name.length() > 0){ |
2 |
26 Feb 07 |
jari |
4250 |
((org.tigr.microarray.mev.cluster.gui.LeafInfo)node.getUserObject()).setName(name); |
2 |
26 Feb 07 |
jari |
4251 |
((DefaultTreeModel)tree.getModel()).nodeChanged(node); |
2 |
26 Feb 07 |
jari |
4252 |
} |
2 |
26 Feb 07 |
jari |
4253 |
}else if(node.getUserObject() instanceof String){ |
2 |
26 Feb 07 |
jari |
4254 |
String name = JOptionPane.showInputDialog(getFrame(), "Enter New Name"); |
2 |
26 Feb 07 |
jari |
4255 |
if(name != null && name.length() > 0){ |
2 |
26 Feb 07 |
jari |
4256 |
node.setUserObject(name); |
2 |
26 Feb 07 |
jari |
4257 |
((DefaultTreeModel)tree.getModel()).nodeChanged(node); |
2 |
26 Feb 07 |
jari |
4258 |
} |
2 |
26 Feb 07 |
jari |
4259 |
} |
2 |
26 Feb 07 |
jari |
4260 |
} |
2 |
26 Feb 07 |
jari |
4261 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Adds a CGH Data View |
2 |
26 Feb 07 |
jari |
4264 |
*/ |
2 |
26 Feb 07 |
jari |
4265 |
private void addDataView(DefaultMutableTreeNode node) { |
2 |
26 Feb 07 |
jari |
//System.out.println("addDataView "); |
2 |
26 Feb 07 |
jari |
4267 |
if (node == null) { |
2 |
26 Feb 07 |
jari |
4268 |
return; |
2 |
26 Feb 07 |
jari |
4269 |
} |
2 |
26 Feb 07 |
jari |
4270 |
DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
//treeModel.insertNodeInto(node, mainViewNode, mainViewNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
4272 |
if (!mainViewerNode.getAllowsChildren()){ |
2 |
26 Feb 07 |
jari |
4273 |
mainViewerNode.setAllowsChildren(true); |
2 |
26 Feb 07 |
jari |
4274 |
treeModel.insertNodeInto(node, mainViewerNode, mainViewerNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
4275 |
mainViewerNode.setAllowsChildren(false); |
2 |
26 Feb 07 |
jari |
4276 |
} else { |
2 |
26 Feb 07 |
jari |
4277 |
treeModel.insertNodeInto(node, mainViewerNode, mainViewerNode.getChildCount()); |
2 |
26 Feb 07 |
jari |
4278 |
} |
2 |
26 Feb 07 |
jari |
4279 |
TreeSelectionModel selModel = tree.getSelectionModel(); |
2 |
26 Feb 07 |
jari |
4280 |
TreePath treePath = new TreePath(node.getPath()); |
2 |
26 Feb 07 |
jari |
4281 |
selModel.setSelectionPath(treePath); |
2 |
26 Feb 07 |
jari |
4282 |
tree.scrollPathToVisible(treePath); |
2 |
26 Feb 07 |
jari |
4283 |
} |
2 |
26 Feb 07 |
jari |
4284 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Remember to revisit CGH algorithims after views are ready |
2 |
26 Feb 07 |
jari |
* @param action |
2 |
26 Feb 07 |
jari |
4288 |
*/ |
2 |
26 Feb 07 |
jari |
4289 |
private void onCghAnalysis(Action action){ |
2 |
26 Feb 07 |
jari |
//System.out.println("onCghAnalysis "); |
2 |
26 Feb 07 |
jari |
4291 |
String className = (String)action.getValue(ActionManager.PARAMETER); |
2 |
26 Feb 07 |
jari |
4292 |
try { |
2 |
26 Feb 07 |
jari |
4293 |
Class clazz = Class.forName(className); |
2 |
26 Feb 07 |
jari |
4294 |
NumberOfAlterationsCalculator gui = (NumberOfAlterationsCalculator)clazz.newInstance(); |
2 |
26 Feb 07 |
jari |
4295 |
DefaultMutableTreeNode result = gui.execute(framework); |
2 |
26 Feb 07 |
jari |
4296 |
addAnalysisResult(result); |
2 |
26 Feb 07 |
jari |
4297 |
} catch (ClassCastException e) { |
2 |
26 Feb 07 |
jari |
4298 |
System.out.println("Error: org.tigr.microarray.mev.cluster.gui.IClusterGUI interface is expected."); |
2 |
26 Feb 07 |
jari |
4299 |
ShowThrowableDialog.show(mainframe, "Analysis Error", false, e); |
2 |
26 Feb 07 |
jari |
4300 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
4301 |
ShowThrowableDialog.show(mainframe, "Analysis Error", false, e); |
2 |
26 Feb 07 |
jari |
4302 |
} |
2 |
26 Feb 07 |
jari |
4303 |
} |
2 |
26 Feb 07 |
jari |
4304 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* ICGHListener impl |
2 |
26 Feb 07 |
jari |
* Event that is processed what the underlying data |
2 |
26 Feb 07 |
jari |
* has changed |
2 |
26 Feb 07 |
jari |
4309 |
*/ |
2 |
26 Feb 07 |
jari |
4310 |
public void onDataChanged() { |
2 |
26 Feb 07 |
jari |
4311 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
4312 |
} |
2 |
26 Feb 07 |
jari |
4313 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* ICGHListener impl |
2 |
26 Feb 07 |
jari |
* Event that is processed when the method of |
2 |
26 Feb 07 |
jari |
* probe value calculation has changed |
2 |
26 Feb 07 |
jari |
4318 |
*/ |
2 |
26 Feb 07 |
jari |
4319 |
public void onCloneValuesChanged(){ |
2 |
26 Feb 07 |
jari |
4320 |
fireCloneValuesChanged(); |
2 |
26 Feb 07 |
jari |
4321 |
} |
2 |
26 Feb 07 |
jari |
4322 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Once CGH clone values have been updated |
2 |
26 Feb 07 |
jari |
4325 |
*/ |
2 |
26 Feb 07 |
jari |
4326 |
private void fireCloneValuesChanged(){ |
2 |
26 Feb 07 |
jari |
//System.out.println("fireCloneValuesChanged "); |
2 |
26 Feb 07 |
jari |
4328 |
IViewer viewer = getCurrentViewer(); |
2 |
26 Feb 07 |
jari |
4329 |
if(viewer instanceof ICGHViewer){ |
2 |
26 Feb 07 |
jari |
4330 |
((ICGHViewer)viewer).onCloneValuesChanged(framework.getCghCloneValueMenu()); |
2 |
26 Feb 07 |
jari |
4331 |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
4332 |
} |
2 |
26 Feb 07 |
jari |
4333 |
} |
2 |
26 Feb 07 |
jari |
4334 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* @param boolean show |
2 |
26 Feb 07 |
jari |
* Removes/Adds the viewer header |
2 |
26 Feb 07 |
jari |
4338 |
*/ |
2 |
26 Feb 07 |
jari |
4339 |
private void onShowHeader(boolean show){ |
2 |
26 Feb 07 |
jari |
//System.out.println("onShowHeader "); |
2 |
26 Feb 07 |
jari |
4341 |
if(show){ |
2 |
26 Feb 07 |
jari |
4342 |
getCurrentViewer().getHeaderComponent().setVisible(show); |
2 |
26 Feb 07 |
jari |
4343 |
viewScrollPane.getColumnHeader().setVisible(show); |
2 |
26 Feb 07 |
jari |
4344 |
}else{ |
2 |
26 Feb 07 |
jari |
4345 |
getCurrentViewer().getHeaderComponent().setVisible(show); |
2 |
26 Feb 07 |
jari |
4346 |
viewScrollPane.getColumnHeader().setVisible(show); |
2 |
26 Feb 07 |
jari |
4347 |
} |
2 |
26 Feb 07 |
jari |
4348 |
} |
2 |
26 Feb 07 |
jari |
4349 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* ICGHListener Impl |
2 |
26 Feb 07 |
jari |
* Event that is processed when a chromosome is selected to be displayed |
2 |
26 Feb 07 |
jari |
* @param eventObj |
2 |
26 Feb 07 |
jari |
4354 |
*/ |
2 |
26 Feb 07 |
jari |
4355 |
public void onChromosomeSelected(java.util.EventObject eventObj) { |
2 |
26 Feb 07 |
jari |
//System.out.println("onChromosomeSelected "); |
2 |
26 Feb 07 |
jari |
4357 |
int chromosomeIndex = ((Integer)eventObj.getSource()).intValue(); |
2 |
26 Feb 07 |
jari |
4358 |
TreeNode selectedNode = mainViewerNode.getChildAt(1).getChildAt(chromosomeIndex); |
2 |
26 Feb 07 |
jari |
4359 |
tree.setSelectionPath(new TreePath(((DefaultMutableTreeNode)selectedNode).getPath())); |
2 |
26 Feb 07 |
jari |
4360 |
} |
2 |
26 Feb 07 |
jari |
4361 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* ICGHListener Impl |
2 |
26 Feb 07 |
jari |
* Event that is processed when clone distributions have been loaded |
2 |
26 Feb 07 |
jari |
* Remember to re-visit |
2 |
26 Feb 07 |
jari |
4366 |
*/ |
2 |
26 Feb 07 |
jari |
4367 |
public void CloneDistributionsLoaded() { |
2 |
26 Feb 07 |
jari |
4368 |
System.out.println("onCloneDistributionsLoaded "); |
2 |
26 Feb 07 |
jari |
//menubar.onCloneDistributionsLoaded(); |
2 |
26 Feb 07 |
jari |
4370 |
} |
2 |
26 Feb 07 |
jari |
4371 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Remember |
2 |
26 Feb 07 |
jari |
* Event that is processed when the window has been closed |
2 |
26 Feb 07 |
jari |
* Clash with onClose() of MAV So renamed to onCGHClose() for time being |
2 |
26 Feb 07 |
jari |
4376 |
*/ |
2 |
26 Feb 07 |
jari |
4377 |
protected void onCGHClose(){ |
2 |
26 Feb 07 |
jari |
4378 |
/* |
2 |
26 Feb 07 |
jari |
DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); |
2 |
26 Feb 07 |
jari |
fireOnCloseEvent((DefaultMutableTreeNode)model.getRoot()); |
2 |
26 Feb 07 |
jari |
mainframe.dispose(); |
2 |
26 Feb 07 |
jari |
System.exit(0); |
2 |
26 Feb 07 |
jari |
4383 |
*/ |
2 |
26 Feb 07 |
jari |
4384 |
} |
2 |
26 Feb 07 |
jari |
4385 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Getter for property menubar. |
2 |
26 Feb 07 |
jari |
* @return Value of property menubar. |
2 |
26 Feb 07 |
jari |
4389 |
*/ |
2 |
26 Feb 07 |
jari |
4390 |
public MultipleArrayMenubar getMenubar() { |
2 |
26 Feb 07 |
jari |
4391 |
return menubar; |
2 |
26 Feb 07 |
jari |
4392 |
} |
2 |
26 Feb 07 |
jari |
4393 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Setter for property menubar. |
2 |
26 Feb 07 |
jari |
* @param menubar New value of property menubar. |
2 |
26 Feb 07 |
jari |
4397 |
*/ |
2 |
26 Feb 07 |
jari |
//public void setMenubar(org.abramson.microarray.cgh.CGHMenubar menubar) { |
2 |
26 Feb 07 |
jari |
4399 |
public void setMenubar(MultipleArrayMenubar menubar) { |
2 |
26 Feb 07 |
jari |
//this.menubar = menubar; |
2 |
26 Feb 07 |
jari |
//super.menubar = menubar; |
2 |
26 Feb 07 |
jari |
4402 |
} |
2 |
26 Feb 07 |
jari |
4403 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Nov 01, 2005 |
2 |
26 Feb 07 |
jari |
* CGH Event Handler |
2 |
26 Feb 07 |
jari |
* Not Used Merged with MeV fireMenuChanged() |
2 |
26 Feb 07 |
jari |
private void fireCghMenuChanged(){ |
2 |
26 Feb 07 |
jari |
IViewer viewer = getCurrentViewer(); |
2 |
26 Feb 07 |
jari |
if(viewer instanceof ICGHViewer){ |
2 |
26 Feb 07 |
jari |
//((ICGHViewer)viewer).onMenuChanged(((CGHMenubar)menubar).getCghDisplayMenu()); |
2 |
26 Feb 07 |
jari |
((ICGHViewer)viewer).onMenuChanged(menubar.getCghDisplayMenu()); |
2 |
26 Feb 07 |
jari |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
4413 |
} |
2 |
26 Feb 07 |
jari |
4414 |
} |
2 |
26 Feb 07 |
jari |
4415 |
*/ |
2 |
26 Feb 07 |
jari |
4416 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Nov 02, 2005 |
2 |
26 Feb 07 |
jari |
* Function to create Chr & Expr views |
2 |
26 Feb 07 |
jari |
* CGH Specific |
2 |
26 Feb 07 |
jari |
4420 |
* |
2 |
26 Feb 07 |
jari |
4421 |
*/ |
2 |
26 Feb 07 |
jari |
4422 |
private Vector initializeViews(){ |
2 |
26 Feb 07 |
jari |
4423 |
DefaultMutableTreeNode experimentViews = new DefaultMutableTreeNode(new LeafInfo("Experiment Views"), true); |
2 |
26 Feb 07 |
jari |
4424 |
DefaultMutableTreeNode chromosomeViews = new DefaultMutableTreeNode(new LeafInfo("Chromosome Views"), true); |
2 |
26 Feb 07 |
jari |
4425 |
/** |
2 |
26 Feb 07 |
jari |
* Circle Viewer |
2 |
26 Feb 07 |
jari |
4427 |
*/ |
2 |
26 Feb 07 |
jari |
4428 |
for(int i = 0; i < data.getFeaturesCount(); i++){ |
2 |
26 Feb 07 |
jari |
4429 |
CGHCircleViewerPanel circlePanel = new CGHCircleViewerPanel(new CGHCircleViewerModel(framework)); |
2 |
26 Feb 07 |
jari |
4430 |
circlePanel.setExperimentIndex(i); |
2 |
26 Feb 07 |
jari |
4431 |
circlePanel.setBackground(Color.darkGray); |
2 |
26 Feb 07 |
jari |
4432 |
circlePanel.setDrsListener((EventListener)manager.getListener()); |
2 |
26 Feb 07 |
jari |
4433 |
String name = data.getSampleName(i); |
2 |
26 Feb 07 |
jari |
4434 |
DefaultMutableTreeNode circleViewerNode = new DefaultMutableTreeNode(new LeafInfo(name, circlePanel), false); |
2 |
26 Feb 07 |
jari |
4435 |
experimentViews.add(circleViewerNode); |
2 |
26 Feb 07 |
jari |
4436 |
} |
2 |
26 Feb 07 |
jari |
4437 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Chromomosome Viewer |
2 |
26 Feb 07 |
jari |
4440 |
*/ |
2 |
26 Feb 07 |
jari |
4441 |
CGHPositionGraphCombinedHeader combinedHeader = new CGHPositionGraphCombinedHeader(new java.awt.Insets(0,0,0,0)); |
2 |
26 Feb 07 |
jari |
4442 |
for(int i = 0; i < data.getNumChromosomes(); i++){ |
2 |
26 Feb 07 |
jari |
4443 |
CGHPositionGraphDataModel posModel = new CGHPositionGraphDataModel(/*fcd,*/ framework, i); |
2 |
26 Feb 07 |
jari |
4444 |
CGHAnnotationsModel annotationsModel = new CGHAnnotationsModel(/*fcd,*/ framework, i); |
2 |
26 Feb 07 |
jari |
4445 |
CGHPositionGraphViewer posGraphViewer = new CGHPositionGraphViewer(framework, combinedHeader); |
2 |
26 Feb 07 |
jari |
4446 |
posGraphViewer.setPositionGraphModel(posModel); |
2 |
26 Feb 07 |
jari |
4447 |
posGraphViewer.setAnnotationsModel(annotationsModel); |
2 |
26 Feb 07 |
jari |
4448 |
posGraphViewer.setCytoBandsModel(framework.getCytoBandsModel()); |
2 |
26 Feb 07 |
jari |
4449 |
posGraphViewer.setDrsListener((EventListener)manager.getListener()); |
2 |
26 Feb 07 |
jari |
4450 |
String name = CGHUtility.convertChromToLongString(i+1, data.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
4451 |
DefaultMutableTreeNode chromosomeViewerNode = new DefaultMutableTreeNode(new LeafInfo(name, posGraphViewer), false); |
2 |
26 Feb 07 |
jari |
4452 |
chromosomeViews.add(chromosomeViewerNode); |
2 |
26 Feb 07 |
jari |
4453 |
} |
2 |
26 Feb 07 |
jari |
4454 |
Vector viewerNodes = new Vector(2); |
2 |
26 Feb 07 |
jari |
4455 |
viewerNodes.add(experimentViews); |
2 |
26 Feb 07 |
jari |
4456 |
viewerNodes.add(chromosomeViews); |
2 |
26 Feb 07 |
jari |
//fireExperimentsLoaded(new EventObject(viewerNodes)); |
2 |
26 Feb 07 |
jari |
//onExperimentsLoaded(new EventObject(viewerNodes)); |
2 |
26 Feb 07 |
jari |
4459 |
return viewerNodes; |
2 |
26 Feb 07 |
jari |
4460 |
} |
2 |
26 Feb 07 |
jari |
4461 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* IDataRegionSelection function impl for CGH view |
2 |
26 Feb 07 |
jari |
* Imported from MevCtl class |
2 |
26 Feb 07 |
jari |
* Shows a dialog displaying all of the data values in a data region |
2 |
26 Feb 07 |
jari |
* @param eventObj contains the CGHDataRegionInfo object specifying the region for which |
2 |
26 Feb 07 |
jari |
* to display the data values |
2 |
26 Feb 07 |
jari |
4468 |
*/ |
2 |
26 Feb 07 |
jari |
4469 |
public void DisplayDataValues(EventObject eventObj) { |
2 |
26 Feb 07 |
jari |
4470 |
CGHDataRegionInfo dataRegionInfo = (CGHDataRegionInfo)eventObj.getSource(); |
2 |
26 Feb 07 |
jari |
4471 |
CGHDataValuesDisplay display = new CGHDataValuesDisplay(framework.getFrame(), true); |
2 |
26 Feb 07 |
jari |
4472 |
display.setData(data); |
2 |
26 Feb 07 |
jari |
4473 |
display.setDataRegionInfo(dataRegionInfo); |
2 |
26 Feb 07 |
jari |
4474 |
display.createTextDocument(); |
2 |
26 Feb 07 |
jari |
4475 |
display.show(); |
2 |
26 Feb 07 |
jari |
4476 |
} |
2 |
26 Feb 07 |
jari |
4477 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Finds a Gene in RefGene DB and displays in how many samy samples its |
2 |
26 Feb 07 |
jari |
* copy number has altered. |
2 |
26 Feb 07 |
jari |
4481 |
*/ |
2 |
26 Feb 07 |
jari |
4482 |
public void searchForGene(){ |
2 |
26 Feb 07 |
jari |
4483 |
String geneName = (String)JOptionPane.showInputDialog(framework.getFrame(), "", "Enter Gene Name", JOptionPane.PLAIN_MESSAGE); |
2 |
26 Feb 07 |
jari |
4484 |
if(geneName == null || geneName.length() == 0){ |
2 |
26 Feb 07 |
jari |
4485 |
return; |
2 |
26 Feb 07 |
jari |
4486 |
} |
2 |
26 Feb 07 |
jari |
4487 |
GeneDataSet geneDataSet = new GeneDataSet(); |
2 |
26 Feb 07 |
jari |
4488 |
geneDataSet.loadGeneDataByGeneName(geneName, data.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
4489 |
Vector vecGeneData = geneDataSet.getGeneData(); |
2 |
26 Feb 07 |
jari |
4490 |
showGeneDataDlg(vecGeneData); |
2 |
26 Feb 07 |
jari |
4491 |
} |
2 |
26 Feb 07 |
jari |
4492 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* IDataRegionSelection function impl for CGH view |
2 |
26 Feb 07 |
jari |
* Imported from MevCtl class |
2 |
26 Feb 07 |
jari |
* Displays the genes in a data region |
2 |
26 Feb 07 |
jari |
* @param eventObj contains the CGHDataRegionInfo object specifying the region for which |
2 |
26 Feb 07 |
jari |
* to display the genes |
2 |
26 Feb 07 |
jari |
4499 |
*/ |
2 |
26 Feb 07 |
jari |
4500 |
public void ShowGenes(EventObject eventObj) { |
2 |
26 Feb 07 |
jari |
//Raktim |
2 |
26 Feb 07 |
jari |
4502 |
System.out.println("Show Genes in Region"); |
2 |
26 Feb 07 |
jari |
4503 |
CGHDataRegionInfo dataRegionInfo = (CGHDataRegionInfo)eventObj.getSource(); |
2 |
26 Feb 07 |
jari |
4504 |
ICGHDataRegion dataRegion = dataRegionInfo.getDataRegion(); |
2 |
26 Feb 07 |
jari |
4505 |
DataRegionGeneData geneDataSet = new DataRegionGeneData(dataRegion); |
2 |
26 Feb 07 |
jari |
4506 |
geneDataSet.loadGeneData(data.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
4507 |
Vector vecGeneData = geneDataSet.getGeneData(); |
2 |
26 Feb 07 |
jari |
//Raktim |
2 |
26 Feb 07 |
jari |
//System.out.println("Vector vecGeneData size: " + vecGeneData.size()); |
2 |
26 Feb 07 |
jari |
4510 |
showGeneDataDlg(vecGeneData); |
2 |
26 Feb 07 |
jari |
4511 |
} |
2 |
26 Feb 07 |
jari |
4512 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Helper for above |
2 |
26 Feb 07 |
jari |
* @param vecGeneData |
2 |
26 Feb 07 |
jari |
4516 |
*/ |
2 |
26 Feb 07 |
jari |
4517 |
private void showGeneDataDlg(Vector vecGeneData){ |
2 |
26 Feb 07 |
jari |
4518 |
GeneAmplifications amps = new GeneAmplifications(framework); |
2 |
26 Feb 07 |
jari |
4519 |
amps.setData(data); |
2 |
26 Feb 07 |
jari |
4520 |
GeneDeletions dels = new GeneDeletions(framework); |
2 |
26 Feb 07 |
jari |
4521 |
dels.setData(data); |
2 |
26 Feb 07 |
jari |
4522 |
Iterator it = vecGeneData.iterator(); |
2 |
26 Feb 07 |
jari |
4523 |
Vector alterationRegions = new Vector(); |
2 |
26 Feb 07 |
jari |
4524 |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
4525 |
AlterationRegion alterationRegion = new AlterationRegion(); |
2 |
26 Feb 07 |
jari |
4526 |
ICGHDataRegion dataRegion = (ICGHDataRegion)it.next(); |
2 |
26 Feb 07 |
jari |
4527 |
alterationRegion.setDataRegion(dataRegion); |
2 |
26 Feb 07 |
jari |
4528 |
alterationRegion.setNumDeletions(dels.getNumAlterations(dataRegion)); |
2 |
26 Feb 07 |
jari |
4529 |
alterationRegion.setNumAmplifications(amps.getNumAlterations(dataRegion)); |
2 |
26 Feb 07 |
jari |
4530 |
alterationRegion.setNumSamples(data.getFeaturesCount()); |
2 |
26 Feb 07 |
jari |
4531 |
alterationRegions.add(alterationRegion); |
2 |
26 Feb 07 |
jari |
4532 |
} |
2 |
26 Feb 07 |
jari |
4533 |
NumberOfDeletionsAmpilficationsDataModel dataModel = new NumberOfDeletionsAmpilficationsDataModel(); |
2 |
26 Feb 07 |
jari |
4534 |
dataModel.setAlterationRegions((AlterationRegion[])alterationRegions.toArray(new AlterationRegion[(alterationRegions.size())])); |
2 |
26 Feb 07 |
jari |
4535 |
NumberOfAlterationsViewer viewer = new NumberOfAlterationsViewer(); |
2 |
26 Feb 07 |
jari |
4536 |
viewer.setData(data); |
2 |
26 Feb 07 |
jari |
4537 |
viewer.addDrsListener((EventListener)manager.getListener()); |
2 |
26 Feb 07 |
jari |
4538 |
viewer.setDataModel(dataModel); |
2 |
26 Feb 07 |
jari |
4539 |
JDialog dlg = new JDialog(framework.getFrame(), "Gene Alterations"); |
2 |
26 Feb 07 |
jari |
4540 |
dlg.getContentPane().add(viewer); |
2 |
26 Feb 07 |
jari |
4541 |
dlg.setJMenuBar((JMenuBar)viewer.getHeaderComponent()); |
2 |
26 Feb 07 |
jari |
4542 |
dlg.setSize(1000, 500); |
2 |
26 Feb 07 |
jari |
4543 |
GuiUtil.center(dlg); |
2 |
26 Feb 07 |
jari |
4544 |
dlg.show(); |
2 |
26 Feb 07 |
jari |
4545 |
} |
2 |
26 Feb 07 |
jari |
4546 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* IDataRegionSelection function impl for CGH view |
2 |
26 Feb 07 |
jari |
* Imported from MevCtl class |
2 |
26 Feb 07 |
jari |
* Launches the CGH Browser |
2 |
26 Feb 07 |
jari |
* @param eventObj contains the CGHDataRegionInfo object specifying |
2 |
26 Feb 07 |
jari |
* the region to be displayed and highlighted on the browser |
2 |
26 Feb 07 |
jari |
4553 |
*/ |
2 |
26 Feb 07 |
jari |
4554 |
public void ShowBrowser(EventObject eventObj) { |
2 |
26 Feb 07 |
jari |
4555 |
CGHDataRegionInfo dataRegionInfo = (CGHDataRegionInfo)eventObj.getSource(); |
2 |
26 Feb 07 |
jari |
4556 |
int experimentIndex = dataRegionInfo.getExperimentIndex(); |
2 |
26 Feb 07 |
jari |
4557 |
ICGHDataRegion dataRegion = dataRegionInfo.getDataRegion(); |
2 |
26 Feb 07 |
jari |
4558 |
int chromosomeIndex = dataRegion.getChromosomeIndex(); |
2 |
26 Feb 07 |
jari |
4559 |
CGHChartDataModel chartModel; |
2 |
26 Feb 07 |
jari |
4560 |
CGHTableDataModel tableModel; |
2 |
26 Feb 07 |
jari |
4561 |
int browserCloneValues; |
2 |
26 Feb 07 |
jari |
4562 |
if(data.isHasDyeSwap()){ |
2 |
26 Feb 07 |
jari |
4563 |
chartModel = new CGHChartDataModelDyeSwap(/*fcd,*/ framework, experimentIndex, chromosomeIndex); |
2 |
26 Feb 07 |
jari |
4564 |
tableModel = new CGHTableDataModelDyeSwap(/*fcd,*/ framework, experimentIndex, chromosomeIndex); |
2 |
26 Feb 07 |
jari |
4565 |
browserCloneValues = TMEV.browserDefaultDyeSwapValue; |
2 |
26 Feb 07 |
jari |
4566 |
}else{ |
2 |
26 Feb 07 |
jari |
4567 |
chartModel = new CGHChartDataModelNoDyeSwap(/*fcd,*/ framework, experimentIndex, chromosomeIndex); |
2 |
26 Feb 07 |
jari |
4568 |
tableModel = new CGHTableDataModelNoDyeSwap(/*fcd,*/ framework, experimentIndex, chromosomeIndex); |
2 |
26 Feb 07 |
jari |
4569 |
browserCloneValues = TMEV.browserDefaultNoDyeSwapValue; |
2 |
26 Feb 07 |
jari |
4570 |
} |
2 |
26 Feb 07 |
jari |
4571 |
CGHBrowser browser = new CGHBrowser(data, experimentIndex, chromosomeIndex, chartModel, tableModel, browserCloneValues, data.isHasDyeSwap()); |
2 |
26 Feb 07 |
jari |
4572 |
browser.show(); |
2 |
26 Feb 07 |
jari |
4573 |
browser.setSelectedRegion(dataRegion); |
2 |
26 Feb 07 |
jari |
4574 |
} |
2 |
26 Feb 07 |
jari |
4575 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* IDataRegionSelection function impl for CGH view |
2 |
26 Feb 07 |
jari |
* Imported from MevCtl class |
2 |
26 Feb 07 |
jari |
* @param eventObj |
2 |
26 Feb 07 |
jari |
4580 |
*/ |
2 |
26 Feb 07 |
jari |
4581 |
public void AnnotationsSelected(EventObject eventObj) { |
2 |
26 Feb 07 |
jari |
4582 |
ICGHDataRegion[][] annotationRegions = (ICGHDataRegion[][])eventObj.getSource(); |
2 |
26 Feb 07 |
jari |
4583 |
int chromIndex = getMinChromosomeIndex(annotationRegions); |
2 |
26 Feb 07 |
jari |
4584 |
if(chromIndex != -1){ |
2 |
26 Feb 07 |
jari |
4585 |
fireChromosomeSelected(new EventObject(new Integer(chromIndex))); |
2 |
26 Feb 07 |
jari |
4586 |
} |
2 |
26 Feb 07 |
jari |
4587 |
} |
2 |
26 Feb 07 |
jari |
4588 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* @param annotationRegions |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
4592 |
*/ |
2 |
26 Feb 07 |
jari |
4593 |
public int getMinChromosomeIndex(ICGHDataRegion[][] annotationRegions){ |
2 |
26 Feb 07 |
jari |
4594 |
for(int i = 0; i < annotationRegions.length; i++){ |
2 |
26 Feb 07 |
jari |
4595 |
if(annotationRegions[i].length > 0){ |
2 |
26 Feb 07 |
jari |
4596 |
return i; |
2 |
26 Feb 07 |
jari |
4597 |
} |
2 |
26 Feb 07 |
jari |
4598 |
} |
2 |
26 Feb 07 |
jari |
4599 |
return -1; |
2 |
26 Feb 07 |
jari |
4600 |
} |
2 |
26 Feb 07 |
jari |
4601 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* @param eventObject |
2 |
26 Feb 07 |
jari |
4604 |
*/ |
2 |
26 Feb 07 |
jari |
4605 |
private void fireChromosomeSelected(EventObject eventObject){ |
2 |
26 Feb 07 |
jari |
4606 |
/* |
2 |
26 Feb 07 |
jari |
Iterator it = cghArrayViewerListeners.iterator(); |
2 |
26 Feb 07 |
jari |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
((ICGHListener)it.next()).onChromosomeSelected(eventObject); |
2 |
26 Feb 07 |
jari |
4610 |
} |
2 |
26 Feb 07 |
jari |
4611 |
*/ |
2 |
26 Feb 07 |
jari |
4612 |
this.onChromosomeSelected(eventObject); |
2 |
26 Feb 07 |
jari |
4613 |
} |
2 |
26 Feb 07 |
jari |
4614 |
/** |
2 |
26 Feb 07 |
jari |
* ICGHListenr Impl |
2 |
26 Feb 07 |
jari |
* Raktim CGH |
2 |
26 Feb 07 |
jari |
4617 |
*/ |
2 |
26 Feb 07 |
jari |
4618 |
/** |
2 |
26 Feb 07 |
jari |
* Not needed moved to onExperimentsLoaded(...) |
2 |
26 Feb 07 |
jari |
public void onExperimentsInitialized(java.util.EventObject eventObj){ |
2 |
26 Feb 07 |
jari |
//initialize the clone values menu after the experiments have been loaded in order to |
2 |
26 Feb 07 |
jari |
//create different menus based on the type of experiment that has been loaded. For now, |
2 |
26 Feb 07 |
jari |
//just dye swap or non dye swap experiments |
2 |
26 Feb 07 |
jari |
menubar.initCloneValuesMenu(data.isHasDyeSwap()); |
2 |
26 Feb 07 |
jari |
4625 |
} |
2 |
26 Feb 07 |
jari |
4626 |
*/ |
2 |
26 Feb 07 |
jari |
4627 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* ICGHListner Impl |
2 |
26 Feb 07 |
jari |
* Notifies viewer that experiments have been loaded |
2 |
26 Feb 07 |
jari |
* Called from MAV.fireDataLoaded |
2 |
26 Feb 07 |
jari |
* @param eventObj |
2 |
26 Feb 07 |
jari |
4633 |
*/ |
2 |
26 Feb 07 |
jari |
4634 |
public void ExperimentsLoaded(){ |
2 |
26 Feb 07 |
jari |
//initialize the clone values menu after the experiments have been loaded in order to |
2 |
26 Feb 07 |
jari |
//create different menus based on the type of experiment that has been loaded. Moved |
2 |
26 Feb 07 |
jari |
//from onExperimentsInitialized(java.util.EventObject eventObj) to here |
2 |
26 Feb 07 |
jari |
4638 |
menubar.initCloneValuesMenu(data.isHasDyeSwap()); |
2 |
26 Feb 07 |
jari |
4639 |
menubar.enableCloneDistributions(data.hasCloneDistribution(), data.isLog2Data()); |
2 |
26 Feb 07 |
jari |
4640 |
ICGHCloneValueMenu menu = framework.getCghCloneValueMenu(); |
2 |
26 Feb 07 |
jari |
//Remember to replace with data.isHasDyeSwap() |
2 |
26 Feb 07 |
jari |
//data.setHasDyeSwap(TMEV.hasDyeSwap); |
2 |
26 Feb 07 |
jari |
//data.setCGHCopyNumberCalculator(); |
2 |
26 Feb 07 |
jari |
4644 |
data.onCopyDeterminationChanged(menu); |
2 |
26 Feb 07 |
jari |
//initializeViews() creates Chr & Circle viewers |
2 |
26 Feb 07 |
jari |
//Vector viewerNodes = (Vector)eventObj.getSource(); |
2 |
26 Feb 07 |
jari |
4647 |
Vector viewerNodes = initializeViews(); |
2 |
26 Feb 07 |
jari |
//Delete existing nodes from the main view |
2 |
26 Feb 07 |
jari |
//removeChildren(mainViewNode); |
2 |
26 Feb 07 |
jari |
4650 |
removeChildren(mainViewerNode); |
2 |
26 Feb 07 |
jari |
/* Raktim Removed for Sate Saving 4/24 */ |
2 |
26 Feb 07 |
jari |
//removeChildren(analysisNode); |
2 |
26 Feb 07 |
jari |
4653 |
Iterator it = viewerNodes.iterator(); |
2 |
26 Feb 07 |
jari |
4654 |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
4655 |
addDataView((DefaultMutableTreeNode)it.next()); |
2 |
26 Feb 07 |
jari |
4656 |
} |
2 |
26 Feb 07 |
jari |
4657 |
tree.repaint(); |
2 |
26 Feb 07 |
jari |
//systemEnable(TMEV.DATA_AVAILABLE); |
2 |
26 Feb 07 |
jari |
4659 |
} |
2 |
26 Feb 07 |
jari |
4660 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH Cytobands |
2 |
26 Feb 07 |
jari |
4663 |
*/ |
2 |
26 Feb 07 |
jari |
4664 |
private void loadCytoBandFile(){ |
2 |
26 Feb 07 |
jari |
4665 |
CytoBands cytoBands = new CytoBands(); |
2 |
26 Feb 07 |
jari |
4666 |
File cytoBandsFile = null; |
2 |
26 Feb 07 |
jari |
4667 |
if (data.getCGHSpecies() == TMEV.CGH_SPECIES_HS) |
2 |
26 Feb 07 |
jari |
4668 |
cytoBandsFile = new File("data/CGH/Hs_CytoBands.txt"); |
2 |
26 Feb 07 |
jari |
4669 |
else if (data.getCGHSpecies() == TMEV.CGH_SPECIES_MM) |
2 |
26 Feb 07 |
jari |
4670 |
cytoBandsFile = new File("data/CGH/Mm_CytoBands.txt"); |
2 |
26 Feb 07 |
jari |
4671 |
cytoBands.loadAllCytoBands(cytoBandsFile, data.getCGHSpecies()); |
2 |
26 Feb 07 |
jari |
4672 |
cytoBandsModel = new CytoBandsModel(cytoBands); |
2 |
26 Feb 07 |
jari |
4673 |
} |
2 |
26 Feb 07 |
jari |
4674 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Remove a node from View |
2 |
26 Feb 07 |
jari |
4677 |
*/ |
2 |
26 Feb 07 |
jari |
4678 |
protected void removeChildren(DefaultMutableTreeNode removeNode){ |
2 |
26 Feb 07 |
jari |
4679 |
while(removeNode.getChildCount() > 0){ |
2 |
26 Feb 07 |
jari |
4680 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)removeNode.getFirstChild(); |
2 |
26 Feb 07 |
jari |
4681 |
if (node == null || node.getParent() == null) { |
2 |
26 Feb 07 |
jari |
4682 |
return; |
2 |
26 Feb 07 |
jari |
4683 |
} |
2 |
26 Feb 07 |
jari |
4684 |
fireOnCloseEvent(node); |
2 |
26 Feb 07 |
jari |
4685 |
TreePath parentPath = new TreePath(((DefaultMutableTreeNode)node.getParent()).getPath()); |
2 |
26 Feb 07 |
jari |
4686 |
((DefaultTreeModel)tree.getModel()).removeNodeFromParent(node); |
2 |
26 Feb 07 |
jari |
4687 |
((TreeSelectionModel)tree.getSelectionModel()).setSelectionPath(parentPath); |
2 |
26 Feb 07 |
jari |
4688 |
tree.scrollPathToVisible(parentPath); |
2 |
26 Feb 07 |
jari |
4689 |
} |
2 |
26 Feb 07 |
jari |
4690 |
} |
2 |
26 Feb 07 |
jari |
/* End CGH Functions*/ |
2 |
26 Feb 07 |
jari |
4692 |
/** |
2 |
26 Feb 07 |
jari |
* Initializes the SessionMetaData object associated with this MultipleArrayViewer. |
2 |
26 Feb 07 |
jari |
* This object stores session-specific metadata, such as the current jvm version, |
2 |
26 Feb 07 |
jari |
* current MeV version, and other important items. This class is used in state-saving |
2 |
26 Feb 07 |
jari |
* for version compatability purposes. |
2 |
26 Feb 07 |
jari |
* EH |
2 |
26 Feb 07 |
jari |
4698 |
*/ |
2 |
26 Feb 07 |
jari |
4699 |
private void initSessionMetaData(){ |
2 |
26 Feb 07 |
jari |
4700 |
smd = new SessionMetaData(); |
2 |
26 Feb 07 |
jari |
4701 |
smd.setSaveDate(new Date()); |
2 |
26 Feb 07 |
jari |
4702 |
smd.setJREVersion(System.getProperty("java.version")); |
2 |
26 Feb 07 |
jari |
4703 |
smd.setJVMVersion(System.getProperty("java.vm.version")); |
2 |
26 Feb 07 |
jari |
4704 |
smd.setMevMajorVersion(4); |
2 |
26 Feb 07 |
jari |
4705 |
smd.setMevMinorVersion(0); |
2 |
26 Feb 07 |
jari |
4706 |
smd.setMevMicroVersion(01); |
2 |
26 Feb 07 |
jari |
4707 |
smd.setBeta(false); |
2 |
26 Feb 07 |
jari |
4708 |
} |
2 |
26 Feb 07 |
jari |
4709 |
|
2 |
26 Feb 07 |
jari |
4710 |
|
2 |
26 Feb 07 |
jari |
4711 |
/** |
2 |
26 Feb 07 |
jari |
* The listener to listen to mouse, action, tree, keyboard and window events. |
2 |
26 Feb 07 |
jari |
4713 |
*/ |
2 |
26 Feb 07 |
jari |
4714 |
private class EventListener extends MouseAdapter implements ActionListener, TreeSelectionListener, KeyListener, WindowListener, java.io.Serializable, IDataRegionSelectionListener, ICGHListener { |
2 |
26 Feb 07 |
jari |
4715 |
|
2 |
26 Feb 07 |
jari |
4716 |
public void actionPerformed(ActionEvent event) { |
2 |
26 Feb 07 |
jari |
4717 |
String command = event.getActionCommand(); |
2 |
26 Feb 07 |
jari |
4718 |
if (command.equals(ActionManager.CLOSE_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4719 |
onClose(); |
2 |
26 Feb 07 |
jari |
4720 |
} else if (command.equals(ActionManager.NEW_MAV_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4721 |
onNewMultipleArrayViewer(); |
2 |
26 Feb 07 |
jari |
4722 |
} else if (command.equals(ActionManager.LOAD_FILE_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4723 |
onLoadFile(); |
2 |
26 Feb 07 |
jari |
4724 |
} else if (command.equals(ActionManager.LOAD_EXPRESSION_COMMAND)) { |
2 |
26 Feb 07 |
jari |
//onLoadExpressionFile(); |
2 |
26 Feb 07 |
jari |
4726 |
} else if (command.equals(ActionManager.LOAD_DIRECTORY_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4727 |
onLoadDirectory(); |
2 |
26 Feb 07 |
jari |
4728 |
} else if (command.equals(ActionManager.LOAD_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4729 |
loadData(); |
2 |
26 Feb 07 |
jari |
4730 |
}else if (command.equals(ActionManager.LOAD_CLUSTER_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4731 |
onLoadCluster(); |
2 |
26 Feb 07 |
jari |
4732 |
} else if (command.equals(ActionManager.LOAD_STANFORD_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4733 |
onLoadStanford(); |
2 |
26 Feb 07 |
jari |
4734 |
} else if (command.equals(ActionManager.LOAD_DB_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4735 |
onLoadDatabase(); |
2 |
26 Feb 07 |
jari |
4736 |
} else if(command.equals(ActionManager.TOGGLE_ABBR_EXPT_NAMES_CMD)) { |
2 |
26 Feb 07 |
jari |
4737 |
data.toggleExptNameLength(); |
2 |
26 Feb 07 |
jari |
4738 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
4739 |
fireMenuChanged(); |
2 |
26 Feb 07 |
jari |
4740 |
fireHeaderChanged(); |
2 |
26 Feb 07 |
jari |
4741 |
doViewLayout(); |
2 |
26 Feb 07 |
jari |
4742 |
} else if (command.equals(ActionManager.DISPLAY_LABEL_CMD)) { |
2 |
26 Feb 07 |
jari |
4743 |
onLabelChanged((Action)event.getSource()); |
2 |
26 Feb 07 |
jari |
4744 |
} else if (command.equals(ActionManager.DISPLAY_EXPERIMENT_LABEL_CMD)) { |
2 |
26 Feb 07 |
jari |
4745 |
onExperimentLabelChanged((Action)event.getSource()); |
2 |
26 Feb 07 |
jari |
4746 |
} else if (command.equals(ActionManager.ADD_NEW_EXPERIMENT_LABEL_CMD)) { |
2 |
26 Feb 07 |
jari |
4747 |
onExperimentLabelAdded(); |
2 |
26 Feb 07 |
jari |
4748 |
} else if (command.equals(ActionManager.DISPLAY_10X10_CMD)) { |
2 |
26 Feb 07 |
jari |
4749 |
onElementSizeChanged(10, 10); |
2 |
26 Feb 07 |
jari |
4750 |
} else if (command.equals(ActionManager.DISPLAY_20X5_CMD)) { |
2 |
26 Feb 07 |
jari |
4751 |
onElementSizeChanged(20, 5); |
2 |
26 Feb 07 |
jari |
4752 |
} else if (command.equals(ActionManager.DISPLAY_50X10_CMD)) { |
2 |
26 Feb 07 |
jari |
4753 |
onElementSizeChanged(50, 10); |
2 |
26 Feb 07 |
jari |
4754 |
} else if (command.equals(ActionManager.DISPLAY_5X2_CMD)) { |
2 |
26 Feb 07 |
jari |
4755 |
onElementSizeChanged( 5, 2); |
2 |
26 Feb 07 |
jari |
4756 |
} else if (command.equals(ActionManager.DISPLAY_OTHER_CMD)) { |
2 |
26 Feb 07 |
jari |
4757 |
onElementSizeChanged(); |
2 |
26 Feb 07 |
jari |
4758 |
} else if (command.equals(ActionManager.GREEN_RED_COLOR_SCHEME_CMD)){ |
2 |
26 Feb 07 |
jari |
4759 |
onColorSchemeChange(IDisplayMenu.GREEN_RED_SCHEME); |
2 |
26 Feb 07 |
jari |
4760 |
} else if (command.equals(ActionManager.BLUE_YELLOW_COLOR_SCHEME_CMD)){ |
2 |
26 Feb 07 |
jari |
4761 |
onColorSchemeChange(IDisplayMenu.BLUE_YELLOW_SCHEME); |
2 |
26 Feb 07 |
jari |
4762 |
} else if (command.equals(ActionManager.RAINBOW_COLOR_SCHEME_CMD)){ |
2 |
26 Feb 07 |
jari |
4763 |
onColorSchemeChange(IDisplayMenu.RAINBOW_COLOR_SCHEME); |
2 |
26 Feb 07 |
jari |
4764 |
} else if (command.equals(ActionManager.CUSTOM_COLOR_SCHEME_CMD)){ |
2 |
26 Feb 07 |
jari |
4765 |
onColorSchemeChange(IDisplayMenu.CUSTOM_COLOR_SCHEME); |
2 |
26 Feb 07 |
jari |
4766 |
} else if (command.equals(ActionManager.COLOR_GRADIENT_CMD)){ |
2 |
26 Feb 07 |
jari |
4767 |
onColorGradientChange(((javax.swing.JCheckBoxMenuItem)(event.getSource())).isSelected()); |
2 |
26 Feb 07 |
jari |
4768 |
} else if (command.equals(ActionManager.DISPLAY_DRAW_BORDERS_CMD)) { |
2 |
26 Feb 07 |
jari |
4769 |
onDrawBorders(); |
2 |
26 Feb 07 |
jari |
4770 |
} else if (command.equals(ActionManager.SYSTEM_INFO_CMD)) { |
2 |
26 Feb 07 |
jari |
4771 |
onSystemInfo(); |
2 |
26 Feb 07 |
jari |
4772 |
} else if (command.equals(ActionManager.DEFAULT_DISTANCES_CMD)) { |
2 |
26 Feb 07 |
jari |
4773 |
onDefaultDistance(); |
2 |
26 Feb 07 |
jari |
4774 |
} else if (command.equals(ActionManager.TOTAL_INTENSITY_CMD)) { |
2 |
26 Feb 07 |
jari |
4775 |
onNormalize(ISlideData.TOTAL_INTENSITY); |
2 |
26 Feb 07 |
jari |
4776 |
} else if (command.equals(ActionManager.LINEAR_REGRESSION_CMD)) { |
2 |
26 Feb 07 |
jari |
4777 |
onNormalize(ISlideData.LINEAR_REGRESSION); |
2 |
26 Feb 07 |
jari |
4778 |
} else if (command.equals(ActionManager.RATIO_STATISTICS_CMD)) { |
2 |
26 Feb 07 |
jari |
4779 |
onNormalize(ISlideData.RATIO_STATISTICS_99); |
2 |
26 Feb 07 |
jari |
4780 |
} else if (command.equals(ActionManager.ITERATIVE_LOG_CMD)) { |
2 |
26 Feb 07 |
jari |
4781 |
onNormalize(ISlideData.ITERATIVE_LOG); |
2 |
26 Feb 07 |
jari |
4782 |
} else if (command.equals(ActionManager.TOTAL_INTENSITY_LIST_CMD)) { |
2 |
26 Feb 07 |
jari |
4783 |
onNormalizeList(ISlideData.TOTAL_INTENSITY_LIST); |
2 |
26 Feb 07 |
jari |
4784 |
} else if (command.equals(ActionManager.LINEAR_REGRESSION_LIST_CMD)) { |
2 |
26 Feb 07 |
jari |
4785 |
onNormalizeList(ISlideData.LINEAR_REGRESSION_LIST); |
2 |
26 Feb 07 |
jari |
4786 |
} else if (command.equals(ActionManager.RATIO_STATISTICS_LIST_CMD )) { |
2 |
26 Feb 07 |
jari |
4787 |
onNormalizeList(ISlideData.RATIO_STATISTICS_99_LIST); |
2 |
26 Feb 07 |
jari |
4788 |
} else if (command.equals(ActionManager.ITERATIVE_LOG_LIST_CMD)) { |
2 |
26 Feb 07 |
jari |
4789 |
onNormalizeList(ISlideData.ITERATIVE_LOG_LIST); |
2 |
26 Feb 07 |
jari |
4790 |
} else if (command.equals(ActionManager.NO_NORMALIZATION_CMD)) { |
2 |
26 Feb 07 |
jari |
4791 |
onNormalize(ISlideData.NO_NORMALIZATION); |
2 |
26 Feb 07 |
jari |
4792 |
} else if (command.equals(ActionManager.SAVE_IMAGE_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4793 |
onSaveImage(); |
2 |
26 Feb 07 |
jari |
4794 |
} else if (command.equals(ActionManager.PRINT_IMAGE_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4795 |
onPrintImage(); |
2 |
26 Feb 07 |
jari |
4796 |
} else if (command.equals(ActionManager.ANALYSIS_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4797 |
onAnalysis((Action)event.getSource()); |
2 |
26 Feb 07 |
jari |
4798 |
} else if (command.equals(ActionManager.DEFAULT_DISTANCE_CMD)) { |
2 |
26 Feb 07 |
jari |
4799 |
menubar.setDistanceFunction(Algorithm.DEFAULT); |
2 |
26 Feb 07 |
jari |
4800 |
} else if (command.equals(ActionManager.PEARSON_CORRELATION_CMD)) { |
2 |
26 Feb 07 |
jari |
4801 |
menubar.setDistanceFunction(Algorithm.PEARSON); |
2 |
26 Feb 07 |
jari |
4802 |
} else if (command.equals(ActionManager.PEARSON_UNCENTERED_CMD)) { |
2 |
26 Feb 07 |
jari |
4803 |
menubar.setDistanceFunction(Algorithm.PEARSONUNCENTERED); |
2 |
26 Feb 07 |
jari |
4804 |
} else if (command.equals(ActionManager.PEARSON_SQUARED_CMD)) { |
2 |
26 Feb 07 |
jari |
4805 |
menubar.setDistanceFunction(Algorithm.PEARSONSQARED); |
2 |
26 Feb 07 |
jari |
4806 |
} else if (command.equals(ActionManager.COSINE_CORRELATION_CMD)) { |
2 |
26 Feb 07 |
jari |
4807 |
menubar.setDistanceFunction(Algorithm.COSINE); |
2 |
26 Feb 07 |
jari |
4808 |
} else if (command.equals(ActionManager.COVARIANCE_VALUE_CMD)) { |
2 |
26 Feb 07 |
jari |
4809 |
menubar.setDistanceFunction(Algorithm.COVARIANCE); |
2 |
26 Feb 07 |
jari |
4810 |
} else if (command.equals(ActionManager.EUCLIDEAN_DISTANCE_CMD)) { |
2 |
26 Feb 07 |
jari |
4811 |
menubar.setDistanceFunction(Algorithm.EUCLIDEAN); |
2 |
26 Feb 07 |
jari |
4812 |
} else if (command.equals(ActionManager.AVERAGE_DOT_PRODUCT_CMD)) { |
2 |
26 Feb 07 |
jari |
4813 |
menubar.setDistanceFunction(Algorithm.DOTPRODUCT); |
2 |
26 Feb 07 |
jari |
4814 |
} else if (command.equals(ActionManager.MANHATTAN_DISTANCE_CMD)) { |
2 |
26 Feb 07 |
jari |
4815 |
menubar.setDistanceFunction(Algorithm.MANHATTAN); |
2 |
26 Feb 07 |
jari |
4816 |
} else if (command.equals(ActionManager.MUTUAL_INFORMATION_CMD)) { |
2 |
26 Feb 07 |
jari |
4817 |
menubar.setDistanceFunction(Algorithm.MUTUALINFORMATION); |
2 |
26 Feb 07 |
jari |
4818 |
} else if (command.equals(ActionManager.SPEARMAN_RANK_CORRELATION_CMD)) { |
2 |
26 Feb 07 |
jari |
4819 |
menubar.setDistanceFunction(Algorithm.SPEARMANRANK); |
2 |
26 Feb 07 |
jari |
4820 |
} else if (command.equals(ActionManager.KENDALLS_TAU_CMD)) { |
2 |
26 Feb 07 |
jari |
4821 |
menubar.setDistanceFunction(Algorithm.KENDALLSTAU); |
2 |
26 Feb 07 |
jari |
4822 |
} else if (command.equals(ActionManager.ABSOLUTE_DISTANCE_CMD)) { |
2 |
26 Feb 07 |
jari |
4823 |
menubar.setDistanceAbsolute(((AbstractButton)event.getSource()).isSelected()); |
2 |
26 Feb 07 |
jari |
4824 |
} else if (command.equals(ActionManager.DELETE_NODE_CMD)) { |
2 |
26 Feb 07 |
jari |
4825 |
onDeleteNode(); |
2 |
26 Feb 07 |
jari |
4826 |
} else if (command.equals(ActionManager.SET_DATA_SOURCE_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4827 |
Object source = event.getSource(); |
2 |
26 Feb 07 |
jari |
4828 |
if(source instanceof JCheckBoxMenuItem) |
2 |
26 Feb 07 |
jari |
4829 |
onSetData(((JCheckBoxMenuItem)event.getSource()).isSelected()); |
2 |
26 Feb 07 |
jari |
4830 |
else |
2 |
26 Feb 07 |
jari |
4831 |
onSetData(true); //reset main view |
2 |
26 Feb 07 |
jari |
4832 |
} else if (command.equals(ActionManager.USE_PERCENTAGE_CUTOFFS_CMD)) { |
2 |
26 Feb 07 |
jari |
4833 |
applyPercentageCutoffs(); |
2 |
26 Feb 07 |
jari |
//add mas5 present call noise filter |
2 |
26 Feb 07 |
jari |
4835 |
}else if(command.equals(ActionManager.USE_PRESENT_CALL_CMD)){ |
2 |
26 Feb 07 |
jari |
4836 |
applyPresentCallFilter(); |
2 |
26 Feb 07 |
jari |
4837 |
}else if(command.equals(ActionManager.USE_GENEPIXFLAGS_CMD)){ |
2 |
26 Feb 07 |
jari |
4838 |
applyGenePixFlagsFilter(); |
2 |
26 Feb 07 |
jari |
4839 |
}else if(command.equals(ActionManager.USE_GCOS_PERCENTAGE_CUTOFF_CMD)){ |
2 |
26 Feb 07 |
jari |
4840 |
applyGCOSPercentageFilter(); |
2 |
26 Feb 07 |
jari |
4841 |
}else if(command.equals(ActionManager.USE_PVALUE_CUTOFF_CMD)){ |
2 |
26 Feb 07 |
jari |
4842 |
applyPvaluePercentageFilter(); |
2 |
26 Feb 07 |
jari |
4843 |
} else if (command.equals(ActionManager.USE_LOWER_CUTOFFS_CMD)) { |
2 |
26 Feb 07 |
jari |
4844 |
applyLowerCutoffs(); |
2 |
26 Feb 07 |
jari |
4845 |
} else if (command.equals(ActionManager.USE_VARIANCE_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
4846 |
applyVarianceFilter(); |
2 |
26 Feb 07 |
jari |
4847 |
} else if (command.equals(ActionManager.IMPORT_GENE_LIST_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4848 |
onImportList(Cluster.GENE_CLUSTER); |
2 |
26 Feb 07 |
jari |
4849 |
} else if (command.equals(ActionManager.IMPORT_SAMPLE_LIST_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4850 |
onImportList(Cluster.EXPERIMENT_CLUSTER); |
2 |
26 Feb 07 |
jari |
4851 |
} else if (command.equals(ActionManager.CDNA_LOW_INTENSITY_CMD)) { |
2 |
26 Feb 07 |
jari |
4852 |
applyLowerCutoffs(); |
2 |
26 Feb 07 |
jari |
4853 |
}else if (command.equals(ActionManager.OLIGEN_LOW_INTENSITY_CMD)) { |
2 |
26 Feb 07 |
jari |
4854 |
applySingleLowerCutoffs(); |
2 |
26 Feb 07 |
jari |
4855 |
} |
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
/*else if (command.equals(ActionManager.SET_DETECTION_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
onSetDetectionFilter(); |
2 |
26 Feb 07 |
jari |
} else if (command.equals(ActionManager.SET_FOLD_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
onSetFoldFilter(); |
2 |
26 Feb 07 |
jari |
} else if (command.equals(ActionManager.USE_DETECTION_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
onUseDetectionFilter( (AbstractButton) event.getSource()); |
2 |
26 Feb 07 |
jari |
} else if (command.equals(ActionManager.USE_FOLD_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
onUseFoldFilter( (AbstractButton) event.getSource()); |
2 |
26 Feb 07 |
jari |
4865 |
} |
2 |
26 Feb 07 |
jari |
4866 |
*/ |
2 |
26 Feb 07 |
jari |
// vu 7.22.05 |
2 |
26 Feb 07 |
jari |
4868 |
else if ( command.equals( ActionManager.RAMA_CMD ) ) { |
2 |
26 Feb 07 |
jari |
4869 |
onRama(); |
2 |
26 Feb 07 |
jari |
4870 |
} else if( command.equals( ActionManager.RAMA_DOC_CMD ) ) { |
2 |
26 Feb 07 |
jari |
4871 |
onRamaDoc(); |
2 |
26 Feb 07 |
jari |
4872 |
} |
2 |
26 Feb 07 |
jari |
4873 |
|
2 |
26 Feb 07 |
jari |
// pcahan |
2 |
26 Feb 07 |
jari |
4875 |
else if (command.equals(ActionManager.SET_DETECTION_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
4876 |
onSetDetectionFilter(); |
2 |
26 Feb 07 |
jari |
4877 |
} else if (command.equals(ActionManager.SET_FOLD_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
4878 |
onSetFoldFilter(); |
2 |
26 Feb 07 |
jari |
4879 |
} else if (command.equals(ActionManager.USE_DETECTION_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
4880 |
onUseDetectionFilter( (AbstractButton) event.getSource()); |
2 |
26 Feb 07 |
jari |
4881 |
} else if (command.equals(ActionManager.USE_FOLD_FILTER_CMD)) { |
2 |
26 Feb 07 |
jari |
4882 |
onUseFoldFilter( (AbstractButton) event.getSource()); |
2 |
26 Feb 07 |
jari |
4883 |
} else if (command.equals(ActionManager.DIVIDE_GENES_MEDIAN_CMD)) { |
2 |
26 Feb 07 |
jari |
4884 |
onDivideGenesMedian(); |
2 |
26 Feb 07 |
jari |
4885 |
} else if (command.equals(ActionManager.DIVIDE_GENES_MEAN_CMD)) { |
2 |
26 Feb 07 |
jari |
4886 |
onDivideGenesMean(); |
2 |
26 Feb 07 |
jari |
4887 |
} else if (command.equals(ActionManager.LOG2_TRANSFORM_CMD)) { |
2 |
26 Feb 07 |
jari |
4888 |
onLog2Transform(); |
2 |
26 Feb 07 |
jari |
4889 |
} else if (command.equals(ActionManager.UNLOG2_TRANSFORM_CMD)) { |
2 |
26 Feb 07 |
jari |
4890 |
onUnLog2Transform(); |
2 |
26 Feb 07 |
jari |
4891 |
} else if (command.equals(ActionManager.NORMALIZE_SPOTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4892 |
onNormalizeSpots(); |
2 |
26 Feb 07 |
jari |
4893 |
} else if (command.equals(ActionManager.DIVIDE_SPOTS_RMS_CMD)) { |
2 |
26 Feb 07 |
jari |
4894 |
onDivideSpotsRMS(); |
2 |
26 Feb 07 |
jari |
4895 |
} else if (command.equals(ActionManager.DIVIDE_SPOTS_SD_CMD)) { |
2 |
26 Feb 07 |
jari |
4896 |
onDivideSpotsSD(); |
2 |
26 Feb 07 |
jari |
4897 |
} else if (command.equals(ActionManager.MEAN_CENTER_SPOTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4898 |
onMeanCenterSpots(); |
2 |
26 Feb 07 |
jari |
4899 |
} else if (command.equals(ActionManager.MEDIAN_CENTER_SPOTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4900 |
onMedianCenterSpots(); |
2 |
26 Feb 07 |
jari |
4901 |
} else if (command.equals(ActionManager.DIGITAL_SPOTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4902 |
onDigitalSpots(); |
2 |
26 Feb 07 |
jari |
4903 |
} else if (command.equals(ActionManager.NORMALIZE_EXPERIMENTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4904 |
onNormalizeExperiments(); |
2 |
26 Feb 07 |
jari |
4905 |
} else if (command.equals(ActionManager.DIVIDE_EXPERIMENTS_RMS_CMD)) { |
2 |
26 Feb 07 |
jari |
4906 |
onDivideExperimentsRMS(); |
2 |
26 Feb 07 |
jari |
4907 |
} else if (command.equals(ActionManager.DIVIDE_EXPERIMENTS_SD_CMD)) { |
2 |
26 Feb 07 |
jari |
4908 |
onDivideExperimentsSD(); |
2 |
26 Feb 07 |
jari |
4909 |
} else if (command.equals(ActionManager.MEAN_CENTER_EXPERIMENTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4910 |
onMeanCenterExperiments(); |
2 |
26 Feb 07 |
jari |
4911 |
} else if (command.equals(ActionManager.MEDIAN_CENTER_EXPERIMENTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4912 |
onMedianCenterExperiments(); |
2 |
26 Feb 07 |
jari |
4913 |
} else if (command.equals(ActionManager.DIGITAL_EXPERIMENTS_CMD)) { |
2 |
26 Feb 07 |
jari |
4914 |
onDigitalExperiments(); |
2 |
26 Feb 07 |
jari |
4915 |
} else if (command.equals(ActionManager.LOG10_TO_LOG2_CMD)) { |
2 |
26 Feb 07 |
jari |
4916 |
onLog10toLog2(); |
2 |
26 Feb 07 |
jari |
4917 |
} else if (command.equals(ActionManager.LOG2_TO_LOG10_CMD)) { |
2 |
26 Feb 07 |
jari |
4918 |
onLog2toLog10(); |
2 |
26 Feb 07 |
jari |
4919 |
} else if (command.equals(ActionManager.ADJUST_INTENSITIES_0_CMD)) { |
2 |
26 Feb 07 |
jari |
4920 |
onAdjustIntensities((AbstractButton)event.getSource()); |
2 |
26 Feb 07 |
jari |
4921 |
} else if (command.equals(ActionManager.SAVE_MATRIX_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4922 |
onSaveMatrix(); |
2 |
26 Feb 07 |
jari |
4923 |
} else if (command.equals(ActionManager.DISPLAY_SET_RATIO_SCALE_CMD)) { |
2 |
26 Feb 07 |
jari |
4924 |
onSetRatioScale(); |
2 |
26 Feb 07 |
jari |
4925 |
} else if (command.equals(ActionManager.DELETE_ALL_EXPERIMENT_CLUSTERS_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4926 |
onDeleteAllExperimentClusters(); |
2 |
26 Feb 07 |
jari |
4927 |
} else if (command.equals(ActionManager.DELETE_ALL_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4928 |
onDeleteAll(); |
2 |
26 Feb 07 |
jari |
4929 |
} else if (command.equals(ActionManager.LOAD_ANALYSIS_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4930 |
loadAnalysis(); |
2 |
26 Feb 07 |
jari |
4931 |
} else if (command.equals(ActionManager.SAVE_ANALYSIS_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4932 |
saveAnalysis(); |
2 |
26 Feb 07 |
jari |
4933 |
} else if (command.equals(ActionManager.SAVE_ANALYSIS_AS_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4934 |
saveAnalysisAs(); |
2 |
26 Feb 07 |
jari |
4935 |
} else if (command.equals(ActionManager.NEW_SCRIPT_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4936 |
onNewScript(); |
2 |
26 Feb 07 |
jari |
4937 |
} else if (command.equals(ActionManager.LOAD_SCRIPT_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4938 |
onLoadScript(); |
2 |
26 Feb 07 |
jari |
4939 |
} else if (command.equals(ActionManager.SEARCH_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4940 |
search(); |
2 |
26 Feb 07 |
jari |
4941 |
} else if (command.equals(ActionManager.APPEND_SAMPLE_ANNOTATION_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4942 |
appendSampleAnnotation(); |
2 |
26 Feb 07 |
jari |
4943 |
} else if (command.equals(ActionManager.APPEND_GENE_ANNOTATION_COMMAND)) { |
2 |
26 Feb 07 |
jari |
4944 |
appendGeneAnnotation(); |
2 |
26 Feb 07 |
jari |
4945 |
} |
2 |
26 Feb 07 |
jari |
4946 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Sept 29, 05 |
2 |
26 Feb 07 |
jari |
* CGH Command Handlers |
2 |
26 Feb 07 |
jari |
4949 |
*/ |
2 |
26 Feb 07 |
jari |
4950 |
else if(command.equals(ActionManager.LOAD_CLONE_DISTRIBUTIONS_FROM_FILE_ACTION)){ |
2 |
26 Feb 07 |
jari |
//ctl.loadCloneDistributionsFromFile(); |
2 |
26 Feb 07 |
jari |
//System.out.println("Called " + ActionManager.LOAD_CLONE_DISTRIBUTIONS_FROM_FILE_ACTION); |
2 |
26 Feb 07 |
jari |
4953 |
JOptionPane.showMessageDialog(null, "Called " + ActionManager.LOAD_CLONE_DISTRIBUTIONS_FROM_FILE_ACTION, "alert", JOptionPane.INFORMATION_MESSAGE); |
2 |
26 Feb 07 |
jari |
4954 |
}else if(command.equals(ActionManager.SHOW_FLANKING_REGIONS)) { |
2 |
26 Feb 07 |
jari |
4955 |
onSetShowFlankingRegions( ((AbstractButton)event.getSource()).isSelected()); |
2 |
26 Feb 07 |
jari |
4956 |
}else if(command.equals(ActionManager.CGH_ELEMENT_LENGTH_5)){ |
2 |
26 Feb 07 |
jari |
4957 |
onChangeCghElementLength(5); |
2 |
26 Feb 07 |
jari |
4958 |
}else if(command.equals(ActionManager.CGH_ELEMENT_LENGTH_10)){ |
2 |
26 Feb 07 |
jari |
4959 |
onChangeCghElementLength(10); |
2 |
26 Feb 07 |
jari |
4960 |
}else if(command.equals(ActionManager.CGH_ELEMENT_LENGTH_20)){ |
2 |
26 Feb 07 |
jari |
4961 |
onChangeCghElementLength(20); |
2 |
26 Feb 07 |
jari |
4962 |
}else if(command.equals(ActionManager.CGH_ELEMENT_LENGTH_50)){ |
2 |
26 Feb 07 |
jari |
4963 |
onChangeCghElementLength(50); |
2 |
26 Feb 07 |
jari |
4964 |
}else if(command.equals(ActionManager.CGH_ELEMENT_LENGTH_100)){ |
2 |
26 Feb 07 |
jari |
4965 |
onChangeCghElementLength(100); |
2 |
26 Feb 07 |
jari |
4966 |
}else if(command.equals(ActionManager.CGH_ELEMENT_LENGTH_OTHER)){ |
2 |
26 Feb 07 |
jari |
4967 |
onChangeCghElementLengthOther(); |
2 |
26 Feb 07 |
jari |
4968 |
}else if(command.equals(ActionManager.CGH_ELEMENT_LENGTH_FIT)){ |
2 |
26 Feb 07 |
jari |
4969 |
onChangeCghElementLength(ICGHDisplayMenu.FIT_SIZE); |
2 |
26 Feb 07 |
jari |
4970 |
}else if(command.equals(ActionManager.CGH_ELEMENT_WIDTH_5)){ |
2 |
26 Feb 07 |
jari |
4971 |
onChangeCghElementWidth(5); |
2 |
26 Feb 07 |
jari |
4972 |
}else if(command.equals(ActionManager.CGH_ELEMENT_WIDTH_10)){ |
2 |
26 Feb 07 |
jari |
4973 |
onChangeCghElementWidth(10); |
2 |
26 Feb 07 |
jari |
4974 |
}else if(command.equals(ActionManager.CGH_ELEMENT_WIDTH_20)){ |
2 |
26 Feb 07 |
jari |
4975 |
onChangeCghElementWidth(20); |
2 |
26 Feb 07 |
jari |
4976 |
}else if(command.equals(ActionManager.CGH_ELEMENT_WIDTH_50)){ |
2 |
26 Feb 07 |
jari |
4977 |
onChangeCghElementWidth(50); |
2 |
26 Feb 07 |
jari |
4978 |
}else if(command.equals(ActionManager.CGH_ELEMENT_WIDTH_100)){ |
2 |
26 Feb 07 |
jari |
4979 |
onChangeCghElementWidth(100); |
2 |
26 Feb 07 |
jari |
4980 |
}else if(command.equals(ActionManager.CGH_ELEMENT_WIDTH_OTHER)){ |
2 |
26 Feb 07 |
jari |
4981 |
onChangeCghElementWidthOther(); |
2 |
26 Feb 07 |
jari |
4982 |
}else if(command.equals(ActionManager.CGH_ELEMENT_WIDTH_FIT)){ |
2 |
26 Feb 07 |
jari |
4983 |
onChangeCghElementWidth((int)ICGHDisplayMenu.FIT_SIZE); |
2 |
26 Feb 07 |
jari |
4984 |
}else if(command.equals(ActionManager.CGH_DISPLAY_TYPE_COMBINED)){ |
2 |
26 Feb 07 |
jari |
4985 |
onChangeCghDisplayType(ICGHDisplayMenu.DISPLAY_TYPE_COMBINED); |
2 |
26 Feb 07 |
jari |
4986 |
}else if(command.equals(ActionManager.CGH_DISPLAY_TYPE_SEPARATED)){ |
2 |
26 Feb 07 |
jari |
4987 |
onChangeCghDisplayType(ICGHDisplayMenu.DISPLAY_TYPE_SEPARATED); |
2 |
26 Feb 07 |
jari |
4988 |
}else if(command.equals(ActionManager.CGH_DISPLAY_ORDER)){ |
2 |
26 Feb 07 |
jari |
4989 |
onChangeCghDisplayOrder(); |
2 |
26 Feb 07 |
jari |
4990 |
}else if(command.equals(ActionManager.CGH_DELETE_SAMPLE)){ |
2 |
26 Feb 07 |
jari |
4991 |
onDeleteSample(); |
2 |
26 Feb 07 |
jari |
4992 |
}else if(command.equals(ActionManager.CGH_DISPLAY_LABEL_WSL_ID)){ |
2 |
26 Feb 07 |
jari |
4993 |
onChangeDisplayLabelType(ICGHDisplayMenu.DISPLAY_WSL_ID); |
2 |
26 Feb 07 |
jari |
4994 |
}else if(command.equals(ActionManager.CGH_DISPLAY_LABEL_ALIAS)){ |
2 |
26 Feb 07 |
jari |
4995 |
onChangeDisplayLabelType(ICGHDisplayMenu.DISPLAY_ALIAS); |
2 |
26 Feb 07 |
jari |
4996 |
}else if(command.equals(ActionManager.CGH_DISPLAY_LABEL_ID1)){ |
2 |
26 Feb 07 |
jari |
4997 |
onChangeDisplayLabelType(ICGHDisplayMenu.DISPLAY_ID1); |
2 |
26 Feb 07 |
jari |
4998 |
}else if(command.equals(ActionManager.CGH_SET_THRESHOLDS)){ |
2 |
26 Feb 07 |
jari |
4999 |
onCghSetThresholds(); |
2 |
26 Feb 07 |
jari |
5000 |
}else if(command.equals(ActionManager.CGH_CLEAR_ANNOTATIONS)){ |
2 |
26 Feb 07 |
jari |
5001 |
onClearAnnotations(); |
2 |
26 Feb 07 |
jari |
5002 |
}else if(command.equals(ActionManager.CGH_ANALYSIS_COMMAND)){ |
2 |
26 Feb 07 |
jari |
5003 |
onCghAnalysis((Action)event.getSource()); |
2 |
26 Feb 07 |
jari |
5004 |
}else if(command.equals(ActionManager.FIND_GENE)){ |
2 |
26 Feb 07 |
jari |
5005 |
searchForGene(); |
2 |
26 Feb 07 |
jari |
5006 |
}else if(command.equals(ActionManager.CIRCLE_VIEWER_BACKGROUND)){ |
2 |
26 Feb 07 |
jari |
5007 |
onSetCircleViewerBackground(); |
2 |
26 Feb 07 |
jari |
5008 |
}else if(command.equals(ActionManager.COMPARE_EXPERIMENTS)){ |
2 |
26 Feb 07 |
jari |
5009 |
}else if(command.equals(ActionManager.CLONE_VALUE_DISCRETE_DETERMINATION)){ |
2 |
26 Feb 07 |
jari |
5010 |
onChangeCloneValueType(ICGHCloneValueMenu.CLONE_VALUE_DISCRETE_DETERMINATION); |
2 |
26 Feb 07 |
jari |
5011 |
}else if(command.equals(ActionManager.CLONE_VALUE_LOG_AVERAGE_INVERTED)){ |
2 |
26 Feb 07 |
jari |
5012 |
onChangeCloneValueType(ICGHCloneValueMenu.CLONE_VALUE_LOG_AVERAGE_INVERTED); |
2 |
26 Feb 07 |
jari |
5013 |
}else if(command.equals(ActionManager.CLONE_VALUE_LOG_CLONE_DISTRIBUTION)){ |
2 |
26 Feb 07 |
jari |
5014 |
onChangeCloneValueType(ICGHCloneValueMenu.CLONE_VALUE_LOG_CLONE_DISTRIBUTION); |
2 |
26 Feb 07 |
jari |
5015 |
}else if(command.equals(ActionManager.CLONE_VALUE_THRESHOLD_OR_CLONE_DISTRIBUTION)){ |
2 |
26 Feb 07 |
jari |
5016 |
onChangeCloneValueType(ICGHCloneValueMenu.CLONE_VALUE_THRESHOLD_OR_CLONE_DISTRIBUTION); |
2 |
26 Feb 07 |
jari |
5017 |
}else if(command.equals(ActionManager.FLANKING_REGIONS_BY_THRESHOLD)){ |
2 |
26 Feb 07 |
jari |
5018 |
onChangeFlankingRegionType(ICGHCloneValueMenu.FLANKING_REGIONS_BY_THRESHOLD); |
2 |
26 Feb 07 |
jari |
5019 |
}else if(command.equals(ActionManager.FLANKING_REGIONS_BY_LOG_CLONE_DISTRIBUTION)){ |
2 |
26 Feb 07 |
jari |
5020 |
onChangeFlankingRegionType(ICGHCloneValueMenu.FLANKING_REGIONS_BY_LOG_CLONE_DISTRIBUTION); |
2 |
26 Feb 07 |
jari |
5021 |
}else if(command.equals(ActionManager.FLANKING_REGIONS_BY_THRESHOLD_OR_CLONE_DISTRIBUTION)){ |
2 |
26 Feb 07 |
jari |
5022 |
onChangeFlankingRegionType(ICGHCloneValueMenu.FLANKING_REGIONS_BY_THRESHOLD_OR_CLONE_DISTRIBUTION); |
2 |
26 Feb 07 |
jari |
5023 |
}else if(command.equals(ActionManager.SHOW_HEADER)){ |
2 |
26 Feb 07 |
jari |
5024 |
onShowHeader( ((AbstractButton)event.getSource()).isSelected()); |
2 |
26 Feb 07 |
jari |
5025 |
}else if(command.equals(ActionManager.CLONE_P_THRESH)){ |
2 |
26 Feb 07 |
jari |
5026 |
onSetClonePThresh(); |
2 |
26 Feb 07 |
jari |
5027 |
}else if (command.equals(ActionManager.RENAME_NODE_CMD)) { |
2 |
26 Feb 07 |
jari |
5028 |
onRenameNode(); |
2 |
26 Feb 07 |
jari |
5029 |
} |
2 |
26 Feb 07 |
jari |
/* End CGH Command Handlers */ |
2 |
26 Feb 07 |
jari |
5031 |
else { |
2 |
26 Feb 07 |
jari |
5032 |
System.out.println("unhandled command = " + command); |
2 |
26 Feb 07 |
jari |
5033 |
} |
2 |
26 Feb 07 |
jari |
5034 |
} |
2 |
26 Feb 07 |
jari |
5035 |
|
2 |
26 Feb 07 |
jari |
5036 |
public void valueChanged(TreeSelectionEvent event) { |
2 |
26 Feb 07 |
jari |
5037 |
onNodeChanged(event); |
2 |
26 Feb 07 |
jari |
5038 |
} |
2 |
26 Feb 07 |
jari |
5039 |
|
2 |
26 Feb 07 |
jari |
5040 |
public void mouseReleased(MouseEvent event) { |
2 |
26 Feb 07 |
jari |
5041 |
maybeShowPopup(event); |
2 |
26 Feb 07 |
jari |
5042 |
} |
2 |
26 Feb 07 |
jari |
5043 |
|
2 |
26 Feb 07 |
jari |
5044 |
public void mousePressed(MouseEvent event) { |
2 |
26 Feb 07 |
jari |
5045 |
maybeShowPopup(event); |
2 |
26 Feb 07 |
jari |
5046 |
} |
2 |
26 Feb 07 |
jari |
5047 |
|
2 |
26 Feb 07 |
jari |
5048 |
/** |
2 |
26 Feb 07 |
jari |
* Shows a popup menu for a selected navigation tree node. |
2 |
26 Feb 07 |
jari |
5050 |
*/ |
2 |
26 Feb 07 |
jari |
5051 |
private void maybeShowPopup(MouseEvent e) { |
2 |
26 Feb 07 |
jari |
5052 |
|
2 |
26 Feb 07 |
jari |
5053 |
if (!e.isPopupTrigger()) { |
2 |
26 Feb 07 |
jari |
5054 |
return; |
2 |
26 Feb 07 |
jari |
5055 |
} |
2 |
26 Feb 07 |
jari |
5056 |
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); |
2 |
26 Feb 07 |
jari |
5057 |
if (selPath == null) { |
2 |
26 Feb 07 |
jari |
5058 |
return; |
2 |
26 Feb 07 |
jari |
5059 |
} |
2 |
26 Feb 07 |
jari |
5060 |
tree.setSelectionPaths(new TreePath[] {selPath}); |
2 |
26 Feb 07 |
jari |
5061 |
JPopupMenu popup = null; |
2 |
26 Feb 07 |
jari |
5062 |
DefaultMutableTreeNode node = (DefaultMutableTreeNode)selPath.getLastPathComponent(); |
2 |
26 Feb 07 |
jari |
5063 |
Object userObject = node.getUserObject(); |
2 |
26 Feb 07 |
jari |
5064 |
if (userObject instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
5065 |
popup = ((LeafInfo)userObject).getJPopupMenu(); |
2 |
26 Feb 07 |
jari |
5066 |
} |
2 |
26 Feb 07 |
jari |
// adds the delete menu item for a custom node |
2 |
26 Feb 07 |
jari |
5068 |
if (selPath.getPathCount() > 2) { |
2 |
26 Feb 07 |
jari |
5069 |
if(node.getParent() == clusterNode) |
2 |
26 Feb 07 |
jari |
5070 |
return; |
2 |
26 Feb 07 |
jari |
5071 |
if (popup == null) { |
2 |
26 Feb 07 |
jari |
5072 |
popup = new JPopupMenu(); |
2 |
26 Feb 07 |
jari |
5073 |
if(userObject instanceof LeafInfo) { |
2 |
26 Feb 07 |
jari |
5074 |
Object viewerObj = ((LeafInfo)userObject).getViewer(); |
2 |
26 Feb 07 |
jari |
5075 |
if(viewerObj == null) { |
2 |
26 Feb 07 |
jari |
5076 |
popup.add(createDeleteMenuItem()); |
2 |
26 Feb 07 |
jari |
5077 |
} else if(viewerObj instanceof IViewer && ((IViewer)viewerObj).getClusters() != null && ((IViewer)viewerObj).getExperiment() != null && ((IViewer)viewerObj).getViewerType() != -1) { |
2 |
26 Feb 07 |
jari |
5078 |
popup.add(createDeleteMenuItem()); |
2 |
26 Feb 07 |
jari |
5079 |
popup.addSeparator(); |
2 |
26 Feb 07 |
jari |
5080 |
popup.add(createSetDataMenuItem(((LeafInfo)userObject).isSelectedDataSource())); |
2 |
26 Feb 07 |
jari |
5081 |
} |
2 |
26 Feb 07 |
jari |
5082 |
} else { |
2 |
26 Feb 07 |
jari |
5083 |
popup.add(createDeleteMenuItem()); |
2 |
26 Feb 07 |
jari |
5084 |
} |
2 |
26 Feb 07 |
jari |
5085 |
} else { |
2 |
26 Feb 07 |
jari |
5086 |
if (!isContainsDeleteItem(popup)) { |
2 |
26 Feb 07 |
jari |
5087 |
popup.addSeparator(); |
2 |
26 Feb 07 |
jari |
5088 |
popup.add(createDeleteMenuItem()); |
2 |
26 Feb 07 |
jari |
5089 |
} |
2 |
26 Feb 07 |
jari |
5090 |
} |
2 |
26 Feb 07 |
jari |
5091 |
} else if( ((LeafInfo)userObject).toString().equals("Main View") && data.getFeaturesCount() != 0 ) { |
2 |
26 Feb 07 |
jari |
5092 |
popup = new JPopupMenu(); |
2 |
26 Feb 07 |
jari |
5093 |
JMenuItem item = new JMenuItem("Set as Data Source"); |
2 |
26 Feb 07 |
jari |
5094 |
item.setActionCommand(ActionManager.SET_DATA_SOURCE_COMMAND); |
2 |
26 Feb 07 |
jari |
5095 |
item.addActionListener(this); |
2 |
26 Feb 07 |
jari |
5096 |
popup.add(item); |
2 |
26 Feb 07 |
jari |
5097 |
} |
2 |
26 Feb 07 |
jari |
5098 |
if (popup != null) { |
2 |
26 Feb 07 |
jari |
5099 |
popup.show(e.getComponent(), e.getX(), e.getY()); |
2 |
26 Feb 07 |
jari |
5100 |
} |
2 |
26 Feb 07 |
jari |
5101 |
} |
2 |
26 Feb 07 |
jari |
5102 |
|
2 |
26 Feb 07 |
jari |
5103 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a delete menu item. |
2 |
26 Feb 07 |
jari |
5105 |
*/ |
2 |
26 Feb 07 |
jari |
5106 |
private JMenuItem createDeleteMenuItem() { |
2 |
26 Feb 07 |
jari |
5107 |
JMenuItem menuItem = new JMenuItem("Delete"); |
2 |
26 Feb 07 |
jari |
5108 |
menuItem.setActionCommand(ActionManager.DELETE_NODE_CMD); |
2 |
26 Feb 07 |
jari |
5109 |
menuItem.addActionListener(this); |
2 |
26 Feb 07 |
jari |
5110 |
return menuItem; |
2 |
26 Feb 07 |
jari |
5111 |
} |
2 |
26 Feb 07 |
jari |
5112 |
|
2 |
26 Feb 07 |
jari |
5113 |
|
2 |
26 Feb 07 |
jari |
5114 |
/** |
2 |
26 Feb 07 |
jari |
* Creates a data source CheckBox menu item. |
2 |
26 Feb 07 |
jari |
5116 |
*/ |
2 |
26 Feb 07 |
jari |
5117 |
private JCheckBoxMenuItem createSetDataMenuItem(boolean selected) { |
2 |
26 Feb 07 |
jari |
5118 |
JCheckBoxMenuItem box = new JCheckBoxMenuItem("Set as Data Source", selected); |
2 |
26 Feb 07 |
jari |
5119 |
box.setActionCommand(ActionManager.SET_DATA_SOURCE_COMMAND); |
2 |
26 Feb 07 |
jari |
5120 |
box.addActionListener(this); |
2 |
26 Feb 07 |
jari |
5121 |
return box; |
2 |
26 Feb 07 |
jari |
5122 |
} |
2 |
26 Feb 07 |
jari |
5123 |
|
2 |
26 Feb 07 |
jari |
5124 |
|
2 |
26 Feb 07 |
jari |
5125 |
/** |
2 |
26 Feb 07 |
jari |
* Checkes if node already contains the delete item. |
2 |
26 Feb 07 |
jari |
5127 |
*/ |
2 |
26 Feb 07 |
jari |
5128 |
private boolean isContainsDeleteItem(JPopupMenu popup) { |
2 |
26 Feb 07 |
jari |
5129 |
Component[] components = popup.getComponents(); |
2 |
26 Feb 07 |
jari |
5130 |
for (int i=components.length; --i >= 0;) { |
2 |
26 Feb 07 |
jari |
5131 |
if (components[i] instanceof JMenuItem) { |
2 |
26 Feb 07 |
jari |
5132 |
if (((JMenuItem)components[i]).getActionCommand().equals(ActionManager.DELETE_NODE_CMD)) { |
2 |
26 Feb 07 |
jari |
5133 |
return true; |
2 |
26 Feb 07 |
jari |
5134 |
} |
2 |
26 Feb 07 |
jari |
5135 |
} |
2 |
26 Feb 07 |
jari |
5136 |
} |
2 |
26 Feb 07 |
jari |
5137 |
return false; |
2 |
26 Feb 07 |
jari |
5138 |
} |
2 |
26 Feb 07 |
jari |
5139 |
|
2 |
26 Feb 07 |
jari |
5140 |
public void keyReleased(KeyEvent event) {} |
2 |
26 Feb 07 |
jari |
5141 |
public void keyPressed(KeyEvent e) {} |
2 |
26 Feb 07 |
jari |
5142 |
public void keyTyped(KeyEvent e) {} |
2 |
26 Feb 07 |
jari |
5143 |
|
2 |
26 Feb 07 |
jari |
5144 |
public void windowOpened(WindowEvent e) {} |
2 |
26 Feb 07 |
jari |
5145 |
public void windowClosing(WindowEvent e) { |
2 |
26 Feb 07 |
jari |
5146 |
onClose(); |
2 |
26 Feb 07 |
jari |
5147 |
} |
2 |
26 Feb 07 |
jari |
5148 |
public void windowClosed(WindowEvent e) {} |
2 |
26 Feb 07 |
jari |
5149 |
public void windowIconified(WindowEvent e) {} |
2 |
26 Feb 07 |
jari |
5150 |
public void windowDeiconified(WindowEvent e) {} |
2 |
26 Feb 07 |
jari |
5151 |
public void windowActivated(WindowEvent e) {} |
2 |
26 Feb 07 |
jari |
5152 |
public void windowDeactivated(WindowEvent e) {} |
2 |
26 Feb 07 |
jari |
5153 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Sept 29, 05 |
2 |
26 Feb 07 |
jari |
* Adding CGH Listener Functions |
2 |
26 Feb 07 |
jari |
* IDataRegionSelectionListener functions |
2 |
26 Feb 07 |
jari |
5157 |
*/ |
2 |
26 Feb 07 |
jari |
5158 |
public void onShowBrowser(EventObject eventObj){ |
2 |
26 Feb 07 |
jari |
5159 |
ShowBrowser(eventObj); |
2 |
26 Feb 07 |
jari |
5160 |
} |
2 |
26 Feb 07 |
jari |
5161 |
public void onDisplayDataValues(EventObject eventObj){ |
2 |
26 Feb 07 |
jari |
5162 |
DisplayDataValues(eventObj); |
2 |
26 Feb 07 |
jari |
5163 |
} |
2 |
26 Feb 07 |
jari |
5164 |
public void onShowGenes(EventObject eventObj){ |
2 |
26 Feb 07 |
jari |
5165 |
ShowGenes(eventObj); |
2 |
26 Feb 07 |
jari |
5166 |
} |
2 |
26 Feb 07 |
jari |
5167 |
public void onAnnotationsSelected(EventObject eventObj){ |
2 |
26 Feb 07 |
jari |
5168 |
AnnotationsSelected(eventObj); |
2 |
26 Feb 07 |
jari |
5169 |
} |
2 |
26 Feb 07 |
jari |
5170 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Sept 29, 05 |
2 |
26 Feb 07 |
jari |
* Adding CGH Listener Functions |
2 |
26 Feb 07 |
jari |
* ICGHListener functions |
2 |
26 Feb 07 |
jari |
5174 |
*/ |
2 |
26 Feb 07 |
jari |
5175 |
public void onDataChanged(){ |
2 |
26 Feb 07 |
jari |
5176 |
fireDataChanged(); |
2 |
26 Feb 07 |
jari |
5177 |
} |
2 |
26 Feb 07 |
jari |
5178 |
public void onCloneValuesChanged(){ |
2 |
26 Feb 07 |
jari |
5179 |
fireCloneValuesChanged(); |
2 |
26 Feb 07 |
jari |
5180 |
} |
2 |
26 Feb 07 |
jari |
5181 |
public void onChromosomeSelected(java.util.EventObject eventObj){ |
2 |
26 Feb 07 |
jari |
5182 |
fireChromosomeSelected(eventObj); |
2 |
26 Feb 07 |
jari |
5183 |
} |
2 |
26 Feb 07 |
jari |
5184 |
public void onCloneDistributionsLoaded(){ |
2 |
26 Feb 07 |
jari |
5185 |
CloneDistributionsLoaded(); |
2 |
26 Feb 07 |
jari |
5186 |
} |
2 |
26 Feb 07 |
jari |
//public void onExperimentsLoaded(java.util.EventObject eventObj); |
2 |
26 Feb 07 |
jari |
//public void onExperimentsInitialized(java.util.EventObject eventObj); |
2 |
26 Feb 07 |
jari |
5189 |
public void onExperimentsLoaded(){ |
2 |
26 Feb 07 |
jari |
5190 |
ExperimentsLoaded(); |
2 |
26 Feb 07 |
jari |
5191 |
} |
2 |
26 Feb 07 |
jari |
5192 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Loads data from the user specified directory. |
2 |
26 Feb 07 |
jari |
5195 |
*/ |
2 |
26 Feb 07 |
jari |
5196 |
protected void onLoadDirectory() { |
2 |
26 Feb 07 |
jari |
5197 |
onLoadDirectory(); |
2 |
26 Feb 07 |
jari |
//ctl.onLoadDirectory(); |
2 |
26 Feb 07 |
jari |
5199 |
} |
2 |
26 Feb 07 |
jari |
5200 |
} |
2 |
26 Feb 07 |
jari |
5201 |
|
2 |
26 Feb 07 |
jari |
5202 |
/** |
2 |
26 Feb 07 |
jari |
* This <code>IFramework</code> implementation delegates |
2 |
26 Feb 07 |
jari |
* all its invokations to the outer class. |
2 |
26 Feb 07 |
jari |
5205 |
*/ |
2 |
26 Feb 07 |
jari |
5206 |
private class FrameworkImpl implements IFramework { |
2 |
26 Feb 07 |
jari |
//public static final long serialVersionUID = 10201020001L; |
2 |
26 Feb 07 |
jari |
5208 |
|
2 |
26 Feb 07 |
jari |
5209 |
public IData getData() { |
2 |
26 Feb 07 |
jari |
5210 |
return MultipleArrayViewer.this.getData(); |
2 |
26 Feb 07 |
jari |
5211 |
} |
2 |
26 Feb 07 |
jari |
5212 |
public JFrame getJFrame() { |
2 |
26 Feb 07 |
jari |
5213 |
return mainframe; |
2 |
26 Feb 07 |
jari |
5214 |
} |
2 |
26 Feb 07 |
jari |
5215 |
public AlgorithmFactory getAlgorithmFactory() { |
2 |
26 Feb 07 |
jari |
5216 |
return MultipleArrayViewer.this.getAlgorithmFactory(); |
2 |
26 Feb 07 |
jari |
5217 |
} |
2 |
26 Feb 07 |
jari |
5218 |
public IDisplayMenu getDisplayMenu() { |
2 |
26 Feb 07 |
jari |
5219 |
return menubar.getDisplayMenu(); |
2 |
26 Feb 07 |
jari |
5220 |
} |
2 |
26 Feb 07 |
jari |
5221 |
public IDistanceMenu getDistanceMenu() { |
2 |
26 Feb 07 |
jari |
5222 |
return menubar.getDistanceMenu(); |
2 |
26 Feb 07 |
jari |
5223 |
} |
2 |
26 Feb 07 |
jari |
5224 |
public Frame getFrame() { |
2 |
26 Feb 07 |
jari |
5225 |
return MultipleArrayViewer.this.getFrame(); |
2 |
26 Feb 07 |
jari |
5226 |
} |
2 |
26 Feb 07 |
jari |
5227 |
public void setContentLocation(int x, int y) { |
2 |
26 Feb 07 |
jari |
5228 |
MultipleArrayViewer.this.setContentLocation(x, y); |
2 |
26 Feb 07 |
jari |
5229 |
} |
2 |
26 Feb 07 |
jari |
5230 |
public void displaySingleArrayViewer(int feature) { |
2 |
26 Feb 07 |
jari |
5231 |
MultipleArrayViewer.this.displaySingleArrayViewer(feature); |
2 |
26 Feb 07 |
jari |
5232 |
} |
2 |
26 Feb 07 |
jari |
5233 |
public void displaySlideElementInfo(int feature, int probe) { |
2 |
26 Feb 07 |
jari |
5234 |
MultipleArrayViewer.this.displaySlideElementInfo(feature, probe); |
2 |
26 Feb 07 |
jari |
5235 |
} |
2 |
26 Feb 07 |
jari |
5236 |
public String getStatusText() { |
2 |
26 Feb 07 |
jari |
5237 |
return MultipleArrayViewer.this.getStatusText(); |
2 |
26 Feb 07 |
jari |
5238 |
} |
2 |
26 Feb 07 |
jari |
5239 |
public void setStatusText(String text) { |
2 |
26 Feb 07 |
jari |
5240 |
MultipleArrayViewer.this.setStatusText(text); |
2 |
26 Feb 07 |
jari |
5241 |
} |
2 |
26 Feb 07 |
jari |
5242 |
public Object getUserObject() { |
2 |
26 Feb 07 |
jari |
5243 |
return MultipleArrayViewer.this.getUserObject(); |
2 |
26 Feb 07 |
jari |
5244 |
} |
2 |
26 Feb 07 |
jari |
5245 |
public void setTreeNode(DefaultMutableTreeNode node){ |
2 |
26 Feb 07 |
jari |
5246 |
MultipleArrayViewer.this.selectNode(node); |
2 |
26 Feb 07 |
jari |
5247 |
} |
2 |
26 Feb 07 |
jari |
5248 |
|
2 |
26 Feb 07 |
jari |
5249 |
public void addNode(DefaultMutableTreeNode parent, DefaultMutableTreeNode child) { |
2 |
26 Feb 07 |
jari |
5250 |
MultipleArrayViewer.this.addNode(parent, child); |
2 |
26 Feb 07 |
jari |
5251 |
} |
2 |
26 Feb 07 |
jari |
5252 |
|
2 |
26 Feb 07 |
jari |
5253 |
public Color storeCluster(int[] indices, Experiment experiment, int clusterType){ |
2 |
26 Feb 07 |
jari |
5254 |
return MultipleArrayViewer.this.storeCluster(indices, experiment, clusterType); |
2 |
26 Feb 07 |
jari |
5255 |
} |
2 |
26 Feb 07 |
jari |
5256 |
|
2 |
26 Feb 07 |
jari |
5257 |
public Color storeSubCluster(int[] indices, Experiment experiment, int clusterType){ |
2 |
26 Feb 07 |
jari |
5258 |
return MultipleArrayViewer.this.storeSubCluster(indices, experiment, clusterType); |
2 |
26 Feb 07 |
jari |
5259 |
} |
2 |
26 Feb 07 |
jari |
5260 |
|
2 |
26 Feb 07 |
jari |
5261 |
public boolean removeSubCluster(int[] indices, Experiment experiment, int clusterType) { |
2 |
26 Feb 07 |
jari |
5262 |
return MultipleArrayViewer.this.removeSubCluster(indices, experiment, clusterType); |
2 |
26 Feb 07 |
jari |
5263 |
} |
2 |
26 Feb 07 |
jari |
5264 |
|
2 |
26 Feb 07 |
jari |
5265 |
public boolean removeCluster(int[] indices, Experiment experiment, int clusterType) { |
2 |
26 Feb 07 |
jari |
5266 |
return MultipleArrayViewer.this.removeCluster(indices, experiment, clusterType); |
2 |
26 Feb 07 |
jari |
5267 |
} |
2 |
26 Feb 07 |
jari |
5268 |
|
2 |
26 Feb 07 |
jari |
5269 |
public void launchNewMAV(int[] indices, Experiment experiment, String label, int clusterType){ |
2 |
26 Feb 07 |
jari |
5270 |
MultipleArrayViewer.this.launchNewMAV(indices, experiment, label, clusterType); |
2 |
26 Feb 07 |
jari |
5271 |
} |
2 |
26 Feb 07 |
jari |
5272 |
|
2 |
26 Feb 07 |
jari |
5273 |
public void openClusterNode(String algorithmNode, String clusterID) { |
2 |
26 Feb 07 |
jari |
5274 |
MultipleArrayViewer.this.openClusterNode(algorithmNode, clusterID); |
2 |
26 Feb 07 |
jari |
5275 |
} |
2 |
26 Feb 07 |
jari |
5276 |
|
2 |
26 Feb 07 |
jari |
5277 |
public ClusterRepository getClusterRepository(int clusterType){ |
2 |
26 Feb 07 |
jari |
5278 |
return MultipleArrayViewer.this.getClusterRepository(clusterType); |
2 |
26 Feb 07 |
jari |
5279 |
} |
2 |
26 Feb 07 |
jari |
5280 |
|
2 |
26 Feb 07 |
jari |
/** Returns the currently selected node. |
2 |
26 Feb 07 |
jari |
5282 |
*/ |
2 |
26 Feb 07 |
jari |
5283 |
public DefaultMutableTreeNode getCurrentNode() { |
2 |
26 Feb 07 |
jari |
5284 |
return MultipleArrayViewer.this.getCurrentNode(); |
2 |
26 Feb 07 |
jari |
5285 |
} |
2 |
26 Feb 07 |
jari |
5286 |
|
2 |
26 Feb 07 |
jari |
/** Returns the result node containing the supplied object |
2 |
26 Feb 07 |
jari |
5288 |
*/ |
2 |
26 Feb 07 |
jari |
5289 |
public DefaultMutableTreeNode getNode(Object object) { |
2 |
26 Feb 07 |
jari |
5290 |
return MultipleArrayViewer.this.getNode(object); |
2 |
26 Feb 07 |
jari |
5291 |
} |
2 |
26 Feb 07 |
jari |
5292 |
|
2 |
26 Feb 07 |
jari |
/** Adds string to history node |
2 |
26 Feb 07 |
jari |
5294 |
*/ |
2 |
26 Feb 07 |
jari |
5295 |
public void addHistory(String historyEvent) { |
2 |
26 Feb 07 |
jari |
5296 |
MultipleArrayViewer.this.addHistory(historyEvent); |
2 |
26 Feb 07 |
jari |
5297 |
} |
2 |
26 Feb 07 |
jari |
5298 |
|
2 |
26 Feb 07 |
jari |
/** Returns the ResultTree object |
2 |
26 Feb 07 |
jari |
5300 |
*/ |
2 |
26 Feb 07 |
jari |
5301 |
public ResultTree getResultTree() { |
2 |
26 Feb 07 |
jari |
5302 |
return MultipleArrayViewer.this.getResultTree(); |
2 |
26 Feb 07 |
jari |
5303 |
} |
2 |
26 Feb 07 |
jari |
5304 |
|
2 |
26 Feb 07 |
jari |
/** Adds result to the ResultTree |
2 |
26 Feb 07 |
jari |
5306 |
*/ |
2 |
26 Feb 07 |
jari |
5307 |
public void addAnalysisResult(DefaultMutableTreeNode resultNode) { |
2 |
26 Feb 07 |
jari |
5308 |
MultipleArrayViewer.this.addAnalysisResult(resultNode); |
2 |
26 Feb 07 |
jari |
5309 |
} |
2 |
26 Feb 07 |
jari |
5310 |
|
2 |
26 Feb 07 |
jari |
/** Refreshes current viewer if it's an IViewer */ |
2 |
26 Feb 07 |
jari |
5312 |
public void refreshCurrentViewer() { |
2 |
26 Feb 07 |
jari |
5313 |
MultipleArrayViewer.this.refreshCurrentViewer(); |
2 |
26 Feb 07 |
jari |
5314 |
} |
2 |
26 Feb 07 |
jari |
5315 |
|
2 |
26 Feb 07 |
jari |
/** Stores indices to a cluster in the manager but doesn't link to a particular viewer node. |
2 |
26 Feb 07 |
jari |
5317 |
*/ |
2 |
26 Feb 07 |
jari |
5318 |
public void storeOperationCluster(String source, String clusterID, int[] indices, boolean geneCluster) { |
2 |
26 Feb 07 |
jari |
5319 |
MultipleArrayViewer.this.storeOperationCluster(source, clusterID, indices, geneCluster); |
2 |
26 Feb 07 |
jari |
5320 |
} |
2 |
26 Feb 07 |
jari |
5321 |
|
2 |
26 Feb 07 |
jari |
5322 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim Nov 02, 2005 |
2 |
26 Feb 07 |
jari |
* CGH Specific methods |
2 |
26 Feb 07 |
jari |
5325 |
*/ |
2 |
26 Feb 07 |
jari |
5326 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH Display Menu accessor |
2 |
26 Feb 07 |
jari |
5329 |
*/ |
2 |
26 Feb 07 |
jari |
5330 |
public ICGHDisplayMenu getCghDisplayMenu(){ |
2 |
26 Feb 07 |
jari |
5331 |
return menubar.getCghDisplayMenu(); |
2 |
26 Feb 07 |
jari |
5332 |
} |
2 |
26 Feb 07 |
jari |
5333 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* CGH Clone Menu accessor |
2 |
26 Feb 07 |
jari |
5336 |
*/ |
2 |
26 Feb 07 |
jari |
5337 |
public ICGHCloneValueMenu getCghCloneValueMenu(){ |
2 |
26 Feb 07 |
jari |
5338 |
return menubar.getCloneValueMenu(); |
2 |
26 Feb 07 |
jari |
5339 |
} |
2 |
26 Feb 07 |
jari |
5340 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
5343 |
*/ |
2 |
26 Feb 07 |
jari |
5344 |
public Rectangle getViewerBounds(){ |
2 |
26 Feb 07 |
jari |
5345 |
return viewScrollPane.getViewportBorderBounds(); |
2 |
26 Feb 07 |
jari |
5346 |
} |
2 |
26 Feb 07 |
jari |
5347 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim |
2 |
26 Feb 07 |
jari |
* Returns the cytoband model of the a species |
2 |
26 Feb 07 |
jari |
5350 |
*/ |
2 |
26 Feb 07 |
jari |
5351 |
public CytoBandsModel getCytoBandsModel(){ |
2 |
26 Feb 07 |
jari |
5352 |
return cytoBandsModel; |
2 |
26 Feb 07 |
jari |
5353 |
} |
2 |
26 Feb 07 |
jari |
5354 |
} |
2 |
26 Feb 07 |
jari |
5355 |
} |