py4cytoscape.session.save_session

save_session(filename=None, base_url='http://127.0.0.1:1234/v1', *, overwrite_file=True)[source]

Saves the current Cytoscape session as a CYS file.

If no filename is provided, then it attempts to save to an existing CYS file associated with the session. If filename already exists, then it is overwritten.

Parameters
  • filename (str) – Full path or path relative to current working directory, in addition to the name of the file. The .cys extension is automatically added. Leave blank to update previously saved session file.

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

  • overwrite_file (bool) – False allows an error to be generated if the file already exists; True allows Cytoscape to overwrite it without asking

Returns

{} empty

Return type

dict

Raises
  • CyError – if filename is invalid

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

Examples

>>> save_session('other') # Save current session as other.cys
{}
>>> save_session('other.cys') # Save current session as other.cys
{}
>>> save_session() # Save current session back to the same file it was loaded from
{}
>>> save_session('other.cys', overwrite_file=False) # Save session only if other.cys doesn't already exist
{}