use of org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap 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.EnrichmentMap in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method createStyleOptions.
public EMStyleOptions createStyleOptions(CyNetworkView netView) {
EnrichmentMap map = netView != null ? emManager.getEnrichmentMap(netView.getModel().getSUID()) : null;
EMViewControlPanel viewPanel = getControlPanel().getViewControlPanel(netView);
return createStyleOptions(map, viewPanel);
}
use of org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap in project EnrichmentMapApp by BaderLab.
the class LegendPanel method update.
/**
* Update parameters panel based on given enrichment map parameters
* @param chartType
*/
void update(EMStyleOptions options, Collection<EMDataSet> filteredDataSets) {
this.options = options;
CyNetworkView networkView = options != null ? options.getNetworkView() : null;
removeAll();
EnrichmentMap map = networkView != null ? emManager.getEnrichmentMap(networkView.getModel().getSUID()) : null;
EMCreationParameters params = map != null ? map.getParams() : null;
if (params == null) {
JLabel infoLabel = new JLabel("No EnrichmentMap View selected");
infoLabel.setEnabled(false);
infoLabel.setForeground(UIManager.getColor("Label.disabledForeground"));
infoLabel.setHorizontalAlignment(JLabel.CENTER);
infoLabel.setVerticalAlignment(JLabel.CENTER);
infoLabel.setBorder(new EmptyBorder(120, 40, 120, 40));
add(infoLabel, BorderLayout.CENTER);
} else {
nodeLegendPanel = null;
nodeColorPanel = null;
nodeShapePanel = null;
nodeChartPanel = null;
edgeLegendPanel = null;
edgeColorPanel = null;
updateNodeColorPanel(filteredDataSets, map);
updateNodeShapePanel(map);
updateNodeChartPanel(filteredDataSets, map);
updateEdgeColorPanel(map);
JPanel panel = new JPanel();
final GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(getNodeLegendPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(getEdgeLegendPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(getNodeLegendPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getEdgeLegendPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
JScrollPane scrollPane = new JScrollPane(panel);
add(scrollPane, BorderLayout.CENTER);
}
revalidate();
}
use of org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap in project EnrichmentMapApp by BaderLab.
the class LegendPanelMediator method showCreationParamsDialog.
@SuppressWarnings("serial")
private void showCreationParamsDialog() {
JDialog d = new JDialog(dialog, "EnrichmentMap Creation Parameters", ModalityType.APPLICATION_MODAL);
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.setMinimumSize(new Dimension(420, 260));
d.setPreferredSize(new Dimension(580, 460));
JButton closeButton = new JButton(new AbstractAction("Close") {
@Override
public void actionPerformed(ActionEvent e) {
d.dispose();
}
});
JPanel bottomPanel = LookAndFeelUtil.createOkCancelPanel(null, closeButton);
d.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
CyNetworkView netView = legendPanelProvider.get().getOptions().getNetworkView();
if (netView != null) {
EnrichmentMap map = emManager.getEnrichmentMap(netView.getModel().getSUID());
CreationParametersPanel paramsPanel = new CreationParametersPanel(map);
d.getContentPane().add(paramsPanel, BorderLayout.CENTER);
}
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(d.getRootPane(), null, closeButton.getAction());
d.getRootPane().setDefaultButton(closeButton);
d.setLocationRelativeTo(dialog);
d.pack();
d.setVisible(true);
}
use of org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap in project EnrichmentMapApp by BaderLab.
the class HeatMapMainPanel method updateSetting_RankOption.
public void updateSetting_RankOption(RankingOption rankOption) {
selectedRankOption = rankOption;
List<String> genes = getGenes(getOperator());
HeatMapTableModel tableModel = (HeatMapTableModel) table.getModel();
EnrichmentMap map = tableModel.getEnrichmentMap();
List<Integer> geneIds = genes.stream().map(map::getHashFromGene).collect(Collectors.toList());
CompletableFuture<Optional<Map<Integer, RankValue>>> rankingFuture = rankOption.computeRanking(geneIds);
if (rankingFuture != null) {
rankingFuture.whenComplete((ranking, ex) -> {
if (ranking.isPresent()) {
tableModel.setRanking(rankOption.getName(), ranking.get());
table.getColumnModel().getColumn(HeatMapTableModel.RANK_COL).setHeaderValue(rankOption);
} else {
tableModel.setRanking(rankOption.getName(), null);
table.getColumnModel().getColumn(HeatMapTableModel.RANK_COL).setHeaderValue(new RankOptionErrorHeader(rankOption));
}
table.getTableHeader().repaint();
});
}
settingChanged();
}
Aggregations