py4cytoscape.networks.add_cy_nodes¶
-
add_cy_nodes
(node_names, skip_duplicate_names=True, network=None, base_url='http://127.0.0.1:1234/v1')[source]¶ Add one or more nodes to a Cytoscape network.
- Parameters
node_names (list or None) – A
list
of node namesskip_duplicate_names (bool) – Skip adding a node if a node with the same name is already in the network. If
FALSE
then a duplicate node (with a unique SUID) will be added.network (SUID or str or None) – Name or SUID of a network or view. 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
A
list
ofnamed lists
of name and SUID for each node added.- Return type
list
- 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
>>> add_cy_nodes(['newnode1', 'newnode2'], skip_duplicate_names=False) [{"name": "newnode1", "SUID": 1459}, {"name": "newnode2", "SUID": 1460}] >>> add_cy_nodes('newnode1, newnode2', skip_duplicate_names=False) [{"name": "newnode1", "SUID": 1459}, {"name": "newnode2", "SUID": 1460}] >>> add_cy_nodes(['newnode2', 'newnode3'], skip_duplicate_names=True) [{"name": "newnode3", "SUID": 1460}]