// Example 2. Creating nested groups

CyNetwork subgroup = methodThatGetsASubgroup();
CyNetwork [] groups = groupManager.getGroupsInNetwork(myNet);
Map args = new Hashtable();

for(int i = 0; i < groups.length; i++){
    groupManager.addGroupToNetwork(groups[i], subgroup); // nest a group
    // recursive collapse:
    args.put(CollapsingStrategy.IS_RECURSIVE, Boolean.TRUE);
    collapsingStrategy.group(myNet,groups[i],args); // collapses the nested group
    // OR, stack subsubgroup, collapse subgroup:
    args.put(CollapsingStrategy.IS_RECURSIVE, Boolean.FALSE);
    stackingStrategy.group(groups[i],subgroup); // stack nested group
    collapsingStrategy.group(myNet,groups[i],); // collapse top level group


// This is code in a GroupingStrategy:
public boolean group (CyNetwork network, CyNetwork subnetwork, Map args){
 if(args.containsKey(IS_RECURSIVE) && args.get(IS_RECURSIVE).equals(Boolean.TRUE)){
  // recursive grouping, use GroupManager.getGroupsInNetwork to get groups within groups...
  CyNetwork [] subsubgroups = groupManager.getGroupsInNetwork(subnetwork);
  // .. do stuff
  // non-recursive, do stuff...


public void tagSubnetworkAsGroup(CyNetwork net,CyNetwork[] subnet) {
    for ( int i = 0; i < subnet.length; i++ )

API/CommentInterfaces (last edited 2009-02-12 01:03:03 by localhost)

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux