py4cytoscape.layouts.layout_copycat

layout_copycat(source_network, target_network, source_column='name', target_column='name', grid_unmapped=True, select_unmapped=True, base_url='http://127.0.0.1:1234/v1')[source]

Copy a layout from one network to another.

Sets the coordinates for each node in the target network to the coordinates of a matching node in the source network. Optional parameters such as gridUnmapped and selectUnmapped determine the behavior of target network nodes that could not be matched.

Parameters
  • source_network (SUID or str or None) – Name of the network to get node coordinates from; default is “current” network. If an SUID is provided, the corresponding network name is used.

  • target_network (SUID or str or None) – Name of the network to apply coordinates to; default is “current” network. If an SUID is provided, the corresponding network name is used.

  • source_column (str) – The name of column in the source_network node table used to match nodes; default is ‘name’

  • target_column (str) – The name of column in the target_network node table used to match nodes; default is ‘name’

  • grid_unmapped (bool) – If this is set to True, any nodes in the target network that could not be matched to a node in the source network will be laid out in a grid; default is True

  • select_unmapped (bool) – If this is set to True, any nodes in the target network that could not be matched to a node in the source network will be selected in the target network; default is True

  • base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://localhost:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

{‘mappedNodeCount’: 330, ‘unmappedNodeCount’: 0} containing count of nodes coordinates modified

Return type

dict

Raises
  • CyError – if source_network, target_network, source_column or target_column are invalid

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

Examples

>>> layout_copycat('galFiltered.sif', galFiltered.sif_1)
{'mappedNodeCount': 330, 'unmappedNodeCount': 0}
>>> layout_copycat('galFiltered.sif', galFiltered.sif_1, source_column='shared name', target_column='shared name')
{'mappedNodeCount': 330, 'unmappedNodeCount': 0}