Skip to content

Commit 61c9c58

Browse files
committed
Revert commit c302be3. Refs #108.
1 parent 310d173 commit 61c9c58

File tree

6 files changed

+75
-70
lines changed

6 files changed

+75
-70
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/CyActivator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public void start(BundleContext bc) {
126126
EnrichmentMapInputPanel emPanel = new EnrichmentMapInputPanel(cyNetworkFactoryRef, cyApplicationManagerRef, cyNetworkManagerRef, cyNetworkViewManagerRef, tableFactory, tableManager, cyNetworkViewFactoryRef, visualMappingManagerRef, visualStyleFactoryRef, continuousMappingFunctionFactoryRef,discreteMappingFunctionFactoryRef, passthroughMappingFunctionFactoryRef, dialogTaskManager, sessionManager, cySwingApplicationRef, openBrowserRef,fileUtil,streamUtil,registrar,layoutManager,mapTableToNetworkTable,bulkEmPanel);
127127
PostAnalysisPanel postEMPanel = new PostAnalysisPanel(cyApplicationManagerRef,cySwingApplicationRef, openBrowserRef,fileUtil,sessionManager, streamUtil,registrar, dialogTaskManager,eventHelper, compilerServiceRef, visualMappingManagerRef, visualStyleFactoryRef, continuousMappingFunctionFactoryRef, discreteMappingFunctionFactoryRef, passthroughMappingFunctionFactoryRef);
128128
//create two instances of the heatmap panel
129-
HeatMapPanel heatMapPanel_node = new HeatMapPanel(true, cySwingApplicationRef, fileUtil, cyApplicationManagerRef, openBrowserRef,syncTaskManager,streamUtil);
130-
HeatMapPanel heatMapPanel_edge = new HeatMapPanel(false, cySwingApplicationRef, fileUtil, cyApplicationManagerRef, openBrowserRef,syncTaskManager,streamUtil);
129+
HeatMapPanel heatMapPanel_node = new HeatMapPanel(true, cySwingApplicationRef, fileUtil, cyApplicationManagerRef, openBrowserRef,dialogTaskManager,streamUtil);
130+
HeatMapPanel heatMapPanel_edge = new HeatMapPanel(false, cySwingApplicationRef, fileUtil, cyApplicationManagerRef, openBrowserRef,dialogTaskManager,streamUtil);
131131
ParametersPanel paramsPanel = new ParametersPanel(openBrowserRef, cyApplicationManagerRef);
132132

133133
//Get an instance of EM manager
Lines changed: 49 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,77 @@
11
package org.baderlab.csplugins.enrichmentmap.heatmap.task;
22

3-
import java.net.URL;
4-
5-
import javax.swing.Icon;
6-
import javax.swing.ImageIcon;
7-
import javax.swing.JOptionPane;
8-
93
import org.baderlab.csplugins.enrichmentmap.EnrichmentMapParameters;
104
import org.baderlab.csplugins.enrichmentmap.heatmap.HeatMapParameters;
115
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
126
import org.baderlab.csplugins.enrichmentmap.view.HeatMapPanel;
13-
import org.cytoscape.application.swing.CySwingApplication;
147
import org.cytoscape.work.AbstractTask;
158
import org.cytoscape.work.ObservableTask;
169
import org.cytoscape.work.TaskMonitor;
10+
import org.cytoscape.work.Tunable;
11+
import org.cytoscape.work.util.ListSingleSelection;
1712

1813
public class HeatMapHierarchicalClusterQuestionTask extends AbstractTask implements ObservableTask {
19-
20-
private static final String CLUSTER = "Cluster results anyways";
21-
private static final String NO_SORT = "Do not cluster the results";
22-
23-
private int numConditions = 0;
24-
private int numConditions2 = 0;
25-
26-
private HeatMapPanel heatmapPanel;
27-
private EnrichmentMap map;
28-
private EnrichmentMapParameters params;
29-
private HeatMapParameters hmParams;
30-
private CySwingApplication swingApplication;
31-
32-
public HeatMapHierarchicalClusterQuestionTask(
33-
CySwingApplication swingApplication, int numConditions,
34-
int numConditions2, HeatMapPanel heatmapPanel, EnrichmentMap map) {
35-
this.swingApplication = swingApplication;
14+
15+
//@Tunable(description="<html>The combination of the selected gene sets contains more than 1000 genes.<BR> Clustering will take a while.<BR> Would you like to cluster anyways?")
16+
//@Tunable(description="The combination of the selected gene sets contains more than 1000 genes. Clustering will take a while. Would you like to cluster anyways?")
17+
//public boolean cluster;
18+
@Tunable(description="<html>The combination of the selected gene sets contains more than 1000 genes.<BR> Clustering will take a while. Would you like to cluster anyways?")
19+
public ListSingleSelection<String> clusterResponse;
20+
21+
private static String cluster = "Cluster results anyways";
22+
private static String no_sort = "Do not cluster the results";
23+
24+
private int numConditions = 0;
25+
private int numConditions2 = 0;
26+
27+
private HeatMapPanel heatmapPanel;
28+
private EnrichmentMap map;
29+
private EnrichmentMapParameters params;
30+
private HeatMapParameters hmParams;
31+
32+
private TaskMonitor taskMonitor;
33+
34+
public HeatMapHierarchicalClusterQuestionTask(int numConditions,
35+
int numConditions2,
36+
HeatMapPanel heatmapPanel,
37+
EnrichmentMap map) {
38+
super();
3639
this.numConditions = numConditions;
3740
this.numConditions2 = numConditions2;
3841
this.heatmapPanel = heatmapPanel;
3942
this.map = map;
4043
this.params = map.getParams();
4144
this.hmParams = this.params.getHmParams();
45+
46+
clusterResponse = new ListSingleSelection<String>( no_sort,cluster);
4247
}
43-
48+
4449
@Override
45-
public void run(TaskMonitor tm) throws Exception {
46-
String clusterResponse = showInputDialog();
47-
if(clusterResponse == null)
48-
return;
49-
50-
if(clusterResponse.equals(CLUSTER)) {
51-
HeatMapHierarchicalClusterTask clusterTask = new HeatMapHierarchicalClusterTask(numConditions, numConditions2, heatmapPanel, map);
50+
public void run(TaskMonitor arg0) throws Exception {
51+
if(clusterResponse.getSelectedValue().equals(cluster)){
52+
HeatMapHierarchicalClusterTask clusterTask = new HeatMapHierarchicalClusterTask(this.numConditions,this.numConditions2,this.heatmapPanel,this.map);
5253
this.insertTasksAfterCurrentTask(clusterTask);
53-
} else {
54-
hmParams.setSort(HeatMapParameters.Sort.NONE);
5554
}
55+
else
56+
hmParams.setSort(HeatMapParameters.Sort.NONE);
57+
5658
}
57-
58-
59-
private String showInputDialog() {
60-
Object[] options = { NO_SORT, CLUSTER };
61-
String message = "<html>The combination of the selected gene sets contains more than 1000 genes.<BR><BR>"
62-
+ "Clustering may take a while. Would you like to cluster anyways?<BR></html>";
63-
64-
String response = (String) JOptionPane.showInputDialog(
65-
swingApplication.getJFrame(),
66-
message,
67-
"EnrichmentMap: Clustering",
68-
JOptionPane.PLAIN_MESSAGE,
69-
getDialogIcon(),
70-
options,
71-
NO_SORT);
72-
73-
return response;
59+
60+
public void run() throws Exception {
61+
if(clusterResponse.getSelectedValue().equals(cluster)){
62+
HeatMapHierarchicalClusterTask clusterTask = new HeatMapHierarchicalClusterTask(this.numConditions,this.numConditions2,this.heatmapPanel,this.map);
63+
this.insertTasksAfterCurrentTask(clusterTask);
64+
}
65+
else
66+
hmParams.setSort(HeatMapParameters.Sort.NONE);
67+
7468
}
7569

76-
private Icon getDialogIcon() {
77-
URL iconURL = getClass().getResource("enrichmentmap_logo.png");
78-
return iconURL == null ? null : new ImageIcon(iconURL);
79-
}
80-
8170
public <R> R getResults(Class<? extends R> arg0) {
71+
// TODO Auto-generated method stub
8272
return null;
8373
}
8474

85-
}
75+
76+
77+
}

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/heatmap/task/HeatMapHierarchicalClusterTaskFactory.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package org.baderlab.csplugins.enrichmentmap.heatmap.task;
22

3+
import org.baderlab.csplugins.enrichmentmap.EnrichmentMapParameters;
4+
import org.baderlab.csplugins.enrichmentmap.heatmap.HeatMapParameters;
35
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
46
import org.baderlab.csplugins.enrichmentmap.view.HeatMapPanel;
5-
import org.cytoscape.application.swing.CySwingApplication;
67
import org.cytoscape.work.TaskFactory;
78
import org.cytoscape.work.TaskIterator;
89

@@ -14,11 +15,10 @@ public class HeatMapHierarchicalClusterTaskFactory implements TaskFactory {
1415

1516
private HeatMapPanel heatmapPanel;
1617
private EnrichmentMap map;
17-
private CySwingApplication swingApplication;
1818

19-
public HeatMapHierarchicalClusterTaskFactory(CySwingApplication swingApplication, int numConditions,
19+
public HeatMapHierarchicalClusterTaskFactory(int numConditions,
2020
int numConditions2, HeatMapPanel heatmapPanel, EnrichmentMap map) {
21-
this.swingApplication = swingApplication;
21+
super();
2222
this.numConditions = numConditions;
2323
this.numConditions2 = numConditions2;
2424
this.heatmapPanel = heatmapPanel;
@@ -38,7 +38,7 @@ public TaskIterator createTaskIterator() {
3838

3939
//if there are too many genes then check that the user wants to do clustering
4040
if(size > hierarchicalClusterMax){
41-
HeatMapHierarchicalClusterQuestionTask clusterquesttask = new HeatMapHierarchicalClusterQuestionTask(swingApplication, this.numConditions,this.numConditions2,this.heatmapPanel,this.map);
41+
HeatMapHierarchicalClusterQuestionTask clusterquesttask = new HeatMapHierarchicalClusterQuestionTask(this.numConditions,this.numConditions2,this.heatmapPanel,this.map);
4242
clusterIterator.append(clusterquesttask);
4343
}
4444
else{

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/LoadSignatureGMTFilesTask.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public String getTitle() {
4242
}
4343

4444

45+
/**
46+
* @see cytoscape.task.Task#run()
47+
*/
4548
public void load() {
4649
//now a Cytoscape Task (LoadSignatureGenesetsTask)
4750
try {

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/HeatMapPanel.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
import org.baderlab.csplugins.enrichmentmap.model.Ranking;
113113
import org.baderlab.csplugins.enrichmentmap.model.SignificantGene;
114114
import org.baderlab.csplugins.enrichmentmap.parsers.DetermineEnrichmentResultFileReader;
115+
import org.baderlab.csplugins.enrichmentmap.task.ResultTaskObserver;
115116
import org.cytoscape.application.CyApplicationManager;
116117
import org.cytoscape.application.swing.CySwingApplication;
117118
import org.cytoscape.application.swing.CytoPanelComponent;
@@ -122,7 +123,7 @@
122123
import org.cytoscape.util.swing.FileChooserFilter;
123124
import org.cytoscape.util.swing.FileUtil;
124125
import org.cytoscape.util.swing.OpenBrowser;
125-
import org.cytoscape.work.SynchronousTaskManager;
126+
import org.cytoscape.work.swing.DialogTaskManager;
126127
import org.mskcc.colorgradient.ColorGradientRange;
127128
import org.mskcc.colorgradient.ColorGradientTheme;
128129
import org.mskcc.colorgradient.ColorGradientWidget;
@@ -147,7 +148,7 @@ public class HeatMapPanel extends JPanel implements CytoPanelComponent{
147148
private CyApplicationManager applicationManager;
148149
private FileUtil fileUtil;
149150
private OpenBrowser openBrowser;
150-
private SynchronousTaskManager syncTaskManager;
151+
private DialogTaskManager dialogTaskMonitor;
151152
private StreamUtil streamUtil;
152153

153154
private static final long serialVersionUID = 1903063204304411983L;
@@ -247,7 +248,7 @@ public class HeatMapPanel extends JPanel implements CytoPanelComponent{
247248
* if true it is a node heatmap, else it is an edge heatmap
248249
*/
249250
public HeatMapPanel(boolean node, CySwingApplication application,
250-
FileUtil fileUtil,CyApplicationManager applicationManager,OpenBrowser openBrowser, SynchronousTaskManager syncTaskManager,StreamUtil streamUtil){
251+
FileUtil fileUtil,CyApplicationManager applicationManager,OpenBrowser openBrowser, DialogTaskManager dialogTaskMonitor,StreamUtil streamUtil){
251252
this.node = node;
252253
this.setLayout(new java.awt.BorderLayout());
253254

@@ -260,7 +261,7 @@ public HeatMapPanel(boolean node, CySwingApplication application,
260261
this.application = application;
261262
this.applicationManager = applicationManager;
262263
this.openBrowser = openBrowser;
263-
this.syncTaskManager = syncTaskManager;
264+
this.dialogTaskMonitor = dialogTaskMonitor;
264265
this.streamUtil = streamUtil;
265266
this.fileUtil = fileUtil;
266267
}
@@ -1738,8 +1739,17 @@ else if((hmParams.getSort() == HeatMapParameters.Sort.COLUMN) || (hmParams.getSo
17381739
hmParams.setSortbycolumn_event_triggered(true);
17391740
}
17401741
else if(hmParams.getSort() == HeatMapParameters.Sort.CLUSTER){
1741-
HeatMapHierarchicalClusterTaskFactory clustertask = new HeatMapHierarchicalClusterTaskFactory(application, this.numConditions,this.numConditions2,this,this.map);
1742-
syncTaskManager.execute(clustertask.createTaskIterator());
1742+
HeatMapHierarchicalClusterTaskFactory clustertask = new HeatMapHierarchicalClusterTaskFactory(this.numConditions,this.numConditions2,this,this.map);
1743+
ResultTaskObserver observer = new ResultTaskObserver();
1744+
1745+
this.dialogTaskMonitor.execute(clustertask.createTaskIterator(),observer );
1746+
while (!observer.isAllFinished()) {
1747+
try {
1748+
Thread.sleep(100);
1749+
} catch (InterruptedException e) {
1750+
// TODO Auto-generated catch block
1751+
e.printStackTrace();
1752+
} }
17431753
ranks = this.ranks;
17441754
}
17451755

-9.23 KB
Binary file not shown.

0 commit comments

Comments
 (0)