Skip to content

Commit 35d1894

Browse files
committed
Leading edge can be selected when running genemania from context menu.
Refs #437
1 parent 8b42fad commit 35d1894

12 files changed

+232
-122
lines changed
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import java.lang.reflect.Type;
99
import java.util.Collections;
1010
import java.util.List;
11-
import java.util.Set;
1211

1312
import javax.swing.JFrame;
1413
import javax.swing.JOptionPane;
@@ -17,6 +16,7 @@
1716
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
1817
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager;
1918
import org.baderlab.csplugins.enrichmentmap.util.TaskUtil;
19+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption;
2020
import org.baderlab.csplugins.enrichmentmap.view.util.OpenBrowser;
2121
import org.cytoscape.command.AvailableCommands;
2222
import org.cytoscape.command.CommandExecutorTaskFactory;
@@ -27,7 +27,6 @@
2727
import org.cytoscape.work.TaskIterator;
2828
import org.cytoscape.work.TaskMonitor;
2929
import org.cytoscape.work.json.JSONResult;
30-
import org.cytoscape.work.swing.DialogTaskManager;
3130

3231
import com.google.common.reflect.TypeToken;
3332
import com.google.gson.Gson;
@@ -36,7 +35,7 @@
3635
import com.google.inject.Singleton;
3736

3837
@Singleton
39-
public class GeneManiaMediator {
38+
public class GeneManiaTaskFactory {
4039

4140
@Inject private QueryGeneManiaTask.Factory queryGeneManiaTaskFactory;
4241

@@ -46,16 +45,9 @@ public class GeneManiaMediator {
4645
@Inject private AvailableCommands availableCommands;
4746
@Inject private Provider<JFrame> jFrameProvider;
4847
@Inject private OpenBrowser openBrowser;
49-
@Inject private DialogTaskManager taskManager;
50-
51-
52-
public void runGeneMANIA(EnrichmentMap map, List<String> genes, Set<String> leadingEdgeGenes) {
53-
TaskIterator ti = createTaskIterator(map, genes, leadingEdgeGenes);
54-
taskManager.execute(ti);
55-
}
5648

5749

58-
public TaskIterator createTaskIterator(EnrichmentMap map, List<String> genes, Set<String> leadingEdgeGenes) {
50+
public TaskIterator createTaskIterator(EnrichmentMap map, List<String> genes, List<GSEALeadingEdgeRankingOption> leadingEdgeRanks) {
5951
// Show message to user if genemania not installed
6052
List<String> commands = availableCommands.getCommands(GENEMANIA_NAMESPACE);
6153

@@ -73,7 +65,9 @@ public TaskIterator createTaskIterator(EnrichmentMap map, List<String> genes, Se
7365
return null;
7466
}
7567

76-
QueryGeneManiaTask queryTask = queryGeneManiaTaskFactory.create(genes, leadingEdgeGenes);
68+
69+
70+
QueryGeneManiaTask queryTask = queryGeneManiaTaskFactory.create(map, genes, leadingEdgeRanks);
7771

7872
// Get list of organisms from GeneMANIA
7973
TaskIterator ti = commandExecutorTaskFactory.createTaskIterator(

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/genemania/QueryGeneManiaNodeViewTaskFactory.java

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

3-
import java.util.Collections;
43
import java.util.List;
54

65
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
76
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager;
87
import org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder.Columns;
8+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption;
9+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.RankingOptionFactory;
910
import org.cytoscape.model.CyNetwork;
1011
import org.cytoscape.model.CyNode;
1112
import org.cytoscape.model.CyRow;
@@ -18,9 +19,9 @@
1819

1920
public class QueryGeneManiaNodeViewTaskFactory implements NodeViewTaskFactory {
2021

21-
@Inject private GeneManiaMediator geneManiaMediator;
22+
@Inject private GeneManiaTaskFactory geneManiaTaskFactory;
2223
@Inject private EnrichmentMapManager emManager;
23-
24+
@Inject private RankingOptionFactory rankingOptionFactory;
2425

2526
@Override
2627
public TaskIterator createTaskIterator(View<CyNode> nodeView, CyNetworkView networkView) {
@@ -31,7 +32,10 @@ public TaskIterator createTaskIterator(View<CyNode> nodeView, CyNetworkView netw
3132
CyRow row = network.getRow(node);
3233
List<String> genes = Columns.NODE_GENES.get(row, map.getParams().getAttributePrefix());
3334

34-
return geneManiaMediator.createTaskIterator(map, genes, Collections.emptySet());
35+
List<GSEALeadingEdgeRankingOption> rankOptions = rankingOptionFactory.getGSEADataSetSetRankOptions(map);
36+
37+
TaskIterator tasks = geneManiaTaskFactory.createTaskIterator(map, genes, rankOptions);
38+
return tasks;
3539
}
3640

3741
@Override

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/genemania/QueryGeneManiaTask.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
import java.util.HashMap;
55
import java.util.List;
66
import java.util.Map;
7-
import java.util.Set;
87

8+
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
99
import org.baderlab.csplugins.enrichmentmap.task.tunables.GeneListTunable;
1010
import org.baderlab.csplugins.enrichmentmap.util.TaskUtil;
11+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption;
1112
import org.cytoscape.command.CommandExecutorTaskFactory;
1213
import org.cytoscape.work.AbstractTask;
1314
import org.cytoscape.work.ProvidesTitle;
@@ -50,12 +51,12 @@ public class QueryGeneManiaTask extends AbstractTask {
5051
@Inject private SynchronousTaskManager<?> syncTaskManager;
5152

5253
public static interface Factory {
53-
QueryGeneManiaTask create(List<String> geneList, Set<String> leadingEdge);
54+
QueryGeneManiaTask create(EnrichmentMap map, List<String> geneList, List<GSEALeadingEdgeRankingOption> leadingEdgeRanks);
5455
}
5556

5657
@Inject
57-
public QueryGeneManiaTask(@Assisted List<String> geneList, @Assisted Set<String> leadingEdge) {
58-
this.geneList = new GeneListTunable(geneList, leadingEdge);
58+
public QueryGeneManiaTask(@Assisted EnrichmentMap map, @Assisted List<String> geneList, @Assisted List<GSEALeadingEdgeRankingOption> leadingEdgeRanks) {
59+
this.geneList = new GeneListTunable(map, geneList, leadingEdgeRanks);
5960
this.organisms = new ListSingleSelection<>();
6061
this.weightingMethods = new ListSingleSelection<>(GMWeightingMethod.values());
6162
this.weightingMethods.setSelectedValue(weightingMethods.getPossibleValues().get(0));

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/string/QueryStringNodeViewTaskFactory.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package org.baderlab.csplugins.enrichmentmap.task.string;
22

3-
import java.util.Collections;
43
import java.util.List;
54

65
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
76
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager;
87
import org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder.Columns;
8+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption;
9+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.RankingOptionFactory;
910
import org.cytoscape.model.CyNetwork;
1011
import org.cytoscape.model.CyNode;
1112
import org.cytoscape.model.CyRow;
@@ -18,9 +19,9 @@
1819

1920
public class QueryStringNodeViewTaskFactory implements NodeViewTaskFactory {
2021

21-
@Inject private StringAppMediator stringAppMediator;
22+
@Inject private StringAppTaskFactory stringAppFactory;
2223
@Inject private EnrichmentMapManager emManager;
23-
24+
@Inject private RankingOptionFactory rankingOptionFactory;
2425

2526
@Override
2627
public TaskIterator createTaskIterator(View<CyNode> nodeView, CyNetworkView networkView) {
@@ -31,7 +32,9 @@ public TaskIterator createTaskIterator(View<CyNode> nodeView, CyNetworkView netw
3132
CyRow row = network.getRow(node);
3233
List<String> genes = Columns.NODE_GENES.get(row, map.getParams().getAttributePrefix());
3334

34-
return stringAppMediator.createTaskIterator(map, genes, Collections.emptySet());
35+
List<GSEALeadingEdgeRankingOption> rankOptions = rankingOptionFactory.getGSEADataSetSetRankOptions(map);
36+
37+
return stringAppFactory.createTaskIterator(map, genes, rankOptions);
3538
}
3639

3740
@Override

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/string/QueryStringTask.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import java.util.HashMap;
44
import java.util.List;
55
import java.util.Map;
6-
import java.util.Set;
76

7+
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
88
import org.baderlab.csplugins.enrichmentmap.task.tunables.GeneListTunable;
99
import org.baderlab.csplugins.enrichmentmap.util.TaskUtil;
10+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption;
1011
import org.cytoscape.command.CommandExecutorTaskFactory;
1112
import org.cytoscape.model.CyNetwork;
1213
import org.cytoscape.work.AbstractTask;
@@ -49,12 +50,12 @@ public class QueryStringTask extends AbstractTask {
4950
@Inject private CommandExecutorTaskFactory commandExecutorTaskFactory;
5051

5152
public static interface Factory {
52-
QueryStringTask create(List<String> geneList, Set<String> leadingEdge);
53+
QueryStringTask create(EnrichmentMap map, List<String> geneList, List<GSEALeadingEdgeRankingOption> leadingEdgeRanks);
5354
}
5455

5556
@Inject
56-
public QueryStringTask(@Assisted List<String> geneList, @Assisted Set<String> leadingEdge) {
57-
this.geneList = new GeneListTunable(geneList, leadingEdge);
57+
public QueryStringTask(@Assisted EnrichmentMap map, @Assisted List<String> geneList, @Assisted List<GSEALeadingEdgeRankingOption> leadingEdgeRanks) {
58+
this.geneList = new GeneListTunable(map, geneList, leadingEdgeRanks);
5859
this.organisms = new ListSingleSelection<>();
5960
}
6061

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import java.util.ArrayList;
99
import java.util.Collections;
1010
import java.util.List;
11-
import java.util.Set;
1211

1312
import javax.swing.JFrame;
1413
import javax.swing.JOptionPane;
@@ -17,6 +16,7 @@
1716
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
1817
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager;
1918
import org.baderlab.csplugins.enrichmentmap.util.TaskUtil;
19+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption;
2020
import org.baderlab.csplugins.enrichmentmap.view.util.OpenBrowser;
2121
import org.cytoscape.command.AvailableCommands;
2222
import org.cytoscape.command.CommandExecutorTaskFactory;
@@ -26,14 +26,13 @@
2626
import org.cytoscape.work.TaskIterator;
2727
import org.cytoscape.work.TaskMonitor;
2828
import org.cytoscape.work.json.JSONResult;
29-
import org.cytoscape.work.swing.DialogTaskManager;
3029

3130
import com.google.common.reflect.TypeToken;
3231
import com.google.gson.Gson;
3332
import com.google.inject.Inject;
3433
import com.google.inject.Provider;
3534

36-
public class StringAppMediator {
35+
public class StringAppTaskFactory {
3736

3837
@Inject private QueryStringTask.Factory queryStringTaskFactory;
3938

@@ -43,16 +42,9 @@ public class StringAppMediator {
4342
@Inject private AvailableCommands availableCommands;
4443
@Inject private Provider<JFrame> jFrameProvider;
4544
@Inject private OpenBrowser openBrowser;
46-
@Inject private DialogTaskManager taskManager;
4745

4846

49-
public void runString(EnrichmentMap map, List<String> genes, Set<String> leadingEdgeGenes) {
50-
TaskIterator ti = createTaskIterator(map, genes, leadingEdgeGenes);
51-
taskManager.execute(ti);
52-
}
53-
54-
55-
public TaskIterator createTaskIterator(EnrichmentMap map, List<String> genes, Set<String> leadingEdgeGenes) {
47+
public TaskIterator createTaskIterator(EnrichmentMap map, List<String> genes, List<GSEALeadingEdgeRankingOption> leadingEdgeRanks) {
5648
// Show message to user if STRING App not installed
5749
List<String> commands = availableCommands.getCommands(STRING_NAMESPACE);
5850

@@ -70,7 +62,7 @@ public TaskIterator createTaskIterator(EnrichmentMap map, List<String> genes, Se
7062
return null;
7163
}
7264

73-
QueryStringTask queryTask = queryStringTaskFactory.create(genes, leadingEdgeGenes);
65+
QueryStringTask queryTask = queryStringTaskFactory.create(map, genes, leadingEdgeRanks);
7466

7567
// Get list of organisms from STRING App
7668
TaskIterator ti = commandExecutorTaskFactory.createTaskIterator(

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/tunables/GeneListGUITunableHandler.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
import java.lang.reflect.Field;
44
import java.lang.reflect.Method;
55
import java.util.List;
6-
import java.util.Set;
76

87
import javax.swing.GroupLayout;
98
import javax.swing.JLabel;
109
import javax.swing.JPanel;
1110

11+
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
12+
import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption;
1213
import org.cytoscape.util.swing.LookAndFeelUtil;
1314
import org.cytoscape.work.Tunable;
1415
import org.cytoscape.work.swing.AbstractGUITunableHandler;
@@ -43,10 +44,12 @@ private void init() {
4344
private JPanel createGeneListPanel() {
4445
JLabel title = new JLabel(getDescription());
4546

46-
List<String> genes = getGeneListTunable().getGenes();
47-
Set<String> leadingEdgeGenes = getGeneListTunable().getLeadingEdgeGenes();
47+
GeneListTunable geneListTunable = getGeneListTunable();
48+
EnrichmentMap map = geneListTunable.getEnrichmentMap();
49+
List<String> genes = geneListTunable.getGenes();
50+
List<GSEALeadingEdgeRankingOption> leadingEdgeRanks = geneListTunable.getLeadingEdgeRanks();
4851

49-
checkboxPanel = new GeneListPanel(genes, leadingEdgeGenes);
52+
checkboxPanel = new GeneListPanel(map, genes, leadingEdgeRanks);
5053

5154
JPanel panel = new JPanel();
5255

@@ -73,7 +76,7 @@ private JPanel createGeneListPanel() {
7376
panel.setOpaque(false);
7477
return panel;
7578
}
76-
79+
7780
@Override
7881
public JPanel getJPanel() {
7982
return panel;

0 commit comments

Comments
 (0)