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;
}
use of org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet in project EnrichmentMapApp by BaderLab.
the class DataSetSelector method getSelectedItems.
public Set<AbstractDataSet> getSelectedItems() {
Set<AbstractDataSet> set = new HashSet<>();
int[] selectedRows = getTable().getSelectedRows();
for (int r : selectedRows) {
AbstractDataSet ds = (AbstractDataSet) table.getModel().getValueAt(r, NAME_COL_IDX);
set.add(ds);
}
return set;
}
use of org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet in project EnrichmentMapApp by BaderLab.
the class DataSetSelector method updateRemoveButton.
private void updateRemoveButton() {
boolean onlySignatureSelected = true;
int[] selectedRows = getTable().getSelectedRows();
if (selectedRows.length > 0) {
for (int r : selectedRows) {
AbstractDataSet ds = (AbstractDataSet) table.getModel().getValueAt(r, NAME_COL_IDX);
if (ds instanceof EMSignatureDataSet == false) {
onlySignatureSelected = false;
break;
}
}
} else {
onlySignatureSelected = false;
}
getRemoveButton().setEnabled(onlySignatureSelected);
}
use of org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet in project EnrichmentMapApp by BaderLab.
the class DataSetSelector method setCheckedItems.
public void setCheckedItems(Set<AbstractDataSet> newValue) {
final Set<AbstractDataSet> oldValue = getCheckedItems();
checkedItems.clear();
final int rowCount = getTable().getRowCount();
for (int i = 0; i < rowCount; i++) {
AbstractDataSet ds = (AbstractDataSet) getTable().getValueAt(i, NAME_COL_IDX);
boolean checked = newValue != null && newValue.contains(ds);
getTable().setValueAt(checked, i, SELECTED_COL_IDX);
checkedItems.put(ds, checked);
}
getTable().repaint();
updateSelectionButtons();
firePropertyChange("checkedData", oldValue, getCheckedItems());
}
Aggregations