Search in sources :

Example 46 with EMDataSet

use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.

the class AddRanksDialog method createTextFieldPanel.

private JPanel createTextFieldPanel() {
    JLabel ranksNameLabel = new JLabel("Ranks Name:");
    ranksNameText = new JTextField();
    textFieldForeground = ranksNameText.getForeground();
    ranksNameText.setText("MyRanks");
    ranksNameText.addFocusListener(new FocusValidator(ranksNameText));
    JLabel ranksFileLabel = new JLabel("Ranks File:");
    ranksFileText = new JTextField();
    JButton ranksBrowse = new JButton("Browse...");
    ranksFileText.addFocusListener(new FocusValidator(ranksFileText));
    ranksBrowse.addActionListener(e -> browse(ranksFileText, FileBrowser.Filter.RANK));
    JLabel datasetLabel = new JLabel("Data Set:");
    dataSetCombo = new JComboBox<>();
    for (EMDataSet dataset : map.getDataSetList()) {
        dataSetCombo.addItem(new ComboItem<>(dataset, dataset.getName()));
    }
    SwingUtil.makeSmall(ranksNameLabel, ranksNameText, ranksFileLabel, ranksFileText, ranksBrowse, datasetLabel, dataSetCombo);
    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(ranksNameLabel).addComponent(ranksFileLabel).addComponent(datasetLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(ranksNameText, 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(ranksFileText, 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(dataSetCombo, 0, DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(layout.createParallelGroup().addComponent(ranksBrowse)));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(ranksNameLabel).addComponent(ranksNameText)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(ranksFileLabel).addComponent(ranksFileText).addComponent(ranksBrowse)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(datasetLabel).addComponent(dataSetCombo)));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) JTextField(javax.swing.JTextField)

Example 47 with EMDataSet

use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.

the class AddRanksDialog method loadRanksAndClose.

private void loadRanksAndClose() {
    String rankFileName = ranksFileText.getText();
    String ranksName = getRanksName();
    EMDataSet dataset = getDataSet();
    RanksFileReaderTask task = new RanksFileReaderTask(rankFileName, dataset, ranksName, true);
    dialogTaskManager.execute(new TaskIterator(task), new TaskObserver() {

        @Override
        public void taskFinished(ObservableTask task) {
        }

        @Override
        public void allFinished(FinishStatus finishStatus) {
            resultRanksName = ranksName;
            dispose();
        }
    });
}
Also used : TaskObserver(org.cytoscape.work.TaskObserver) ObservableTask(org.cytoscape.work.ObservableTask) TaskIterator(org.cytoscape.work.TaskIterator) RanksFileReaderTask(org.baderlab.csplugins.enrichmentmap.parsers.RanksFileReaderTask) FinishStatus(org.cytoscape.work.FinishStatus) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet)

Example 48 with EMDataSet

use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.

the class PostAnalysisWeightPanel method build.

public boolean build(PostAnalysisParameters.Builder builder) {
    double value = ((Number) rankTestTextField.getValue()).doubleValue();
    PostAnalysisFilterParameters rankTest = new PostAnalysisFilterParameters(getFilterType(), value);
    builder.setDataSetName(getDataSet());
    builder.setUniverseType(getUniverseType());
    builder.setUserDefinedUniverseSize(getUserDefinedUniverseSize());
    builder.setRankTestParameters(rankTest);
    if (getFilterType().isMannWhitney()) {
        if (map.isSingleRanksPerDataset()) {
            for (EMDataSet dataset : map.getDataSetList()) {
                String ranksName = dataset.getExpressionSets().getAllRanksNames().iterator().next();
                builder.addDataSetToRankFile(dataset.getName(), ranksName);
            }
        } else {
            JFrame jframe = serviceRegistrar.getService(CySwingApplication.class).getJFrame();
            MannWhitneyRanksDialog dialog = new MannWhitneyRanksDialog(jframe, map);
            Optional<Map<String, String>> result = dialog.open();
            if (result.isPresent()) {
                Map<String, String> dataSetToRank = result.get();
                dataSetToRank.forEach(builder::addDataSetToRankFile);
            } else {
                return false;
            }
        }
    }
    return true;
}
Also used : JFrame(javax.swing.JFrame) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) PostAnalysisFilterParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) Map(java.util.Map)

Example 49 with EMDataSet

use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.

the class LegendPanel method createChartPanel.

private ChartPanel createChartPanel(Collection<EMDataSet> dataSets) {
    JFreeChart chart = null;
    List<EMDataSet> sortedDataSets = ChartUtil.sortDataSets(dataSets);
    ChartType chartType = options.getChartOptions() != null ? options.getChartOptions().getType() : null;
    switch(chartType) {
        case RADIAL_HEAT_MAP:
            chart = ChartUtil.createRadialHeatMapLegend(sortedDataSets, options.getChartOptions());
            break;
        case HEAT_MAP:
            chart = ChartUtil.createHeatMapLegend(sortedDataSets, options.getChartOptions());
            break;
        case HEAT_STRIPS:
            chart = ChartUtil.createHeatStripsLegend(sortedDataSets, options.getChartOptions());
            break;
        default:
            break;
    }
    ChartPanel chartPanel = chart != null ? new ChartPanel(chart) : null;
    if (chartPanel != null) {
        chartPanel.setPopupMenu(null);
        chartPanel.setMouseZoomable(false);
    }
    return chartPanel;
}
Also used : ChartPanel(org.jfree.chart.ChartPanel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) ChartType(org.baderlab.csplugins.enrichmentmap.style.ChartType) JFreeChart(org.jfree.chart.JFreeChart)

Example 50 with EMDataSet

use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.

the class GradientLegendPanel method renderLegend.

private void renderLegend(JTable table, int row, int col) {
    HeatMapTableModel tableModel = (HeatMapTableModel) table.getModel();
    Object value = tableModel.getValueAt(row, col);
    removeAll();
    if (value instanceof Double) {
        EMDataSet dataset = tableModel.getDataSet(col);
        ColorRenderer renderer = (ColorRenderer) table.getCellRenderer(row, col);
        DataSetColorRange colorRange = renderer.getRange(dataset, tableModel.getTransform());
        JPanel panel = createExpressionLegendPanel(colorRange);
        add(panel, BorderLayout.CENTER);
        revalidate();
    }
}
Also used : JPanel(javax.swing.JPanel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet)

Aggregations

EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)58 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)30 DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)20 Test (org.junit.Test)19 Method (org.baderlab.csplugins.enrichmentmap.model.EMDataSet.Method)13 EnrichmentMapParameters (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapParameters)11 Map (java.util.Map)10 EMCreationParameters (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)10 Set (java.util.Set)8 EnrichmentResult (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResult)8 GeneSet (org.baderlab.csplugins.enrichmentmap.model.GeneSet)7 CyNode (org.cytoscape.model.CyNode)7 JPanel (javax.swing.JPanel)6 Inject (com.google.inject.Inject)5 Color (java.awt.Color)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 JLabel (javax.swing.JLabel)5 CyEdge (org.cytoscape.model.CyEdge)5 CyNetwork (org.cytoscape.model.CyNetwork)5