use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeViewFrame in project clusterMaker2 by RBVI.
the class HeatMapView method startup.
protected void startup() {
CyProperty cyProperty = manager.getService(CyProperty.class, "(cyPropertyName=cytoscape3.props)");
List<String> nodeAttributeList = context.attributeList.getNodeAttributeList();
String edgeAttribute = context.attributeList.getEdgeAttribute();
if (nodeAttributeList == null && edgeAttribute == null) {
monitor.showMessage(TaskMonitor.Level.ERROR, "Must select either one edge column or two or more node columns");
return;
}
if (nodeAttributeList != null && nodeAttributeList.size() > 0 && edgeAttribute != null) {
monitor.showMessage(TaskMonitor.Level.ERROR, "Can't have both node and edge columns selected");
return;
}
if (nodeAttributeList != null && nodeAttributeList.size() < 2) {
monitor.showMessage(TaskMonitor.Level.ERROR, "Must have at least two node columns for cluster weighting");
return;
}
String[] nodeArray;
// Handle selected only
if (!context.selectedOnly) {
nodeArray = new String[myNetwork.getNodeCount()];
int index = 0;
for (CyNode node : myNetwork.getNodeList()) {
nodeArray[index++] = ModelUtils.getName(myNetwork, node);
}
} else {
if (edgeAttribute != null && edgeAttribute.length() > 0) {
List<CyEdge> selectedEdges = CyTableUtil.getEdgesInState(myNetwork, CyNetwork.SELECTED, true);
Set<CyNode> nodesSeen = new HashSet<CyNode>();
for (CyEdge edge : selectedEdges) {
nodesSeen.add(edge.getSource());
nodesSeen.add(edge.getTarget());
}
int index = 0;
nodeArray = new String[nodesSeen.size()];
for (CyNode node : nodesSeen) nodeArray[index++] = ModelUtils.getName(myNetwork, node);
} else {
List<CyNode> selectedNodes = CyTableUtil.getNodesInState(myNetwork, CyNetwork.SELECTED, true);
nodeArray = new String[selectedNodes.size()];
int index = 0;
for (CyNode node : selectedNodes) {
nodeArray[index++] = ModelUtils.getName(myNetwork, node);
}
}
}
Arrays.sort(nodeArray);
ModelUtils.createAndSetLocal(myNetwork, myNetwork, ClusterManager.NODE_ORDER_ATTRIBUTE, Arrays.asList(nodeArray), List.class, String.class);
// Edge attribute?
if (edgeAttribute != null && edgeAttribute.length() > 0) {
ModelUtils.createAndSetLocal(myNetwork, myNetwork, ClusterManager.ARRAY_ORDER_ATTRIBUTE, Arrays.asList(nodeArray), List.class, String.class);
ModelUtils.createAndSetLocal(myNetwork, myNetwork, ClusterManager.CLUSTER_EDGE_ATTRIBUTE, "edge." + edgeAttribute, String.class, null);
} else {
int index = 0;
Collections.sort(nodeAttributeList);
ModelUtils.createAndSetLocal(myNetwork, myNetwork, ClusterManager.ARRAY_ORDER_ATTRIBUTE, nodeAttributeList, List.class, String.class);
}
// Get our data model
dataModel = new TreeViewModel(monitor, myNetwork, myView, manager);
// Set up the global config
setConfigDefaults(new PropertyConfig(cyProperty, globalConfigName(), "ProgramConfig"));
// Set up our configuration
PropertyConfig documentConfig = new PropertyConfig(cyProperty, getShortName(), "DocumentConfig");
dataModel.setDocumentConfig(documentConfig);
// Create our view frame
TreeViewFrame frame = new TreeViewFrame(this, appName);
// Set the data model
frame.setDataModel(dataModel);
frame.setLoaded(true);
frame.addWindowListener(this);
frame.setVisible(true);
geneSelection = frame.getGeneSelection();
geneSelection.addObserver(this);
arraySelection = frame.getArraySelection();
arraySelection.addObserver(this);
manager.registerService(this, RowsSetListener.class, new Properties());
}
use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeViewFrame in project clusterMaker2 by RBVI.
the class TreeView method startup.
protected void startup() {
CyProperty cyProperty = manager.getService(CyProperty.class, "(cyPropertyName=cytoscape3.props)");
// Get our data model
dataModel = new TreeViewModel(monitor, myNetwork, myView, manager);
// Set up the global config
setConfigDefaults(new PropertyConfig(cyProperty, globalConfigName(), "ProgramConfig"));
// Set up our configuration
PropertyConfig documentConfig = new PropertyConfig(cyProperty, getShortName(), "DocumentConfig");
dataModel.setDocumentConfig(documentConfig);
// Create our view frame
TreeViewFrame frame = new TreeViewFrame(this, appName);
// Set the data model
frame.setDataModel(dataModel);
frame.setLoaded(true);
frame.addWindowListener(this);
frame.setVisible(true);
geneSelection = frame.getGeneSelection();
geneSelection.addObserver(this);
arraySelection = frame.getArraySelection();
arraySelection.addObserver(this);
manager.registerService(this, RowsSetListener.class, new Properties());
}
Aggregations