use of org.cytoscape.view.model.CyNetworkView in project EnrichmentMapApp by BaderLab.
the class HeatMapMediator method heatMapParamsChanged.
/**
* Callback that HeatMapMainPanel calls.
*/
public void heatMapParamsChanged(HeatMapParams params) {
CyNetworkView networkView = applicationManager.getCurrentNetworkView();
if (networkView != null) {
Long suid = networkView.getModel().getSUID();
EnrichmentMap map = emManager.getEnrichmentMap(suid);
// Overwrite all the params of the other one except 'operator'.
// The 'operator' field is the only param that is kept separate.
HeatMapParams otherParams = getHeatMapParams(map, suid, !onlyEdges);
HeatMapParams newOtherParams = new HeatMapParams.Builder(params).setOperator(otherParams.getOperator()).build();
emManager.registerHeatMapParams(suid, !onlyEdges, newOtherParams);
emManager.registerHeatMapParams(suid, onlyEdges, params);
}
}
use of org.cytoscape.view.model.CyNetworkView in project EnrichmentMapApp by BaderLab.
the class SessionViewIO method restoreView.
public void restoreView(CySession session) {
if (!headless) {
CyTable table = getPrivateTable();
if (table != null) {
for (CyRow row : table.getAllRows()) {
Long suid = COL_NETWORK_VIEW_ID.get(row);
String json = COL_VIEW_JSON.get(row);
if (suid != null && json != null) {
CyNetworkView netView = getNetworkView(suid);
if (netView != null) {
ViewParams params = ViewSerializer.deserialize(json);
if (params != null) {
params.setNetworkViewID(netView.getSUID());
controlPanelMediatorProvider.get().reset(params);
}
}
}
}
}
}
}
use of org.cytoscape.view.model.CyNetworkView in project EnrichmentMapApp by BaderLab.
the class BaseNetworkTest method runPostAnalysis.
protected void runPostAnalysis(CyNetwork emNetwork, PostAnalysisParameters.Builder builder, String dataSetName) throws Exception {
// Set up mocks
when(applicationManager.getCurrentNetwork()).thenReturn(emNetwork);
CyNetworkView networkViewMock = mock(CyNetworkView.class);
when(applicationManager.getCurrentNetworkView()).thenReturn(networkViewMock);
when(networkViewManager.getNetworkViews(emNetwork)).thenReturn(Arrays.asList(networkViewMock));
@SuppressWarnings("unchecked") View<CyNode> nodeViewMock = Mockito.mock(View.class);
when(networkViewMock.getNodeView(Matchers.<CyNode>anyObject())).thenReturn(nodeViewMock);
when(nodeViewMock.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).thenReturn(Double.valueOf(0.0));
EnrichmentMap map = emManager.getEnrichmentMap(emNetwork.getSUID());
assertNotNull(map);
// Load the gene-sets from the file
SerialTestTaskManager testTaskManager = new SerialTestTaskManager();
File file = new File(builder.getSignatureGMTFileName());
LoadSignatureSetsActionListener loader = loadSignatureSetsActionListenerFactory.create(file, new FilterMetric.None(), map);
loader.setTaskManager(testTaskManager);
loader.setGeneSetCallback(builder::setLoadedGMTGeneSets);
loader.setFilteredSignatureSetsCallback(builder::addSelectedGeneSetNames);
loader.actionPerformed(null);
PostAnalysisParameters paParams = builder.build();
// Run post-analysis
EMDataSet dataSet = map.getDataSet(dataSetName);
CreateDiseaseSignatureTaskParallel signatureTask = buildDiseaseSignatureTaskFactory.create(paParams, map, Arrays.asList(dataSet));
testTaskManager = new SerialTestTaskManager();
testTaskManager.execute(new TaskIterator(signatureTask));
}
use of org.cytoscape.view.model.CyNetworkView in project EnrichmentMapApp by BaderLab.
the class ControlPanel method getEmViewCombo.
JComboBox<CyNetworkView> getEmViewCombo() {
if (emViewCombo == null) {
emViewCombo = new JComboBox<>();
emViewCombo.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof CyNetworkView)
this.setText(NetworkUtil.getTitle((CyNetworkView) value));
else
this.setText("-- Select EnrichmentMap View --");
return this;
}
});
}
return emViewCombo;
}
use of org.cytoscape.view.model.CyNetworkView in project EnrichmentMapApp by BaderLab.
the class ControlPanel method updateEmViewCombo.
void updateEmViewCombo() {
CyNetworkView selectedItem = (CyNetworkView) getEmViewCombo().getSelectedItem();
Map<Long, EnrichmentMap> emMap = emManager.getAllEnrichmentMaps();
getEmViewCombo().setEnabled(!emMap.isEmpty());
getEmViewCombo().removeAllItems();
if (!emMap.isEmpty()) {
Set<CyNetworkView> allViews = networkViewManager.getNetworkViewSet();
List<CyNetworkView> emViews = allViews.stream().filter(emManager::isEnrichmentMap).collect(Collectors.toList());
Collator collator = Collator.getInstance(Locale.getDefault());
emViews.sort((v1, v2) -> collator.compare(NetworkUtil.getTitle(v1), NetworkUtil.getTitle(v2)));
emViews.forEach(getEmViewCombo()::addItem);
getEmViewCombo().setSelectedItem(selectedItem);
}
}
Aggregations