Skip to content

Commit ae4b9bc

Browse files
committed
Support -log10(pval)*sign(NES) in PDF export
1 parent 1cd87e1 commit ae4b9bc

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,19 @@ public void run(TaskMonitor taskMonitor) throws IOException, DocumentException {
7070

7171

7272
private List<Element> createNodeColorSection(PdfWriter writer) throws DocumentException {
73-
// ColorLegendPanel colorPanel = content.getNodeColorLegend();
74-
// if(colorPanel == null)
75-
// return null;
76-
// Paragraph title = new Paragraph(new Chunk(LegendContent.NODE_COLOR_HEADER));
77-
// Paragraph body = new Paragraph();
78-
// body.add(createNodeColor(writer, colorPanel));
79-
// return Arrays.asList(title, body);
80-
return null;
73+
ColorLegendPanel posColorPanel = content.getNodePosLegend();
74+
ColorLegendPanel negColorPanel = content.getNodeNegLegend();
75+
if(posColorPanel == null)
76+
return null;
77+
78+
String colName = content.getNodeColorMappingColName();
79+
Paragraph title = new Paragraph(new Chunk(LegendContent.NODE_COLOR_HEADER + ": " + colName));
80+
Paragraph body = new Paragraph();
81+
body.add(createNodeColor(writer, posColorPanel));
82+
if(negColorPanel != null)
83+
body.add(createNodeColor(writer, negColorPanel));
84+
85+
return Arrays.asList(title, body);
8186
}
8287

8388
private static Image createNodeColor(PdfWriter writer, ColorLegendPanel colorPanel) throws DocumentException {

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
public interface LegendContent {
1212

13-
public static final String NODE_COLOR_HEADER = "Node Fill Color: Phenotype * (1-P_value)";
13+
public static final String NODE_COLOR_HEADER = "Node Fill Color";
1414
public static final String NODE_CHART_HEADER = "Node Charts";
1515
public static final String NODE_SHAPE_HEADER = "Node Shape";
1616
public static final String NODE_CHART_COLOR_HEADER = "Node Chart Colors";
@@ -20,25 +20,27 @@ public interface LegendContent {
2020
public static final int LEGEND_ICON_SIZE = 18;
2121

2222

23-
public JFreeChart getChart();
23+
JFreeChart getChart();
2424

25-
public String getChartLabel();
25+
String getChartLabel();
2626

27-
public Icon getGeneSetNodeShape();
27+
Icon getGeneSetNodeShape();
2828

29-
public Icon getSignatureNodeShape();
29+
Icon getSignatureNodeShape();
3030

31-
public ColorLegendPanel getNodePosLegend();
31+
ColorLegendPanel getNodePosLegend();
3232

33-
public ColorLegendPanel getNodeNegLegend();
33+
ColorLegendPanel getNodeNegLegend();
3434

35-
public ColorLegendPanel getChartPosLegend();
35+
String getNodeColorMappingColName();
3636

37-
public ColorLegendPanel getChartNegLegend();
37+
ColorLegendPanel getChartPosLegend();
3838

39-
public Map<Object,Paint> getEdgeColors();
39+
ColorLegendPanel getChartNegLegend();
4040

41-
public Map<Object,Paint> getDataSetColors();
41+
Map<Object,Paint> getEdgeColors();
4242

43-
public EMStyleOptions getOptions();
43+
Map<Object,Paint> getDataSetColors();
44+
45+
EMStyleOptions getOptions();
4446
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ public ColorLegendPanel getNodeNegLegend() {
188188
return nodeNegLegend;
189189
}
190190

191+
@Override
192+
public String getNodeColorMappingColName() {
193+
return EMStyleBuilder.getDefaultMappingColumn(options).getBaseName();
194+
}
195+
191196
@Override
192197
public JFreeChart getChart() {
193198
return chart;

0 commit comments

Comments
 (0)