An object that represents a group of nodes and edges.
An interface describing a factory used for creating
The CyGroupManager maintains information about all of the groups an instance of Cytoscape.
CyGroupis an extention of Cytoscape's model that provides the following additional capabilities:
org.cytoscape.model) provides for a single-level hierarchy: a
CyRootNetworkcan contain a set of
CySubNetworks. The base model also provides for the capability where a
CyNodecan contain a pointer to a
CyGroupuses the network pointer to point to a
CySubNetworkwithin the same
CyRootNetworkas the node. This is important for the next two additional capabilities.
CyNode. This representative
CyNodehas as its network pointer a
CySubNetworkthat contains the collapsed nodes and edges.
CyEdges that link between a
CyNodethat exists within a group and a
CyNodethat is outside of the group or within another group.
CyGroupis stored internally as a network and a list of external edges (edges that connect from nodes within the group to nodes outside of the group. Groups may contain nodes which represent groups, which allows for the creation of explicit hierarchies of groups. To create a group, use one of the
CyGroupManagerservice is provided that tracks which groups apply in which networks and which
CyNodes actually represent
As with other core capabilities, there are two ways to create groups depending
on whether the App developers is creating an OSGi bundle or a "Simple App". In either
case, the App developer must get a reference to a
For a "simple app" this is available as part of the
CyGroupFactory groupFactory = adapter.getCyGroupFactory();
CyGroupFactoryis available as a service:
CyGroupFactory groupFactory = getService(bc, CyGroupFactory.class);
CyGroupis created either as an empty group ( (
CyGroupFactory.createGroup(CyNetwork network, boolean register)):
CyGroup emptyGroup = groupFactory.createGroup(network, true);
CyGroupFactory.createGroup(CyNetwork network, CyNode node, boolean register)):
CyGroup emptyGroup = groupFactory.createGroup(network, node, true);
CyGroupFactory.createGroup(CyNetwork network, List nodes, List edges, boolean register)):
CyGroup emptyGroup = groupFactory.createGroup(network, nodes, edges, true);
CyGroupFactory.createGroup(CyNetwork network, CyNode node, List nodes, List edges, boolean register)):
CyGroup emptyGroup = groupFactory.createGroup(network, node, nodes, edges, true);
CyGroupManager. This should almost always be set to "true". For group factory methods that take a list of nodes and edges, the edge list may be null. In this case, the initial edge list will be the edges that connect all of the provided nodes and the initial external edge list will be the edges that connect the provided nodes to nodes outside of the list. So, the easiest way to create a group is to collect the list of nodes to be members and call:
CyGroup emptyGroup = groupFactory.createGroup(network, nodes, null, true);
Once a group has been created and registered with the
methods are available to determine the
CyGroup that corresponds to
CyNode in a particular
CyGroupManager.getGroup(org.cytoscape.model.CyNode, org.cytoscape.model.CyNetwork)), get all of the groups in a given
get all of the groups a particular
CyNode is a member of
CyGroupManager.getGroupsForNode(CyNode node)). A couple of other
useful methods are also provided.
In addition to the
CyGroup also provides some important methods. In particular,
methods to add or remove nodes or edges to the group (
methods to inquire as to group state (
CyGroup.isInNetwork(org.cytoscape.model.CyNetwork)), and methods to change the state of the group
CyNode(the group node) and remove all of the member
CyEdges (edges between group members and nodes outside of the group) are replaced by meta-edges between the group node and the corresponding external node. This process can be somewhat complicated by the fact that the external node of the edge might itself be a collapsed member of a group.
CyEdges that connect the group
CyNodeitself to other nodes are added to the network.
CyTabledata for the collapsed group is updated to include both the number of children and the number of descendents
CyTabledata for the collapsed group node is (optionally) updated to reflect an aggregation of all of the data in the member nodes.
GroupNodesRemovedListener), when groups are created and destroyed (
GroupAddedListener), and perhaps most usefully when the state of the group changes (
GroupCollapsedListener). The latter two listeners would be used by Apps that are providing their own view-level visualization for groups.
Aggregatorinterface. The next step would be to add that interface to the
CyGroupAggregationManageris a service that provides all of the aggregators for a given type to the underlying group code. When a group node is collapsed, the aggregator for each column is called to aggregate all of the values of the member nodes onto the column of the group node.
Copyright 2011 Cytoscape Consortium. All rights reserved.