1
1
package org .baderlab .csplugins .enrichmentmap .commands ;
2
2
3
- import static org .baderlab .csplugins .enrichmentmap .commands .tunables .CommandUtil .lssFromEnum ;
4
- import static org .baderlab .csplugins .enrichmentmap .style .ChartData .DATA_SET ;
5
- import static org .baderlab .csplugins .enrichmentmap .style .ChartData .EXPRESSION_DATA ;
6
- import static org .baderlab .csplugins .enrichmentmap .style .ChartData .FDR_VALUE ;
7
- import static org .baderlab .csplugins .enrichmentmap .style .ChartData .NES_VALUE ;
8
- import static org .baderlab .csplugins .enrichmentmap .style .ChartData .NONE ;
9
- import static org .baderlab .csplugins .enrichmentmap .style .ChartData .PHENOTYPES ;
10
- import static org .baderlab .csplugins .enrichmentmap .style .ChartData .P_VALUE ;
11
- import static org .baderlab .csplugins .enrichmentmap .style .ChartType .DATASET_PIE ;
12
- import static org .baderlab .csplugins .enrichmentmap .style .ChartType .HEAT_MAP ;
13
- import static org .baderlab .csplugins .enrichmentmap .style .ChartType .HEAT_STRIPS ;
14
- import static org .baderlab .csplugins .enrichmentmap .style .ChartType .RADIAL_HEAT_MAP ;
15
-
16
3
import java .util .Map ;
17
4
5
+ import org .baderlab .csplugins .enrichmentmap .commands .tunables .ChartTunables ;
18
6
import org .baderlab .csplugins .enrichmentmap .commands .tunables .NetworkTunable ;
19
7
import org .baderlab .csplugins .enrichmentmap .model .EnrichmentMap ;
20
8
import org .baderlab .csplugins .enrichmentmap .style .ChartData ;
27
15
import org .cytoscape .work .AbstractTask ;
28
16
import org .cytoscape .work .ContainsTunables ;
29
17
import org .cytoscape .work .TaskMonitor ;
30
- import org .cytoscape .work .Tunable ;
31
- import org .cytoscape .work .util .ListSingleSelection ;
32
18
33
19
import com .google .inject .Inject ;
34
20
@@ -40,24 +26,9 @@ public class ChartCommandTask extends AbstractTask {
40
26
@ ContainsTunables @ Inject
41
27
public NetworkTunable networkTunable ;
42
28
43
- @ Tunable (description = "Sets the chart data to show." )
44
- public ListSingleSelection <String > data ;
45
-
46
- @ Tunable (description = "Sets the chart type." )
47
- public ListSingleSelection <String > type ;
48
-
49
- @ Tunable (description = "Sets the chart colors." )
50
- public ListSingleSelection <String > colors ;
51
-
52
- @ Tunable
53
- public boolean showChartLabels = true ;
54
-
29
+ @ ContainsTunables @ Inject
30
+ public ChartTunables chartTunable ;
55
31
56
- public ChartCommandTask () {
57
- data = lssFromEnum (NES_VALUE , P_VALUE , FDR_VALUE , PHENOTYPES , DATA_SET , EXPRESSION_DATA , NONE ); // want NES to be the default
58
- type = lssFromEnum (RADIAL_HEAT_MAP , HEAT_STRIPS , HEAT_MAP ); // don't include DATASET_PIE
59
- colors = lssFromEnum (ColorScheme .values ());
60
- }
61
32
62
33
@ Override
63
34
public void run (TaskMonitor taskMonitor ) {
@@ -67,9 +38,9 @@ public void run(TaskMonitor taskMonitor) {
67
38
if (networkView == null || map == null )
68
39
throw new IllegalArgumentException ("network is not an EnrichmentMap network" );
69
40
70
- ChartData chartData = ChartData . valueOf ( data . getSelectedValue () );
71
- ChartType chartType = chartData == DATA_SET ? DATASET_PIE : ChartType . valueOf ( type . getSelectedValue () );
72
- ColorScheme colorScheme = ColorScheme . valueOf ( colors . getSelectedValue () );
41
+ ChartData chartData = chartTunable . getChartData ( );
42
+ ChartType chartType = chartTunable . getChartType ( );
43
+ ColorScheme colorScheme = chartTunable . getColorScheme ( );
73
44
74
45
// validate
75
46
if (chartData == ChartData .EXPRESSION_DATA && !networkTunable .isAssociatedEnrichmenMap ())
@@ -81,7 +52,7 @@ public void run(TaskMonitor taskMonitor) {
81
52
if (chartData == ChartData .FDR_VALUE && !map .getParams ().isFDR ())
82
53
throw new IllegalArgumentException ("data=FDR_VALUE cannot be used on this network" );
83
54
84
- ChartOptions options = new ChartOptions (chartData , chartType , colorScheme , showChartLabels );
55
+ ChartOptions options = new ChartOptions (chartData , chartType , colorScheme , chartTunable . showChartLabels () );
85
56
86
57
Map <Long ,ViewParams > viewParamsMap = controlPanelMediator .getAllViewParams ();
87
58
ViewParams params = viewParamsMap .get (networkView .getSUID ());
0 commit comments