use of org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet 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.model.AbstractDataSet in project EnrichmentMapApp by BaderLab.
the class DataSetSelector method update.
public void update() {
Map<AbstractDataSet, Boolean> oldCheckedItems = new HashMap<>(checkedItems);
items.clear();
checkedItems.clear();
List<AbstractDataSet> newItems = new ArrayList<>();
newItems.addAll(map.getDataSetList());
newItems.addAll(map.getSignatureSetList());
if (newItems != null) {
for (AbstractDataSet ds : newItems) {
items.add(ds);
boolean selected = // New items are selected by default!
!oldCheckedItems.containsKey(ds) || oldCheckedItems.get(ds) == Boolean.TRUE;
checkedItems.put(ds, selected);
}
}
updateTable();
updateSelectionButtons();
updateRemoveButton();
}
use of org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet in project EnrichmentMapApp by BaderLab.
the class DataSetSelector method updateTable.
private void updateTable() {
final Object[][] data = new Object[items.size()][HEARDER_NAMES.length];
int i = 0;
for (AbstractDataSet ds : items) {
data[i][SELECTED_COL_IDX] = checkedItems.get(ds);
data[i][TYPE_COL_IDX] = ds;
data[i][NAME_COL_IDX] = ds;
data[i][GENES_COL_IDX] = ds.getGeneSetsOfInterest().size();
i++;
}
final DefaultTableModel model = new DefaultTableModel(data, HEARDER_NAMES) {
@Override
public boolean isCellEditable(int row, int column) {
// TODO Allow renaming?
return false;
}
};
getTable().setModel(model);
JCheckBox tmpField = new JCheckBox();
makeSmall(tmpField);
getTable().getColumnModel().getColumn(TYPE_COL_IDX).setMaxWidth(16);
getTable().getColumnModel().getColumn(SELECTED_COL_IDX).setMaxWidth(tmpField.getPreferredSize().width);
getTable().getColumnModel().getColumn(GENES_COL_IDX).setMaxWidth(48);
getTable().getColumnModel().getColumn(TYPE_COL_IDX).setResizable(false);
getTable().getColumnModel().getColumn(SELECTED_COL_IDX).setResizable(false);
}
use of org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet 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;
}
});
}
use of org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet 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;
}
Aggregations