Skip to content

Commit a51190b

Browse files
committed
Fixes NPE that prevented the GeneMANIA/String associated panels from being created.
1 parent 541ef73 commit a51190b

File tree

1 file changed

+8
-11
lines changed
  • EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap

1 file changed

+8
-11
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/HeatMapMediator.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ private void disposeContentPanel() {
162162
heatMapPanel.showContentPanel(null);
163163
}
164164

165-
166165
public List<String> getGenes() {
167166
return getContentPanel().getGenes();
168167
}
@@ -508,6 +507,7 @@ private void runGeneMANIA() {
508507
return;
509508
}
510509

510+
EnrichmentMap map = getContentPanel().getEnrichmentMap();
511511
QueryGeneManiaTask queryTask = queryGeneManiaTaskFactory.create(getContentPanel().getGenes());
512512

513513
// Get list of organisms from GeneMANIA
@@ -550,12 +550,12 @@ public void taskFinished(ObservableTask task) {
550550
@Override
551551
public void allFinished(FinishStatus finishStatus) {
552552
if (finishStatus == FinishStatus.getSucceeded())
553-
onGeneManiaQueryFinished(queryTask.getResult(), getContentPanel());
553+
onGeneManiaQueryFinished(queryTask.getResult(), map);
554554
}
555555
});
556556
}
557557

558-
private void onGeneManiaQueryFinished(GMSearchResult res, HeatMapContentPanel contentPanel) {
558+
private void onGeneManiaQueryFinished(GMSearchResult res, EnrichmentMap map) {
559559
CyNetwork net = null;
560560

561561
if (res != null && res.getNetwork() != null && res.getGenes() != null
@@ -565,17 +565,15 @@ private void onGeneManiaQueryFinished(GMSearchResult res, HeatMapContentPanel co
565565
if (net == null) {
566566
invokeOnEDT(() -> {
567567
JOptionPane.showMessageDialog(
568-
SwingUtilities.getWindowAncestor(contentPanel),
568+
SwingUtilities.getWindowAncestor(getContentPanel()),
569569
"The GeneMANIA search returned no results.",
570570
"No Results",
571571
JOptionPane.INFORMATION_MESSAGE
572572
);
573573
});
574574
} else {
575575
// Update the model
576-
EnrichmentMap map = contentPanel.getEnrichmentMap();
577576
map.addAssociatedNetworkID(net.getSUID());
578-
579577
emManager.addAssociatedAppAttributes(net, map, AssociatedApp.GENEMANIA);
580578
// TODO
581579
// // Modify GeneMANIA's style
@@ -604,6 +602,7 @@ private void runString() {
604602
return;
605603
}
606604

605+
EnrichmentMap map = getContentPanel().getEnrichmentMap();
607606
QueryStringTask queryTask = queryStringTaskFactory.create(getContentPanel().getGenes());
608607

609608
// Get list of organisms from STRING App
@@ -646,28 +645,26 @@ public void taskFinished(ObservableTask task) {
646645
@Override
647646
public void allFinished(FinishStatus finishStatus) {
648647
if (finishStatus == FinishStatus.getSucceeded())
649-
onStringQueryFinished(queryTask.getResult(), getContentPanel());
648+
onStringQueryFinished(queryTask.getResult(), map);
650649
}
651650
});
652651
}
653652

654-
private void onStringQueryFinished(Long netId, HeatMapContentPanel contentPanel) {
653+
private void onStringQueryFinished(Long netId, EnrichmentMap map) {
655654
CyNetwork net = netId != null ? networkManager.getNetwork(netId) : null;
656655

657656
if (net == null) {
658657
invokeOnEDT(() -> {
659658
JOptionPane.showMessageDialog(
660-
SwingUtilities.getWindowAncestor(contentPanel),
659+
SwingUtilities.getWindowAncestor(getContentPanel()),
661660
"The STRING protein query returned no results.",
662661
"No Results",
663662
JOptionPane.INFORMATION_MESSAGE
664663
);
665664
});
666665
} else {
667666
// Update the model
668-
EnrichmentMap map = contentPanel.getEnrichmentMap();
669667
map.addAssociatedNetworkID(net.getSUID());
670-
671668
emManager.addAssociatedAppAttributes(net, map, AssociatedApp.STRING);
672669
// TODO
673670
// // Modify GeneMANIA's style

0 commit comments

Comments
 (0)