Skip to content

Commit 13f7471

Browse files
committed
Fixes ranks not showing up. Fixes #355
1 parent 3224f19 commit 13f7471

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

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

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ void update(
390390
// MKTODO this wont work if selected item is Class but doesn't exist anymore
391391
getCompressCombo().setSelectedItem(ComboItem.of(params.getCompress()));
392392

393-
selectedRankingOption = getRankOptionFromParams(params);
393+
RankingOption rankingOption = getRankOptionFromParams(params);
394394

395395
// Update the setings panel
396396
optionsPopup.update(params);
@@ -418,7 +418,7 @@ void update(
418418
} catch(IllegalArgumentException e) {}
419419

420420
// Re-compute the ranking
421-
setSelectedRankingOption(selectedRankingOption);
421+
setSelectedRankingOption(rankingOption);
422422
}
423423

424424
protected OptionsPopup getOptionsPopup() {
@@ -472,33 +472,31 @@ public RankingOption getSelectedRankingOption() {
472472
}
473473

474474
public void setSelectedRankingOption(RankingOption newValue) {
475-
if (selectedRankingOption != newValue) {
476-
RankingOption oldValue = selectedRankingOption;
477-
selectedRankingOption = newValue;
478-
List<String> genes = unionGenes; // always use all the genes, fixes #310
479-
480-
HeatMapTableModel tableModel = (HeatMapTableModel) getTable().getModel();
481-
EnrichmentMap map = tableModel.getEnrichmentMap();
482-
List<Integer> geneIds = genes.stream().map(map::getHashFromGene).collect(Collectors.toList());
483-
484-
CompletableFuture<Optional<Map<Integer,RankValue>>> rankingFuture = newValue.computeRanking(geneIds);
485-
486-
if (rankingFuture != null) {
487-
rankingFuture.whenComplete((ranking, ex) -> {
488-
if (ranking.isPresent()) {
489-
tableModel.setRanking(newValue.getName(), ranking.get());
490-
getTable().getColumnModel().getColumn(HeatMapTableModel.RANK_COL).setHeaderValue(newValue);
491-
} else {
492-
tableModel.setRanking(newValue.getName(), null);
493-
getTable().getColumnModel().getColumn(HeatMapTableModel.RANK_COL)
494-
.setHeaderValue(new RankOptionErrorHeader(newValue));
495-
}
496-
getTable().getTableHeader().repaint();
497-
});
498-
}
499-
500-
firePropertyChange("selectedRankingOption", oldValue, newValue);
475+
RankingOption oldValue = selectedRankingOption;
476+
this.selectedRankingOption = newValue;
477+
List<String> genes = unionGenes; // always use all the genes, fixes #310
478+
479+
HeatMapTableModel tableModel = (HeatMapTableModel) getTable().getModel();
480+
EnrichmentMap map = tableModel.getEnrichmentMap();
481+
List<Integer> geneIds = genes.stream().map(map::getHashFromGene).collect(Collectors.toList());
482+
483+
CompletableFuture<Optional<Map<Integer,RankValue>>> rankingFuture = newValue.computeRanking(geneIds);
484+
485+
if (rankingFuture != null) {
486+
rankingFuture.whenComplete((ranking, ex) -> {
487+
if (ranking.isPresent()) {
488+
tableModel.setRanking(newValue.getName(), ranking.get());
489+
getTable().getColumnModel().getColumn(HeatMapTableModel.RANK_COL).setHeaderValue(newValue);
490+
} else {
491+
tableModel.setRanking(newValue.getName(), null);
492+
getTable().getColumnModel().getColumn(HeatMapTableModel.RANK_COL)
493+
.setHeaderValue(new RankOptionErrorHeader(newValue));
494+
}
495+
getTable().getTableHeader().repaint();
496+
});
501497
}
498+
499+
firePropertyChange("selectedRankingOption", oldValue, newValue);
502500
}
503501

504502
List<String> getGenes(Operator operator) {

0 commit comments

Comments
 (0)