py4cytoscape.networks.rename_network

rename_network(title, network=None, base_url='http://127.0.0.1:1234/v1')[source]

Sets a new name for a network.

Duplicate network names are not allowed

Parameters
  • title (str) – New name for the network

  • network (SUID or str or None) – name or SUID of the network that you want to rename; default is “current” network

  • 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

server JSON response

Return type

dict

Raises
  • ValueError – if server response has no JSON

  • CyError – if network name or SUID doesn’t exist

  • requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error

Examples

>>> rename_network('renamed network') # changes "current" network's name to "renamed network"
{'network': 22752, 'title': 'renamed network'}
>>> rename_network('renamed network', 'MyNetwork') # changes network named 'MyNetwork' to be named "renamed network"
{'network': 22752, 'title': 'renamed network'}
>>> rename_network('renamed network', 1502) # sets network having SUID 1502 to be named "renamed network"
{'network': 1502, 'title': 'renamed network'}