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;
}
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();
}
});
}
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;
}
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;
}
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();
}
}
Aggregations