use of org.baderlab.csplugins.enrichmentmap.style.ChartOptions in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method createStyleOptions.
private EMStyleOptions createStyleOptions(EnrichmentMap map, EMViewControlPanel viewPanel) {
if (map == null || viewPanel == null)
return null;
Set<AbstractDataSet> dataSets = viewPanel.getDataSetSelector().getCheckedItems();
boolean publicationReady = viewPanel.getPublicationReadyCheck().isSelected();
boolean postAnalysis = map.hasSignatureDataSets();
ChartData data = (ChartData) viewPanel.getChartDataCombo().getSelectedItem();
ChartType type = getChartType(viewPanel);
ColorScheme colorScheme = (ColorScheme) viewPanel.getChartColorsCombo().getSelectedItem();
boolean showLabels = viewPanel.getShowChartLabelsCheck().isSelected();
ChartOptions chartOptions = new ChartOptions(data, type, colorScheme, showLabels);
return new EMStyleOptions(viewPanel.getNetworkView(), map, dataSets::contains, chartOptions, postAnalysis, publicationReady);
}
use of org.baderlab.csplugins.enrichmentmap.style.ChartOptions in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method createChart.
public CyCustomGraphics2<?> createChart(EMStyleOptions options) {
CyCustomGraphics2<?> chart = null;
ChartOptions chartOptions = options.getChartOptions();
ChartData data = chartOptions != null ? chartOptions.getData() : null;
if (data != null && data != ChartData.NONE) {
// Ignore Signature Data Sets in charts
Set<EMDataSet> dataSets = filterDataSets(options.getDataSets());
if (dataSets.size() > 1) {
ColumnDescriptor<Double> columnDescriptor = data.getColumnDescriptor();
List<CyColumnIdentifier> columns = ChartUtil.getSortedColumnIdentifiers(options.getAttributePrefix(), dataSets, columnDescriptor, columnIdFactory);
ChartType type = chartOptions.getType();
Map<String, Object> props = new HashMap<>(type.getProperties());
props.put("cy_dataColumns", columns);
List<Double> range = ChartUtil.calculateGlobalRange(options.getNetworkView().getModel(), columns);
props.put("cy_range", range);
props.put("cy_autoRange", false);
props.put("cy_globalRange", true);
props.put("cy_showItemLabels", chartOptions.isShowLabels());
props.put("cy_colors", chartOptions.getColorScheme().getColors());
try {
CyCustomGraphics2Factory<?> factory = chartFactoryManager.getChartFactory(type.getId());
if (factory != null)
chart = factory.getInstance(props);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return chart;
}
use of org.baderlab.csplugins.enrichmentmap.style.ChartOptions in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method reset.
public void reset(ViewParams params) {
long netViewID = params.getNetworkViewID();
invokeOnEDT(() -> {
EMViewControlPanel viewPanel = getControlPanel().getViewControlPanel(netViewID);
if (viewPanel == null)
return;
EnrichmentMap map = emManager.getEnrichmentMap(viewPanel.getNetworkView().getModel().getSUID());
if (map == null)
return;
try {
// Update Filters
if (params.getPValue() != null && viewPanel.getPValueSliderPanel() != null)
viewPanel.getPValueSliderPanel().setValue(params.getPValue());
if (params.getQValue() != null && viewPanel.getQValueSliderPanel() != null)
viewPanel.getQValueSliderPanel().setValue(params.getQValue());
if (params.getSimilarityCoefficient() != null && viewPanel.getSimilaritySliderPanel() != null)
viewPanel.getSimilaritySliderPanel().setValue(params.getSimilarityCoefficient());
if (params.getNodeCutoffParam() == CutoffParam.P_VALUE)
viewPanel.getPValueRadio().doClick();
else if (params.getNodeCutoffParam() == CutoffParam.Q_VALUE)
viewPanel.getQValueRadio().doClick();
Set<String> filteredOutDataSetNames = params.getFilteredOutDataSets();
if (filteredOutDataSetNames != null && !filteredOutDataSetNames.isEmpty()) {
Set<AbstractDataSet> allDataSets = viewPanel.getAllDataSets();
Set<AbstractDataSet> filteredDataSets = allDataSets.stream().filter(ds -> !filteredOutDataSetNames.contains(ds.getName())).collect(Collectors.toSet());
viewPanel.getDataSetSelector().setCheckedItems(filteredDataSets);
}
// Update Style options
ChartOptions chartOptions = params.getChartOptions();
viewPanel.getChartDataCombo().setSelectedItem(chartOptions != null ? chartOptions.getData() : null);
viewPanel.getChartTypeCombo().setSelectedItem(chartOptions != null ? chartOptions.getType() : null);
viewPanel.getChartColorsCombo().setSelectedItem(chartOptions != null ? chartOptions.getColorScheme() : null);
viewPanel.getShowChartLabelsCheck().setSelected(chartOptions != null && chartOptions.isShowLabels());
viewPanel.getPublicationReadyCheck().setSelected(params.isPublicationReady());
viewPanel.updateChartDataCombo();
updateVisualStyle(map, viewPanel);
filterNodesAndEdges(viewPanel, map);
} finally {
updating = false;
}
});
}
Aggregations