|
8 | 8 |
|
9 | 9 | import java.awt.BorderLayout;
|
10 | 10 | import java.awt.CardLayout;
|
| 11 | +import java.awt.GridBagConstraints; |
11 | 12 | import java.awt.GridBagLayout;
|
12 | 13 | import java.awt.event.ActionListener;
|
13 | 14 | import java.text.DecimalFormat;
|
@@ -79,6 +80,8 @@ public class PAWeightPanel extends JPanel {
|
79 | 80 | private JRadioButton userDefinedRadioButton;
|
80 | 81 | private JFormattedTextField universeSelectionTextField;
|
81 | 82 |
|
| 83 | + private JRadioButton hyperIntersectButton; |
| 84 | + |
82 | 85 | private JLabel iconLabel;
|
83 | 86 | private JLabel warnLabel;
|
84 | 87 |
|
@@ -133,7 +136,7 @@ private void createContents() {
|
133 | 136 | .addComponent(title)
|
134 | 137 | .addGroup(layout.createSequentialGroup()
|
135 | 138 | .addComponent(selectPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
|
136 |
| - .addComponent(cardPanel, 300, 300, 300) |
| 139 | + .addComponent(cardPanel, 450, 450, 450) |
137 | 140 | )
|
138 | 141 | );
|
139 | 142 | layout.setVerticalGroup(layout.createSequentialGroup()
|
@@ -327,6 +330,50 @@ else if(filterType.isMannWhitney())
|
327 | 330 |
|
328 | 331 |
|
329 | 332 | private JPanel createHypergeomCard() {
|
| 333 | + JPanel universePanel = createHypergeomUniversePanel(); |
| 334 | + JPanel samplePanel = createHypergeomSamplePanel(); |
| 335 | + |
| 336 | + JPanel panel = new JPanel(new GridBagLayout()); |
| 337 | + panel.add(universePanel, GBCFactory.grid(0,0).weightx(.5).fill(GridBagConstraints.BOTH).get()); |
| 338 | + panel.add(samplePanel, GBCFactory.grid(1,0).weightx(.5).fill(GridBagConstraints.BOTH).get()); |
| 339 | + panel.setOpaque(false); |
| 340 | + return panel; |
| 341 | + } |
| 342 | + |
| 343 | + private JPanel createHypergeomSamplePanel() { |
| 344 | + hyperIntersectButton = new JRadioButton("Intersection"); |
| 345 | + JRadioButton hyperSigButton = new JRadioButton("Signature gene set"); |
| 346 | + makeSmall(hyperSigButton, hyperIntersectButton); |
| 347 | + |
| 348 | + ButtonGroup buttonGroup = new ButtonGroup(); |
| 349 | + buttonGroup.add(hyperSigButton); |
| 350 | + buttonGroup.add(hyperIntersectButton); |
| 351 | + hyperIntersectButton.setSelected(true); |
| 352 | + |
| 353 | + JPanel panel = new JPanel(); |
| 354 | + panel.setBorder(LookAndFeelUtil.createTitledBorder("Genes in sample (n)")); |
| 355 | + |
| 356 | + final GroupLayout layout = new GroupLayout(panel); |
| 357 | + panel.setLayout(layout); |
| 358 | + layout.setAutoCreateContainerGaps(true); |
| 359 | + layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF()); |
| 360 | + |
| 361 | + layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING, true) |
| 362 | + .addComponent(hyperIntersectButton) |
| 363 | + .addComponent(hyperSigButton) |
| 364 | + ); |
| 365 | + layout.setVerticalGroup(layout.createSequentialGroup() |
| 366 | + .addComponent(hyperIntersectButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE) |
| 367 | + .addComponent(hyperSigButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE) |
| 368 | + ); |
| 369 | + |
| 370 | + if (LookAndFeelUtil.isAquaLAF()) |
| 371 | + panel.setOpaque(false); |
| 372 | + |
| 373 | + return panel; |
| 374 | + } |
| 375 | + |
| 376 | + private JPanel createHypergeomUniversePanel() { |
330 | 377 | ActionListener universeSelectActionListener = e -> {
|
331 | 378 | boolean enable = e.getActionCommand().equals("User Defined");
|
332 | 379 | universeSelectionTextField.setEnabled(enable);
|
@@ -382,7 +429,7 @@ private JPanel createHypergeomCard() {
|
382 | 429 | makeSmall(gmtRadioButton, expressionSetRadioButton, intersectionRadioButton, userDefinedRadioButton, universeSelectionTextField);
|
383 | 430 |
|
384 | 431 | JPanel panel = new JPanel();
|
385 |
| - panel.setBorder(LookAndFeelUtil.createTitledBorder("Advanced Hypergeometric Universe")); |
| 432 | + panel.setBorder(LookAndFeelUtil.createTitledBorder("Hypergeometric Universe")); |
386 | 433 |
|
387 | 434 | final GroupLayout layout = new GroupLayout(panel);
|
388 | 435 | panel.setLayout(layout);
|
@@ -610,7 +657,12 @@ public FilterMetric createFilterMetric(String dataset) {
|
610 | 657 | case HYPERGEOM:
|
611 | 658 | UniverseType universeType = getUniverseType();
|
612 | 659 | int universe = universeType.getGeneUniverse(map, dataset, getUserDefinedUniverseSize());
|
613 |
| - return new FilterMetric.Hypergeom(value, universe); |
| 660 | + FilterMetric.Hypergeom hyperFilterMetric = new FilterMetric.Hypergeom(value, universe); |
| 661 | + if(hyperIntersectButton.isSelected()) { |
| 662 | + Set<Integer> universeGenes = map.getAllEnrichmentGenes(); |
| 663 | + hyperFilterMetric.setUniverseFilter(universeGenes); |
| 664 | + } |
| 665 | + return hyperFilterMetric; |
614 | 666 | case MANN_WHIT_TWO_SIDED:
|
615 | 667 | case MANN_WHIT_GREATER:
|
616 | 668 | case MANN_WHIT_LESS:
|
|
0 commit comments