py4cytoscape.tools.merge_networks
-
merge_networks
(sources=None, title=None, operation='union', node_keys=None, node_merge_map=None, nodes_only=False, edge_keys=None, edge_merge_map=None, network_merge_map=None, in_network_merge=True, base_url='http://127.0.0.1:1234/v1')[source] Merge Networks.
Combine networks via union, intersection, or difference operations. Lots of optional parameters choose from!
- Parameters
sources (list) – List of network names to be merged.
title (str) – Title of the resulting merged network. Default is a concatentation of operation and source network titles.
operation (str) – Type of merge: union (default), intersection or difference.
node_keys (list) – An order-dependent list of columns to match nodes across source networks. Default is “name” column for all sources.
node_merge_map (list) – A list of column merge records specifying how to merge node table data. Each record should be of the form: [“network1 column”, “network2 column”, “merged column”, “type”], where column names are provided and type is String, Integer, Double or List.
nodes_only (bool) – If True, this will merge the node tables and ignore edge and network table data. Default is False.
edge_keys (list) – An order-dependent list of columns to match edges across source networks. Default is “name” column for all sources.
edge_merge_map (list) – A list of column merge records specifying how to merge edge table data. Each record should be of the form: [“network1 column”, “network2 column”, “merged column”, “type”], where column names are provided and type is String, Integer, Double or List.
network_merge_map (list) – A list of column merge records specifying how to merge network table data. Each record should be of the form: [“network1 column”, “network2 column”, “merged column”, “type”], where column names are provided and type is String, Integer, Double or List.
in_network_merge (bool) If True (default) – merged.
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
SUID of merged network
- Return type
int
- Raises
CyError – if an invalid parameter is passed
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> merge_networks(['Network_0', 'Network_1']) 366343 >>> merge_networks(['Network_0', 'Network_1'], title='nodes mapped') 366343 >>> merge_networks(['Network_0', 'Network_1'], node_merge_map=[['given name', 'first name', 'called', 'String'], ['score', 'age', 'score_m', 'Integer']], title='nodes mapped') 366343