py4cytoscape.py4cytoscape_utils.edge_name_to_edge_suid

edge_name_to_edge_suid(edge_names, network=None, base_url='http://127.0.0.1:1234/v1', *, unique_list=False)[source]

Translate one edge name or a list of edge names into a list of SUIDs.

List can contain either names or SUIDs. If the list contains all SUIDs and no names, the list is returned.

If a name occurs multiple times in the list and unique_list=True, a different SUID is returned for each name instance, provided that the network has enough same-named edges. If not, an error is returned.

If a name occures multiple times but unique_list=False, a list of SUIDs is returned for each name instance. If there is only one name, the SUID is returned as a scalar.

Parameters
  • edge_names (str or list) – an edge name or a list of edge names

  • 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.

  • unique_list (bool) – True if duplicate edge names refer to different edges; False if it doesn’t matter

Returns

[<SUID or SUID listcorresponding to each name>] or None if edge_names is None

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

>>> edge_name_to_edge_suid('YDR277C (pp) YDL194W')
[1022]
>>> edge_name_to_edge_suid(1022)
[1022]
>>> edge_name_to_edge_suid(['YDR277C (pp) YDL194W', 'YDR277C (pp) YDR206W'], network='myNetwork')
[1022, 1023]
>>> edge_name_to_edge_suid('YDR277C (pp) YDL194W, YDR277C (pp) YDR206W', network='myNetwork')
[1022, 1023]
>>> edge_name_to_edge_suid([1022, 1023], network='myNetwork')
[1022, 1023]
>>> edge_name_to_edge_suid(['YDR277C (pp) YDL194W', 'YDR277C (pp) YDL194W'], network='myNetwork', unique_list=True)
[1022, 1024]
>>> edge_name_to_edge_suid(['YDR277C (pp) YDL194W', 'YDR277C (pp) YDL194W', 'YDR277C (pp) YDR206W'], network='myNetwork')
[[1022, 1024], [1022, 1024], 1023]

Note

To identify a node whose name contains a comma, use ‘\’ to escape the comma. For example, ‘node1 (pd) node\,2’ identifies ‘node1 (pd) node,2’.