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();
}
use of org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap in project EnrichmentMapApp by BaderLab.
the class HeatMapMainPanel method updateSetting_Transform.
private void updateSetting_Transform(Transform transform) {
HeatMapTableModel tableModel = (HeatMapTableModel) table.getModel();
if (tableModel.getTransform().isCompress() != transform.isCompress()) {
HeatMapParams params = this.buildParams();
EnrichmentMap map = tableModel.getEnrichmentMap();
List<RankingOption> rankOptions = parent.getMediator().getDataSetRankOptions(map);
SwingUtilities.invokeLater(() -> reset(map, params, rankOptions, Sets.newHashSet(unionGenes), Sets.newHashSet(interGenes)));
} else {
tableModel.setTransform(transform);
// clear cached data used by the ColorRenderer
updateSetting_ShowValues(isShowValues());
}
settingChanged();
}
Aggregations