py4cytoscape.groups.create_group¶
- create_group(group_name, nodes=None, nodes_by_col='SUID', network=None, base_url='http://127.0.0.1:1234/v1')[source]¶
Create a group from the specified nodes.
- Parameters
group_name (str) – The name used to identify and optionaly label the group
nodes (list or str or None) – List of node SUIDs, names, other column values, or keyword: selected, unselected or all. Default is currently selected nodes.
nodes_by_col (str) – name of node table column corresponding to provided nodes list. Default is ‘SUID’.
network (SUID or str or None) – Name or SUID of a network. Default is the “current” network active in Cytoscape.
base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.
- Returns
{‘group’: SUID} where SUID identifies the node corresponding to the group
- Return type
dict
- Raises
CyError – if network name or SUID doesn’t exist
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> create_group('Group 1', ['GDS1', 'SIP4', 'PDC1'], nodes_by_col='COMMON') # create group containing nodes by common name {'group': 95335} >>> create_group('Group 1') # create group containing all selected nodes {'group': 95335} >>> create_group('Group 1', []) # create group with no nodes {'group': 95335} >>> create_group('Group 1', nodes='unselected') # create group with all unselected nodes {'group': 95335}