Skip to content

Commit fac4958

Browse files
committed
Clean up genemania dialog. Refs #377
1 parent d4bdd50 commit fac4958

File tree

6 files changed

+43
-51
lines changed

6 files changed

+43
-51
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/LoadEnrichmentsFromGenemaniaTask.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void run(TaskMonitor tm) {
5757
tm.setProgress(0.7);
5858

5959
createDataSet(genemaniaNetwork, geneSets, annotations);
60+
dataset.getMap().getParams().setFDR(true);
6061

6162
tm.setProgress(1.0);
6263
}

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/CutoffPropertiesPanel.java

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class CutoffPropertiesPanel extends JPanel {
4646

4747
// node filtering
4848
private JCheckBox filterGenesCheckbox;
49+
private JLabel filterGenesLabel;
4950
private JFormattedTextField qvalueText;
5051
private JLabel pvalueLabel;
5152
private JFormattedTextField pvalueText;
@@ -61,6 +62,7 @@ public class CutoffPropertiesPanel extends JPanel {
6162
// edge filtering
6263
private JFormattedTextField similarityCutoffText;
6364
private JComboBox<ComboItem<SimilarityMetric>> cutoffMetricCombo;
65+
private JLabel edgeStrategyLabel;
6466
private JComboBox<ComboItem<EdgeStrategy>> edgeStrategyCombo;
6567
private CombinedConstantSlider combinedConstantSlider;
6668
private SimilaritySlider similaritySlider;
@@ -70,6 +72,8 @@ public class CutoffPropertiesPanel extends JPanel {
7072
private JCheckBox notationCheckBox;
7173
private JCheckBox advancedCheckBox;
7274

75+
private boolean isGenemania;
76+
7377
private final List<Pair<SimilarityMetric, Double>> sliderTicks = Arrays.asList(
7478
Pair.of(SimilarityMetric.JACCARD, 0.35),
7579
Pair.of(SimilarityMetric.JACCARD, 0.25),
@@ -90,6 +94,11 @@ private Map<SimilarityMetric,Double> initialCutoffValues() {
9094
return values;
9195
}
9296

97+
public void setGeneMania() {
98+
this.isGenemania = true;
99+
updateVisibility();
100+
similaritySlider.setTick(1);
101+
}
93102

94103
@AfterInjection
95104
public void createContents() {
@@ -108,11 +117,9 @@ public void createContents() {
108117
});
109118

110119
advancedCheckBox = new JCheckBox("Show Advanced Options");
111-
advancedCheckBox.addActionListener(e ->
112-
showAdvancedOptions(advancedCheckBox.isSelected())
113-
);
120+
advancedCheckBox.addActionListener(e -> updateVisibility());
114121

115-
showAdvancedOptions(false);
122+
updateVisibility();
116123

117124
SwingUtil.makeSmall(notationCheckBox, advancedCheckBox);
118125

@@ -150,7 +157,7 @@ private JPanel createFilterNodesPanel() {
150157
panel.setBorder(LookAndFeelUtil.createTitledBorder("Number of Nodes (gene-set filtering)"));
151158

152159

153-
JLabel filterGenesLabel = new JLabel("Filter genes by expressions:");
160+
filterGenesLabel = new JLabel("Filter genes by expressions:");
154161
JLabel qvalueLabel = new JLabel("FDR q-value cutoff:");
155162
pvalueLabel = new JLabel("p-value cutoff:");
156163
nesFilterLabel = new JLabel("NES (GSEA only):");
@@ -309,12 +316,12 @@ private JPanel createFilterEdgesPanel() {
309316

310317

311318
private JPanel createFilterEdgesPanel_Top() {
312-
JLabel edgesLabel = new JLabel("Data Set Edges:");
319+
edgeStrategyLabel = new JLabel("Data Set Edges:");
313320
edgeStrategyCombo = new JComboBox<>();
314321
edgeStrategyCombo.addItem(new ComboItem<>(EdgeStrategy.AUTOMATIC, "Automatic"));
315322
edgeStrategyCombo.addItem(new ComboItem<>(EdgeStrategy.DISTINCT, "Separate edge for each data set (denser)"));
316323
edgeStrategyCombo.addItem(new ComboItem<>(EdgeStrategy.COMPOUND, "Combine edges across data sets (sparser)"));
317-
SwingUtil.makeSmall(edgeStrategyCombo, edgesLabel);
324+
SwingUtil.makeSmall(edgeStrategyCombo, edgeStrategyLabel);
318325

319326
JPanel panel = new JPanel();
320327
final GroupLayout layout = new GroupLayout(panel);
@@ -324,12 +331,12 @@ private JPanel createFilterEdgesPanel_Top() {
324331

325332
layout.setHorizontalGroup(
326333
layout.createSequentialGroup()
327-
.addComponent(edgesLabel)
334+
.addComponent(edgeStrategyLabel)
328335
.addComponent(edgeStrategyCombo)
329336
);
330337
layout.setVerticalGroup(
331338
layout.createParallelGroup(Alignment.BASELINE)
332-
.addComponent(edgesLabel)
339+
.addComponent(edgeStrategyLabel)
333340
.addComponent(edgeStrategyCombo)
334341
);
335342

@@ -472,17 +479,23 @@ public void reset() {
472479
}
473480

474481

475-
private void showAdvancedOptions(boolean show) {
476-
pvalueLabel.setVisible(show);
477-
pvalueText.setVisible(show);
478-
nesFilterLabel.setVisible(show);
479-
nesFilterCombo.setVisible(show);
480-
minExperimentsLabel.setVisible(show);
481-
minExperimentsText.setVisible(show);
482-
shouldFilterMinLabel.setVisible(show);
483-
shouldFilterMinCheckbox.setVisible(show);
484-
parseBaderlabLabel.setVisible(show);
485-
parseBaderlabCheckbox.setVisible(show);
482+
private void updateVisibility() {
483+
boolean show = advancedCheckBox.isSelected();
484+
pvalueLabel.setVisible(show && !isGenemania);
485+
pvalueText.setVisible(show && !isGenemania);
486+
nesFilterLabel.setVisible(show && !isGenemania);
487+
nesFilterCombo.setVisible(show && !isGenemania);
488+
minExperimentsLabel.setVisible(show && !isGenemania);
489+
minExperimentsText.setVisible(show && !isGenemania);
490+
shouldFilterMinLabel.setVisible(show && !isGenemania);
491+
shouldFilterMinCheckbox.setVisible(show && !isGenemania);
492+
parseBaderlabLabel.setVisible(show && !isGenemania);
493+
parseBaderlabCheckbox.setVisible(show && !isGenemania);
494+
495+
filterGenesCheckbox.setVisible(!isGenemania);
496+
filterGenesLabel.setVisible(!isGenemania);
497+
edgeStrategyLabel.setVisible(!isGenemania);
498+
edgeStrategyCombo.setVisible(!isGenemania);
486499

487500
CardLayout cardLayout = (CardLayout)cardPanel.getLayout();
488501
cardLayout.show(cardPanel, show ? "advanced" : "simple");

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/SimilaritySlider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public SimilaritySlider(List<Pair<SimilarityMetric, Double>> cutoffs, int defaul
4343
add(slider, BorderLayout.SOUTH);
4444
}
4545

46+
public void setTick(int tick) {
47+
slider.setValue(tick);
48+
}
4649

4750
public Pair<SimilarityMetric,Double> getTickValue() {
4851
return cutoffs.get(slider.getValue()-1);

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/genemania/GenemaniaDialogPage.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.util.Collections;
66
import java.util.List;
77

8-
import javax.swing.JLabel;
98
import javax.swing.JOptionPane;
109
import javax.swing.JPanel;
1110

@@ -57,20 +56,17 @@ private String getOrganismName() {
5756
@Override
5857
public JPanel createBodyPanel(CardDialogCallback callback) {
5958
this.callback = callback;
59+
cutoffPanel.setGeneMania();
6060

6161
// Assume GenemaniaDialogShowAction did its job of validating the current network.
6262
genemaniaNetwork = applicationManager.getCurrentNetwork();
6363

6464
networkNamePanel = new NamePanel("Network Name");
65-
66-
String name = genemaniaNetwork.getRow(genemaniaNetwork).get(CyNetwork.NAME, String.class);
67-
String text = "Create an EnrichmentMap network from the Genemania network '" + name + "'?";
68-
JLabel label = new JLabel(text);
65+
networkNamePanel.setAutomaticName(getOrganismName());
6966

7067
JPanel panel = new JPanel(new GridBagLayout());
71-
panel.add(label, GBCFactory.grid(0,0).insets(0).weightx(1.0).fill(GridBagConstraints.HORIZONTAL).get());
72-
panel.add(networkNamePanel, GBCFactory.grid(0,1).insets(0).weightx(1.0).fill(GridBagConstraints.HORIZONTAL).get());
73-
panel.add(cutoffPanel, GBCFactory.grid(0,2).insets(0).weightx(1.0).fill(GridBagConstraints.HORIZONTAL).get());
68+
panel.add(networkNamePanel, GBCFactory.grid(0,0).insets(0).weightx(1.0).fill(GridBagConstraints.HORIZONTAL).get());
69+
panel.add(cutoffPanel, GBCFactory.grid(0,1).insets(0).weightx(1.0).fill(GridBagConstraints.HORIZONTAL).get());
7470
return panel;
7571
}
7672

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/genemania/GenemaniaDialogParameters.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public List<CardDialogPage> getPages() {
3131

3232
@Override
3333
public Dimension getPreferredSize() {
34-
return new Dimension(820, 700);
34+
return new Dimension(820, 320);
3535
}
3636

3737
@Override
3838
public Dimension getMinimumSize() {
39-
return new Dimension(650, 550);
39+
return new Dimension(650, 320);
4040
}
4141

4242
@Override

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/genemania/GenemaniaDialogShowAction.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,9 @@ public void showDialog() {
4343
showNotGenemaniaNetworkError();
4444
return;
4545
}
46-
47-
// String networkName = network.getRow(network).get(CyNetwork.NAME, String.class);
48-
// boolean confirm = showConfirmDialog(networkName);
49-
// if(confirm) {
50-
// createEMNetworkFrom(network);
51-
// }
5246
super.showDialog();
5347
}
5448

55-
// private boolean showConfirmDialog(String networkName) {
56-
// int r = JOptionPane.showConfirmDialog(jframeProvider.get(),
57-
// "Create an EnrichmentMap network from the Genemania network '" + networkName + "'?",
58-
// "EnrichmentMap: Create from Genemania",
59-
// JOptionPane.OK_CANCEL_OPTION);
60-
// return r == JOptionPane.OK_OPTION;
61-
// }
62-
6349
private void showNoNetworkError() {
6450
JOptionPane.showMessageDialog(jframeProvider.get(),
6551
"Please select a network first.",
@@ -74,11 +60,6 @@ private void showNotGenemaniaNetworkError() {
7460
JOptionPane.ERROR_MESSAGE);
7561
}
7662

77-
// private void createEMNetworkFrom(CyNetwork genemaniaNetwork) {
78-
//
79-
//
80-
// }
81-
8263
private boolean hasRequiredData(CyNetwork network) {
8364
CyTable table = network.getDefaultNetworkTable();
8465

@@ -100,8 +81,6 @@ private boolean hasRequiredData(CyNetwork network) {
10081
List<GenemaniaAnnotation> fromJson = gson.fromJson(jsonString, listType);
10182
if(fromJson == null || fromJson.isEmpty()) {
10283
return false;
103-
} else {
104-
System.out.println("found it: " + fromJson.get(0));
10584
}
10685
} catch(JsonParseException e) {
10786
return false;

0 commit comments

Comments
 (0)