py4cytoscape.styles.import_visual_styles

import_visual_styles(filename='styles.xml', base_url='http://127.0.0.1:1234/v1')[source]

Load styles from an XML file and returns the names of the loaded styles.

Note

To load a style 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_visual_styles to load it from there.

Parameters
  • filename (str) – Name of the style file to load. Only reads XML files. Default is “styles.xml”.

  • 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

[names of styles loaded]

Return type

list

Raises
  • CyError – if the input file can’t be read

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

Examples

>>> import_visual_styles() # export styles.xml in the current directory
['galFiltered Style']
>>> import_visual_styles('curstyle.xml') # export curstyle.xml in the current directory
['galFiltered Style']