@@ -113,8 +113,9 @@ public static class Columns {
113
113
114
114
// Multi-edge case
115
115
public static final ColumnDescriptor <String > EDGE_DATASET = new ColumnDescriptor <>("Data Set" , String .class );
116
- public static final String EDGE_DATASET_VALUE_COMPOUND = "compound" ;
116
+ public static final String EDGE_DATASET_VALUE_COMPOUND = "compound" ;
117
117
public static final String EDGE_DATASET_VALUE_SIG = "signature" ; // post-analysis edges
118
+ public static final String EDGE_INTERACTION_VALUE_OVERLAP = "Geneset_Overlap" ;
118
119
public static final String EDGE_INTERACTION_VALUE_SIG = "sig" ; // post-analysis edges
119
120
public static final ColumnDescriptor <String > EDGE_SIG_DATASET = new ColumnDescriptor <>("Signature Set" , String .class );
120
121
@@ -265,8 +266,11 @@ private void setEdgePaint(VisualStyle vs, EMStyleOptions options) {
265
266
}
266
267
267
268
private DiscreteMapping <String , Paint > createEdgeColorMapping (EMStyleOptions options , VisualProperty <Paint > vp ) {
268
- String prefix = options .getAttributePrefix ();
269
- String col = Columns .EDGE_DATASET .with (prefix , null );
269
+ int dataSetCount = options .getEnrichmentMap ().getDataSetCount ();
270
+ boolean distinctEdges = options .getEnrichmentMap ().getParams ().getCreateDistinctEdges ();
271
+
272
+ String col = (dataSetCount > 1 && distinctEdges ) ?
273
+ Columns .EDGE_DATASET .with (options .getAttributePrefix (), null ) : CyEdge .INTERACTION ;
270
274
271
275
DiscreteMapping <String , Paint > dm = (DiscreteMapping <String , Paint >) dmFactory
272
276
.createVisualMappingFunction (col , String .class , vp );
@@ -278,28 +282,33 @@ private DiscreteMapping<String, Paint> createEdgeColorMapping(EMStyleOptions opt
278
282
eventHelper .silenceEventSource (dm );
279
283
280
284
try {
281
- dm .putMapValue (Columns .EDGE_DATASET_VALUE_COMPOUND , Colors .COMPOUND_EDGE_COLOR );
282
- // dm.putMapValue(Columns.EDGE_DATASET_VALUE_SIG, Colors.SIG_EDGE_COLOR);
283
-
284
- List <EMDataSet > dataSets = options .getEnrichmentMap ().getDataSetList ();
285
- final ColorBrewer colorBrewer ;
286
-
287
- // Try colorblind and/or print friendly colours first
288
- if (dataSets .size () <= 4 ) // Try a colorblind safe color scheme first
289
- colorBrewer = ColorBrewer .Paired ; // http://colorbrewer2.org/#type=qualitative&scheme=Paired&n=4
290
- else if (dataSets .size () <= 5 ) // Same--more than 5, it adds a RED that can be confused with the edge selection color
291
- colorBrewer = ColorBrewer .Paired ; // http://colorbrewer2.org/#type=qualitative&scheme=Paired&n=5
292
- else
293
- colorBrewer = ColorBrewer .Set3 ; // http://colorbrewer2.org/#type=qualitative&scheme=Set3&n=12
285
+ if (dataSetCount > 1 && distinctEdges ) {
286
+ List <EMDataSet > dataSets = options .getEnrichmentMap ().getDataSetList ();
287
+ final ColorBrewer colorBrewer ;
294
288
295
- Color [] colors = colorBrewer .getColorPalette (dataSets .size ());
296
-
297
- // Do not use the filtered data sets here, because we don't want edge colours changing when filtering
298
- for (int i = 0 ; i < dataSets .size (); i ++) {
299
- EMDataSet ds = dataSets .get (i );
300
- Color color = colors [i ];
301
- dm .putMapValue (ds .getName (), color );
302
- ds .setColor (color );
289
+ // Try colorblind and/or print friendly colours first
290
+ if (dataSets .size () <= 4 ) // Try a colorblind safe color scheme first
291
+ colorBrewer = ColorBrewer .Paired ; // http://colorbrewer2.org/#type=qualitative&scheme=Paired&n=4
292
+ else if (dataSets .size () <= 5 ) // Same--more than 5, it adds a RED that can be confused with the edge selection color
293
+ colorBrewer = ColorBrewer .Paired ; // http://colorbrewer2.org/#type=qualitative&scheme=Paired&n=5
294
+ else
295
+ colorBrewer = ColorBrewer .Set3 ; // http://colorbrewer2.org/#type=qualitative&scheme=Set3&n=12
296
+
297
+ Color [] colors = colorBrewer .getColorPalette (dataSets .size ());
298
+
299
+ // Do not use the filtered data sets here, because we don't want edge colours changing when filtering
300
+ for (int i = 0 ; i < dataSets .size (); i ++) {
301
+ EMDataSet ds = dataSets .get (i );
302
+ Color color = colors [i ];
303
+ dm .putMapValue (ds .getName (), color );
304
+ ds .setColor (color );
305
+ }
306
+ } else {
307
+ Color overlapColor = distinctEdges ?
308
+ ColorBrewer .Paired .getColorPalette (1 )[0 ] : Colors .COMPOUND_EDGE_COLOR ;
309
+
310
+ dm .putMapValue (Columns .EDGE_INTERACTION_VALUE_OVERLAP , overlapColor );
311
+ dm .putMapValue (Columns .EDGE_INTERACTION_VALUE_SIG , Colors .SIG_EDGE_COLOR );
303
312
}
304
313
} finally {
305
314
eventHelper .unsilenceEventSource (dm );
0 commit comments