use of org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions 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.EMStyleOptions in project EnrichmentMapApp by BaderLab.
the class CreateEMViewTask method visualizeMap.
private void visualizeMap() {
CyNetwork network = networkManager.getNetwork(map.getNetworkID());
CyNetworkView view = networkViewFactory.createNetworkView(network);
networkViewManager.addNetworkView(view);
//apply force directed layout
CyLayoutAlgorithm layout = layoutManager.getLayout("force-directed");
if (layout == null)
layout = layoutManager.getDefaultLayout();
Task styleTask = applyStyleTaskFactory.create(new EMStyleOptions(view, map), null, false);
TaskIterator layoutTasks = layout.createTaskIterator(view, layout.createLayoutContext(), CyLayoutAlgorithm.ALL_NODE_VIEWS, null);
TaskIterator moreTasks = new TaskIterator();
moreTasks.append(styleTask);
moreTasks.append(layoutTasks);
insertTasksAfterCurrentTask(moreTasks);
}
use of org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method updateVisualStyle.
private void updateVisualStyle(EnrichmentMap map, EMViewControlPanel viewPanel, boolean updateChartOnly) {
EMStyleOptions options = createStyleOptions(map, viewPanel);
CyCustomGraphics2<?> chart = createChart(options);
applyVisualStyle(options, chart, updateChartOnly);
}
use of org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method getAllViewParams.
public Map<Long, ViewParams> getAllViewParams() {
Map<Long, ViewParams> map = new HashMap<>();
getControlPanel().getAllControlPanels().forEach((suid, panel) -> {
CutoffParam cuttofParam = panel.getPValueRadio().isSelected() ? CutoffParam.P_VALUE : CutoffParam.Q_VALUE;
Double pVal = panel.getPValueSliderPanel() != null ? panel.getPValueSliderPanel().getValue() : null;
Double qVal = panel.getQValueSliderPanel() != null ? panel.getQValueSliderPanel().getValue() : null;
Double sCoeff = panel.getSimilaritySliderPanel() != null ? panel.getSimilaritySliderPanel().getValue() : null;
Set<AbstractDataSet> uncheckedDataSets = panel.getUncheckedDataSets();
Set<String> filteredDataSets = uncheckedDataSets.stream().map(AbstractDataSet::getName).collect(Collectors.toSet());
EMStyleOptions options = createStyleOptions(panel.getNetworkView());
boolean pubReady = panel.getPublicationReadyCheck().isSelected();
ViewParams params = new ViewParams(suid, cuttofParam, pVal, qVal, sCoeff, filteredDataSets, options.getChartOptions(), pubReady);
map.put(suid, params);
});
return map;
}
use of org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions in project EnrichmentMapApp by BaderLab.
the class CreateDiseaseSignatureTaskFactory method createTaskIterator.
@Override
public TaskIterator createTaskIterator() {
// Make sure that the minimum information is set in the current set of parameters
EnrichmentMap map = emManager.getEnrichmentMap(netView.getModel().getSUID());
StringBuilder errorBuilder = new StringBuilder();
checkMinimalRequirements(errorBuilder, params);
if (params.getRankTestParameters().getType().isMannWhitney() && map.getAllRanks().isEmpty())
errorBuilder.append("Mann-Whitney requires ranks. \n");
this.errors = errorBuilder.toString();
if (errors.isEmpty()) {
ControlPanelMediator controlPanelMediator = controlPanelMediatorProvider.get();
EMStyleOptions options = controlPanelMediator.createStyleOptions(netView);
CyCustomGraphics2<?> chart = controlPanelMediator.createChart(options);
List<EMDataSet> dataSetList = getDataSets(map);
TaskIterator tasks = new TaskIterator();
tasks.append(signatureTaskFactory.create(params, map, dataSetList));
tasks.append(applyStyleTaskFactory.create(options, chart, false));
return tasks;
} else {
// MKTODO not entirely sure what to do in this case, just return an empty iterator I guess...
return new TaskIterator(new AbstractTask() {
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
throw new RuntimeException(errors);
}
});
}
}
Aggregations