Skip to content

Commit ce03605

Browse files
committed
Fix p-value colors going in wrong direction.
Refs #452
1 parent 725b3a7 commit ce03605

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/EMStyleBuilder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ public static NodeShape getDefaultNodeShape(ChartType chartType) {
198198

199199

200200
public void updateStyle(VisualStyle vs, EMStyleOptions options, CyCustomGraphics2<?> chart, StyleUpdateScope scope) {
201-
System.out.println("EMStyleBuilder.updateStyle(): " + scope);
202201
String chartName = chart != null ? chart.getDisplayName() : null;
203202
ChartType chartType = ChartType.toChartType(chartName);
204203

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/ApplyEMStyleTask.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,13 @@ public CyCustomGraphics2<?> createChart() {
261261

262262
ColorScheme colorScheme = chartOptions != null ? chartOptions.getColorScheme() : null;
263263

264-
if (colorScheme != null && colorScheme.getPoints() != null) {
265-
List<Double> points = colorScheme.getPoints();
266-
267-
if (!points.isEmpty())
268-
props.put(AbstractChart.COLOR_POINTS, points);
269-
}
264+
if (colorScheme != null && !colorScheme.getPoints().isEmpty()) {
265+
props.put(AbstractChart.COLOR_POINTS, colorScheme.getPoints());
266+
}
270267
}
268+
271269
try {
272270
CyCustomGraphics2Factory<?> factory = chartFactoryManager.getChartFactory(type.getId());
273-
274271
if (factory != null)
275272
chart = factory.getInstance(props);
276273
} catch (Exception e) {

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/legend/LegendPanel.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,16 @@ private void updateNodeChartColorPanel(Collection<EMDataSet> dataSets) {
325325
double max = range.get(1);
326326

327327
String posMaxLabel = max > 0 ? String.format("%.2f", max) : "N/A";
328-
Color posMaxColor = colors.get(0);
329-
Color posMinColor = colors.get(colors.size()/2);
328+
Color posMaxColor;
329+
Color posMinColor;
330+
if(data == ChartData.NES_VALUE) {
331+
posMaxColor = colors.get(0);
332+
posMinColor = colors.get(colors.size()/2);
333+
} else {
334+
posMaxColor = colors.get(colors.size()/2);
335+
posMinColor = colors.get(0);
336+
}
337+
330338
chartPosLegend = new ColorLegendPanel(posMaxColor, posMinColor, posMaxLabel, "0", false);
331339
JLabel posLabel = new JLabel("Positive");
332340
SwingUtil.makeSmall(posLabel);

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/ChartUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public static List<Color> getChartColors(ChartOptions options, boolean forStyle)
147147
// The 3-color schemes need to be swapped when the chart only includes positive numbers.
148148
// Swap UP and ZERO colors if q or p-value (it should not have negative values!)
149149
if ((data == ChartData.FDR_VALUE || data == ChartData.P_VALUE) && colors.size() == 3)
150-
colors = Arrays.asList(colors.get(1), colors.get(0), colors.get(1));
150+
colors = Arrays.asList(colors.get(0), colors.get(1));
151151
}
152152

153153
return colors;

0 commit comments

Comments
 (0)