py4cytoscape.networks.add_cy_edges¶
-
add_cy_edges
(source_target_list, edge_type='interacts with', directed=False, network=None, base_url='http://127.0.0.1:1234/v1')[source]¶ Add one or more edges to a Cytoscape network by listing source and target node pairs.
- Parameters
source_target_list (list or list of lists) – Source and target node pairs
edgeType (str) – The type of interaction. Default is ‘interacts with’.
directed (bool) – Indicates whether interactions are directed. Default is
FALSE
.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
of dicts for each edge (SUID, source, target) added.- Return type
list of dicts
- Raises
CyError – if network name or SUID doesn’t exist, or if a source or target can’t resolve to just one node.
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> add_cy_edges(['YLR075W', 'YKL028W']) [{'SUID': 2884, 'source': 1552, 'target': 1698}] >>> add_cy_edges([['YKL028W', 'YJR066W'], ['YJR066W', 'YLR452C'], ['YGR046W', 'YLR452C']]) [{'SUID': 2886, 'source': 1698, 'target': 1645}, {'SUID': 2887, 'source': 1645, 'target': 1534} ...]