Search in sources :

Example 1 with EMStyleOptions

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);
}
Also used : EMStyleOptions(org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions) ChartData(org.baderlab.csplugins.enrichmentmap.style.ChartData) AbstractDataSet(org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet) ColorScheme(org.baderlab.csplugins.enrichmentmap.style.ColorScheme) ChartType(org.baderlab.csplugins.enrichmentmap.style.ChartType) ChartOptions(org.baderlab.csplugins.enrichmentmap.style.ChartOptions)

Example 2 with EMStyleOptions

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);
}
Also used : EMStyleOptions(org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions) Task(org.cytoscape.work.Task) AbstractTask(org.cytoscape.work.AbstractTask) TaskIterator(org.cytoscape.work.TaskIterator) CyLayoutAlgorithm(org.cytoscape.view.layout.CyLayoutAlgorithm) CyNetwork(org.cytoscape.model.CyNetwork) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 3 with EMStyleOptions

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);
}
Also used : EMStyleOptions(org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions)

Example 4 with EMStyleOptions

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;
}
Also used : EMStyleOptions(org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions) ViewParams(org.baderlab.csplugins.enrichmentmap.view.control.io.ViewParams) HashMap(java.util.HashMap) AbstractDataSet(org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet) CutoffParam(org.baderlab.csplugins.enrichmentmap.view.control.io.ViewParams.CutoffParam)

Example 5 with EMStyleOptions

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);
            }
        });
    }
}
Also used : EMStyleOptions(org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions) AbstractTask(org.cytoscape.work.AbstractTask) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) ControlPanelMediator(org.baderlab.csplugins.enrichmentmap.view.control.ControlPanelMediator) TaskIterator(org.cytoscape.work.TaskIterator) TaskMonitor(org.cytoscape.work.TaskMonitor) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet)

Aggregations

EMStyleOptions (org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions)5 AbstractDataSet (org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet)2 AbstractTask (org.cytoscape.work.AbstractTask)2 TaskIterator (org.cytoscape.work.TaskIterator)2 HashMap (java.util.HashMap)1 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)1 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)1 ChartData (org.baderlab.csplugins.enrichmentmap.style.ChartData)1 ChartOptions (org.baderlab.csplugins.enrichmentmap.style.ChartOptions)1 ChartType (org.baderlab.csplugins.enrichmentmap.style.ChartType)1 ColorScheme (org.baderlab.csplugins.enrichmentmap.style.ColorScheme)1 ControlPanelMediator (org.baderlab.csplugins.enrichmentmap.view.control.ControlPanelMediator)1 ViewParams (org.baderlab.csplugins.enrichmentmap.view.control.io.ViewParams)1 CutoffParam (org.baderlab.csplugins.enrichmentmap.view.control.io.ViewParams.CutoffParam)1 CyNetwork (org.cytoscape.model.CyNetwork)1 CyLayoutAlgorithm (org.cytoscape.view.layout.CyLayoutAlgorithm)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1 Task (org.cytoscape.work.Task)1 TaskMonitor (org.cytoscape.work.TaskMonitor)1