py4cytoscape.networks.import_network_from_file

import_network_from_file(file=None, base_url='http://127.0.0.1:1234/v1')[source]

Loads a network from specified file.

Note

To load a network file from cloud storage, use the file’s URL and the sandbox_url_to function to download the file to a sandbox, and then use import_network_from_file to load it from there.

Parameters
  • file (str) – Name of file in any of the supported formats (e.g., SIF, GML, xGMML, etc). If None, a demo network file in SIF format is loaded.

  • 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

{“networks”: [network suid], “views”: [suid for views]} where networks and views lists have length 1

Return type

dict

Raises
  • CyError – if file cannot be found or loaded

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

Examples

>>> import_network_from_file() # import demo network
{'networks': [131481], 'views': [131850]}
>>> import_network_from_file('data/yeastHighQuality.sif')
{'networks': [131481], 'views': [131850]}