2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
* NumberOfAlterationsCalculator.java |
2 |
26 Feb 07 |
jari |
3 |
* |
2 |
26 Feb 07 |
jari |
* Created on May 19, 2003, 1:57 AM |
2 |
26 Feb 07 |
jari |
5 |
*/ |
2 |
26 Feb 07 |
jari |
6 |
|
2 |
26 Feb 07 |
jari |
7 |
package org.tigr.microarray.mev.cgh.CGHAlgorithms.NumberOfAlterations; |
2 |
26 Feb 07 |
jari |
8 |
|
2 |
26 Feb 07 |
jari |
9 |
import java.util.Collection; |
2 |
26 Feb 07 |
jari |
10 |
import java.util.Iterator; |
2 |
26 Feb 07 |
jari |
11 |
|
2 |
26 Feb 07 |
jari |
12 |
import javax.swing.tree.DefaultMutableTreeNode; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
import org.tigr.microarray.mev.cgh.CGHDataObj.AlterationRegion; |
2 |
26 Feb 07 |
jari |
15 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.AlgorithmResultsViewers.NumberOfAlterationsViewers.AlterationParametersViewer; |
2 |
26 Feb 07 |
jari |
16 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.AlgorithmResultsViewers.NumberOfAlterationsViewers.NumberOfAlterationsDataModel; |
2 |
26 Feb 07 |
jari |
17 |
import org.tigr.microarray.mev.cgh.CGHGuiObj.AlgorithmResultsViewers.NumberOfAlterationsViewers.NumberOfAlterationsViewer; |
2 |
26 Feb 07 |
jari |
18 |
import org.tigr.microarray.mev.cluster.algorithm.AlgorithmException; |
2 |
26 Feb 07 |
jari |
19 |
import org.tigr.microarray.mev.cluster.gui.ICGHCloneValueMenu; |
2 |
26 Feb 07 |
jari |
20 |
import org.tigr.microarray.mev.cluster.gui.IClusterGUI; |
2 |
26 Feb 07 |
jari |
21 |
import org.tigr.microarray.mev.cluster.gui.IData; |
2 |
26 Feb 07 |
jari |
22 |
import org.tigr.microarray.mev.cluster.gui.IFramework; |
2 |
26 Feb 07 |
jari |
23 |
import org.tigr.microarray.mev.cluster.gui.IViewer; |
2 |
26 Feb 07 |
jari |
24 |
import org.tigr.microarray.mev.cluster.gui.LeafInfo; |
2 |
26 Feb 07 |
jari |
25 |
|
2 |
26 Feb 07 |
jari |
26 |
/** |
2 |
26 Feb 07 |
jari |
27 |
* |
2 |
26 Feb 07 |
jari |
* @author Adam Margolin |
2 |
26 Feb 07 |
jari |
* @author Raktim Sinha |
2 |
26 Feb 07 |
jari |
30 |
*/ |
2 |
26 Feb 07 |
jari |
31 |
|
2 |
26 Feb 07 |
jari |
32 |
public abstract class NumberOfAlterationsCalculator implements IClusterGUI { |
2 |
26 Feb 07 |
jari |
//making these public for now, but could switch subclasses of this class to |
2 |
26 Feb 07 |
jari |
//the same package |
2 |
26 Feb 07 |
jari |
//public CGHMultipleArrayDataFcd fcd; |
2 |
26 Feb 07 |
jari |
36 |
public IFramework framework; |
2 |
26 Feb 07 |
jari |
37 |
public IData data; |
2 |
26 Feb 07 |
jari |
38 |
public String nodeName = ""; |
2 |
26 Feb 07 |
jari |
39 |
|
2 |
26 Feb 07 |
jari |
/** Creates a new instance of NumberOfAlterationsCalculator */ |
2 |
26 Feb 07 |
jari |
41 |
public NumberOfAlterationsCalculator() { |
2 |
26 Feb 07 |
jari |
42 |
} |
2 |
26 Feb 07 |
jari |
43 |
|
2 |
26 Feb 07 |
jari |
44 |
public abstract DefaultMutableTreeNode execute(IFramework framework) throws AlgorithmException; |
2 |
26 Feb 07 |
jari |
45 |
|
2 |
26 Feb 07 |
jari |
46 |
/** |
2 |
26 Feb 07 |
jari |
* NOT USED |
2 |
26 Feb 07 |
jari |
* Replaced by one below - DefaultMutableTreeNode createResultsTree(Collection results) |
2 |
26 Feb 07 |
jari |
* @param results |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
51 |
*/ |
2 |
26 Feb 07 |
jari |
52 |
public DefaultMutableTreeNode createResultsTree2(Collection results){ |
2 |
26 Feb 07 |
jari |
53 |
DefaultMutableTreeNode root = new DefaultMutableTreeNode(nodeName); |
2 |
26 Feb 07 |
jari |
54 |
root.add(new DefaultMutableTreeNode(new LeafInfo("Parameters", createParametersViewer()))); |
2 |
26 Feb 07 |
jari |
55 |
root.add(new DefaultMutableTreeNode(new LeafInfo("Results", createResultsViewer(results)))); |
2 |
26 Feb 07 |
jari |
56 |
return root; |
2 |
26 Feb 07 |
jari |
57 |
} |
2 |
26 Feb 07 |
jari |
58 |
|
2 |
26 Feb 07 |
jari |
59 |
/** |
2 |
26 Feb 07 |
jari |
* New method to be consistent with Mev Look & Feel |
2 |
26 Feb 07 |
jari |
* @param results |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
63 |
*/ |
2 |
26 Feb 07 |
jari |
64 |
public DefaultMutableTreeNode createResultsTree(Collection results){ |
2 |
26 Feb 07 |
jari |
65 |
DefaultMutableTreeNode root = new DefaultMutableTreeNode(nodeName); |
2 |
26 Feb 07 |
jari |
66 |
|
2 |
26 Feb 07 |
jari |
67 |
root.add(new DefaultMutableTreeNode(new LeafInfo("Results", createResultsViewer(results)))); |
2 |
26 Feb 07 |
jari |
68 |
addGeneralInfo(root); |
2 |
26 Feb 07 |
jari |
69 |
return root; |
2 |
26 Feb 07 |
jari |
70 |
} |
2 |
26 Feb 07 |
jari |
71 |
|
2 |
26 Feb 07 |
jari |
72 |
/** |
2 |
26 Feb 07 |
jari |
* Raktim 4/27 |
2 |
26 Feb 07 |
jari |
* Added for State Saving to capture the File used for LoadGeneList |
2 |
26 Feb 07 |
jari |
* @param results |
2 |
26 Feb 07 |
jari |
* @param file |
2 |
26 Feb 07 |
jari |
* @return |
2 |
26 Feb 07 |
jari |
78 |
*/ |
2 |
26 Feb 07 |
jari |
79 |
public DefaultMutableTreeNode createResultsTree(Collection results, String file){ |
2 |
26 Feb 07 |
jari |
80 |
DefaultMutableTreeNode root = new DefaultMutableTreeNode(nodeName); |
2 |
26 Feb 07 |
jari |
81 |
|
2 |
26 Feb 07 |
jari |
82 |
root.add(new DefaultMutableTreeNode(new LeafInfo("Results", createResultsViewer(results)))); |
2 |
26 Feb 07 |
jari |
83 |
addGeneralInfo(root); |
2 |
26 Feb 07 |
jari |
84 |
return root; |
2 |
26 Feb 07 |
jari |
85 |
} |
2 |
26 Feb 07 |
jari |
86 |
|
2 |
26 Feb 07 |
jari |
87 |
public DefaultMutableTreeNode createResultsTree(Collection results, boolean addInfo){ |
2 |
26 Feb 07 |
jari |
88 |
DefaultMutableTreeNode root = new DefaultMutableTreeNode(nodeName); |
2 |
26 Feb 07 |
jari |
89 |
|
2 |
26 Feb 07 |
jari |
90 |
root.add(new DefaultMutableTreeNode(new LeafInfo("Results", createResultsViewer(results)))); |
2 |
26 Feb 07 |
jari |
91 |
if(addInfo) |
2 |
26 Feb 07 |
jari |
92 |
addGeneralInfo(root); |
2 |
26 Feb 07 |
jari |
93 |
return root; |
2 |
26 Feb 07 |
jari |
94 |
} |
2 |
26 Feb 07 |
jari |
95 |
|
2 |
26 Feb 07 |
jari |
96 |
private IViewer createResultsViewer(Collection results){ |
2 |
26 Feb 07 |
jari |
97 |
AlterationRegion[] alterationRegions = new AlterationRegion[results.size()]; |
2 |
26 Feb 07 |
jari |
98 |
|
2 |
26 Feb 07 |
jari |
99 |
Iterator it = results.iterator(); |
2 |
26 Feb 07 |
jari |
100 |
int i = 0; |
2 |
26 Feb 07 |
jari |
101 |
while(it.hasNext()){ |
2 |
26 Feb 07 |
jari |
102 |
AlterationRegion alterationRegion = (AlterationRegion)it.next(); |
2 |
26 Feb 07 |
jari |
103 |
alterationRegions[i++] = alterationRegion; |
2 |
26 Feb 07 |
jari |
104 |
} |
2 |
26 Feb 07 |
jari |
105 |
|
2 |
26 Feb 07 |
jari |
106 |
NumberOfAlterationsDataModel dataModel = new NumberOfAlterationsDataModel(); |
2 |
26 Feb 07 |
jari |
107 |
dataModel.setAlterationRegions(alterationRegions); |
2 |
26 Feb 07 |
jari |
108 |
|
2 |
26 Feb 07 |
jari |
109 |
NumberOfAlterationsViewer viewer = new NumberOfAlterationsViewer(); |
2 |
26 Feb 07 |
jari |
110 |
viewer.setData(framework.getData()); |
2 |
26 Feb 07 |
jari |
111 |
viewer.setDataModel(dataModel); |
2 |
26 Feb 07 |
jari |
112 |
|
2 |
26 Feb 07 |
jari |
113 |
return viewer; |
2 |
26 Feb 07 |
jari |
114 |
} |
2 |
26 Feb 07 |
jari |
115 |
|
2 |
26 Feb 07 |
jari |
116 |
public IViewer createParametersViewer(){ |
2 |
26 Feb 07 |
jari |
117 |
return new AlterationParametersViewer(framework); |
2 |
26 Feb 07 |
jari |
118 |
} |
2 |
26 Feb 07 |
jari |
119 |
|
2 |
26 Feb 07 |
jari |
120 |
/** |
2 |
26 Feb 07 |
jari |
* Adds node with general iformation. |
2 |
26 Feb 07 |
jari |
122 |
*/ |
2 |
26 Feb 07 |
jari |
123 |
private void addGeneralInfo(DefaultMutableTreeNode root) { |
2 |
26 Feb 07 |
jari |
124 |
ICGHCloneValueMenu menu = framework.getCghCloneValueMenu(); |
2 |
26 Feb 07 |
jari |
125 |
DefaultMutableTreeNode node = new DefaultMutableTreeNode("General Information"); |
2 |
26 Feb 07 |
jari |
126 |
node.add(new DefaultMutableTreeNode("Amplification Threshold: " + menu.getAmpThresh())); |
2 |
26 Feb 07 |
jari |
127 |
node.add(new DefaultMutableTreeNode("Deletion Threshold: " + menu.getDelThresh())); |
2 |
26 Feb 07 |
jari |
128 |
node.add(new DefaultMutableTreeNode("Amplification 2 Copy Threshold: " + menu.getAmpThresh2Copy())); |
2 |
26 Feb 07 |
jari |
129 |
node.add(new DefaultMutableTreeNode("Deletion 2 Copy Threshold: " + menu.getDelThresh2Copy())); |
2 |
26 Feb 07 |
jari |
130 |
root.add(node); |
2 |
26 Feb 07 |
jari |
131 |
} |
2 |
26 Feb 07 |
jari |
132 |
|
2 |
26 Feb 07 |
jari |
133 |
|
2 |
26 Feb 07 |
jari |
134 |
/** |
2 |
26 Feb 07 |
jari |
* Getter for property fcd. |
2 |
26 Feb 07 |
jari |
* @return Value of property fcd. |
2 |
26 Feb 07 |
jari |
* Not used in New Struct |
2 |
26 Feb 07 |
jari |
138 |
|
2 |
26 Feb 07 |
jari |
public org.abramson.microarray.cgh.CGHFcdObj.CGHMultipleArrayDataFcd getFcd() { |
2 |
26 Feb 07 |
jari |
return fcd; |
2 |
26 Feb 07 |
jari |
141 |
} |
2 |
26 Feb 07 |
jari |
142 |
*/ |
2 |
26 Feb 07 |
jari |
143 |
|
2 |
26 Feb 07 |
jari |
144 |
public IData getData(){ |
2 |
26 Feb 07 |
jari |
145 |
return this.data; |
2 |
26 Feb 07 |
jari |
146 |
} |
2 |
26 Feb 07 |
jari |
147 |
|
2 |
26 Feb 07 |
jari |
148 |
/** |
2 |
26 Feb 07 |
jari |
* Setter for property fcd. |
2 |
26 Feb 07 |
jari |
* @param fcd New value of property fcd. |
2 |
26 Feb 07 |
jari |
* Not used in New Struct |
2 |
26 Feb 07 |
jari |
152 |
|
2 |
26 Feb 07 |
jari |
public void setFcd(org.abramson.microarray.cgh.CGHFcdObj.CGHMultipleArrayDataFcd fcd) { |
2 |
26 Feb 07 |
jari |
this.fcd = fcd; |
2 |
26 Feb 07 |
jari |
155 |
} |
2 |
26 Feb 07 |
jari |
156 |
*/ |
2 |
26 Feb 07 |
jari |
157 |
|
2 |
26 Feb 07 |
jari |
158 |
public void setData(IData dat) { |
2 |
26 Feb 07 |
jari |
159 |
this.data = dat; |
2 |
26 Feb 07 |
jari |
160 |
} |
2 |
26 Feb 07 |
jari |
/** Getter for property framework. |
2 |
26 Feb 07 |
jari |
* @return Value of property framework. |
2 |
26 Feb 07 |
jari |
163 |
*/ |
2 |
26 Feb 07 |
jari |
164 |
public IFramework getFramework() { |
2 |
26 Feb 07 |
jari |
165 |
return framework; |
2 |
26 Feb 07 |
jari |
166 |
} |
2 |
26 Feb 07 |
jari |
167 |
|
2 |
26 Feb 07 |
jari |
/** Setter for property framework. |
2 |
26 Feb 07 |
jari |
* @param framework New value of property framework. |
2 |
26 Feb 07 |
jari |
170 |
*/ |
2 |
26 Feb 07 |
jari |
171 |
public void setFramework(IFramework framework) { |
2 |
26 Feb 07 |
jari |
172 |
this.framework = framework; |
2 |
26 Feb 07 |
jari |
173 |
} |
2 |
26 Feb 07 |
jari |
174 |
|
2 |
26 Feb 07 |
jari |
175 |
} |