use of org.baderlab.csplugins.enrichmentmap.style.WidthFunction in project EnrichmentMapApp by BaderLab.
the class EdgeWidthDialog method createButtonPanel.
private JPanel createButtonPanel() {
JButton restoreDefaultsButton = new JButton("Restore Defaults");
restoreDefaultsButton.addActionListener(e -> {
setTextFieldValues(EdgeWidthParams.defaultValues());
});
JButton cancelButton = new JButton(new AbstractAction("Cancel") {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
JButton okButton = new JButton(new AbstractAction("OK") {
@Override
public void actionPerformed(ActionEvent e) {
double emLowerWidth = ((Number) emLowerWidthText.getValue()).doubleValue();
double emUpperWidth = ((Number) emUpperWidthText.getValue()).doubleValue();
double lessThan100 = ((Number) lessThan100Text.getValue()).doubleValue();
double lessThan10 = ((Number) lessThan10Text.getValue()).doubleValue();
double greaterThan = ((Number) greaterThanText.getValue()).doubleValue();
EdgeWidthParams params = new EdgeWidthParams(emLowerWidth, emUpperWidth, lessThan100, lessThan10, greaterThan);
params.save(network);
Task task = new Task() {
public void run(TaskMonitor taskMonitor) throws Exception {
taskMonitor.setTitle("EnrichmentMap");
taskMonitor.setStatusMessage("Calculating Post-Analysis Edge Widths");
WidthFunction widthFunction = widthFunctionProvider.get();
widthFunction.setEdgeWidths(network, prefix, taskMonitor);
}
public void cancel() {
}
};
taskManager.execute(new TaskIterator(task));
dispose();
}
});
JPanel bottomPanel = LookAndFeelUtil.createOkCancelPanel(okButton, cancelButton, restoreDefaultsButton);
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(getRootPane(), okButton.getAction(), cancelButton.getAction());
getRootPane().setDefaultButton(okButton);
return bottomPanel;
}
use of org.baderlab.csplugins.enrichmentmap.style.WidthFunction in project EnrichmentMapApp by BaderLab.
the class PostAnalysisTaskTest method test_4_WidthFunction.
@Test
public void test_4_WidthFunction(@Continuous VisualMappingFunctionFactory cmFactory, EnrichmentMapManager emManager, Provider<WidthFunction> widthFunctionProvider) {
CyNetworkManager networkManager = mock(CyNetworkManager.class);
when(networkManager.getNetworkSet()).thenReturn(Collections.singleton(emNetwork));
mockContinuousMappingFactory(cmFactory);
EdgeSimilarities edges = TestUtils.getEdgeSimilarities(emNetwork);
CyEdge sigEdge1 = edges.getEdge("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP8_PLUS100");
CyEdge sigEdge2 = edges.getEdge("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP1_PLUS100");
EnrichmentMap map = emManager.getEnrichmentMap(emNetwork.getSUID());
assertNotNull(map);
WidthFunction widthFunction = widthFunctionProvider.get();
widthFunction.setEdgeWidths(emNetwork, "EM1_", null);
String widthCol = Columns.EDGE_WIDTH_FORMULA_COLUMN.with("EM1_", null);
double sigWidth1 = emNetwork.getRow(sigEdge1).get(widthCol, Double.class);
assertEquals(8.0, sigWidth1, 0.0);
double sigWidth2 = emNetwork.getRow(sigEdge2).get(widthCol, Double.class);
assertEquals(1.0, sigWidth2, 0.0);
}
Aggregations