Skip to content

Commit caec0d8

Browse files
committed
Allow building of network from just GMT file. Fixes #254
1 parent 333c155 commit caec0d8

File tree

1 file changed

+17
-6
lines changed
  • EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation

1 file changed

+17
-6
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private void createBody() {
139139
analysisTypeCombo.addItem(new ComboItem<>(Method.Generic, Method.Generic.getLabel()));
140140
analysisTypeCombo.addItem(new ComboItem<>(Method.Specialized, Method.Specialized.getLabel()));
141141
analysisTypeCombo.addActionListener(e -> {
142-
analysisTypeChanged();
142+
updateLabels();
143143
firePropertyChange(PROP_NAME, null, getDisplayName());
144144
});
145145
makeSmall(analysisLabel, analysisTypeCombo);
@@ -150,7 +150,10 @@ private void createBody() {
150150
expressionsText = pathTextFactory.create("Expressions:", FileBrowser.Filter.EXPRESSION);
151151
ranksText = pathTextFactory.create("Ranks:", FileBrowser.Filter.RANK);
152152
classesText = pathTextFactory.create("Classes:", FileBrowser.Filter.CLASS);
153+
153154
classesText.getTextField().getDocument().addDocumentListener(SwingUtil.simpleDocumentListener(this::preFillPhenotypes));
155+
enrichments1Text.getTextField().getDocument().addDocumentListener(SwingUtil.simpleDocumentListener(this::updateLabels));
156+
gmtText.getTextField().getDocument().addDocumentListener(SwingUtil.simpleDocumentListener(this::updateLabels));
154157

155158
enrichments2Text.getLabel().setVisible(false);
156159
enrichments2Text.getTextField().setVisible(false);
@@ -262,13 +265,21 @@ private void createBody() {
262265
}
263266

264267

265-
private void analysisTypeChanged() {
268+
private void updateLabels() {
266269
switch(getMethod()) {
267270
case Generic:
268271
case Specialized:
269-
enrichments1Text.getLabel().setText("* Enrichments:");
270272
enrichments2Text.setVisible(false);
271-
gmtText.getLabel().setText("GMT:");
273+
if(enrichments1Text.isEmpty() == gmtText.isEmpty()) {
274+
enrichments1Text.getLabel().setText("* Enrichments:");
275+
gmtText.getLabel().setText("* GMT:");
276+
} else if(enrichments1Text.isEmpty()) {
277+
enrichments1Text.getLabel().setText("Enrichments:");
278+
gmtText.getLabel().setText("* GMT:");
279+
} else if(gmtText.isEmpty()) {
280+
enrichments1Text.getLabel().setText("* Enrichments:");
281+
gmtText.getLabel().setText("GMT:");
282+
}
272283
break;
273284
case GSEA:
274285
enrichments1Text.getLabel().setText("* Enrichments Pos:");
@@ -298,8 +309,8 @@ public List<Message> validateInput(MasterDetailDialogPage parent) {
298309
List<Message> messages = new ArrayList<>();
299310
if(nameText.isEmpty())
300311
messages.add(Message.error("Name field is empty."));
301-
if(enrichments1Text.isEmpty())
302-
messages.add(Message.error("Enrichments file path is empty."));
312+
if(enrichments1Text.isEmpty() && gmtText.isEmpty())
313+
messages.add(Message.error("Enrichments file or GMT file is required."));
303314
if(!enrichments1Text.emptyOrReadable() && getMethod() == Method.GSEA)
304315
messages.add(Message.error("Enrichments Pos file path is not valid."));
305316
if(!enrichments1Text.emptyOrReadable() && getMethod() != Method.GSEA)

0 commit comments

Comments
 (0)