Search in sources :

Example 46 with EnrichmentMap

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);
}
Also used : EMViewControlPanel(org.baderlab.csplugins.enrichmentmap.view.control.ControlPanel.EMViewControlPanel) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)

Example 47 with EnrichmentMap

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();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) EmptyBorder(javax.swing.border.EmptyBorder) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 48 with EnrichmentMap

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);
}
Also used : JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) AbstractAction(javax.swing.AbstractAction) CyNetworkView(org.cytoscape.view.model.CyNetworkView) JDialog(javax.swing.JDialog)

Example 49 with EnrichmentMap

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();
}
Also used : Optional(java.util.Optional) HeatMapTableModel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.HeatMapTableModel) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) RankValue(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankValue) RankOptionErrorHeader(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankOptionErrorHeader)

Example 50 with EnrichmentMap

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();
}
Also used : HeatMapTableModel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.HeatMapTableModel) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)

Aggregations

EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)57 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)27 Test (org.junit.Test)22 DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)21 EMCreationParameters (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)13 Method (org.baderlab.csplugins.enrichmentmap.model.EMDataSet.Method)13 CyNetwork (org.cytoscape.model.CyNetwork)12 EnrichmentMapParameters (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapParameters)11 EnrichmentResult (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult)10 CyNetworkView (org.cytoscape.view.model.CyNetworkView)10 Map (java.util.Map)8 CyEdge (org.cytoscape.model.CyEdge)7 CyRow (org.cytoscape.model.CyRow)7 NullTaskMonitor (org.baderlab.csplugins.enrichmentmap.util.NullTaskMonitor)6 TaskIterator (org.cytoscape.work.TaskIterator)6 ImmutableSet (com.google.common.collect.ImmutableSet)5 HashSet (java.util.HashSet)5 GeneSet (org.baderlab.csplugins.enrichmentmap.model.GeneSet)5 Inject (com.google.inject.Inject)4 ActionEvent (java.awt.event.ActionEvent)4