py4cytoscape.styles.export_visual_styles¶
- export_visual_styles(filename=None, type='XML', styles=None, base_url='http://127.0.0.1:1234/v1')[source]¶
Save one or more visual styles to file.
- Parameters
filename (str) – Full path or path relavtive to current working directory, in addition to the name of the file. Extension is automatically added based on the
type
argument. Default is “styles.xml”type (str) – Type of data file to export, e.g., XML, JSON (case sensitive). Default is XML. Note: Only XML can be read by
import_visual_styles()
.styles (str) – specified, only the current one is exported.
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
{‘file’: name of file written}
- Return type
dict
- Raises
CyError – if the output file can’t be created
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> export_visual_styles() # export the current style to styles.xml in the current directory {'file': 'C:\Users\CyDeveloper\styles.xml'} >>> export_visual_styles('curstyle') # export the current style to curstyle.xml in the current directory {'file': 'C:\Users\CyDeveloper\curstyle.xml'} >>> export_visual_styles('curstyle', type='json') # export the current style in cytoscape.js format {'file': 'C:\Users\CyDeveloper\curstyle.json'}
See also