Date post: | 20-Jan-2023 |
Category: |
Documents |
Upload: | khangminh22 |
View: | 0 times |
Download: | 0 times |
CONTENTS
1 Audience 3
2 Python 5
3 Free Software 7
4 History 9
5 Documentation 11
6 Indices and tables 271
Python Module Index 273
Index 275
i
py4cytoscape Documentation, Release 0.0.1
py4cytoscape is a Python package that communicates with Cytoscape via its REST API, providing access to a set over250 functions that enable control of Cytoscape from within standalone and Notebook Python programming environ-ments. It provides nearly identical functionality to RCy3, an R package in Bioconductor available to R programmers.
py4cytoscape provides:
• functions that can be leveraged from Python code to implement network biology-oriented workflows;
• access to user-written Cytoscape Apps that implement Cytoscape Automation protocols;
• logging and debugging facilities that enable rapid development, maintenance, and auditing of Python-basedworkflow;
• two-way conversion between the igraph and NetworkX graph packages, which enables interoperability withpopular packages available in public repositories (e.g., PyPI); and
• the ability to painlessly work with large data sets generated within Python or available on public repositories(e.g., STRING and NDEx).
With py4cytoscape, you can leverage Cytoscape to:
• load and store networks in standard and nonstandard data formats;
• visualize molecular interaction networks and biological pathways;
• integrate these networks with annotations, gene expression profiles and other state data;
• analyze, profile, and cluster these networks based on integrated data, using new and existing algorithms.
py4cytoscape enables an agile collaboration between powerful Cytoscape, Python libraries, and novel Python code soas to realize auditable, reproducible and sharable workflows.
CONTENTS 1
CHAPTER
ONE
AUDIENCE
The audience for py4cytoscape includes biologists, mathematicians, physicists, biologists, computer scientists, andsocial scientists. A running sample of research based on Cytoscape can be found on Tumblr. Cytoscape providestutorials, videos, and automation vignettes.
Google Scholar reports that Cytoscape was cited in over 10,000 in academic papers in 2019, most of which executedCytoscape via the traditional mouse and keyboard. py4cytoscape can automate these results as a means of achievingreproducible science.
3
CHAPTER
TWO
PYTHON
Python is a powerful programming language that allows simple and flexible representations of networks as well asclear and concise expressions of network algorithms. Python has a vibrant and growing ecosystem of packages thatcan be used in combination with py4cytoscape integrate with traditional workflow engines (e.g., Galaxy and GenePattern) to produce robust end-to-end workflows.
In order to make the most out of py4cytoscape you should know how to write basic programs in Python. Among themany guides to Python, we recommend the Python documentation and Python in a Nutshell.
5
CHAPTER
THREE
FREE SOFTWARE
py4cytoscape is free software; you can redistribute it and/or modify it under the terms of the License. We welcomecontributions. Join us on GitHub.
7
CHAPTER
FOUR
HISTORY
The original Python libraries for Cytoscape were written by Keiichiro Ono in 2015 as an interface to the then-newCyREST automation interface. Its original name was py2cytoscape. It was further evolved through 2019 by KozoNishida and Jorge Bouças.
In late 2019, py4cytoscape was undertaken by Barry Demchak as a replacement for py2cytoscape. It implemented theAPI defined by RCy3, an R package in Bioconductor developed by a Cytoscape Automation working group consistingof Alex Pico (primary author), Mark Grimes, Julia Gustavsen, Shraddha Pai, Ruth Isserlin, Barry Demchak. RCy3was based on prior work contributed by Paul Shannon, Tanja Muetze, Georgi Kolishkovski and Keiichiro Ono.
We intend to keep the function definitions available through py4cytoscape and RCy3 consistent and synchronizedgoing forward, and to re-integrate unique features found only in py2cytoscape.
9
CHAPTER
FIVE
DOCUMENTATION
5.1 Install
py4cytoscape requires Python 3.6, 3.7, or 3.8. If you do not already have a Python environment configured onyour computer, please see the instructions for installing the full scientific Python stack.
Note: If you are on Windows and want to install optional packages (e.g., scipy), then you will need to install a Pythondistributions such as Anaconda, Enthought Canopy, Python(x,y), WinPython, or Pyzo. If you use one of these Pythondistribution, please refer to their online documentation.
PyCharm and other integrated development environments often install their own Python distributions.
Below we assume you have the default Python environment already configured on your computer and you intend toinstall py4cytoscape inside of it. If you want to create and work with Python virtual environments, please followinstructions on venv and virtual environments.
First, make sure you have the latest version of pip (the Python package manager) installed. If you do not, refer to thePip documentation and install pip first.
5.1.1 Cytoscape Prerequisite
To exercise py4cytoscape, you must first have downloaded, installed, and executed Cytoscape. If you have notalready done this, please refer to the Launching Cytoscape instructions.
Note: Cytoscape and py4cytoscape must be running on the same workstation or virtual machine.py4cytoscape communicates with Cytoscape via a localhost connection, which precludes py4cytoscape fromaccessing Cytoscape remotely. While this limitation can be overcome by configuring py4cytoscape or supplyingthe Cytoscape URL in py4cytoscape calls, this can become a complex networking problem if firewalls and routersare present on the network.
11
py4cytoscape Documentation, Release 0.0.1
5.1.2 Install the development version (Python Console)
Install the current release of py4cytoscape with pip:
pip install python-igraph requests pandas networkxgit clone git://github.com/bdemchak/py4cytoscapecd py4cytoscapepython setup.py install # or python setup.py install --user
5.1.3 Install the development version (Jupyter Notebook)
Install the current release of py4cytoscape with pip:
!pip install python-igraph requests pandas networkx!pip install git+https://github.com/bdemchak/py4cytoscape!curl localhost:1234
5.1.4 Verify Cytoscape connection
To verify that py4cytoscape is properly installed and able to communicate with Cytoscape, execute the followingin a Python Console or Jupyter Notebook (after starting Cytoscape):
import py4cytoscape as py4dir(py4)py4.cytoscape_ping()py4.cytoscape_version_info()py4.import_network_from_file("tests\data\galfiltered.sif")
This will import py4cytoscape into the Python namespace, print a (long) list of py4cytoscape entrypoints,and then demonstrate a connection to Cytoscape by collecting Cytoscape information and loading a demonstrationnetwork.
5.1.5 Testing
py4cytoscape uses the Python unittest testing package. You can learn more about unittest on its home-page.
To execute tests from an OS command line, set the current directory to the py4cytoscape package directory. Then,establish the execution environment:
cd testsset PYTHONPATH=..
The py4cytoscape test suite consists of a number of sub-suites. Executing one or two of them is relatively quick.To execute a single sub-suite (e.g., test_apps.py):
python -m unittest test_apps.py
To execute more than one sub-suite (e.g., test_apps.py and test_filters.py):
python -m unittest test_apps.py test_filters.py
To execute the entire test suite:
12 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
python -m unittest
To execute a single test (e.g., test_get_app_information) in a single test suite:
python -m unittest test_apps.AppsTests.test_get_app_information
Note: To send test output to a file, redirect stderr and console:
python -m unittest 2>stderr.log 1>cons.log
Some tests require console input, and without console prompts, the tests will appear to stall. To avoid executing suchtests, set the PY4CYTOSCAPE_SKIP_UI_TESTS environment variable described below.
Note: To execute tests with less console debug output, set this environment variable before executing tests:
set PY4CYTOSCAPE_SUMMARY_LOGGER=FALSE
To further configure logging, see the Logging file.
Note: To execute tests without showing test names as tests execute, set this environment variable before executingthe tests:
set PY4CYTOSCAPE_SHOW_TEST_PROGRESS=FALSE
Note: To skip execution of tests that require user input, set this environment variable before executing tests:
set PY4CYTOSCAPE_SKIP_UI_TESTS=TRUE
Note: When executing a large number of tests, we recommend that all three environment variables be set as describedabove.
Note: When executing tests in PyCharm, you can set environment variables using the Run | EditConfigurations... menu item.
5.2 Tutorial
This guide can help you start working with py4cytoscape.
. . . save this space for a simple workflow that Kozo is working on . . .
5.2. Tutorial 13
py4cytoscape Documentation, Release 0.0.1
5.3 Reference
Release 0.0.1
Date Jun 21, 2020
5.3.1 Apps
Functions for inspecting and managing apps for Cytoscape.
Local Apps
disable_app(app[, base_url]) Disable App.enable_app(app[, base_url]) Enable App.get_app_status(app[, base_url]) Retrieve the current status of a Cytoscape app: Installed,
Uninstalled or Disabled.get_app_updates([base_url]) Retrieve list of currently installed Cytoscape apps with
updates available.get_disabled_apps([base_url]) Retrieve list of currently disabled apps in Cytoscape.get_installed_apps([base_url]) Retrieve list of currently installed apps in Cytoscape.get_uninstalled_apps([base_url]) Retrieve list of apps not currently installed in Cytoscape.install_app(app[, base_url]) Installs an app in Cytoscapeuninstall_app(app[, base_url]) Uninstall an app from Cytoscape.update_app(app[, base_url]) Update a Cytoscape app to the latest available version.
py4cytoscape.apps.disable_app
disable_app(app, base_url='http://localhost:1234/v1')Disable App.
Disable an app to effectively remove it from your Cytoscape session without having to uninstall it.
Parameters
• app (str) – Name of app
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘appName’: <name of app>}, and is returned whether or not app exists
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
14 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> disable_app('stringApp'){'appName': 'stringApp'}
py4cytoscape.apps.enable_app
enable_app(app, base_url='http://localhost:1234/v1')Enable App.
Enable a previously installed and disabled app in Cytoscape.
Parameters
• app (str) – Name of app
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘appName’: <name of app>}, and is returned whether or not app exists
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> enable_app('stringApp'){'appName': 'stringApp'}
py4cytoscape.apps.get_app_status
get_app_status(app, base_url='http://localhost:1234/v1')Retrieve the current status of a Cytoscape app: Installed, Uninstalled or Disabled.
Parameters
• app (str) – Name of app
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘appName’: <appname>, ‘status’: <status>} where <status> is Installed, Disabled orUninstalled
Return type dict
Raises
• CyError – if app does not exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 15
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_app_status('stringApp'){'appName': 'stringApp', 'status': 'Installed'}
py4cytoscape.apps.get_app_updates
get_app_updates(base_url='http://localhost:1234/v1')Retrieve list of currently installed Cytoscape apps with updates available.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of dicts, one for each app {‘appName’: <appname>, ‘version’: <version>, ‘informa-tion’: <information>}
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_app_updates()[{'appName': 'JSON Support', 'version': '3.7.0', 'information': 'null'}, ...]
py4cytoscape.apps.get_disabled_apps
get_disabled_apps(base_url='http://localhost:1234/v1')Retrieve list of currently disabled apps in Cytoscape.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of dicts, one for each app {‘appName’: <appname>, ‘version’: <version>, ‘descrip-tion’: <description>, ‘status’: <status>} where <status> is always ‘Disabled’
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
16 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_disabled_apps()[{'appName': 'stringApp', 'version': '1.4.2', 'description': 'Import and augment→˓Cytoscape networks from STRING', 'status': 'Disabled'}, {...}, ...]
py4cytoscape.apps.get_installed_apps
get_installed_apps(base_url='http://localhost:1234/v1')Retrieve list of currently installed apps in Cytoscape.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of dicts, one for each app {‘appName’: <appname>, ‘version’: <version>, ‘descrip-tion’: <description>, ‘status’: <status>} where status may be ‘Installed’, ‘Disabled’, ‘Unin-stalled’
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_installed_apps()[{'appName': 'JSON Support', 'version': '3.7.0', 'description': 'null', 'status':→˓'Installed'}, ...]
py4cytoscape.apps.get_uninstalled_apps
get_uninstalled_apps(base_url='http://localhost:1234/v1')Retrieve list of apps not currently installed in Cytoscape.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of dicts, one for each app {‘appName’: <appname>, ‘version’: <version>, ‘descrip-tion’: <description>, ‘status’: <status>} where status may be ‘Installed’, ‘Disabled’, ‘Unin-stalled’
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
5.3. Reference 17
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_uninstalled_apps()[{'appName': 'JSON Support', 'version': '3.7.0', 'description': 'null', 'status':→˓'Uninstalled'}, ...]
py4cytoscape.apps.install_app
install_app(app, base_url='http://localhost:1234/v1')Installs an app in Cytoscape
Parameters
• app (str) – Name of app
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {} always empty, whether app exists or not
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> install_app('stringApp'){}
py4cytoscape.apps.uninstall_app
uninstall_app(app, base_url='http://localhost:1234/v1')Uninstall an app from Cytoscape.
Parameters
• app (str) – Name of app
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘appName’: <name of app>} whether app exists or not
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
18 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> uninstall_app('stringApp'){'appName': 'stringApp'}
py4cytoscape.apps.update_app
update_app(app, base_url='http://localhost:1234/v1')Update a Cytoscape app to the latest available version.
Parameters
• app (str) – Name of app
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [] whether or not app exists
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> update_app('stringApp')[]
App Store
get_app_information(app[, base_url]) Retrieve the name, brief description and version of a Cy-toscape app.
get_available_apps([base_url]) Retrieve a list of apps available for installation in Cy-toscape.
open_app_store(app[, base_url]) Opens the Cytoscape App Store in a new tab in yourdefault browser.
py4cytoscape.apps.get_app_information
get_app_information(app, base_url='http://localhost:1234/v1')Retrieve the name, brief description and version of a Cytoscape app.
Parameters
• app (str) – Name of app
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘Unused memory freed up.’
5.3. Reference 19
py4cytoscape Documentation, Release 0.0.1
Return type str
Raises
• CyError – if app is unknown
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_app_information('stringApp'){'app': 'stringApp', 'descriptionName': 'Import and augment Cytoscape networks→˓from STRING', 'version': '1.5.1'}
py4cytoscape.apps.get_available_apps
get_available_apps(base_url='http://localhost:1234/v1')Retrieve a list of apps available for installation in Cytoscape.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of dicts, one for each app {‘appName’: <appname>, ‘description’: <description>, ‘de-tails’: <details>}
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_available_apps()[{'appName': 'stringApp', 'description': 'Import and augment Cytoscape networks→˓from STRING', 'details': ''}, {...}, ...]
py4cytoscape.apps.open_app_store
open_app_store(app, base_url='http://localhost:1234/v1')Opens the Cytoscape App Store in a new tab in your default browser.
Parameters
• app (str) – Name of app (‘’ for main App Store page)
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {} whether page for app exists or not
Return type dict
20 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> open_app_store('stringApp'){}
5.3.2 Collections
Functions for getting information about network COLLECTIONS.
Collections
get_collection_list([base_url]) Get Collection List.get_collection_name([collection_suid,base_url])
Get Collection Name.
get_collection_networks([collection_suid,. . . ])
Get Collection Networks.
get_collection_suid([network, base_url]) Get Collection Suid.
py4cytoscape.collections.get_collection_list
get_collection_list(base_url='http://localhost:1234/v1')Get Collection List.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of collection names, one for each collection
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_collection_list()[]>>> get_collection_list()['galFiltered.sif', 'BINDyeast.sif']
5.3. Reference 21
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.collections.get_collection_name
get_collection_name(collection_suid=None, base_url='http://localhost:1234/v1')Get Collection Name.
Parameters
• collection_suid (SUID or None) – SUID of a collection (or None for “current”collection)
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns the name of the collection associated with SUID
Return type str
Raises
• CyError – if no collection exists
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error or SUID doesn’t exist
Examples
>>> get_collection_name()'galFiltered.sif'>>> get_collection_suid(851296)'galFiltered.sif'
py4cytoscape.collections.get_collection_networks
get_collection_networks(collection_suid=None, base_url='http://localhost:1234/v1')Get Collection Networks.
Parameters
• collection_suid (SUID or None) – SUID of a collection (or None for “current”collection)
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of SUIDs for networks within the collection
Return type list
Raises
• CyError – if no collection exists
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error or SUID doesn’t exist
22 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_collection_name()'galFiltered.sif'>>> get_collection_suid(851296)'galFiltered.sif'
py4cytoscape.collections.get_collection_suid
get_collection_suid(network=None, base_url='http://localhost:1234/v1')Get Collection Suid.
Parameters
• network (SUID or str or None) – Network name or SUID of a network in thecollection
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns the SUID of the collection containing the network
Return type int
Raises
• CyError – if no collection exists
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_collection_suid()[851280]>>> get_collection_suid('current')[851280]>>> get_collection_suid(851296)[851280]>>> get_collection_suid('galFiltered.sif')[851280]
5.3.3 Commands
Functions for constructing any arbitrary CyREST API or Commands API method via standard GET, PUT, POST andDELETE protocols. These functions handle marshalling and unmarshalling of urls, parameters and returns so thathigher-level functions can work with Python-friendly arguments and returns.
I. CyREST API functions
II. Commands API functions
III. Internal functions
5.3. Reference 23
py4cytoscape Documentation, Release 0.0.1
CyREST API
cyrest_delete([operation, parameters, . . . ]) Construct a query, make DELETE call and process theresult.
cyrest_get([operation, parameters, . . . ]) Construct a query, make GET call and process the result.cyrest_post([operation, parameters, body, . . . ]) Construct a query and body, make POST call and pro-
cess the result.cyrest_put([operation, parameters, body, . . . ]) Construct a query and body, make PUT call and process
the result.
py4cytoscape.commands.cyrest_delete
cyrest_delete(operation=None, parameters=None, base_url='http://localhost:1234/v1', re-quire_json=True)
Construct a query, make DELETE call and process the result.
Parameters
• operation (str) – A string to be converted to the REST query namespace
• parameters (dict) – A named list of values to be converted to REST query parameters
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
• require_json (bool) – True if only JSON is accepted as a response; otherwise, returnnon-JSON if response is non-JSON
Returns a dict if result was JSON; otherwise a string
Return type str or dict
Raises
• ValueError – if JSON is expected and response is not JSON
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> cyrest_delete('networks/51/views', require_json=False) # deletes views for→˓network 51''>>> cyrest_delete('session') # deletes the current session{'message': 'New session created.'}
24 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.commands.cyrest_get
cyrest_get(operation=None, parameters=None, base_url='http://localhost:1234/v1', require_json=True)Construct a query, make GET call and process the result.
Parameters
• operation (str) – A string to be converted to the REST query namespace
• parameters (dict) – A named list of values to be converted to REST query parameters
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
• require_json (bool) – True if only JSON is accepted as a response; otherwise, returnnon-JSON if response is non-JSON
Returns a dict if result was JSON; otherwise a string
Return type str or dict
Raises
• ValueError – if JSON is expected and response is not JSON
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> cyrest_get('gc', require_json=False) # starts Cytoscape garbage collection''>>> cyrest_get('version') # fetches CyREST version{'apiVersion': 'v1', 'cytoscapeVersion': '3.8.0'}
py4cytoscape.commands.cyrest_post
cyrest_post(operation=None, parameters=None, body=None, base_url='http://localhost:1234/v1', re-quire_json=True)
Construct a query and body, make POST call and process the result.
Parameters
• operation (str) – A string to be converted to the REST query namespace
• parameters (dict) – A named list of values to be converted to REST query parameters
• body (dict) – A named list of values to be converted to JSON
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
• require_json (bool) – True if only JSON is accepted as a response; otherwise, returnnon-JSON if response is non-JSON
Returns a dict if result was JSON; otherwise a string
Return type str or dict
5.3. Reference 25
py4cytoscape Documentation, Release 0.0.1
Raises
• ValueError – if JSON is expected and response is not JSON
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> cyrest_post('networks/51/views') # Add a view to a network{'networkViewSUID': '52'}>>> cyrest_post('commands/command/echo', body={'message': 'Hi there'}) # echo a→˓message{'data': ['Hi there'], 'errors': '[]}
py4cytoscape.commands.cyrest_put
cyrest_put(operation=None, parameters=None, body=None, base_url='http://localhost:1234/v1', re-quire_json=True)
Construct a query and body, make PUT call and process the result.
Parameters
• operation (str) – A string to be converted to the REST query namespace
• parameters (dict) – A named list of values to be converted to REST query parameters
• body (dict) – A named list of values to be converted to JSON
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
• require_json (bool) – True if only JSON is accepted as a response; otherwise, returnnon-JSON if response is non-JSON
Returns a dict if result was JSON; otherwise a string
Return type str or dict
Raises
• ValueError – if JSON is expected and response is not JSON
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> cyrest_put('networks/views/currentNetworkView', body={'networkViewSUID': view}→˓) # Make a view the current view{'data': {}, 'errors': '[]}
26 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Cytoscape Commands API
commands_get(cmd_string[, base_url]) Commands GET.commands_help([cmd_string, base_url]) Commands Help.commands_post(cmd[, base_url]) Commands POST.commands_run(cmd_string[, base_url]) Run a Command.
py4cytoscape.commands.commands_get
commands_get(cmd_string, base_url='http://localhost:1234/v1')Commands GET.
Using the same syntax as Cytoscape’s Command Line Dialog, this function converts a command string into aCyREST query URL, executes a GET request, and parses the result content into a list object.
Parameters
• cmd_string (str) – command
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a list of lines in the command result (omitting the “Finished” line at the end)
Return type list
Raises
• CyError – if command has an error
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> commands_get('command sleep duration=5')[]>>> commands_get('apps status app="Network Merge"')['app: Network Merge, status: Installed']>>> commands_get('view')["Available commands for 'view':", 'create', 'destroy', 'export', 'fit content',→˓'fit selected', ...]
py4cytoscape.commands.commands_help
commands_help(cmd_string='help', base_url='http://localhost:1234/v1')Commands Help.
Using the same syntax as Cytoscape’s Command Line Dialog, this function returns a list of available commandsor args. Works with or without ‘help’ command prefix. Note that if you ask about a command that doesn’t haveany arguments, this function will run the command!
Parameters
• cmd_string (str) – command
5.3. Reference 27
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a list of lines in the command result (omitting the “Finished” line at the end)
Return type list
Raises
• CyError – if command has an error
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> commands_help('apps')['disable', 'enable', 'information', 'install', 'list available', 'list disabled',→˓ ...]
py4cytoscape.commands.commands_post
commands_post(cmd, base_url='http://localhost:1234/v1')Commands POST.
Using the same syntax as Cytoscape’s Command Line Dialog, this function converts a command string into aCyREST query URL, executes a POST request, and parses the result content into a dict object.
Parameters
• cmd_string (str) – command
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a structured command reply
Return type dict or list
Raises
• CyError – if command has an error
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> commands_post('apps status app="Network Merge"'){'appName': 'Network Merge', 'status': 'Installed'}>>> commands_post('apps list available')[{appName: 'CHAT', 'description': 'Identify contextually relevant hubs in→˓biological networks', 'details': ''},{'appName': 'AgilentLiteratureSearch', 'description': 'Mines scientific→˓literature to ... ', 'details': ''} ...]
28 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.commands.commands_run
commands_run(cmd_string, base_url='http://localhost:1234/v1')Run a Command.
Using the same syntax as Cytoscape’s Command Line Dialog, this function converts a command string into aCyREST query URL, executes a GET request, and parses the result content into a list object. Same as com-mandsGET.
Parameters
• cmd_string (str) – command
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a list of lines in the command result (omitting the “Finished” line at the end)
Return type list
Raises
• CyError – if command has an error
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> commands_run('session new destroyCurrentSession=true')[]
Cytoscape Commands
command_echo([variable_name, base_url]) Command Echo.command_open_dialog([base_url]) Command Open Dialog.command_pause([message, base_url]) Command Pause.command_quit([base_url]) Command Quit.command_run_file(file[, args, base_url]) Command Run File.command_sleep([duration, base_url]) Command Sleep.
py4cytoscape.commands.command_echo
command_echo(variable_name='*', base_url='http://localhost:1234/v1')Command Echo.
The echo command will display the value of the variable specified by the variableName argument, or all vari-ables if variableName is not provided.
Parameters
• variable_name (str) – The name of the variable to display. Default is to display allvariable values using “*”.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version to
5.3. Reference 29
py4cytoscape Documentation, Release 0.0.1
connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a list containing as single string containing the variable_name value
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> command_echo('Hi there')['Hi there']>>> command_echo()['*']
py4cytoscape.commands.command_open_dialog
command_open_dialog(base_url='http://localhost:1234/v1')Command Open Dialog.
The command line dialog provides a field to enter commands and view results. It also provides the help com-mand to display namespaces, commands, and arguments
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns None
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> command_open_dialog()
py4cytoscape.commands.command_pause
command_pause(message='', base_url='http://localhost:1234/v1')Command Pause.
The pause command displays a dialog with the text provided in the message argument and waits for the user toclick OK.
Parameters
• message (str) – Text to display in pause dialog
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
30 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> command_pause(){}
py4cytoscape.commands.command_quit
command_quit(base_url='http://localhost:1234/v1')Command Quit.
This command causes Cytoscape to exit. It is typically used at the end of a script file
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> command_quit(){}
py4cytoscape.commands.command_run_file
command_run_file(file, args=None, base_url='http://localhost:1234/v1')Command Run File.
The run command will execute a command script from the file pointed to by the file argument, which shouldcontain Cytoscape commands, one per line. Arguments to the script are provided by the args argument
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
5.3. Reference 31
py4cytoscape Documentation, Release 0.0.1
Examples
>>> command_run_file('data/CommandScript.txt'){}
py4cytoscape.commands.command_sleep
command_sleep(duration=None, base_url='http://localhost:1234/v1')Command Sleep.
The sleep command will pause processing for a period of time as specified by duration seconds. It is typicallyused as part of a command script.
Parameters
• duration (float) – The time in seconds to sleep
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> command_sleep(6){}
Swagger API-level Documentation
commands_api([base_url]) Open Swagger docs for CyREST Commands API.cyrest_api([base_url]) Open Swagger docs for CyREST API.
py4cytoscape.commands.commands_api
commands_api(base_url='http://localhost:1234/v1')Open Swagger docs for CyREST Commands API.
Opens swagger docs in default browser for a live instance of Commands available via CyREST.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns True
Return type bool
32 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> commands_api() # loads Swagger CyREST Commands API into browserTrue
py4cytoscape.commands.cyrest_api
cyrest_api(base_url='http://localhost:1234/v1')Open Swagger docs for CyREST API.
Opens swagger docs in default browser for a live instance of CyREST operations.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns True
Return type bool
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cyrest_api() # loads Swagger CyREST API into browserTrue
5.3.4 CyNDEx
Functions for communicating with NDEx from within Cytoscape.
Read/Write
export_network_to_ndex(username, password,. . . )
Send a copy of a Cytoscape network to NDEx as a newsubmission.
import_network_from_ndex(ndex_id[, . . . ]) Import a network from the NDEx database into Cy-toscape.
update_network_in_ndex(username, password,. . . )
Update Network In NDEx.
5.3. Reference 33
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.cy_ndex.export_network_to_ndex
export_network_to_ndex(username, password, is_public, network=None, metadata=None,base_url='http://localhost:1234/v1')
Send a copy of a Cytoscape network to NDEx as a new submission.
Parameters
• username (str) – NDEx account username; required for private content
• password (str) – NDEx account password; required for private content
• is_public (bool) – Whether to make the network publicly accessible at NDEx.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• metadata (dict) – A list of structured information describing the network
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns NDEx identifier externalId for new submission
Return type str
Raises
• CyError – if credentials or network are invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> export_network_to_ndex('userid', 'password', False)'7bc2548c-9c93-11ea-aaef-0ac135e8bacf'>>> export_network_to_ndex('userid', 'password', False, network='galFiltered.sif')'7bc2548c-9c93-11ea-aaef-0ac135e8bacf'
py4cytoscape.cy_ndex.import_network_from_ndex
import_network_from_ndex(ndex_id, username=None, password=None, access_key=None,base_url='http://localhost:1234/v1')
Import a network from the NDEx database into Cytoscape.
Parameters
• ndex_id (str) – Network externalId provided by NDEx. This is not the same as aCytoscape SUID.
• username (str) – NDEx account username; required for private content
• password (str) – NDEx account password; required for private content
• access_key (str) – NDEx accessKey; alternate acccess to private content
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
34 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Returns SUID of imported network
Return type int
Raises
• CyError – if credentials, NDEx ID or access_key are invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> import_network_from_ndex(galFiltered_uuid, 'userid', 'password')52>>> import_network_from_ndex(galFiltered_uuid, access_key=test_key)52
py4cytoscape.cy_ndex.update_network_in_ndex
update_network_in_ndex(username, password, is_public, network=None, metadata=None,base_url='http://localhost:1234/v1')
Update Network In NDEx.
Update an existing network in NDEx, given a previously assoicaiated Cytoscape network, e.g., previously ex-ported to NDEx or imported from NDEx.
Parameters
• username (str) – NDEx account username; required for private content
• password (str) – NDEx account password; required for private content
• is_public (bool) – Whether to make the network publicly accessible at NDEx.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• metadata (dict) – A list of structured information describing the network
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns NDEx identifier externalId for the updated submission
Return type str
Raises
• CyError – if credentials or network are invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 35
py4cytoscape Documentation, Release 0.0.1
Examples
>>> update_network_in_ndex('userid', 'password', False)'7bc2548c-9c93-11ea-aaef-0ac135e8bacf'>>> update_network_in_ndex('userid', 'password', False, network='galFiltered.sif')'7bc2548c-9c93-11ea-aaef-0ac135e8bacf'
Utility
get_network_ndex_id([network, base_url]) Get Network NDEx Id.
py4cytoscape.cy_ndex.get_network_ndex_id
get_network_ndex_id(network=None, base_url='http://localhost:1234/v1')Get Network NDEx Id.
Retrieve the NDEx externalId for a Cytoscape network, presuming it has already been exported to NDEx.
If the Cytoscape network is not associated with an NDEx network, the return value will be None.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• metadata (dict) – A list of structured information describing the network
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns NDEx identifier externalId or NULL
Return type str
Raises
• CyError – if network is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_network_ndex_id()'7bc2548c-9c93-11ea-aaef-0ac135e8bacf'>>> get_network_ndex_id(network='galFiltered.sif')'7bc2548c-9c93-11ea-aaef-0ac135e8bacf'
36 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
5.3.5 Cytoscape System
Functions for inspecting and managing apps for Cytoscape.
Resources
cytoscape_free_memory([base_url]) Manually call Java’s garbage collection System.gc() to free up unused memory.
cytoscape_memory_status([base_url]) Returns the memory resources of the server running Cy-toscape.
cytoscape_number_of_cores([base_url]) Returns the processor resources of the server runningCytoscape.
py4cytoscape.cytoscape_system.cytoscape_free_memory
cytoscape_free_memory(base_url='http://localhost:1234/v1')Manually call Java’s garbage collection System.gc() to free up unused memory.
This process happens automatically, but may be useful to call explicitly for testing or evaluation purposes.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘Unused memory freed up.’
Return type str
Raises
• CyError – if can’t free memory
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> cytoscape_free_memory()'Unused memory freed up.'
py4cytoscape.cytoscape_system.cytoscape_memory_status
cytoscape_memory_status(base_url='http://localhost:1234/v1')Returns the memory resources of the server running Cytoscape.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘usedMemory’: <mem>, ‘freeMemory’: <mem>, ‘totalMemory’: <mem>, ‘maxMem-ory’: <mem>} where <mem> is a count of megabytes
Return type dict
5.3. Reference 37
py4cytoscape Documentation, Release 0.0.1
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cytoscape_memory_status(){'usedMemory': 160, 'freeMemory': 1819, 'totalMemory': 1979, 'maxMemory': 5510}
py4cytoscape.cytoscape_system.cytoscape_number_of_cores
cytoscape_number_of_cores(base_url='http://localhost:1234/v1')Returns the processor resources of the server running Cytoscape.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns count of available CPUs
Return type int
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cytoscape_number_of_cores()4
System
cytoscape_api_versions([base_url]) Get the list of available CyREST API versions.cytoscape_ping([base_url]) Ping Cytoscapecytoscape_version_info([base_url]) Return the versions of the current Cytoscape and
CyREST API.
py4cytoscape.cytoscape_system.cytoscape_api_versions
cytoscape_api_versions(base_url='http://localhost:1234/v1')Get the list of available CyREST API versions.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of available API versions
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
38 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> cytoscape_api_versions()['v1']
py4cytoscape.cytoscape_system.cytoscape_ping
cytoscape_ping(base_url='http://localhost:1234/v1')Ping Cytoscape
Tests the connection to Cytoscape via CyREST and verifies that supported versions of Cytoscape and CyRESTAPI are loaded.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns None
Raises
• CyError – if error connecting to CyREST or version is unsupported
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> cytoscape_ping()You are connected to Cytoscape!
py4cytoscape.cytoscape_system.cytoscape_version_info
cytoscape_version_info(base_url='http://localhost:1234/v1')Return the versions of the current Cytoscape and CyREST API.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘apiVersion’: <version>, ‘cytoscapeVersion’: <version>}
Return type dict
Raises
• CyError – if error connecting to CyREST
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 39
py4cytoscape Documentation, Release 0.0.1
Examples
>>> cytoscape_version_info(){'apiVersion': 'v1', 'cytoscapeVersion': '3.8.0'}
5.3.6 Exceptions
Error classes for py4cytoscape.
Exceptions
CyError
py4cytoscape.exceptions.CyError
exception CyError
5.3.7 Filters
Functions for working with FILTERS for the selection of nodes and edges in networks, including operations to importand export filters. In the Cytoscape user interface, filters are managed in the Select tab of the Control Panel.
Existing Filters
apply_filter([filter_name, hide, network, . . . ]) Run an existing filter by supplying the filter name.export_filters([filename, base_url]) Saves filters to file in JSON format.get_filter_list([base_url]) Retrieve list of named filters in current sessionimport_filters(filename[, base_url]) Loads filters from a file in JSON format.
py4cytoscape.filters.apply_filter
apply_filter(filter_name='Default filter', hide=False, network=None,base_url='http://localhost:1234/v1')
Run an existing filter by supplying the filter name.
Parameters
• filter_name (str) – Name of filter to apply. Default is “Default filter”.
• hide (bool) – Whether to hide filtered out nodes and edges. Default is FALSE. Ignoredif all nodes or edges are filtered out. This is an alternative to filtering for node and edgeselection.
• network (SUID or str or None) – Name or SUID of the network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of the
40 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
CyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: <node list>, ‘edges’: <edge list>} returns list of nodes and edges selected afterfilter executes
Return type dict
Raises
• CyError – if filter doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> apply_filter('degree filter 1x'){'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> apply_filter('degree filter 1x', hide=True, network='My Network'){'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}
See also:
unhide_all()
py4cytoscape.filters.export_filters
export_filters(filename='filters.json', base_url='http://localhost:1234/v1')Saves filters to file in JSON format.
Parameters
• filename (str) – Full path or path relavtive to current working directory, in addition tothe name of the file. Default is “filters.json”.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> export_filters() # Saves all filters in file 'filters.json'{}>>> export_filters('test.json') # Saves all filters in file 'test.json'{}>>> export_filters('test') # Saves all filters in file 'test.json'{}
5.3. Reference 41
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.filters.get_filter_list
get_filter_list(base_url='http://localhost:1234/v1')Retrieve list of named filters in current session
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns returns list of available filter names
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_filter_list()['degree filter 1x', 'degree filter 2x']
py4cytoscape.filters.import_filters
import_filters(filename, base_url='http://localhost:1234/v1')Loads filters from a file in JSON format.
Adds filters to whatever filters already exist, and renames filters where names already exist. Also executes eachfilter.
Parameters
• filename (str) – Path and name of the filters file to load.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> import_filters('test.json') # Fetches filters in file 'test.json'{}>>> import_filters('test') # Fetches filters in file 'test'{}
42 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
New Filters
create_column_filter(filter_name, column,. . . )
Create Column Filter.
create_composite_filter(filter_name, fil-ter_list)
Combine filters to control node and edge selection basedon previously created filters.
create_degree_filter(filter_name, criterion) Create Degree Filter.
py4cytoscape.filters.create_column_filter
create_column_filter(filter_name, column, criterion, predicate, caseSensitive=False,anyMatch=True, type='nodes', hide=False, network=None,base_url='http://localhost:1234/v1')
Create Column Filter.
Create a filter to control node or edge selection. Works on columns of boolean, string, numeric and lists. Notethe unique restrictions for criterion and predicate depending on the type of column being filtered.
Parameters
• filter_name (str) – Name for new filter.
• column (str) – Table column to base filter upon.
• criterion (list, bool, str, int or float) – For boolean columns: Trueor False. For string columns: a string value, e.g., “hello”. If the predicate is REGEX thenthis can be a regular expression as accepted by the Java Pattern class (https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html). For numeric columns: If the predicateis BETWEEN or IS_NOT_BETWEEN then this is a two-element list of numbers, example:[1,5], otherwise a single number.
• predicate (str) – For boolean columns: IS, IS_NOT. For string columns: IS,IS_NOT, CONTAINS, DOES_NOT_CONTAIN, REGEX. For numeric columns:IS, IS_NOT, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN,LESS_THAN_OR_EQUAL, BETWEEN, IS_NOT_BETWEEN.
• caseSensitive (bool) – If string matching should be case sensitive. Default is FALSE.
• anyMatch (bool) – Only applies to List columns. If true then at least one element in thelist must pass the filter, if false then all the elements in the list must pass the filter. Defaultis TRUE.
• type (str) – Apply filter to “nodes” (default) or “edges”.
• hide (bool) – Whether to hide filtered out nodes and edges. Default is FALSE. Ignoredif all nodes or edges are filtered out. This is an alternative to filtering for node and edgeselection.
• network (SUID or str or None) – Name or SUID of the network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: <node list>, ‘edges’: <edge list>} returns list of nodes and edges selected afterfilter executes
Return type dict
5.3. Reference 43
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if column doesn’t exist in the table named by type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> create_column_filter('myFilter', 'log2FC', [-1,1], "IS_NOT_BETWEEN") # filter→˓on numeric value log2FC{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', 'pValue', 0.05, "LESS_THAN") # Filter on→˓floating point column pValue{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', 'function', "kinase", "CONTAINS", False) #→˓Function on string column name{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', 'name', "^Y.*C$", "REGEX") # Filter on→˓string column name{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', 'isTarget', True , "IS") # Filter on boolean→˓column isTarget{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', 'isTarget', True , "IS", hide=True) # Filter→˓on boolean column isTarget{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', 'Betweenness', [300, 600] , "BETWEEN", type=→˓'edges') # Filter edges{'nodes': None, 'edges': [{'YPR119W (pd) YMR043W', 'YDR412W (pp) YPR119W'}]}
py4cytoscape.filters.create_composite_filter
create_composite_filter(filter_name, filter_list, type='ALL', hide=False, network=None,base_url='http://localhost:1234/v1')
Combine filters to control node and edge selection based on previously created filters.
Parameters
• filter_name (str) – Name for new filter.
• filter_list (list) – List of names of filters to combine.
• type (str) – Type of composition, requiring ALL (default) or ANY filters to pass for finalnode and edge selection.
• hide (bool) – Whether to hide filtered out nodes and edges. Default is FALSE. Ignoredif all nodes or edges are filtered out. This is an alternative to filtering for node and edgeselection.
• network (SUID or str or None) – Name or SUID of the network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
44 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Returns {‘nodes’: <node list>, ‘edges’: <edge list>} returns list of nodes and edges selected afterfilter executes
Return type dict
Raises
• CyError – if filter list contains less than one filter or has filters that don’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> create_composite_filter('New Filter', ['degree filter 1x', 'degree filter 2x→˓']){'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_composite_filter('New Filter', ['degree filter 1x', 'column filter 10x→˓'], type='ANY', network="My network"){'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': [{'YPR119W (pd)→˓YMR043W', 'YDR412W (pp) YPR119W'}]}>>> create_composite_filter('New Filter', ['degree filter 1x', 'degree filter 2x→˓'], hide=True){'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}
py4cytoscape.filters.create_degree_filter
create_degree_filter(filter_name, criterion, predicate='BETWEEN', edge_type='ANY', hide=False,network=None, base_url='http://localhost:1234/v1')
Create Degree Filter.
Creates a filter to control node selection base on in/out degree.
Parameters
• filter_name (str) – Name for new filter.
• criterion (list) – A two-element vector of numbers, example: [1,5].
• predicate (str) – BETWEEN (default) or IS_NOT_BETWEEN
• edgeType (str) – Type of edges to consider in degree count: ANY (default), UNDI-RECTED, INCOMING, OUTGOING, DIRECTED
• hide (bool) – Whether to hide filtered out nodes and edges. Default is FALSE. Ignoredif all nodes or edges are filtered out. This is an alternative to filtering for node and edgeselection.
• network (SUID or str or None) – Name or SUID of the network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: <node list>, ‘edges’: <edge list>} returns list of nodes and edges selected afterfilter executes
Return type dict
5.3. Reference 45
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if criterion is not list of two values
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> create_degree_filter('myFilter', [2, 5]) # filter on any nodes having between→˓2 and 5 edges{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_degree_filter('myFilter', [2, 5], predicate='IS_NOT_BETWEEN') # filter→˓for edges < 2 or > 5{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', [2, 5], edge_type='INCOMING') # filter for→˓between 2 and 5 incoming edges{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}>>> create_column_filter('myFilter', [2, 5], hide=True) # filter for between 2→˓and 5 edges, and hide them{'nodes': ['YDR395W', 'YLR362W', 'YPL248C', 'YGL035C'], 'edges': None}
5.3.8 Groups
Functions for working with GROUPS in Cytoscape.
Add/Remove Groups and Nodes
add_to_group(group_name[, nodes, . . . ]) Add the specified nodes and edges to the specifiedgroup.
create_group(group_name[, nodes, . . . ]) Create a group from the specified nodes.create_group_by_column(group_name[, col-umn, . . . ])
Create a group of nodes defined by a column value.
delete_group([groups, groups_by_col, . . . ]) Delete one or more groups, while leaving member nodesintact.
remove_from_group(group_name[, nodes, . . . ]) Remove the specified nodes and edges from the speci-fied group.
py4cytoscape.groups.add_to_group
add_to_group(group_name, nodes=None, nodes_by_col='SUID', edges=None, edges_by_col='SUID', net-work=None, base_url='http://localhost:1234/v1')
Add the specified nodes and edges to the specified group.
Parameters
• group_name (str) – Specifies the name used to identify the group
• nodes (list or str or None) – List of node SUIDs, names, other column values,or keyword: selected, unselected or all. Default is currently selected nodes.
• nodes_by_col (str) – name of node table column corresponding to provided nodes list.Default is ‘SUID’.
46 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• edges (list or str or None) – List of edge SUIDs, names, other column values,or keyword: selected, unselected or all. Default is currently selected edges.
• edges_by_col (str) – name of edge table column corresponding to provided edges list.Default is ‘SUID’.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> add_to_group('Group 1', ['GDS1', 'SIP4', 'PDC1'], nodes_by_col='COMMON') #→˓add nodes by common name & all selected edges{}>>> add_to_group('Group 1') # add all selected nodes and edges{}>>> add_to_group('Group 1', ['GDS1', 'SIP4', 'PDC1'], nodes_by_col='COMMON',→˓edges=[]) # add all selected nodes and no edges{}>>> add_to_group('Group 1', nodes='unselected', edges='unselected') # add all→˓unselected nodes and edges{}
py4cytoscape.groups.create_group
create_group(group_name, nodes=None, nodes_by_col='SUID', network=None,base_url='http://localhost:1234/v1')
Create a group from the specified nodes.
Parameters
• group_name (str) – The name used to identify and optionaly label the group
• nodes (list or str or None) – List of node SUIDs, names, other column values,or keyword: selected, unselected or all. Default is currently selected nodes.
• nodes_by_col (str) – name of node table column corresponding to provided nodes list.Default is ‘SUID’.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 47
py4cytoscape Documentation, Release 0.0.1
Returns {‘group’: SUID} where SUID identifies the node corresponding to the group
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> create_group('Group 1', ['GDS1', 'SIP4', 'PDC1'], nodes_by_col='COMMON') #→˓create group containing nodes by common name{'group': 95335}>>> create_group('Group 1') # create group containing all selected nodes{'group': 95335}>>> create_group('Group 1', []) # create group with no nodes{'group': 95335}>>> create_group('Group 1', nodes='unselected') # create group with all→˓unselected nodes{'group': 95335}
py4cytoscape.groups.create_group_by_column
create_group_by_column(group_name, column=None, value=None, network=None,base_url='http://localhost:1234/v1')
Create a group of nodes defined by a column value.
Parameters
• group_name (str) – The name used to identify and optionaly label the new group
• column (str) – The name or header of the Node Table column to use for selecting nodesto group
• value (str or int or float or bool) – The value in the column to use for se-lecting nodes to group
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘group’: group SUID} where the SUID identifies new group
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
48 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> create_group_by_column('Group 1', 'Cluster', 'A'){'group': 95336}
py4cytoscape.groups.delete_group
delete_group(groups=None, groups_by_col='SUID', network=None, base_url='http://localhost:1234/v1')Delete one or more groups, while leaving member nodes intact.
Parameters
• groups (list or str or None) – all, selected, unselected. Default is the currentlyselected group.
• groups_by_col (str) – name of node table column corresponding to provided groupslist. Default is ‘SUID’.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘groups’: [group SUIDs]} with the SUID for each deleted group in the list
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> delete_group(['Group 1', 'Group 2'], groups_by_col='shared name') # delete→˓groups by name{groups:[7970, 7980]}>>> delete_group([7970]) # delete groups by SUID{groups:[7970]}>>> delete_group() # delete all selected groups{groups:[7970, 7980]}>>> delete_group(groups='all') # delete all groups{groups:[7970, 7980]}
Note: Group nodes are ungrouped but not deleted in Cytoscape 3.6.1
5.3. Reference 49
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.groups.remove_from_group
remove_from_group(group_name, nodes=None, nodes_by_col='SUID', edges=None,edges_by_col='SUID', network=None, base_url='http://localhost:1234/v1')
Remove the specified nodes and edges from the specified group.
Parameters
• group_name (str) – Specifies the name used to identify the group
• nodes (list or str or None) – List of node SUIDs, names, other column values,or keyword: selected, unselected or all. Default is currently selected nodes.
• nodes_by_col (str) – name of node table column corresponding to provided nodes list.Default is ‘SUID’.
• edges (list or str or None) – List of edge SUIDs, names, other column values,or keyword: selected, unselected or all. Default is currently selected edges.
• edges_by_col (str) – name of edge table column corresponding to provided edges list.Default is ‘SUID’.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> remove_from_group('Group 1', ['GDS1', 'SIP4', 'PDC1'], nodes_by_col='COMMON')→˓# remove nodes by common name & all their edges{}>>> remove_from_group('Group 1') # remove all selected nodes and edges{}>>> remove_from_group('Group 1', nodes=[], edges=[78565, 79565]) # remove edges→˓but not any nodes{}>>> remove_from_group('Group 1', nodes='unselected', edges='unselected') # remove→˓all unselected nodes and edges{}
50 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Existing Groups
collapse_group([groups, network, base_url]) Replace the representation of all of the nodes and edgesin a group with a single node.
expand_group([groups, network, base_url]) Replaces the group node with member nodes for a set ofgroups.
get_group_info(group[, network, base_url]) Retrieve information about a group by name or identi-fier.
list_groups([network, base_url]) Retrieve a list of all group SUIDs in a network.
py4cytoscape.groups.collapse_group
collapse_group(groups=None, network=None, base_url='http://localhost:1234/v1')Replace the representation of all of the nodes and edges in a group with a single node.
Parameters
• groups (list or str) – List of group names or keywords: all, selected, unselected.Default is the currently selected group.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘groups’: [List of SUIDs]} where SUID identifies the node corresponding to the groupthat was collapsed (even if it was already collapsed)
Return type dict
Raises
• CyError – if network name or SUID, or group name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> collapse_group() # collapse all selected groups{'groups': [95335, 95336]}>>> collapse_group('all') # collapse all groups{'groups': [95335, 95336, 95337]}>>> collapse_group(['Group 1', 'Group 2']) # collapse 2 groups{'groups': [95335, 95336]}>>> collapse_group('Group 1,Group 2') # collapse 2 groups{'groups': [95335, 95336]}>>> collapse_group(['SUID:95335', 'SUID:95336']) # collapse 2 groups{'groups': [95335, 95336]}
5.3. Reference 51
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.groups.expand_group
expand_group(groups=None, network=None, base_url='http://localhost:1234/v1')Replaces the group node with member nodes for a set of groups.
Parameters
• groups (list or str) – List of group names or keywords: all, selected, unselected.Default is the currently selected group.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘groups’: [List of SUIDs]} where SUID identifies the node corresponding to the groupthat was expanded (even if it was already expanded)
Return type dict
Raises
• CyError – if network name or SUID, or group name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> expand_group() # expand all selected groups{'groups': [95335, 95336]}>>> expand_group('all') # expand all groups{'groups': [95335, 95336, 95337]}>>> expand_group(['Group 1', 'Group 2']) # expand 2 groups{'groups': [95335, 95336]}>>> expand_group('Group 1,Group 2') # expand 2 groups{'groups': [95335, 95336]}>>> expand_group(['SUID:95335', 'SUID:95336']) # expand 2 groups{'groups': [95335, 95336]}
py4cytoscape.groups.get_group_info
get_group_info(group, network=None, base_url='http://localhost:1234/v1')Retrieve information about a group by name or identifier.
Parameters
• group_name (str or SUID) – Group name or SUID.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
52 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
{‘group’: SUID, ‘name’: name, ‘nodes’: [node SUIDs], ‘internalEdges’: [edge SUIDs], ‘externalEdges’: [edge SUIDs], ‘collapsed’: bool}where SUID identifies the node corresponding to the group, name is the name given tothe group at create time, node SUIDs is a list of nodes in the group, edge SUIDs is alist of edges within or reaching out of the group, and collapsed is True if the group iscollapsed.
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_group_info('group 1'){'group': 95335,'name': 'group 1','nodes': [94214, 94038, 94122],'internalEdges': [],'externalEdges': [94450, 94564, 94403, 94362, 94506, 94537],'collapsed': False}>>> get_group_info(95335, network='My Network'){'group': 95335,'name': 'group 1','nodes': [94214, 94038, 94122],'internalEdges': [],'externalEdges': [94450, 94564, 94403, 94362, 94506, 94537],'collapsed': False}
py4cytoscape.groups.list_groups
list_groups(network=None, base_url='http://localhost:1234/v1')Retrieve a list of all group SUIDs in a network.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {groups: [SUID list]} as list of SUIDs for group nodes
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 53
py4cytoscape Documentation, Release 0.0.1
Examples
>>> list_groups(){'groups': [94214, 94038, 94122]}
5.3.9 Layouts
Functions for performing LAYOUTS in addition to getting and setting layout properties.
I. Perform layout functions
II. Get layout properties
III. Set layout properties
Perform Layout
bundle_edges([network, base_url]) Apply edge bundling to the network specified.clear_edge_bends([network, base_url]) Clear all edge bends created from edge bundling.layout_copycat(source_network, target_network) Copy a layout from one network to another.layout_network([layout_name, network,base_url])
Apply a layout to a network.
py4cytoscape.layouts.bundle_edges
bundle_edges(network=None, base_url='http://localhost:1234/v1')Apply edge bundling to the network specified.
Edge bundling is executed with default parameters; optional parameters are not supported.
Parameters
• network (SUID or str or None) – Name or SUID of the network; default is “cur-rent” network.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘message’: ‘Edge bundling success.’}
Return type dict
Raises
• CyError – if layout_name is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
54 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> bundle_edges() # Bundle edges in current network{'message': 'Edge bundling success.'}>>> bundle_edges('yeastHighQuality.sif') # Bundle edges in named network{'message': 'Edge bundling success.'}
py4cytoscape.layouts.clear_edge_bends
clear_edge_bends(network=None, base_url='http://localhost:1234/v1')Clear all edge bends created from edge bundling.
Parameters
• network (SUID or str or None) – Name or SUID of the network; default is “cur-rent” network.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘message’: ‘Clear all edge bends success.’}
Return type dict
Raises
• CyError – if layout_name is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> clear_edge_bends() # Clear edge bends in current network{'message': 'Edge bundling success.'}>>> clear_edge_bends('yeastHighQuality.sif') # Clear edge bends in named network{'message': 'Edge bundling success.'}
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://localhost:1234/v1')
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 sourcenetwork. Optional parameters such as gridUnmapped and selectUnmapped determine the behavior oftarget network nodes that could not be matched.
Parameters
• source_network (SUID or str or None) – Name of the network to get node co-ordinates from; default is “current” network. If an SUID is provided, the correspondingnetwork name is used.
5.3. Reference 55
py4cytoscape Documentation, Release 0.0.1
• target_network (SUID or str or None) – Name of the network to apply coor-dinates to; default is “current” network. If an SUID is provided, the corresponding networkname is used.
• source_column (str) – The name of column in the source_network node table used tomatch nodes; default is ‘name’
• target_column (str) – The name of column in the target_network node table used tomatch nodes; default is ‘name’
• grid_unmapped (bool) – If this is set to True, any nodes in the target network that couldnot 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 thatcould 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 toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘mappedNodeCount’: 330, ‘unmappedNodeCount’: 0} containing count of nodes coordi-nates modified
Return type dict
Raises
• CyError – if source_network, target_network, source_column or target_column are in-valid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape 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}
py4cytoscape.layouts.layout_network
layout_network(layout_name=None, network=None, base_url='http://localhost:1234/v1')Apply a layout to a network.
Run getLayoutNames to list available layouts.
Parameters
• layout_name (str) – Name of the layout (with optional parameters). If not specified,then the preferred layout set in the Cytoscape UI is applied.
• network (SUID or str or None) – Name or SUID of the network; default is “cur-rent” network.
56 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {} empty
Return type dict
Raises
• CyError – if layout_name is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> layout_network() # Layout current network using default layout{}>>> layout_network('force-directed') # Layout current network using force-→˓directed layout{}>>> layout_network('grid', 'yeastHighQuality.sif') # layout named network using→˓grid layout{}
Layout Properties
get_layout_name_mapping([base_url]) Get Layout Name Mapping.get_layout_names([base_url]) Retrieve the names of the currently supported layout al-
gorithms.get_layout_property_names(layout_name[,. . . ])
Returns a list of the tunable properties for the specifiedlayout.
get_layout_property_type(layout_name, . . . [,. . . ])
Returns the type of one of the tunable properties (prop-erty_name) for the specified layout.
get_layout_property_value(layout_name,. . . )
Returns the appropriately typed value of the specifiedtunable property for the specified layout.
set_layout_properties(layout_name, . . . [,. . . ])
Sets the specified properties for the specified layout.
py4cytoscape.layouts.get_layout_name_mapping
get_layout_name_mapping(base_url='http://localhost:1234/v1')Get Layout Name Mapping.
The Cytoscape ‘Layout’ menu lists many layout algorithms, but the names presented there are different fromthe names by which these algorithms are known to `layout_network` method. This method returns anamed list in which the names are from the GUI, and the values identify the names you must use to choose analgorithms in the programmatic interface.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 57
py4cytoscape Documentation, Release 0.0.1
Returns {gui-layout-name: layout_name, . . . }
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_layout_name_mapping(){'Attribute Circle Layout': 'attribute-circle', 'Stacked Node Layout': 'stacked-→˓node-layout' ...}
py4cytoscape.layouts.get_layout_names
get_layout_names(base_url='http://localhost:1234/v1')Retrieve the names of the currently supported layout algorithms.
These may be used in subsequent calls to the layout_network function.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a list of layout names as strings
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_layout_names()['attribute-circle', 'stacked-node-layout', 'degree-circle', 'circular',→˓'attributes-layout', 'kamada-kawai', 'force-directed', 'cose', 'grid',→˓'hierarchical', 'fruchterman-rheingold', 'isom']
py4cytoscape.layouts.get_layout_property_names
get_layout_property_names(layout_name, base_url='http://localhost:1234/v1')Returns a list of the tunable properties for the specified layout.
Run getLayoutNames to list available layouts
Parameters
• layout_name (str) – Name of the layout
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns strings naming layout parameters
Return type list
58 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Raises requests.exceptions.RequestException – if layout_name is invalid or can’tconnect to Cytoscape or Cytoscape returns an error
Examples
>>> get_layout_property_names('force-directed')['numIterations', 'defaultSpringCoefficient', 'defaultSpringLength',→˓'defaultNodeMass', 'isDeterministic', 'singlePartition']
py4cytoscape.layouts.get_layout_property_type
get_layout_property_type(layout_name, property_name, base_url='http://localhost:1234/v1')Returns the type of one of the tunable properties (property_name) for the specified layout.
Run getLayoutNames to list available layouts. Run getLayoutPropertyNames to list properties perlayout.
Parameters
• layout_name (str) – Name of the layout
• property_name (str) – Name of the property
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns strings naming layout parameters
Return type list
Raises
• KeyError – if property_name is invalid
• requests.exceptions.RequestException – if layout_name is invalid or can’tconnect to Cytoscape or Cytoscape returns an error
Examples
>>> get_layout_property_names('force-directed','defaultSpringLength')"double"
py4cytoscape.layouts.get_layout_property_value
get_layout_property_value(layout_name, property_name, base_url='http://localhost:1234/v1')Returns the appropriately typed value of the specified tunable property for the specified layout.
Run getLayoutNames to list available layouts. Run getLayoutPropertyNames to list properties perlayout.
Parameters
• layout_name (str) – Name of the layout
• property_name (str) – Name of the property
5.3. Reference 59
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns strings naming layout parameters
Return type list
Raises
• KeyError – if property_name is invalid
• requests.exceptions.RequestException – if layout_name is invalid or can’tconnect to Cytoscape or Cytoscape returns an error
Examples
>>> getLayoutPropertyValue('force-directed','defaultSpringLength')50
py4cytoscape.layouts.set_layout_properties
set_layout_properties(layout_name, properties_dict, base_url='http://localhost:1234/v1')Sets the specified properties for the specified layout.
Unmentioned properties are left unchanged.
Run getLayoutNames to list available layouts. Run getLayoutPropertyNames to list properties perlayout.
Parameters
• layout_name (str) – Name of the layout
• properties_dict (dict) – List of one or more property=value pairs
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises requests.exceptions.RequestException – if layout_name is invalid or can’tconnect to Cytoscape or Cytoscape returns an error
60 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_layout_properties('force-directed', {'defaultSpringLength': 50,→˓'defaultSpringCoefficient': 6E-01})''
5.3.10 Networks
Basic Networks
Functions for NETWORK management and retrieving information on networks, nodes and edges. Includes all func-tions that result in the creation of a new network in Cytoscape, in addition to funcitons that extract network modelsinto other useful objects.
I. General network functions
II. General node functions
III. General edge functions
IV. Network creation
V. Network extraction
VI. Internal functions
Note: Go to network_selection.py for all selection-related functions
Nodes
add_cy_nodes(node_names[, . . . ]) Add one or more nodes to a Cytoscape network.get_all_nodes([network, base_url]) Retrieve the names of all the nodes in the network.get_first_neighbors([node_names, . . . ]) Returns a non-redundant list of first neighbors of the
supplied list of nodes or current node selection.get_node_count([network, base_url]) Reports the number of nodes in the network.
py4cytoscape.networks.add_cy_nodes
add_cy_nodes(node_names, skip_duplicate_names=True, network=None,base_url='http://localhost:1234/v1')
Add one or more nodes to a Cytoscape network.
Parameters
• node_names (list or None) – A list of node names
• skip_duplicate_names (bool) – Skip adding a node if a node with the same nameis already in the network. If FALSE then a duplicate node (with a unique SUID) will beadded.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
5.3. Reference 61
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns A list of named lists of name and SUID for each node added.
Return type list
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> add_cy_nodes(['newnode1', 'newnode2'], skip_duplicate_names=False)[{"name": "newnode1", "SUID": 1459}, {"name": "newnode2", "SUID": 1460}]>>> add_cy_nodes(['newnode2', 'newnode3'], skip_duplicate_names=True)[{"name": "newnode3", "SUID": 1460}]
py4cytoscape.networks.get_all_nodes
get_all_nodes(network=None, base_url='http://localhost:1234/v1')Retrieve the names of all the nodes in the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a list of nodes in the network
Return type list
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
62 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_all_nodes()['YDL194W', 'YDR277C', 'YBR043C', ... ]
py4cytoscape.networks.get_first_neighbors
get_first_neighbors(node_names=None, as_nested_list=False, network=None,base_url='http://localhost:1234/v1')
Returns a non-redundant list of first neighbors of the supplied list of nodes or current node selection.
Parameters
• node_names (str or list or None) – A list of node names from the namecolumn of the node table. Default is currently selected nodes.
• as_nested_list (bool) – Whether to return lists of neighbors per query node.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
deduped list of nodes neighboring specified nodes. If as_nested_list parameter is True, a listof neighbor node lists, one per specified node
Return type list
Raises
• CyError – if network name or SUID doesn’t exist, if no nodes are selected, or if nodedoesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_first_neighbors(node_names = None, as_nested_list=True)[['YBR020W', ['YGL035C', 'YOL051W', 'YPL248C', 'YML051W']], ['YGL035C', ['YLR044C→˓', 'YLR377C', ...]], ...]>>> get_first_neighbors(['YBR020W', 'YGL035C'], as_nested_list=False)['YGL035C', 'YOL051W', 'YPL248C', 'YML051W', 'YLR044C', 'YLR377C', 'YIL162W', ...→˓]>>> get_first_neighbors('YBR020W', as_nested_list=False)['YGL035C', 'YOL051W', 'YPL248C', 'YML051W']
See also:
select_nodes(), select_first_neighbors()
5.3. Reference 63
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.networks.get_node_count
get_node_count(network=None, base_url='http://localhost:1234/v1')Reports the number of nodes in the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns count of nodes in network.
Return type int
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_node_count()6>>> get_node_count(52)6>>> get_node_count('galFiltered.sif')6
Edges
add_cy_edges(source_target_list[, . . . ]) Add one or more edges to a Cytoscape network by list-ing source and target node pairs.
get_all_edges([network, base_url]) Retrieve the names of all the edges in the network.get_edge_count([network, base_url]) Reports the number of the edges in the network.get_edge_info(edges[, network, base_url]) Returns source, target and edge table row values.
py4cytoscape.networks.add_cy_edges
add_cy_edges(source_target_list, edge_type='interacts with', directed=False, network=None,base_url='http://localhost:1234/v1')
Add one or more edges to a Cytoscape network by listing source and target node pairs.
Parameters
• source_target_list (list or list of lists) – Source and target node pairs
• edgeType (str) – The type of interaction. Default is ‘interacts with’.
64 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• directed (bool) – Indicates whether interactions are directed. Default is FALSE.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns A list of dicts for each edge (SUID, source, target) added.
Return type list of dicts
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> add_cy_edges(['YLR075W', 'YKL028W'])[{'SUID': 2884, 'source': 1552, 'target': 1698}]>>> add_cy_edges([['YKL028W', 'YJR066W'], ['YJR066W', 'YLR452C'], ['YGR046W',→˓'YLR452C']])[{'SUID': 2886, 'source': 1698, 'target': 1645}, {'SUID': 2887, 'source': 1645,→˓'target': 1534} ...]
py4cytoscape.networks.get_all_edges
get_all_edges(network=None, base_url='http://localhost:1234/v1')Retrieve the names of all the edges in the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns a list of edges in the network
Return type list
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 65
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_all_edges()['YDR277C (pp) YDL194W', 'YDR277C (pp) YJR022W', 'YPR145W (pp) YMR117C', ...]
py4cytoscape.networks.get_edge_count
get_edge_count(network=None, base_url='http://localhost:1234/v1')Reports the number of the edges in the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns count of edges in network.
Return type int
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_edge_count()6>>> get_edge_count(52)6>>> get_edge_count('galFiltered.sif')6
py4cytoscape.networks.get_edge_info
get_edge_info(edges, network=None, base_url='http://localhost:1234/v1')Returns source, target and edge table row values.
Parameters
• edges (list) – list of SUIDs or names of edges, i.e., values in the “name” column. Canalso input single edge.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
66 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Returns list of dicts describing each edge
Return type list of dicts
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_edge_info('YDR277C (pp) YDL194W')[{'source': 2919, 'target': 2918, 'SUID': 3248, 'shared name': 'YDR277C (pp)→˓YDL194W','shared interaction': 'pp', 'name': 'YDR277C (pp) YDL194W', 'selected': False,'interaction': 'pp', 'EdgeBetweenness': 496.0}]
>>> get_edge_info(['YDR277C (pp) YDL194W', 'YDR277C (pp) YJR022W'])[{'source': 2919, 'target': 2918, 'SUID': 3248, 'shared name': 'YDR277C (pp)→˓YDL194W','shared interaction': 'pp', 'name': 'YDR277C (pp) YDL194W', 'selected': False,'interaction': 'pp', 'EdgeBetweenness': 496.0},
{'source': 2919, 'target': 3220, 'SUID': 3249, 'shared name': 'YDR277C (pp)→˓YJR022W','shared interaction': 'pp', 'name': 'YDR277C (pp) YJR022W', 'selected': False,'interaction': 'pp', 'EdgeBetweenness': 988.0}]
Notes: This function is kinda slow. It takes approximately 70ms per edge to return a result, e.g., 850 edges willtake one minute.
Network Management
clone_network([network, base_url]) Makes a copy of a Cytoscape Network with all of itsedges and nodes.
create_subnetwork([nodes, nodes_by_col, . . . ]) Copies a subset of nodes and edges into a newly createdsubnetwork.
delete_all_networks([base_url]) Delete all networks from the current Cytoscape session.delete_network([network, base_url]) Delete a network from the current Cytoscape session.get_network_count([base_url]) Get the number of Cytoscape networks in the current
Cytoscape session.get_network_list([base_url]) Returns the list of Cytoscape network names in the cur-
rent Cytoscape session.get_network_name([suid, base_url]) Get the name of a network.get_network_suid([title, base_url]) Get the SUID of a network.rename_network(title[, network, base_url]) Sets a new name for a network.set_current_network([network, base_url]) Selects the given network as “current”.
5.3. Reference 67
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.networks.clone_network
clone_network(network=None, base_url='http://localhost:1234/v1')Makes a copy of a Cytoscape Network with all of its edges and nodes.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns The SUID of the new network
Return type int
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> clone_network()1477
py4cytoscape.networks.create_subnetwork
create_subnetwork(nodes=None, nodes_by_col='SUID', edges=None, edges_by_col='SUID',exclude_edges=False, subnetwork_name=None, network=None,base_url='http://localhost:1234/v1')
Copies a subset of nodes and edges into a newly created subnetwork.
Parameters
• nodes (list) – list of node names or keyword: selected, unselected or all. Default iscurrently selected nodes.
• nodes_by_col (str) – name of node table column corresponding to provided nodes list;default is ‘SUID’
• edges (list) – list of edge names or keyword: selected, unselected or all. Default iscurrently selected edges.
• edges_by_col (str) – name of edge table column corresponding to provided edges list;default is ‘SUID’
• exclude_edges (bool) – whether to exclude connecting edges; default is FALSE
• subnetwork_name (str) – name of new subnetwork to be created; default is to add anumbered suffix to source network name
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
68 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns The SUID of the new subnetwork
Return type int
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> create_subnetwork(nodes='all') # choose all selected and unselected nodes1477>>> create_subnetwork(edges='selected') # choose only nodes whose edges are→˓selected, and include those edges1477>>> create_subnetwork(nodes=['RAP1', 'HIS4', 'PDC1', 'RPL18A'], nodes_by_col=→˓'COMMON', subnetwork_name=base_name+'xx')
1477
py4cytoscape.networks.delete_all_networks
delete_all_networks(base_url='http://localhost:1234/v1')Delete all networks from the current Cytoscape session.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> delete_all_networks()
5.3. Reference 69
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.networks.delete_network
delete_network(network=None, base_url='http://localhost:1234/v1')Delete a network from the current Cytoscape session.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> delete_network() # delete the current network>>> delete_network(22752) # delete network having SUID>>> delete_network('galFiltered.sif') # delete network having name
py4cytoscape.networks.get_network_count
get_network_count(base_url='http://localhost:1234/v1')Get the number of Cytoscape networks in the current Cytoscape session.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns count of networks
Return type int
Raises
• ValueError – if server response has no JSON
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
70 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_network_count()3
py4cytoscape.networks.get_network_list
get_network_list(base_url='http://localhost:1234/v1')Returns the list of Cytoscape network names in the current Cytoscape session.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns network names
Return type list
Raises
• ValueError – if server response has no JSON
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_network_list()['yeastHighQuality.sif', 'galFiltered.sif']
py4cytoscape.networks.get_network_name
get_network_name(suid=None, base_url='http://localhost:1234/v1')Get the name of a network.
Parameters
• suid (SUID or str or None) – SUID of the network; default is current network. Ifa name is provided, then it is validated and returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns network name
Return type str
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 71
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_network_name() # get name of current networkgalFiltered.sif>>> get_network_name(22752) # get name of network having SUIDgalFiltered.sif>>> get_network_name('galFiltered.sif') # verify that current network is→˓galFiltered.sifgalFiltered.sif
Notes
Together with getNetworkSuid, this function attempts to handle all of the multiple ways we support networkreferencing (e.g., title, SUID, ‘current’, and NULL). These functions are then used by all other functions thattake a “network” argument.
py4cytoscape.networks.get_network_suid
get_network_suid(title=None, base_url='http://localhost:1234/v1')Get the SUID of a network.
Parameters
• suid (SUID or str or None) – Name of the network; default is “current” network.If an SUID is provided, then it is validated and returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns network SUID
Return type int
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_network_suid() # get SUID of current network22752>>> get_network_suid('galFiltered.sif') # get SUID of network having name22752>>> get_network_suid(22752) # verify that current network has SUID 2275222752
72 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Notes
Together with getNetworkSuid, this function attempts to handle all of the multiple ways we support networkreferencing (e.g., title, SUID, ‘current’, and NULL). These functions are then used by all other functions thattake a “network” argument.
py4cytoscape.networks.rename_network
rename_network(title, network=None, base_url='http://localhost:1234/v1')Sets a new name for a network.
Duplicate network names are not allowed
Parameters
• title (str) – New name for the network
• network (SUID or str or None) – name or SUID of the network that you want torename; default is “current” network
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns server JSON response
Return type dict
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> rename_network('renamed network') # changes "current" network's name to→˓"renamed network"{'network': 22752, 'title': 'renamed network'}>>> rename_network('renamed network', 'MyNetwork') # changes network named→˓'MyNetwork' to be named "renamed network"{'network': 22752, 'title': 'renamed network'}>>> rename_network('renamed network', 1502) # sets network having SUID 1502 to be→˓named "renamed network"{'network': 1502, 'title': 'renamed network'}
5.3. Reference 73
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.networks.set_current_network
set_current_network(network=None, base_url='http://localhost:1234/v1')Selects the given network as “current”.
Parameters
• network (SUID or str or None) – Network name or SUID of the network that youwant set as current
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {} (empty dict)
Return type dict
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_current_network() # sets current network to current{}>>> set_current_network('MyNetwork') # sets network named 'MyNetwork' as current{}>>> set_current_network(1502) # sets network having SUID 1502 as current{}
Import/Export
create_igraph_from_network([network,base_url])
Create an igraph network from a Cytoscape network.
create_network_from_data_frames([nodes,. . . ])
Create a network from data frames.
create_network_from_igraph(igraph[, title,. . . ])
Create a Cytoscape network from an igraph network.
create_network_from_networkx(netx[, title,. . . ])
Create a Cytoscape network from a NetworkX graph.
create_networkx_from_network([network,base_url])
Return the Cytoscape network as a networkx multi-di-graph.
export_network([filename, type, network, . . . ]) Export a network to one of mulitple file formats.import_network_from_file([file, base_url]) Loads a network from specified file.
74 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.networks.create_igraph_from_network
create_igraph_from_network(network=None, base_url='http://localhost:1234/v1')Create an igraph network from a Cytoscape network.
Notes
Takes a Cytoscape network and generates data frames for vertices and edges to send to thegraph_from_data_frame function. Nodes and edges from the Cytoscape network will be translated into ver-tices and edges in igraph. Associated table columns will also be passed to igraph as vertex and edge attributes.All networks are implicitly modeled as directed in Cytoscape. Round-trip conversion of an undirected net-work in igraph via createNetworkFromIgraph to Cytoscape and back to igraph will result in a directednetwork.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns The new igraph object
Return type igraph
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> create_igraph_from_network()IGRAPH DN-- 330 359 --+ attr: AverageShortestPathLength (v), BetweennessCentrality (v), COMMON (v),ClosenessCentrality (v), ClusteringCoefficient (v), Degree (v), Eccentricity(v), IsSingleNode (v), NeighborhoodConnectivity (v), NumberOfDirectedEdges(v), NumberOfUndirectedEdges (v), PartnerOfMultiEdgedNodePairs (v),Radiality (v), SelfLoops (v), Stress (v), TopologicalCoefficient (v),degree.layout (v), gal1RGexp (v), gal1RGsig (v), gal4RGexp (v), gal4RGsig(v), gal80Rexp (v), gal80Rsig (v), isExcludedFromPaths (v), name (v),selected (v), shared name (v), EdgeBetweenness (e), interaction (e), name(e), selected (e), shared interaction (e), shared name (e), source (e),target (e)
+ edges (vertex names):YML064C->YLR284C, YML064C->YHR198C, YKL074C->YGL035C, YDL081C->YLR340W,...
See also:
create_network_from_data_frames(), create_network_from_igraph()
5.3. Reference 75
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.networks.create_network_from_data_frames
create_network_from_data_frames(nodes=None, edges=None, title='From dataframe',collection='My Dataframe Network Collection',base_url='http://localhost:1234/v1', *, node_id_list='id',source_id_list='source', target_id_list='target', interac-tion_type_list='interaction')
Create a network from data frames.
Takes data frames for nodes and edges, as well as naming parameters to generate the JSON data format requiredby the “networks” POST operation via CyREST. Returns the network.suid and applies the preferred layout setin Cytoscape preferences.
Notes
nodes should contain a column of character strings named: id. This name can be overridden by the arg:node_id_list. Additional columns are loaded as node attributes. edges should contain columns of char-acter strings named: source, target and interaction. These names can be overridden by args: source_id_list,target_id_list, interaction_type_list. Additional columns are loaded as edge attributes. The interaction listcan contain a single value to apply to all rows; and if excluded altogether, the interaction type will be set to“interacts with”. NOTE: attribute values of types (num) will be imported as (Double); (int) as (Integer); (chr) as(String); and (logical) as (Boolean). (Lists) will be imported as (Lists) in CyREST v3.9+.
Note that the extra id column is created in the node table because the id column is mandatory in the cytoscape.jsformat, which is what is sent to Cytoscape.
Parameters
• nodes (DataFrame) – see details and examples below; default NULL to derive nodesfrom edge sources and targets
• edges (DataFrame) – see details and examples below; default NULL for disconnectedset of nodes
• title (str) – network name
• collection (str) – network collection name
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
• * –
• node_id_list (str) – Name of column in nodes containing node id
• source_id_list (str) – Name of column in edges containing source node name
• target_id_list (str) – Name of column in edges containing target node name
• interaction_type_list (str) – Name of column in edges containing interactionname
Returns The SUID of the new network
Return type int
Raises
• ValueError – if server response has no JSON
• CyError – if network name or SUID doesn’t exist
76 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> node_data = {'id':["node 0","node 1","node 2","node 3"],>>> 'group':["A","A","B","B"],>>> 'score':[20,10,15,5]}>>> nodes = df.DataFrame(data=node_data, columns=['id', 'group', 'score'])>>> edge_data = {'source':["node 0","node 0","node 0","node 2"],>>> 'target':["node 1","node 2","node 3","node 3"],>>> 'interaction':["inhibits","interacts","activates","interacts"],>>> 'weight':[5.1,3.0,5.2,9.9]}>>> edges = df.DataFrame(data=edge_data, columns=['source', 'target', 'interaction→˓', 'weight'])>>>>>> create_network_from_data_frames(nodes, edges, title='From node & edge→˓dataframe')1477
py4cytoscape.networks.create_network_from_igraph
create_network_from_igraph(igraph, title='From igraph', collection='My Igraph Network Collec-tion', base_url='http://localhost:1234/v1')
Create a Cytoscape network from an igraph network.
Takes an igraph network and generates data frames for nodes and edges to send to the createNetwork function.Returns the network.suid and applies the perferred layout set in Cytoscape preferences.
Notes
Vertices and edges from the igraph network will be translated into nodes and edges in Cytoscape. Associatedattributes will also be passed to Cytoscape as node and edge table columns. Note: undirected networks will beimplicitly modeled as directed in Cytoscape. Conversion back via createIgraphFromNetwork will resultin a directed network. Also note: igraph attributes of type “other” denoted by “x” are converted to “String” inCytoscape.
Note that the extra id column is created in the node table because the id column is mandatory in the cytoscape.jsformat, which is what is sent to Cytoscape.
Parameters
• igraph (igraph) – igraph network object
• title (str) – network name
• collection (str) – network collection name
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns The SUID of the new network
Return type int
Raises
5.3. Reference 77
py4cytoscape Documentation, Release 0.0.1
• ValueError – if server response has no JSON
• KeyError – igraph network doesn’t contain required node or edge attributes
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> g = ig.Graph()>>> g.add_vertices(3)>>> g.vs['name'] = ['RAP1', 'HIS4', 'HIS3']>>> g.add_edges([(0, 1), (1, 2)])>>> g.es['source'] = [g.vs[0]['name'], g.vs[1]['name']]>>> g.es['target'] = [g.vs[1]['name'], g.vs[2]['name']]>>> g.es['interaction'] = ['enhances', 'inhibits']>>> create_network_from_igraph(g, 'new graph', 'my collection')138775
See also:
create_network_from_data_frames(), create_igraph_from_network()
py4cytoscape.networks.create_network_from_networkx
create_network_from_networkx(netx, title='From networkx', collection='My NetworkX Network Col-lection', base_url='http://localhost:1234/v1')
Create a Cytoscape network from a NetworkX graph.
Parameters
• netx (MultiDiGraph) – networkx MultiDiGraph object
• title (str) – network name
• collection (str) – network collection name
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘networkSUID’: 31766}
Return type Dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
78 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> n = create_network_from_networkx(netx){'networkSUID': 31766}>>> n = create_network_from_networkx(netx, 'Cool Networkx', 'Collection of Cool→˓Networks'){'networkSUID': 31766}
See also:
create_networkx_from_network()
py4cytoscape.networks.create_networkx_from_network
create_networkx_from_network(network=None, base_url='http://localhost:1234/v1')Return the Cytoscape network as a networkx multi-di-graph.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns The new networkx object
Return type MultiDiGraph
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> n = create_networkx_from_network(network='galFiltered.sif')>>> print(nx.info(n))Name:Type: MultiDiGraphNumber of nodes: 330Number of edges: 359Average in degree: 1.0879Average out degree: 1.0879
See also:
create_network_from_networkx()
5.3. Reference 79
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.networks.export_network
export_network(filename=None, type='SIF', network=None, base_url='http://localhost:1234/v1')Export a network to one of mulitple file formats.
Parameters
• filename (str) – Full path or path relavtive to current working directory, in addition tothe name of the file. Extension is automatically added based on the type argument. Ifblank, then the current network name is used.
• type (str) – File type. SIF (default), CX, cyjs, graphML, NNF, xGMML.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns server JSON response
Return type dict
Raises
• ValueError – if server response has no JSON
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> export_network('/path/filename','SIF'){ 'data': {'file': 'C:\Users\CyDeveloper\xx'}, 'errors': [] }
py4cytoscape.networks.import_network_from_file
import_network_from_file(file=None, base_url='http://localhost:1234/v1')Loads a network from specified file.
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 toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {“networks”: [network suid], “views”: [suid for views]} where networks and views listshave length 1
Return type dict
Raises
• CyError – if file cannot be found or loaded
80 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape 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]}
Network Selection
Functions for working with SELECTIONS of nodes and edges in networks, including operations that perform selectionand rely on prior selection events.
I. General selection functions
II. Node selection functions
III. Edge selection functions
Nodes
clear_selection([type, network, base_url]) If any nodes are selected in the network, they will beunselected.
delete_selected_nodes([network, base_url]) Delete currently selected nodes from the network.get_selected_node_count([network,base_url])
Returns the number of nodes currently selected in thenetwork.
get_selected_nodes([node_suids, network, . . . ]) Retrieve the names of all the nodes selected in the net-work.
invert_node_selection([network, base_url]) Select all nodes that were not selected and deselect allnodes that were selected.
select_all_nodes([network, base_url]) Selects all nodes in a Cytoscape Network.select_first_neighbors([direction, network,. . . ])
Select nodes directly connected to currently selectednodes.
select_nodes(nodes[, by_col, . . . ]) Select nodes in the network by SUID, name or othercolumn values.
select_nodes_connected_by_selected_edges([. . . ])Take currently selected edges and extends the selectionto connected nodes, regardless of directionality.
py4cytoscape.network_selection.clear_selection
clear_selection(type='both', network=None, base_url='http://localhost:1234/v1')If any nodes are selected in the network, they will be unselected.
Parameters
• type (str) – What kinds of objects to deselect: ‘nodes’, ‘edges’ or ‘both’ (default)
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
5.3. Reference 81
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ empty
Return type str
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> clear_selection()''>>> clear_selection(type='both')''>>> clear_selection(type='nodes', network=52)''
py4cytoscape.network_selection.delete_selected_nodes
delete_selected_nodes(network=None, base_url='http://localhost:1234/v1')Delete currently selected nodes from the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
{‘nodes’: [node list], ‘edges’: [edge list]} where node list is the SUIDs of deleted nodesand edge list is the SUIDs of deleted edges
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
82 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> invert_node_selection(){'nodes': [107504, 107503, ...], 'edges': [108033, 108034]}>>> invert_node_selection(network='My Network'){'nodes': [107504, 107503, ...], 'edges': [108033, 108034]}>>> invert_node_selection(network=52){'nodes': [107504, 107503, ...], 'edges': [108033, 108034]}
py4cytoscape.network_selection.get_selected_node_count
get_selected_node_count(network=None, base_url='http://localhost:1234/v1')Returns the number of nodes currently selected in the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns count of selected nodes
Return type int
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_selected_node_count()330>>> get_selected_node_count('My Network')330>>> get_selected_node_count(52)330
py4cytoscape.network_selection.get_selected_nodes
get_selected_nodes(node_suids=False, network=None, base_url='http://localhost:1234/v1')Retrieve the names of all the nodes selected in the network.
Parameters
• node_suids (bool) – Whether to return node SUIDs. Default is FALSE to return nodenames.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
5.3. Reference 83
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of selected SUIDs or node names, or None if no nodes are selected
Return type list
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_selected_nodes()None>>> get_selected_nodes(node_suids=False)['YNL216W', 'YPL075W']>>> get_selected_nodes(node_suids=True, network='My Network')[10235, 10236]
py4cytoscape.network_selection.invert_node_selection
invert_node_selection(network=None, base_url='http://localhost:1234/v1')Select all nodes that were not selected and deselect all nodes that were selected.
Parameters
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
84 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> invert_node_selection(){'nodes': [107504, 107503, ...], 'edges': []}>>> invert_node_selection(network='My Network'){'nodes': [107504, 107503, ...], 'edges': []}>>> invert_node_selection(network=52){'nodes': [107504, 107503, ...], 'edges': []}
Note: In return value, node list is the SUIDs of newly selected nodes and edge list is always empty.
py4cytoscape.network_selection.select_all_nodes
select_all_nodes(network=None, base_url='http://localhost:1234/v1')Selects all nodes in a Cytoscape Network.
Parameters
• nodes (list) – List of node SUIDs, names or other column values
• by_col (str) – Node table column to lookup up provide node values. Default is ‘SUID’.
• preserve_current_selection (bool) – Whether to maintain previously selectednodes.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of SUIDs selected
Return type list
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> select_all_nodes()[107504, 107503, ...]>>> select_all_nodes('My Network')[107504, 107503, ...]>>> select_all_nodes(52)[107504, 107503, ...]
See also:
select_nodes()
5.3. Reference 85
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.network_selection.select_first_neighbors
select_first_neighbors(direction='any', network=None, base_url='http://localhost:1234/v1')Select nodes directly connected to currently selected nodes.
Can specify connection directionality using the direction param.
Parameters
• direction (str) – direction of connections to neighbors to follow, e.g., incoming, out-going, undirected, or any (default)
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> select_first_neighbors(){'nodes': [107504, 107503, ...], 'edges': []}>>> select_first_neighbors(direction='undirected'){'nodes': [107514], 'edges': []}
Note: In the return value, node list is the SUIDs of newly selected nodes and edge list is always empty
py4cytoscape.network_selection.select_nodes
select_nodes(nodes, by_col='SUID', preserve_current_selection=True, network=None,base_url='http://localhost:1234/v1')
Select nodes in the network by SUID, name or other column values.
Parameters
• nodes (list) – List of node SUIDs, names or other column values
• by_col (str) – Node table column to lookup up provide node values. Default is ‘SUID’.
• preserve_current_selection (bool) – Whether to maintain previously selectednodes.
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
86 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> select_nodes(None){}>>> select_nodes(['RAP1'], by_col='COMMON'){'nodes': [107514], 'edges': []}
Note: In the return value, node list is the SUIDs of newly selected nodes and edge list is always empty – dict is{} if no nodes were selected
py4cytoscape.network_selection.select_nodes_connected_by_selected_edges
select_nodes_connected_by_selected_edges(network=None, base_url='http://localhost:1234/v1')Take currently selected edges and extends the selection to connected nodes, regardless of directionality.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 87
py4cytoscape Documentation, Release 0.0.1
Examples
>>> select_nodes_connected_by_selected_edges(){'nodes': [107504, 107503, ...], 'edges': [108033, 108034]}>>> select_nodes_connected_by_selected_edges(network='My Network'){'nodes': [107504, 107503, ...], 'edges': [108033, 108034]}>>> select_nodes_connected_by_selected_edges(network=52){'nodes': [107504, 107503, ...], 'edges': [108033, 108034]}
Note: In the return value, node list is the SUIDs of selected nodes, and edge list is the SUIDs of newly selectededges
Edges
clear_selection([type, network, base_url]) If any nodes are selected in the network, they will beunselected.
delete_duplicate_edges([network, base_url]) Remove edges with duplicate names.delete_selected_edges([network, base_url]) Delete the currently selected edges in the network.delete_self_loops([network, base_url]) Removes edges that connect to a single node as both
source and target.get_selected_edge_count([network,base_url])
Return the number of edges currently selected in the net-work.
get_selected_edges([edge_suids, network, . . . ]) Retrieve the names of all the edges selected in the net-work.
invert_edge_selection([network, base_url]) Select all edges that were not selected and deselect alledges that were selected.
select_all_edges([network, base_url]) Selects all edges in a Cytoscape Network.select_edges(edges[, by_col, . . . ]) Select edges in the network by SUID, name or other
column values.select_edges_adjacent_to_selected_nodes([. . . ])Take currently selected nodes and add to the selection
all edges connected to those nodes, regardless of direc-tionality.
select_edges_connecting_selected_nodes([. . . ])Select edges in a Cytoscape Network connecting theselected nodes, including self loops connecting singlenodes.
py4cytoscape.network_selection.delete_duplicate_edges
delete_duplicate_edges(network=None, base_url='http://localhost:1234/v1')Remove edges with duplicate names.
Only considers cases with identical source, target, interaction and directionality. Duplicate edges are first se-lected and then deleted. Prior edge selections will be lost; node selections will not be affected.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version to
88 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
{‘nodes’: [node list], ‘edges’: [edge list]} where node list is always empty, and edge list isthe SUIDs of deleted edges – dict is {} if no edges were deleted
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> delete_duplicate_edges(){}>>> delete_duplicate_edges(network='My Network'){'nodes': [], 'edges': [104432, 104431, ...]}>>> delete_duplicate_edges(network=52){'nodes': [], 'edges': [104432, 104431, ...]}
py4cytoscape.network_selection.delete_selected_edges
delete_selected_edges(network=None, base_url='http://localhost:1234/v1')Delete the currently selected edges in the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
{‘nodes’: [node list], ‘edges’: [edge list]} where node list is always empty, and edge list isthe SUIDs of deleted edges – dict is {} if no edges were deleted
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 89
py4cytoscape Documentation, Release 0.0.1
Examples
>>> delete_selected_edges(){'nodes': [], 'edges': [104432, 104431, ...]}>>> delete_selected_edges(network='My Network'){}>>> delete_selected_edges(network=52){'nodes': [], 'edges': [104432, 104431, ...]}
py4cytoscape.network_selection.delete_self_loops
delete_self_loops(network=None, base_url='http://localhost:1234/v1')Removes edges that connect to a single node as both source and target.
Self loop edges are first selected and then deleted. Prior edge and node selections will be lost.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> delete_self_loops()''>>> delete_self_loops(network='My Network')''>>> delete_self_loops(network=52)''
90 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.network_selection.get_selected_edge_count
get_selected_edge_count(network=None, base_url='http://localhost:1234/v1')Return the number of edges currently selected in the network.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns count of edges selected in the network
Return type int
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_selected_edge_count()0>>> get_selected_edge_count(network='My Network')359>>> get_selected_edge_count(network=52)359
py4cytoscape.network_selection.get_selected_edges
get_selected_edges(edge_suids=False, network=None, base_url='http://localhost:1234/v1')Retrieve the names of all the edges selected in the network.
Parameters
• edge_suids (bool) – Whether to return edge SUIDs. Default is FALSE to return edgenames.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of edge names (or SUIDs if edge_suids is True) – None if no edges selected
Return type list
Raises
• CyError – if network name or SUID doesn’t exist
5.3. Reference 91
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_selected_edges()None>>> get_selected_edge_count(network='My Network')['YGL035C (pd) YIL162W', 'YGL035C (pd) YLR044C', 'YNL216W (pd) YLR044C']>>> get_selected_edge_count(edge_suids=True, network=52)[27656, 27658, 27716]
py4cytoscape.network_selection.invert_edge_selection
invert_edge_selection(network=None, base_url='http://localhost:1234/v1')Select all edges that were not selected and deselect all edges that were selected.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> invert_edge_selection(){'nodes': [], 'edges': [104432, 104431, ...]}>>> invert_edge_selection(network='My Network'){}>>> invert_edge_selection(network=52){'nodes': [], 'edges': [104432, 104431, ...]}
Note: In the return value, node list is always empty, and edge list is the SUIDs of selected edges – dict is {} ifno edges remain selected
92 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.network_selection.select_all_edges
select_all_edges(network=None, base_url='http://localhost:1234/v1')Selects all edges in a Cytoscape Network.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of SUIDs for edges selected
Return type list
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> select_all_edges()[104432, 104431, ...]>>> select_all_edges(network='My Network')[104432, 104431, ...]>>> select_all_edges(network=52)[104432, 104431, ...]
py4cytoscape.network_selection.select_edges
select_edges(edges, by_col='SUID', preserve_current_selection=True, network=None,base_url='http://localhost:1234/v1')
Select edges in the network by SUID, name or other column values.
Parameters
• edges (list) – List of edge SUIDs, names or other column values
• by.col (str) – Edge table column to lookup up provide edge values. Default is ‘SUID’.
• preserve_current_selection (bool) – Whether to maintain previously selectededges.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
5.3. Reference 93
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> select_edges(None){}>>> select_edges([103332], preserve_current_selection=False, network='My Network'){'nodes': [], 'edges': [108033, 108034]}>>> select_edges(['YGL035C (pd) YIL162W', 'YGL035C (pd) YLR044C', 'YNL216W (pd)→˓YLR044C'], by_col='name', preserve_current_selection=True, network=52){'nodes': [], 'edges': [108033, 108034, 108103]}
Note: In the return value, node list is always empty, and edge list is the SUIDs of newly selected edges – dictis {} if no edges were selected
py4cytoscape.network_selection.select_edges_adjacent_to_selected_nodes
select_edges_adjacent_to_selected_nodes(network=None, base_url='http://localhost:1234/v1')Take currently selected nodes and add to the selection all edges connected to those nodes, regardless of direc-tionality.
Any edges selected beforehand are deselected before any new edges are selected
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
94 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> select_edges_adjacent_to_selected_nodes(){}>>> select_edges_adjacent_to_selected_nodes(network='My Network'){'nodes': [103990, 103991, ...], 'edges': [104432, 104431, ...]}>>> select_edges_adjacent_to_selected_nodes(network=52){'nodes': [103990, 103991, ...], 'edges': [104432, 104431, ...]}
Note: In the return value, node list is list of all selected edges, and edge list is the SUIDs of selected edges –dict is {} if no nodes were selected or there were no newly created edges
py4cytoscape.network_selection.select_edges_connecting_selected_nodes
select_edges_connecting_selected_nodes(network=None, base_url='http://localhost:1234/v1')Select edges in a Cytoscape Network connecting the selected nodes, including self loops connecting singlenodes.
Any edges selected beforehand are deselected before any new edges are selected
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘nodes’: [node list], ‘edges’: [edge list]}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> select_edges_connecting_selected_nodes()None>>> select_edges_connecting_selected_nodes(network='My Network'){'nodes': [103990, 103991, ...], 'edges': [104432, 104431, ...]}>>> select_edges_connecting_selected_nodes(network=52){'nodes': [103990, 103991, ...], 'edges': [104432, 104431, ...]}
Note: In the return value node list is list of all selected nodes, and edge list is the SUIDs of selected edges –dict is None if no nodes were selected or there were no newly created edges
5.3. Reference 95
py4cytoscape Documentation, Release 0.0.1
Network Views
Functions for performing VIEW operations in addition to getting and setting view properties.
Views
export_image([filename, type, resolution, . . . ]) Save the current network view as an image file.fit_content([selected_only, network, base_url]) Zoom and pan network view to maximize either height
or width of current network window.get_network_view_suid([network, base_url]) Retrieve the SUID of a network view.get_network_views([network, base_url]) Retrieve list of network view SUIDs.set_current_view([network, base_url]) Set which network view is “current”.toggle_graphics_details([base_url]) Toggle Graphics Details.
py4cytoscape.network_views.export_image
export_image(filename=None, type='PNG', resolution=None, units=None, height=None, width=None,zoom=None, network=None, base_url='http://localhost:1234/v1')
Save the current network view as an image file.
The image is cropped per the current view in Cytoscape. Consider applying fit_content() prior to export.
Parameters
• filename (str) – Full path or path relavtive to current working directory, in addition tothe name of the file. Extension is automatically added based on the type argument. Ifblank, the current network name will be used.
• type (str) – Type of image to export, e.g., PNG (default), JPEG, PDF, SVG, PS(PostScript).
• resolution (int) – The resolution of the exported image, in DPI. Valid only for bitmapformats, when the selected width and height ‘units’ is inches. The possible values are: 72(default), 100, 150, 300, 600.
• units (str) – The possible values are: pixels (default), inches.
• height (float) – The height of the exported image. Valid only for bitmap formats, suchas PNG and JPEG.
• width (float) – The width of the exported image. Valid only for bitmap formats, suchas PNG and JPEG.
• zoom (float) – The zoom value to proportionally scale the image. The default value is100.0. Valid only for bitmap formats, such as PNG and JPEG
• network (str or SUID or None) – Name or SUID of the network or view. Defaultis the “current” network active in Cytoscape. If a network view SUID is provided, then it isvalidated and returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘file’: name of file} contains absolute path to file that was written
Return type dict
96 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if network or view doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> export_image('output/test', type='JPEG', units='pixels', height=1000,→˓width=2000, zoom=200){"file": "C:\Users\CyDeveloper\tests\output\test.jpeg">>> export_image('output/test', type='PDF', network='My Network'){"file": "C:\Users\CyDeveloper\tests\output\test.pdf">>> export_image(type='PNG', resolution=600, units='inches', height=1.7, width=3.→˓5, zoom=500, network=13098){"file": "C:\Users\CyDeveloper\tests\output\test.png"
py4cytoscape.network_views.fit_content
fit_content(selected_only=False, network=None, base_url='http://localhost:1234/v1')Zoom and pan network view to maximize either height or width of current network window.
Takes first (presumably only) view associated with provided network
Parameters
• selected_only (bool) – Whether to fit only current selection. Default is false, i.e., tofit the entire network
• network (str or SUID or None) – Name or SUID of the network or view. Defaultis the “current” network active in Cytoscape. If a network view SUID is provided, then it isvalidated and returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises
• CyError – if network or view doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 97
py4cytoscape Documentation, Release 0.0.1
Examples
>>> fit_content(){}>>> fit_content(51, selected_only=True){}>>> fit_content(network='galFiltered.sif'){}
py4cytoscape.network_views.get_network_view_suid
get_network_view_suid(network=None, base_url='http://localhost:1234/v1')Retrieve the SUID of a network view.
Parameters
• network (str or SUID or None) – Name or SUID of the network or view. Defaultis the “current” network active in Cytoscape. If a network view SUID is provided, then it isvalidated and returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns SUID of the view for the network. The first (presummably only) view associated a networkis returned.
Return type int
Raises
• CyError – if network or view doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_network_view_suid()130223>>> get_network_view_suid(51)130223>>> get_network_view_suid(network='galFiltered.sif')130223
Dev Notes: analogous to getNetworkSuid, this function attempts to handle all of the multiple ways we sup-port network view referencing (e.g., title, SUID, ‘current’, and NULL). These functions are then used byfunctions that take a “network” argument and requires a view SUID.
98 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.network_views.get_network_views
get_network_views(network=None, base_url='http://localhost:1234/v1')Retrieve list of network view SUIDs.
Parameters
• network (str or SUID or None) – Name or SUID of the network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [list of SUIDs of views] where the list has length 1
Return type list
Raises
• CyError – if network doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_network_views()[130223]>>> get_network_views(51)[130223]>>> get_network_views(network='galFiltered.sif')[130223]
py4cytoscape.network_views.set_current_view
set_current_view(network=None, base_url='http://localhost:1234/v1')Set which network view is “current”.
Takes first (presumably only) view associated with provided network
Parameters
• network (str or SUID or None) – Name or SUID of the network or view. Defaultis the “current” network active in Cytoscape. If a network view SUID is provided, then it isvalidated and returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises
• CyError – if network or view doesn’t exist
5.3. Reference 99
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_current_view(){}>>> set_current_view(51){}>>> set_current_view(network='galFiltered.sif'){}
py4cytoscape.network_views.toggle_graphics_details
toggle_graphics_details(base_url='http://localhost:1234/v1')Toggle Graphics Details.
Regardless of the current zoom level and network size, show (or hide) graphics details, e.g., node labels.
Displaying graphics details on a very large network will affect pan and zoom performance, depending on youravailable RAM. See cytoscape_memory_status().
Parameters
• network (str or SUID or None) – Name or SUID of the network or view. Defaultis the “current” network active in Cytoscape. If a network view SUID is provided, then it isvalidated and returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘message’: ‘Toggled Graphics level of details.’}
Return type dict
Raises
• CyError – if network or view doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> toggle_graphics_details(){'message': 'Toggled Graphics level of details.'}
100 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
5.3.11 Session
Functions for managing Cytoscape SESSIONS, including save, open and close.
Session
close_session(save_before_closing[, . . . ]) Close the current session in Cytoscape, destroying allunsaved work.
open_session([file_location, base_url]) Open Session File or URL.save_session([filename, base_url]) Saves the current Cytoscape session as a CYS file.
py4cytoscape.session.close_session
close_session(save_before_closing, filename=None, base_url='http://localhost:1234/v1')Close the current session in Cytoscape, destroying all unsaved work.
A boolean for whether to save before closing is required since you could lose data by closing without saving.
Parameters
• save_before_closing (bool) – Whether to save before closing the current session.If False, then all unsaved work will be lost.
• filename (str) – If save_before_closing is True and the session has not previ-ously been saved, then the path and name of the session file to save should be provided.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {} empty
Return type dict
Raises
• CyError – if filename is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> close_session(False) # delete the current session without saving it first{}>>> close_session(True) # delete the current session after saving it to the file→˓it came from{}>>> close_session(True, 'new') # delete the current session after saving it to→˓'new.cys'{}
5.3. Reference 101
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.session.open_session
open_session(file_location=None, base_url='http://localhost:1234/v1')Open Session File or URL.
Open a session file or URL. This will clear all networks, tables and styles associated with current session. Besure to saveSession first.
Parameters
• file_location (str) – File path or URL (with ‘http’ or ‘https’ prefix). Default is asample session file.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {} empty
Return type dict
Raises
• CyError – if filename is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> open_session() # load session from sample Yeast Perturbation.cys file{}>>> open_session('data/Affinity Purification.cys') # load session from a file{}>>> open_session('https://github.com/bdemchak/py4cytoscape/blob/master/tests/data/→˓Affinity%20Purification.cys'){}
See also:
save_session()
py4cytoscape.session.save_session
save_session(filename=None, base_url='http://localhost:1234/v1')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. Iffilename already exists, then it is overwritten.
Parameters
• filename (str) – Full path or path relavtive to current working directory, in addition tothe name of the file. The .cys extension is automatically added. Leave blank to updatepreviously saved session file.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
102 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Returns {} empty
Return type dict
Raises
• CyError – if filename is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape 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{}
5.3.12 Styles
Basic Styles
Functions for managing STYLES and retrieving general lists of properties relevant to multiple style modes. Functionsspecific to Default, Mapping, Bypass, Dependencies and Values are in separate files.
I. Style management functions
II. General property functions
Style Management
copy_visual_style(from_style, to_style[, . . . ]) Create a new visual style by copying a specified style.create_visual_style(style_name[, defaults,. . . ])
Create a style from defaults and predefined mappings.
delete_visual_style(style_name[, base_url]) Delete the specified visual style from current session.export_visual_styles([filename, type, . . . ]) Save one or more visual styles to file.get_visual_style_names([base_url]) Retrieve a list of all visual style names.import_visual_styles([filename, base_url]) Load styles from an XML file and returns the names of
the loaded styles.set_visual_style(style_name[, network,base_url])
Apply a visual style to a network.
5.3. Reference 103
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.styles.copy_visual_style
copy_visual_style(from_style, to_style, base_url='http://localhost:1234/v1')Create a new visual style by copying a specified style.
Parameters
• from_style (str) – Name of visual style to copy
• to_style (str) – Name of new visual style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> copy_visual_style('Solid', 'SolidCopy')''
py4cytoscape.styles.create_visual_style
create_visual_style(style_name, defaults=None, mappings=None,base_url='http://localhost:1234/v1')
Create a style from defaults and predefined mappings.
Requires visual property mappings to be previously created, see map_visual_property.
Parameters
• style_name (str) – name for style
• defaults (list) – key-value pairs for default mappings.
• mappings (list) – visual property mappings, see map_visual_property
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘title’: new style name}
Return type dict
Raises
• CyError – if mappings or defaults contain invalid values
104 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> defaults = {'NODE_SHAPE': 'diamond', 'NODE_SIZE': 30, 'EDGE_TRANSPARENCY':→˓120, 'NODE_LABEL_POSITION': 'W,E,c,0.00,0.00'}>>> node_labels = map_visual_property('node label', 'COMMON', 'p')>>> node_fills = map_visual_property('node fill color', 'Degree', 'd', ['1', '2'],→˓ ['#FF9900', '#66AAAA'])>>> arrow_shapes = map_visual_property('Edge Target Arrow Shape', 'interaction',→˓'d', ['pp', 'pd'], ['Arrow', 'T'])>>> edge_width = map_visual_property('edge width', 'EdgeBetweenness', 'p')>>> create_visual_style('NewStyle', defaults=defaults, mappings=[node_labels,→˓node_fills, arrow_shapes, edge_width]){'title': 'NewStyle'}
Note: To apply the style to a network, first create the network and then call set_visual_style
See also:
map_visual_property(), set_visual_style()
py4cytoscape.styles.delete_visual_style
delete_visual_style(style_name, base_url='http://localhost:1234/v1')Delete the specified visual style from current session.
Parameters
• style_name (str) – name of style to delete
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if the style doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 105
py4cytoscape Documentation, Release 0.0.1
Examples
>>> delete_visual_style('NewStyle')''
py4cytoscape.styles.export_visual_styles
export_visual_styles(filename=None, type='XML', styles=None, base_url='http://localhost:1234/v1')Save one or more visual styles to file.
Parameters
• filename (str) – Full path or path relavtive to current working directory, in addition tothe name of the file. Extension is automatically added based on the type argument. Defaultis “styles.xml”
• type (str) – Type of data file to export, e.g., XML, JSON (case sensitive). Default isXML. 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 toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST 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 orCytoscape 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:
import_visual_styles()
106 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.styles.get_visual_style_names
get_visual_style_names(base_url='http://localhost:1234/v1')Retrieve a list of all visual style names.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [names of styles in session]
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> visual_style_names()['Universe', 'Marquee', 'Big Labels', 'BioPAX_SIF', 'Ripple', 'Metallic',→˓'default black', ...]
py4cytoscape.styles.import_visual_styles
import_visual_styles(filename='styles.xml', base_url='http://localhost:1234/v1')Load styles from an XML file and returns the names of the loaded styles.
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 toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST 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 orCytoscape returns an error
5.3. Reference 107
py4cytoscape Documentation, Release 0.0.1
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']
See also:
export_visual_styles()
py4cytoscape.styles.set_visual_style
set_visual_style(style_name, network=None, base_url='http://localhost:1234/v1')Apply a visual style to a network.
Parameters
• style_name (str) – Name of a visual style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘message’: ‘Visual Style applied.’}
Return type dict
Raises
• CyError – if style doesn’t exist or network doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_visual_style('default'){'message': 'Visual Style applied.'}>>> set_visual_style('galFiltered Style', network=51){'message': 'Visual Style applied.'}
Visual Property Names and Values
get_arrow_shapes([base_url]) Get Arrow Shapes.get_line_styles([base_url]) Get Line Styles.get_node_shapes([base_url]) Get Node Shapes.get_visual_property_names([base_url]) Retrieve the names of all possible visual properties.
108 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.styles.get_arrow_shapes
get_arrow_shapes(base_url='http://localhost:1234/v1')Get Arrow Shapes.
Retrieve the names of the currently supported ‘arrows’ – the decorations can (optionally) appear at the ends ofedges, adjacent to the nodes they connect, and conveying information about the nature of the nodes’ relationship.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [arrow shape names]
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_arrow_shapes()['OPEN_CIRCLE', 'SQUARE', 'CIRCLE', 'DELTA_SHORT_2', 'DELTA', 'DIAMOND_SHORT_2', .→˓..]
py4cytoscape.styles.get_line_styles
get_line_styles(base_url='http://localhost:1234/v1')Get Line Styles.
Retrieve the names of the currently supported line types – values which can be used to render edges, and thuscan be used in calls to set_edge_line_style_rule().
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [line style names]
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_line_styles()['MARQUEE_DASH_DOT', 'SOLID', 'BACKWARD_SLASH', 'EQUAL_DASH', 'CONTIGUOUS_ARROW',→˓...]
5.3. Reference 109
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.styles.get_node_shapes
get_node_shapes(base_url='http://localhost:1234/v1')Get Node Shapes.
Retrieve the names of the currently supported node shapes, which can then be used in calls toset_node_shape_rule() and set_default_viz_map_value().
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [node shape names]
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_node_shapes()['ROUND_RECTANGLE', 'VEE', 'TRIANGLE', 'HEXAGON', 'PARALLELOGRAM', 'ELLIPSE',→˓'OCTAGON', ...]
py4cytoscape.styles.get_visual_property_names
get_visual_property_names(base_url='http://localhost:1234/v1')Retrieve the names of all possible visual properties.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [visual property names]
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> get_visual_property_names()['COMPOUND_NODE_PADDING', 'COMPOUND_NODE_SHAPE', 'DING_RENDERING_ENGINE_ROOT',→˓'EDGE', ...]
110 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Style Bypasses
Functions for getting and setting BYPASS values for visual properties, organized into sections:
I. General functions for setting/clearing node, edge and network properties
II. Specific functions for setting particular node, edge and network properties
NOTE: The CyREST ‘bypass’ endpoint is essential to properly set values that will persist for a given network inde-pendent of applied style and style changes, and from session to session if saved.
General Style Bypasses
set_node_property_bypass(node_names, . . . [,. . . ])
Set Node Property Bypass.
set_edge_property_bypass(edge_names, . . . [,. . . ])
Set Edge Property Bypass.
py4cytoscape.style_bypasses.set_node_property_bypass
set_node_property_bypass(node_names, new_values, visual_property, bypass=True, network=None,base_url='http://localhost:1234/v1')
Set Node Property Bypass.
Set bypass values for any node property of the specified nodes, overriding default values and mappings definedby any visual style.
This method permanently overrides any default values or mappings defined for the visual properties of the nodeor nodes specified. To restore defaults and mappings, use clear_node_property_bypass().
Parameters
• node_names (list) – List of node names
• new_values (list) – List of values to set, or single value
• visual_property (str) – Name of a visual property. Seeget_visual_property_names.
• bypass (bool) – Whether to set permanent bypass value. Default is True
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if node, visual property or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 111
py4cytoscape Documentation, Release 0.0.1
Examples
>>> node_names = list(get_table_columns(columns='name')['name'])>>> set_node_property_bypass(node_names, '#FF00FF', 'NODE_FILL_COLOR')>>> ''>>> node_suids = list(get_table_columns(columns='name').index)>>> set_node_property_bypass(node_suids, ['#FF00FF'], 'NODE_FILL_COLOR', network=→˓'galFiltered.sif')>>> ''
See also:
clear_node_property_bypass()
py4cytoscape.style_bypasses.set_edge_property_bypass
set_edge_property_bypass(edge_names, new_values, visual_property, bypass=True, network=None,base_url='http://localhost:1234/v1')
Set Edge Property Bypass.
Set bypass values for any edge property of the specified edges, overriding default values and mappings definedby any visual style.
This method permanently overrides any default values or mappings defined for the visual properties of the edgeor edges specified. To restore defaults and mappings, use clear_edge_property_bypass().
Parameters
• edge_names (list) – List of edgenames
• new_values (list) – List of values to set, or single value
• visual_property (str) – Name of a visual property. Seeget_visual_property_names.
• bypass (bool) – Whether to set permanent bypass value. Default is True
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if edge, visual property or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
112 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> edge_names = list(get_table_columns(table='edge', columns='name')['name'])>>> set_edge_property_bypass(edge_names, '#FF00FF', 'EDGE_UNSELECTED_PAINT')>>> {'data': {}, 'errors': []}>>> edge_suids = list(get_table_columns(table='edge', columns='name').index)>>> set_edge_property_bypass(edge_suids, ['#FF00FF'], 'EDGE_UNSELECTED_PAINT',→˓network='galFiltered.sif')>>> {'data': {}, 'errors': []}
See also:
clear_edge_property_bypass()
Node Style Bypasses
clear_node_opacity_bypass(node_names[,. . . ])
Clear Node Opacity Bypass.
clear_node_property_bypass(node_names,. . . )
Clear Node Property Bypass.
hide_nodes(node_names[, network, base_url]) Hide Nodes.hide_selected_nodes([network, base_url]) Hide Selected Nodes.set_node_border_color_bypass(node_names,. . . )
Override the border color for particular nodes.
set_node_border_opacity_bypass(node_names,. . . )
Override the border opacity for particular nodes.
set_node_border_width_bypass(node_names,. . . )
Override the border width for particular nodes.
set_node_color_bypass(node_names,new_colors)
Set the bypass value for fill color for the specified nodeor nodes.
set_node_fill_opacity_bypass(node_names,. . . )
Override the fill opacity for particular nodes.
set_node_font_face_bypass(node_names,new_fonts)
Override the font face for particular nodes.
set_node_font_size_bypass(node_names,new_sizes)
Override the font size for particular nodes.
set_node_height_bypass(node_names,new_heights)
Override the height for particular nodes.
set_node_label_bypass(node_names,new_labels)
Override the label for particular nodes.
set_node_label_color_bypass(node_names,. . . )
Override the label color for particular nodes.
set_node_label_opacity_bypass(node_names,. . . )
Override the label opacity for particular nodes.
set_node_opacity_bypass(node_names,new_values)
Set the bypass value for node fill, label and border opac-ity for the specified node or nodes.
set_node_shape_bypass(node_names,new_shapes)
Override the shape for particular nodes
set_node_size_bypass(node_names, new_sizes) Set Node Size Bypass.set_node_tooltip_bypass(node_names,new_tooltip)
Sets a bypass tooltip for one or more nodes.
continues on next page
5.3. Reference 113
py4cytoscape Documentation, Release 0.0.1
Table 30 – continued from previous pageset_node_width_bypass(node_names,new_widths)
Override the width for particular nodes.
unhide_nodes(node_names[, network, base_url]) Unhide Nodes.
py4cytoscape.style_bypasses.clear_node_opacity_bypass
clear_node_opacity_bypass(node_names, network=None, base_url='http://localhost:1234/v1')Clear Node Opacity Bypass.
Clear the bypass value for node fill, label and border opacity for the specified node or nodes, effectively restoringany previously defined style defaults or mappings.
Parameters
• node_names (list) – list of node names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> clear_node_opacity_bypass(get_node_names())>>> ''>>> clear_node_opacity_bypass(['YDL194W', 'YBR043C'], network='galFiltered.sif')>>> ''
See also:
set_node_opacity_bypass()
py4cytoscape.style_bypasses.clear_node_property_bypass
clear_node_property_bypass(node_names, visual_property, network=None,base_url='http://localhost:1234/v1')
Clear Node Property Bypass.
Clear bypass values for any node property of the specified nodes, effectively restoring any previously definedstyle defaults or mappings.
Parameters
• node_names (list) – List of node names
114 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• visual_property (str) – Name of a visual property. Seeget_visual_property_names.
• bypass (bool) – Whether to set permanent bypass value. Default is True
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if node, visual property or network name doesn’t exist
• TypeError – if node list is None
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> node_names = list(get_table_columns(columns='name')['name'])>>> clear_node_property_bypass(node_names, 'NODE_FILL_COLOR')>>> ''>>> node_suids = list(get_table_columns(columns='name').index)>>> clear_node_property_bypass(node_suids, 'NODE_FILL_COLOR', network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass()
py4cytoscape.style_bypasses.hide_nodes
hide_nodes(node_names, network=None, base_url='http://localhost:1234/v1')Hide Nodes.
Hide (but do not delete) the specified node or nodes, by setting the Visible property bypass value to false.
This method permanently overrides any default values or mappings defined for this visual property of the nodeor nodes specified. This method ultimately calls the generic function, set_node_property_bypass(),which can be used to set any visual property. To restore defaults and mappings, use unhide_nodes() orunhide_all().
Parameters
• node_names (list) – list of node names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 115
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> hide_nodes(get_node_names())>>> ''>>> hide_nodes(['YDL194W', 'YBR043C'], network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), hide_nodes(), unhide_nodes(), unhide_all()
py4cytoscape.style_bypasses.hide_selected_nodes
hide_selected_nodes(network=None, base_url='http://localhost:1234/v1')Hide Selected Nodes.
Hide (but do not delete) the currently selected nodes, by setting the Visible property bypass value to false.
This method permanently overrides any default values or mappings defined for this visual property of the nodeor nodes specified. This method ultimately calls the generic function, set_node_property_bypass(),which can be used to set any visual property. To restore defaults and mappings, use unhide_nodes() orunhide_all().
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
116 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> hide_selected_nodes()>>> ''>>> hide_selected_nodes(network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), hide_nodes(), unhide_nodes(), unhide_all()
py4cytoscape.style_bypasses.set_node_border_color_bypass
set_node_border_color_bypass(node_names, new_colors, network=None,base_url='http://localhost:1234/v1')
Override the border color for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_colors (str or list) – list of hex colors or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid color is found in new_colors)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_color_bypass(get_node_names(), '#FF00FF')>>> ''>>> set_node_border_color_bypass(['YDL194W', 'YBR043C'], ['#FF00FF', '#CCCCCC'],→˓network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
5.3. Reference 117
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.set_node_border_opacity_bypass
set_node_border_opacity_bypass(node_names, new_values, network=None,base_url='http://localhost:1234/v1')
Override the border opacity for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_values (int or float or list) – list of values to set, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid opacity is found in new_values)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_opacity_bypass(get_node_names(), '#FF00FF')>>> ''>>> set_node_border_opacity_bypass(['YDL194W', 'YBR043C'], [128, 192], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_border_width_bypass
set_node_border_width_bypass(node_names, new_sizes, network=None,base_url='http://localhost:1234/v1')
Override the border width for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
118 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• node_names (list) – list of node names
• new_sizes (int or float or list) – list of size values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if size is invalid)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_width_bypass(get_node_names(), 10)>>> ''>>> set_node_border_width_bypass(['YDL194W', 'YBR043C'], [10, 20.5], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_color_bypass
set_node_color_bypass(node_names, new_colors, network=None,base_url='http://localhost:1234/v1')
Set the bypass value for fill color for the specified node or nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_colors (str or list) – list of hex colors or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid color is found in new_colors)
Return type str
5.3. Reference 119
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_color_bypass(get_node_names(), '#FF00FF')>>> ''>>> set_node_color_bypass(['YDL194W', 'YBR043C'], ['#FF00FF', '#CCCCCC'], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_fill_opacity_bypass
set_node_fill_opacity_bypass(node_names, new_values, network=None,base_url='http://localhost:1234/v1')
Override the fill opacity for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_values (int or float or list) – list of values to set, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid opacity is found in new_values)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
120 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_fill_opacity_bypass(get_node_names(), '#FF00FF')>>> ''>>> set_node_fill_opacity_bypass(['YDL194W', 'YBR043C'], [128, 192], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_font_face_bypass
set_node_font_face_bypass(node_names, new_fonts, network=None,base_url='http://localhost:1234/v1')
Override the font face for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_fonts (str or list) – list of font values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_font_face_bypass(get_node_names(), 'Dialog.italic,plain,20')>>> ''>>> set_node_font_face_bypass(['YDL194W', 'YBR043C'], ['Dialog.italic,plain,20',→˓'Dialog.bold,plain,10'], network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
5.3. Reference 121
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.set_node_font_size_bypass
set_node_font_size_bypass(node_names, new_sizes, network=None,base_url='http://localhost:1234/v1')
Override the font size for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_sizes (int or float or list) – list of font sizes or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_font_size_bypass(get_node_names(), 20)>>> ''>>> set_node_font_size_bypass(['YDL194W', 'YBR043C'], [50, 100], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_height_bypass
set_node_height_bypass(node_names, new_heights, network=None,base_url='http://localhost:1234/v1')
Override the height for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
122 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Parameters
• node_names (list) – list of node names
• new_heights (int or float or list) – list of height values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if height is invalid)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_height_bypass(get_node_names(), 80)>>> ''>>> set_node_height_bypass(['YDL194W', 'YBR043C'], [80, 100.5], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_label_bypass
set_node_label_bypass(node_names, new_labels, network=None,base_url='http://localhost:1234/v1')
Override the label for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_labels (str or list) – list of label values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 123
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_bypass(get_node_names(), 'test label')>>> ''>>> set_node_label_bypass(['YDL194W', 'YBR043C'], ['A', 'B'], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_label_color_bypass
set_node_label_color_bypass(node_names, new_colors, network=None,base_url='http://localhost:1234/v1')
Override the label color for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_colors (str or list) – list of hex colors, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid color)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
124 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_label_color_bypass(get_node_names(), '#FF00FF')>>> ''>>> set_node_label_color_bypass(['YDL194W', 'YBR043C'], ['#FF00FF', '#FFFF00'],→˓network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_label_opacity_bypass
set_node_label_opacity_bypass(node_names, new_values, network=None,base_url='http://localhost:1234/v1')
Override the label opacity for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_values (int or float or list) – list of values to set, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid opacity is found in new_values)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_opacity_bypass(get_node_names(), '#FF00FF')>>> ''>>> set_node_label_opacity_bypass(['YDL194W', 'YBR043C'], [128, 192], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
5.3. Reference 125
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.set_node_opacity_bypass
set_node_opacity_bypass(node_names, new_values, network=None,base_url='http://localhost:1234/v1')
Set the bypass value for node fill, label and border opacity for the specified node or nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_values (int or float or list) – list of values to set, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid opacity is found in new_values)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_opacity_bypass(get_node_names(), '#FF00FF')>>> ''>>> set_node_opacity_bypass(['YDL194W', 'YBR043C'], [128, 192], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_shape_bypass
set_node_shape_bypass(node_names, new_shapes, network=None,base_url='http://localhost:1234/v1')
Override the shape for particular nodes
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
126 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• node_names (list) – list of node names
• new_shapes (str or list) – List of shapes, or single value. Seeget_node_shapes().
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid shape)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_shape_bypass(get_node_names(), 'ROUND_RECTANGLE')>>> ''>>> set_node_shape_bypass(['YDL194W', 'YBR043C'], ['ROUND_RECTANGLE', 'OCTAGON'],→˓network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_size_bypass
set_node_size_bypass(node_names, new_sizes, network=None, base_url='http://localhost:1234/v1')Set Node Size Bypass.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_sizes (int or float or list) – list of size values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid size is found in new_sizes)
Return type str
5.3. Reference 127
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_size_bypass(get_node_names(), 50)>>> ''>>> set_node_size_bypass(['YDL194W', 'YBR043C'], [150.5, 90.5], network=→˓'galFiltered.sif')>>> ''
Note: Sets the bypass value of node size for one or more nodes. Only applicable if node dimensions are locked.See lockNodeDimensions().
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_tooltip_bypass
set_node_tooltip_bypass(node_names, new_tooltip, network=None,base_url='http://localhost:1234/v1')
Sets a bypass tooltip for one or more nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_tooltip (str or list) – list of size values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
128 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_tooltip_bypass(get_node_names(), 'Some Tooltip')>>> ''>>> set_node_tooltip_bypass(['YDL194W', 'YBR043C'], ['One Tooltip', 'Other Tooltip→˓'], network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_node_width_bypass
set_node_width_bypass(node_names, new_widths, network=None,base_url='http://localhost:1234/v1')
Override the width for particular nodes.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_node_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_node_property_bypass(), see examples.
Parameters
• node_names (list) – list of node names
• new_widths (int or float or list) – list of width values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if width is invalid)
Return type str
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_width_bypass(get_node_names(), 80)>>> ''>>> set_node_width_bypass(['YDL194W', 'YBR043C'], [80, 100.5], network=→˓'galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
5.3. Reference 129
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.unhide_nodes
unhide_nodes(node_names, network=None, base_url='http://localhost:1234/v1')Unhide Nodes.
Unhide specified nodes that were previously hidden, by clearing the Node Visible property bypass value.
This method ultimately calls the generic function, clear_node_property_bypass(), which can be usedto clear any visual property.
Parameters
• node_names (list) – list of node names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if node or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> hide_nodes(get_node_names())>>> ''>>> hide_nodes(['YDL194W', 'YBR043C'], network='galFiltered.sif')>>> ''
See also:
clear_node_property_bypass(), unhide_all()
Edge Style Bypasses
clear_edge_property_bypass(edge_names,. . . )
Clear Edge Property Bypass.
hide_edges(edge_names[, network, base_url]) Hide Edges.hide_selected_edges([network, base_url]) Hide Selected Edges.set_edge_color_bypass(edge_names,new_colors)
Set the bypass value for fill color for the specified edgeor edges.
set_edge_font_face_bypass(edge_names,new_fonts)
Override the font face for particular edges.
set_edge_font_size_bypass(edge_names,new_sizes)
Override the font size for particular edges.
continues on next page
130 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Table 31 – continued from previous pageset_edge_label_bypass(edge_names,new_labels)
Override the label for particular edges.
set_edge_label_color_bypass(edge_names,. . . )
Override the label color for particular edges.
set_edge_label_opacity_bypass(edge_names,. . . )
Override the label opacity for particular edges.
set_edge_line_style_bypass(edge_names,. . . )
Override the style for particular edges.
set_edge_line_width_bypass(edge_names,. . . )
Override the width for particular edges.
set_edge_opacity_bypass(edge_names,new_values)
Override the opacity for particular edges.
set_edge_source_arrow_color_bypass(. . . [,. . . ])
Override the target arrow color for particular edges.
set_edge_source_arrow_shape_bypass(. . . [,. . . ])
Override the source arrow shape for particular edges.
set_edge_target_arrow_color_bypass(. . . [,. . . ])
Override the target arrow color for particular edges.
set_edge_target_arrow_shape_bypass(. . . [,. . . ])
Override the target arrow shape for particular edges.
set_edge_tooltip_bypass(edge_names,new_tooltip)
Sets a bypass tooltip for one or more edges.
unhide_edges(edge_names[, network, base_url]) Unhide Edges.
py4cytoscape.style_bypasses.clear_edge_property_bypass
clear_edge_property_bypass(edge_names, visual_property, network=None,base_url='http://localhost:1234/v1')
Clear Edge Property Bypass.
Clear bypass values for any edge property of the specified edges, effectively restoring any previously definedstyle defaults or mappings.
Parameters
• edge_names (list) – List of edge names
• visual_property (str) – Name of a visual property. Seeget_visual_property_names.
• bypass (bool) – Whether to set permanent bypass value. Default is True
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if node, visual property or network name doesn’t exist
5.3. Reference 131
py4cytoscape Documentation, Release 0.0.1
• TypeError – if node list is None
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> edge_names = list(get_table_columns(table='edge', columns='name')['name'])>>> clear_edge_property_bypass(edge_names, 'EDGE_UNSELECTED_PAINT')>>> {'data': {}, 'errors': []}>>> edge_suids = list(get_table_columns(table='edge', columns='name').index)>>> clear_edge_property_bypass(edge_suids, 'EDGE_UNSELECTED_PAINT', network=→˓'galFiltered.sif')>>> {'data': {}, 'errors': []}
See also:
set_edge_property_bypass()
py4cytoscape.style_bypasses.hide_edges
hide_edges(edge_names, network=None, base_url='http://localhost:1234/v1')Hide Edges.
Hide (but do not delete) the specified edge or edges, by setting the Visible property bypass value to false.
This method permanently overrides any default values or mappings defined for this visual property of the edgeor edges specified. This method ultimately calls the generic function, set_edge_property_bypass(),which can be used to set any visual property. To restore defaults and mappings, use unhide_edges() orunhide_all().
Parameters
• edge_names (list) – list of edge names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
132 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> hide_edges(get_edge_names())>>> ''>>> hide_edges(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], network=→˓'galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), hide_edges(), unhide_edges(), unhide_all()
py4cytoscape.style_bypasses.hide_selected_edges
hide_selected_edges(network=None, base_url='http://localhost:1234/v1')Hide Selected Edges.
Hide (but do not delete) the currently selected edges, by setting the Visible property bypass value to false.
This method permanently overrides any default values or mappings defined for this visual property of the edgeor edges specified. This method ultimately calls the generic function, set_edge_property_bypass(),which can be used to set any visual property. To restore defaults and mappings, use unhide_edges() orunhide_all().
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> hide_selected_edges()>>> ''>>> hide_selected_edges(network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), hide_edges(), unhide_edges(), unhide_all()
5.3. Reference 133
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.set_edge_color_bypass
set_edge_color_bypass(edge_names, new_colors, network=None,base_url='http://localhost:1234/v1')
Set the bypass value for fill color for the specified edge or edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_colors (str or list) – list of hex colors or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid color is found in new_colors)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_color_bypass(get_edge_names(), '#FF00FF')>>> ''>>> set_edge_color_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], ['→˓#FF00FF', '#CCCCCC'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_font_face_bypass
set_edge_font_face_bypass(edge_names, new_fonts, network=None,base_url='http://localhost:1234/v1')
Override the font face for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
134 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• edge_names (list) – list of edge names
• new_fonts (str or list) – list of font values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_font_face_bypass(get_edge_names(), 'Dialog.italic,plain,20')>>> ''>>> set_edge_font_face_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], [→˓'Dialog.italic,plain,20', 'Dialog.bold,plain,10'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_font_size_bypass
set_edge_font_size_bypass(edge_names, new_sizes, network=None,base_url='http://localhost:1234/v1')
Override the font size for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_sizes (int or float or list) – list of font sizes or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 135
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_font_size_bypass(get_edge_names(), 20)>>> ''>>> set_edge_font_size_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'],→˓[50, 100], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_label_bypass
set_edge_label_bypass(edge_names, new_labels, network=None,base_url='http://localhost:1234/v1')
Override the label for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_labels (str or list) – list of label values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
136 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_label_bypass(get_edge_names(), 'test label')>>> ''>>> set_edge_label_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], ['A',→˓'B'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_label_color_bypass
set_edge_label_color_bypass(edge_names, new_colors, network=None,base_url='http://localhost:1234/v1')
Override the label color for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_colors (str or list) – list of hex colors, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid color)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_color_bypass(get_edge_names(), '#FF00FF')>>> ''>>> set_edge_label_color_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'],→˓['#FF00FF', '#FFFF00'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
5.3. Reference 137
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.set_edge_label_opacity_bypass
set_edge_label_opacity_bypass(edge_names, new_values, network=None,base_url='http://localhost:1234/v1')
Override the label opacity for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_values (int or float or list) – list of values to set, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid opacity is found in new_values)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_opacity_bypass(get_edge_names(), '#FF00FF')>>> ''>>> set_edge_label_opacity_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C→˓'], [128, 192], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_line_style_bypass
set_edge_line_style_bypass(edge_names, new_styles, network=None,base_url='http://localhost:1234/v1')
Override the style for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
138 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• edge_names (list) – list of edge names
• new_styles (str or list) – List of styles, or single value.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid shape)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_shape_bypass(get_edge_names(), 'SOLID')>>> ''>>> set_edge_shape_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], [→˓'SOLID', 'ZIGZAG'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_line_width_bypass
set_edge_line_width_bypass(edge_names, new_widths, network=None,base_url='http://localhost:1234/v1')
Override the width for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_widths (int or float or list) – list of width values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if width is invalid)
Return type str
5.3. Reference 139
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_width_bypass(get_edge_names(), 80)>>> ''>>> set_edge_width_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], [80,→˓100.5], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_opacity_bypass
set_edge_opacity_bypass(edge_names, new_values, network=None,base_url='http://localhost:1234/v1')
Override the opacity for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the node or nodes specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_values (int or float or list) – list of values to set, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid opacity is found in new_values)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
140 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_opacity_bypass(get_edge_names(), 128)>>> ''>>> set_edge_opacity_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'],→˓[128, 192], network='galFiltered.sif')>>> ''
See also:
set_node_property_bypass(), clear_node_property_bypass()
py4cytoscape.style_bypasses.set_edge_source_arrow_color_bypass
set_edge_source_arrow_color_bypass(edge_names, new_colors, network=None,base_url='http://localhost:1234/v1')
Override the target arrow color for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_colors (str or list) – list of hex colors, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid color)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_color_bypass(get_edge_names(), '#FF00FF')>>> ''>>> set_edge_label_color_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'],→˓['#FF00FF', '#FFFF00'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
5.3. Reference 141
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.set_edge_source_arrow_shape_bypass
set_edge_source_arrow_shape_bypass(edge_names, new_shapes, network=None,base_url='http://localhost:1234/v1')
Override the source arrow shape for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_shapes (str or list) – List of styles, or single value.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid shape)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_source_arrow_shape_bypass(get_edge_names(), 'ARROW')>>> ''>>> set_edge_source_arrow_shape_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp)→˓YNR050C'], ['DIAMOND', 'CIRCLE'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_target_arrow_color_bypass
set_edge_target_arrow_color_bypass(edge_names, new_colors, network=None,base_url='http://localhost:1234/v1')
Override the target arrow color for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
142 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• edge_names (list) – list of edge names
• new_colors (str or list) – list of hex colors, or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid color)
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_color_bypass(get_edge_names(), '#FF00FF')>>> ''>>> set_edge_label_color_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'],→˓['#FF00FF', '#FFFF00'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_target_arrow_shape_bypass
set_edge_target_arrow_shape_bypass(edge_names, new_shapes, network=None,base_url='http://localhost:1234/v1')
Override the target arrow shape for particular edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_shapes (str or list) – List of styles, or single value.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ (None if invalid shape)
Return type str
5.3. Reference 143
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_target_arrow_shape_bypass(get_edge_names(), 'ARROW')>>> ''>>> set_edge_target_arrow_shape_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp)→˓YNR050C'], ['DIAMOND', 'CIRCLE'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.set_edge_tooltip_bypass
set_edge_tooltip_bypass(edge_names, new_tooltip, network=None,base_url='http://localhost:1234/v1')
Sets a bypass tooltip for one or more edges.
This method permanently overrides any default values or mappings defined for this visualproperty of the edge or edges specified. This method ultimately calls the generic function,set_edge_property_bypass() which can be used to set any visual property. To restore defaultsand mappings, use clear_edge_property_bypass(), see examples.
Parameters
• edge_names (list) – list of edge names
• new_tooltip (str or list) – list of size values or single value
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
144 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_tooltip_bypass(get_edge_names(), 'Some Tooltip')>>> ''>>> set_edge_tooltip_bypass(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], [→˓'One Tooltip', 'Other Tooltip'], network='galFiltered.sif')>>> ''
See also:
set_edge_property_bypass(), clear_edge_property_bypass()
py4cytoscape.style_bypasses.unhide_edges
unhide_edges(edge_names, network=None, base_url='http://localhost:1234/v1')Unhide Edges.
Unhide specified edges that were previously hidden, by clearing the edge Visible property bypass value.
This method ultimately calls the generic function, clear_edge_property_bypass(), which can be usedto clear any visual property.
Parameters
• edge_names (list) – list of edge names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if edge or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> hide_edges(get_edge_names())>>> ''>>> hide_edges(['YJR022W (pp) YNL050C', 'YJR022W (pp) YNR050C'], network=→˓'galFiltered.sif')>>> ''
See also:
clear_edge_property_bypass(), unhide_all()
5.3. Reference 145
py4cytoscape Documentation, Release 0.0.1
Network Style Bypasses
clear_network_center_bypass([network,base_url])
Clear the bypass value for center x and y for the net-work, effectively restoring prior default values.
clear_network_property_bypass(visual_property)Clear Network Property Bypass.clear_network_zoom_bypass([network,base_url])
Clear the bypass value for the scale factor for the net-work, effectively restoring prior default values.
set_network_center_bypass(x, y[, bypass,. . . ])
Set the bypass value for center x and y for the network.
set_network_property_bypass(new_value,. . . )
Set Network Property Bypass.
set_network_zoom_bypass(new_value[, bypass,. . . ])
Set the bypass value for scale factor for the network.
unhide_all([network, base_url]) Unhide all previously hidden nodes and edges, by clear-ing the Visible property bypass value.
py4cytoscape.style_bypasses.clear_network_center_bypass
clear_network_center_bypass(network=None, base_url='http://localhost:1234/v1')Clear the bypass value for center x and y for the network, effectively restoring prior default values.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if center property or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> clear_network_center_bypass()>>> {'data': {}, 'errors': []}>>> clear_network_center_bypass(network='galFiltered.sif')>>> {'data': {}, 'errors': []}
Warning: Before clearing the center coordinate bypass, the coordinate bypass must have been set viaa call to either set_network_center_bypass() or set_network_property_bypass() withthe bypass=True parameter set. Otherwise, clearing this property will throw an exception.
146 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.clear_network_property_bypass
clear_network_property_bypass(visual_property, network=None,base_url='http://localhost:1234/v1')
Clear Network Property Bypass.
Clear bypass values for any network property, effectively restoring any previously defined style defaults ormappings.
Parameters
• visual_property (str) – Name of a visual property. Seeget_visual_property_names.
• bypass (bool) – Whether to set permanent bypass value. Default is True
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if visual property or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> clear_network_property_bypass('NETWORK_SCALE_FACTOR')>>> ''>>> clear_network_property_bypass('NETWORK_SCALE_FACTOR', network='galFiltered.sif→˓')>>> ''
See also:
set_network_property_bypass()
py4cytoscape.style_bypasses.clear_network_zoom_bypass
clear_network_zoom_bypass(network=None, base_url='http://localhost:1234/v1')Clear the bypass value for the scale factor for the network, effectively restoring prior default values.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 147
py4cytoscape Documentation, Release 0.0.1
Returns {‘data’: {}, ‘errors’: []}
Return type dict
Raises
• CyError – if zoom property or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> clear_network_zoom_bypass()>>> {'data': {}, 'errors': []}>>> clear_network_zoom_bypass(network='galFiltered.sif')>>> {'data': {}, 'errors': []}
Warning: Before clearing the zoom bypass, the zoom bypass must have been set via a call to eitherset_network_zoom_bypass() or set_network_property_bypass() with the bypass=Trueparameter set. Otherwise, clearing this property will throw an exception.
py4cytoscape.style_bypasses.set_network_center_bypass
set_network_center_bypass(x, y, bypass=False, network=None,base_url='http://localhost:1234/v1')
Set the bypass value for center x and y for the network.
This function could be used to pan and scroll the Cytoscape canvas.
This method permanently overrides any default values for this visual property. This method ultimately calls thegeneric function, set_network_property_bypass(), which can be used to set any visual property. Torestore defaults, use clear_network_property_bypass().
Parameters
• x (float) – Coordinate value, increases going to the right.
• y (float) – Coordinate value, increases going to the down.
• bypass (bool) – Whether to set permanent bypass value. Default is False per commonuse of temporary zoom settings.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if network name doesn’t exist
148 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_network_center_bypass(1.5, bypass=True)>>> ''>>> set_network_center_bypass(0.25, bypass=True, network='galFiltered.sif')>>> ''
See also:
set_network_property_bypass(), clear_netowrk_property_bypass()
py4cytoscape.style_bypasses.set_network_property_bypass
set_network_property_bypass(new_value, visual_property, bypass=True, network=None,base_url='http://localhost:1234/v1')
Set Network Property Bypass.
Set bypass values for any network property, overriding default values defined by any visual style.
This method permanently overrides any default values or mappings defined for the visual properties of thenetwork specified. To restore defaults and mappings, use clear_network_property_bypass().
Parameters
• new_value (any) – Value to set
• visual_property (str) – Name of a visual property. Seeget_visual_property_names.
• bypass (bool) – Whether to set permanent bypass value. Default is True
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if visual property or network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 149
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_network_property_bypass(0.5, 'NETWORK_SCALE_FACTOR')>>> ''>>> set_network_property_bypass(0.5, 'NETWORK_SCALE_FACTOR', network='galFiltered.→˓sif')>>> ''
See also:
clear_network_property_bypass()
py4cytoscape.style_bypasses.set_network_zoom_bypass
set_network_zoom_bypass(new_value, bypass=False, network=None,base_url='http://localhost:1234/v1')
Set the bypass value for scale factor for the network.
This method permanently overrides any default values for this visual property. This method ultimately calls thegeneric function, set_network_property_bypass(), which can be used to set any visual property. Torestore defaults, use clear_network_property_bypass().
Parameters
• new_value (float) – Zoom factor
• bypass (bool) – Whether to set permanent bypass value. Default is False per commonuse of temporary zoom settings.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_network_zoom_bypass(1.5, bypass=True)>>> ''>>> set_network_zoom_bypass(0.25, bypass=True, network='galFiltered.sif')>>> ''
See also:
set_network_property_bypass(), clear_netowrk_property_bypass()
150 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_bypasses.unhide_all
unhide_all(network=None, base_url='http://localhost:1234/v1')Unhide all previously hidden nodes and edges, by clearing the Visible property bypass value.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> unhide_all()>>> ''>>> unhide_all(network='galFiltered.sif')>>> ''
See also:
clear_edge_property_bypass(), unhide_nodes(), unhide_edges()
Style Defaults
Functions for getting and setting DEFAULT values for visual properties, organized into sections:
I. General functions for setting node, edge and network defaults
II. Specific functions for setting particular node, edge and network defaults
General Style Defaults
get_visual_property_default(property[,. . . ])
Retrieve the default value for a visual property.
set_visual_property_default(style_string[,. . . ])
Set the default value for a visual property.
update_style_defaults(style_name, defaults) Update the default values of visual properties in a style.
5.3. Reference 151
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_defaults.get_visual_property_default
get_visual_property_default(property, style_name='default', base_url='http://localhost:1234/v1')Retrieve the default value for a visual property.
Parameters
• property (str) – Name of property, e.g., NODE_FILL_COLOR (seeget_visual_property_names)
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_visual_property_default('EDGE_UNSELECTED_PAINT')''>>> get_visual_property_default('NODE_SHAPE', style_name='galFiltered Style')''
py4cytoscape.style_defaults.set_visual_property_default
set_visual_property_default(style_string, style_name='default', base_url='http://localhost:1234/v1')Set the default value for a visual property.
Parameters
• style_string (dict) – The name and value for the property as {‘visualProperty’:‘NODE_SIZE’, ‘value’: ‘35’}
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if property or style name doesn’t exist
152 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_visual_property_default({'visualProperty': 'EDGE_UNSELECTED_PAINT', 'value→˓': '#CCCCCC'}, style_name='galFiltered Style')''>>> set_visual_property_default({'visualProperty': 'EDGE_TARGET_ARROW_SHAPE',→˓'value': 'CIRCLE'})''
py4cytoscape.style_defaults.update_style_defaults
update_style_defaults(style_name, defaults, base_url='http://localhost:1234/v1')Update the default values of visual properties in a style.
Updates visual property defaults, overriding any prior settings. See map_visual_property() for the listof visual properties.
Parameters
• style_name (str) – name for style
• defaults (dict) – a dict of visual property default settings
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> update_style_defaults('galFiltered Style', {'edge width': '50.0', 'EDGE_→˓TARGET_ARROW_SHAPE': 'CIRCLE'})''>>> update_style_defaults(defaults={'node shape': 'OCTAGON', 'EDGE_LINE_TYPE':→˓'ZIGZAG'})''
See also:
map_visual_property()
5.3. Reference 153
py4cytoscape Documentation, Release 0.0.1
Custom Graphics
remove_node_custom_graphics([slot, . . . ]) Remove Node Custom Graphics.set_node_custom_bar_chart(columns[, type,. . . ])
Set Node Custom Bar Chart.
set_node_custom_box_chart(columns[, colors,. . . ])
Set Node Custom Box Chart.
set_node_custom_heat_map_chart(columns[,. . . ])
Set Node Custom HeatMap Chart.
set_node_custom_line_chart(columns[, . . . ]) Set Node Custom Line Chart.set_node_custom_linear_gradient([colors,. . . ])
Set Node Custom Linear Gradient.
set_node_custom_pie_chart(columns[, colors,. . . ])
Set Node Custom Pie Chart.
set_node_custom_position([node_anchor,. . . ])
Set Node Custom Position.
set_node_custom_radial_gradient([colors,. . . ])
Set Node Custom Radial Gradient.
set_node_custom_ring_chart(columns[, . . . ]) Set Node Custom Ring Chart.
py4cytoscape.style_defaults.remove_node_custom_graphics
remove_node_custom_graphics(slot=1, style_name='default', base_url='http://localhost:1234/v1')Remove Node Custom Graphics.
Remove the default custom charts, images and gradients.
Parameters
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
154 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> remove_node_custom_graphics(style_name='galFiltered Style')''>>> remove_node_custom_graphics(slot=2, style_name='galFiltered Style')''
py4cytoscape.style_defaults.set_node_custom_bar_chart
set_node_custom_bar_chart(columns, type='GROUPED', colors=None, range=None, ori-entation='VERTICAL', col_axis=False, range_axis=False,zero_line=False, axis_width=0.25, axis_color='#000000',axis_font_size=1, separation=0.0, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom Bar Chart.
Makes a bar chart per node using specified node table columns by setting a default custom graphic style.
Parameters
• columns (list) – List of node column names to be displayed, in order.
• type (str) – Type of bar chart: GROUPED (default), STACKED, HEAT_STRIPS, orUP_DOWN
• colors (list) – List of colors to be matched with columns or with range, depending ontype. Default is a set of colors from an appropriate Brewer palette.
• range (list) – Min and max values of chart. Default is to use min and max from specifieddata columns.
• orientation (str) – HORIZONTAL or VERTICAL (default).
• col_axis (bool) – Show axis with column labels. Default is False.
• range_axis (bool) – Show axis with range of values. Default is False.
• zero_line (book) – Show a line at zero. Default is False.
• axis_width (float) – Width of axis lines, if shown. Default is 0.25.
• axis_color (str) – Color of axis lines, if shown. Default is black (‘#000000’).
• axis_font_size (int) – Font size of axis labels, if shown. Default is 1.
• separation (float) – Distance between bars. Default is 0.0.
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
5.3. Reference 155
py4cytoscape Documentation, Release 0.0.1
• CyError – if style name, chart type or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_custom_bar_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓style_name='galFiltered Style')''>>> set_node_custom_bar_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓colors=['#FF00FF', '#00FF00'], slot=2, style_name='galFiltered Style')''
See also:
set_node_custom_position(), remove_node_custom_graphics()
py4cytoscape.style_defaults.set_node_custom_box_chart
set_node_custom_box_chart(columns, colors=None, range=None, orientation='VERTICAL',range_axis=False, zero_line=False, axis_width=0.25,axis_color='#000000', axis_font_size=1, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom Box Chart.
Makes a box chart per node using specified node table columns by setting a default custom graphic style.
Parameters
• columns (list) – List of node column names to be displayed, in order.
• colors (list) – List of colors to be matched with columns or with range, depending ontype. Default is a set of colors from an appropriate Brewer palette.
• range (list) – Min and max values of chart. Default is to use min and max from specifieddata columns.
• orientation (str) – HORIZONTAL or VERTICAL (default).
• col_axis (bool) – Show axis with column labels. Default is False.
• range_axis (bool) – Show axis with range of values. Default is False.
• zero_line (book) – Show a line at zero. Default is False.
• axis_width (float) – Width of axis lines, if shown. Default is 0.25.
• axis_color (str) – Color of axis lines, if shown. Default is black (‘#000000’).
• axis_font_size (int) – Font size of axis labels, if shown. Default is 1.
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
156 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_custom_box_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓style_name='galFiltered Style')''>>> set_node_custom_box_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓colors=['#FF00FF', '#00FF00'], slot=2, style_name='galFiltered Style')''
See also:
set_node_custom_position(), remove_node_custom_graphics()
py4cytoscape.style_defaults.set_node_custom_heat_map_chart
set_node_custom_heat_map_chart(columns, colors=None, range=None, ori-entation='HORIZONTAL', range_axis=False,zero_line=False, axis_width=0.25, axis_color='#000000',axis_font_size=1, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom HeatMap Chart.
Makes a heat map per node using specified node table columns by setting a default custom graphic style.
Parameters
• columns (list) – List of node column names to be displayed, in order.
• colors (list) – List of colors to be matched with columns or with range, depending ontype. Default is a set of colors from an appropriate Brewer palette.
• range (list) – Min and max values of chart. Default is to use min and max from specifieddata columns.
• orientation (str) – HORIZONTAL (default) or VERTICAL.
• range_axis (bool) – Show axis with range of values. Default is False.
• zero_line (book) – Show a line at zero. Default is False.
• axis_width (float) – Width of axis lines, if shown. Default is 0.25.
• axis_color (str) – Color of axis lines, if shown. Default is black (‘#000000’).
• axis_font_size (int) – Font size of axis labels, if shown. Default is 1.
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
5.3. Reference 157
py4cytoscape Documentation, Release 0.0.1
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_custom_heat_map_chart(['AverageShortestPath', 'BetweennessCentrality→˓'], style_name='galFiltered Style')''>>> set_node_custom_heat_map_chart(['AverageShortestPath', 'BetweennessCentrality→˓'], colors=['#123456', '#654321', '#112233', '#888888'], slot=2, style_name=→˓'galFiltered Style')''
See also:
set_node_custom_position(), remove_node_custom_graphics()
py4cytoscape.style_defaults.set_node_custom_line_chart
set_node_custom_line_chart(columns, colors=None, range=None, line_width=1.0,range_axis=False, zero_line=False, axis_width=0.25,axis_color='#000000', axis_font_size=1, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom Line Chart.
Makes a line chart per node using specified node table columns by setting a default custom graphic style.
Parameters
• columns (list) – List of node column names to be displayed, in order.
• colors (list) – List of colors to be matched with columns or with range, depending ontype. Default is a set of colors from an appropriate Brewer palette.
• range (list) – Min and max values of chart. Default is to use min and max from specifieddata columns.
• line_width (float) – Width of chart line. Default is 1.0.
• range_axis (bool) – Show axis with range of values. Default is False.
• zero_line (book) – Show a line at zero. Default is False.
• axis_width (float) – Width of axis lines, if shown. Default is 0.25.
• axis_color (str) – Color of axis lines, if shown. Default is black (‘#000000’).
158 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• axis_font_size (int) – Font size of axis labels, if shown. Default is 1.
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_custom_line_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓style_name='galFiltered Style')''>>> set_node_custom_line_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓colors=['#FF00FF', '#00FF00'], slot=2, style_name='galFiltered Style')''
See also:
set_node_custom_position(), remove_node_custom_graphics()
py4cytoscape.style_defaults.set_node_custom_linear_gradient
set_node_custom_linear_gradient(colors=['#DDDDDD', '#888888'], anchors=[0.0,1.0], angle=0.0, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom Linear Gradient.
Makes a gradient fill per node by setting a default custom graphic style.
Parameters
• colors (list) – List of colors to define gradient
• anchors (list) – Position of colors from 0.0 to 1.0.
• angle (float) – Angle of gradient. Default is 0 (left-to-right).
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 159
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_custom_linear_gradient(style_name='galFiltered Style')''>>> set_node_custom_linear_gradient(colors=['#FF00FF', '#00FF00'], angle=90.0,→˓slot=2, style_name='galFiltered Style')''
py4cytoscape.style_defaults.set_node_custom_pie_chart
set_node_custom_pie_chart(columns, colors=None, start_angle=0.0, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom Pie Chart.
Makes a pie chart per node using specified node table columns by setting a default custom graphic style.
Parameters
• columns (list) – List of node column names to be displayed, in order.
• colors (list) – List of colors to be matched with columns or with range, depending ontype. Default is a set of colors from an appropriate Brewer palette.
• start_angle (float) – Angle to start filling pie. Default is 0.0.
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
160 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_custom_pie_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓style_name='galFiltered Style')''>>> set_node_custom_pie_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓colors=['#FF00FF', '#00FF00'], slot=2, style_name='galFiltered Style')''
See also:
set_node_custom_position(), remove_node_custom_graphics()
py4cytoscape.style_defaults.set_node_custom_position
set_node_custom_position(node_anchor='C', graphic_anchor='C', justification='C',x_offset=0.0, y_offset=0.0, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom Position.
Adjust the position of a custom graphic relative to its node.
Parameters
• node_anchor (str) – Position on node to place the graphic: NW,N,NE,E,SE,S,SW,Wor C for center (default)
• graphic_anchor (str) – Position on graphic to place on node:NW,N,NE,E,SE,S,SW,W or C for center (default)
• justification (str) – Positioning of content within graphic: l,r,c (default)
• x_offset (float) – Additional offset in the x direction
• y_offset (float) – Additional offset in the y direction
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 161
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_custom_position(node_anchor='W', graphic_anchor='E', style_name=→˓'galFiltered Style')''>>> set_node_custom_position(justification='l', slot=2, style_name='galFiltered→˓Style')''
py4cytoscape.style_defaults.set_node_custom_radial_gradient
set_node_custom_radial_gradient(colors=['#DDDDDD', '#888888'], anchors=[0.0, 1.0],x_center=0.5, y_center=0.5, slot=1, style_name='default',base_url='http://localhost:1234/v1')
Set Node Custom Radial Gradient.
Makes a gradient fill per node by setting a default custom graphic style.
Parameters
• colors (list) – List of colors to define gradient
• anchors (list) – Position of colors from 0.0 to 1.0.
• x_center (float) – X position for center of radial effect from 0.0 to 1.0. Default is 0.5.
• y_center (float) – Y position for center of radial effect from 0.0 to 1.0. Default is 0.5.
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
162 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_custom_radial_gradient(style_name='galFiltered Style')''>>> set_node_custom_radial_gradient(colors=['#FF00FF', '#00FF00'], x_center=0.0,→˓y_center=0.0, slot=2, style_name='galFiltered Style')''
py4cytoscape.style_defaults.set_node_custom_ring_chart
set_node_custom_ring_chart(columns, colors=None, start_angle=0.0, hole_size=0.5, slot=1,style_name='default', base_url='http://localhost:1234/v1')
Set Node Custom Ring Chart.
Makes a ring chart per node using specified node table columns by setting a default custom graphic style.
Parameters
• columns (list) – List of node column names to be displayed, in order.
• colors (list) – List of colors to be matched with columns or with
• start_angle (float) – Angle to start filling ring. Default is 0.0.
• hole_size (float) – Size of hole in ring. Ranges 0-1. Default is 0.5.
• slot (int) – Which custom graphics slot to modify. Slots 1-9 are available for indepen-dent charts, gradients and images. Default is 1.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name or slot doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_custom_ring_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓style_name='galFiltered Style')''>>> set_node_custom_ring_chart(['AverageShortestPath', 'BetweennessCentrality'],→˓colors=['#FF00FF', '#00FF00'], slot=2, style_name='galFiltered Style')''
See also:
set_node_custom_position(), remove_node_custom_graphics()
5.3. Reference 163
py4cytoscape Documentation, Release 0.0.1
Node Style Defaults
get_node_selection_color_default([. . . ]) Retrieve the default selection node color.set_node_border_color_default(new_color[,. . . ])
Set the default node border color.
set_node_border_opacity_default(new_opacity)Set defaults opacity value for all unmapped node bor-ders.
set_node_border_width_default(new_width[,. . . ])
Set the default node border width.
set_node_color_default(new_color[, . . . ]) Set the default node color.set_node_fill_opacity_default(new_opacity[,. . . ])
Set default opacity value for all unmapped nodes.
set_node_font_face_default(new_font[,. . . ])
Set the default node font.
set_node_font_size_default(new_size[,. . . ])
Set the default node font size.
set_node_height_default(new_height[, . . . ]) Set the default node height.set_node_label_color_default(new_color[,. . . ])
Set the default node label color.
set_node_label_default(new_label[, . . . ]) Set the default node label.set_node_label_opacity_default(new_opacity)Set default opacity value for all unmapped node labels.set_node_selection_color_default(new_color)Set the default node border color.set_node_shape_default(new_shape[, . . . ]) Set the default node shape.set_node_size_default(new_size[, . . . ]) Set the default node font size.set_node_tooltip_default(new_tooltip[, . . . ]) Set the default node tooltip.set_node_width_default(new_width[, . . . ]) Set the default node width.
py4cytoscape.style_defaults.get_node_selection_color_default
get_node_selection_color_default(style_name='default', base_url='http://localhost:1234/v1')Retrieve the default selection node color.
Parameters
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
164 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_node_selection_color_default(style_name='galFiltered Style')''>>> get_node_selection_color_default()''
py4cytoscape.style_defaults.set_node_border_color_default
set_node_border_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default node border color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_node_border_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_node_border_opacity_default
set_node_border_opacity_default(new_opacity, style_name='default',base_url='http://localhost:1234/v1')
Set defaults opacity value for all unmapped node borders.
Parameters
• new_opacity (int) – Numeric values between 0 and 255; 0 is invisible.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 165
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_opacity_default(205, style_name='galFiltered Style')''>>> set_node_border_opacity_default(10)''
py4cytoscape.style_defaults.set_node_border_width_default
set_node_border_width_default(new_width, style_name='default',base_url='http://localhost:1234/v1')
Set the default node border width.
Parameters
• new_width (int) – Numeric value for width
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
166 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_border_width_default(25, style_name='galFiltered Style')''>>> set_node_border_width_default(10)''
py4cytoscape.style_defaults.set_node_color_default
set_node_color_default(new_color, style_name='default', base_url='http://localhost:1234/v1')Set the default node color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_node_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_node_fill_opacity_default
set_node_fill_opacity_default(new_opacity, style_name='default',base_url='http://localhost:1234/v1')
Set default opacity value for all unmapped nodes.
Parameters
• new_opacity (int) – Numeric values between 0 and 255; 0 is invisible.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 167
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_fill_opacity_default(205, style_name='galFiltered Style')''>>> set_node_fill_opacity_default(10)''
py4cytoscape.style_defaults.set_node_font_face_default
set_node_font_face_default(new_font, style_name='default', base_url='http://localhost:1234/v1')Set the default node font.
Parameters
• new_font (str) – String specification of font face, style and size, e.g., ‘“SansSerif,plain,12” or “Dialog,plain,10”
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
168 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_font_face_default('Dialog.italic,plain,12', style_name='galFiltered→˓Style')''>>> set_node_font_face_default('Dialog.italic,plain,12')''
py4cytoscape.style_defaults.set_node_font_size_default
set_node_font_size_default(new_size, style_name='default', base_url='http://localhost:1234/v1')Set the default node font size.
Parameters
• new_size (int) – Numeric value for size
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_font_size_default(20, style_name='galFiltered Style')''>>> set_node_font_size_default(20)''
py4cytoscape.style_defaults.set_node_height_default
set_node_height_default(new_height, style_name='default', base_url='http://localhost:1234/v1')Set the default node height.
Parameters
• new_height (int) – Numeric value for height.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 169
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_height_default(20, style_name='galFiltered Style')''>>> set_node_height_default(20)''
py4cytoscape.style_defaults.set_node_label_color_default
set_node_label_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default node label color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
170 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_label_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_node_label_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_node_label_default
set_node_label_default(new_label, style_name='default', base_url='http://localhost:1234/v1')Set the default node label.
Parameters
• new_label (str) – String label for unmapped nodes.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_default('test label', style_name='galFiltered Style')''>>> set_node_label_default('test label')''
py4cytoscape.style_defaults.set_node_label_opacity_default
set_node_label_opacity_default(new_opacity, style_name='default',base_url='http://localhost:1234/v1')
Set default opacity value for all unmapped node labels.
Parameters
• new_opacity (int) – Numeric values between 0 and 255; 0 is invisible.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 171
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_opacity_default(50, style_name='galFiltered Style')''>>> set_node_label_opacity_default(50)''
py4cytoscape.style_defaults.set_node_selection_color_default
set_node_selection_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default node border color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
172 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_selection_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_node_selection_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_node_shape_default
set_node_shape_default(new_shape, style_name='default', base_url='http://localhost:1234/v1')Set the default node shape.
Parameters
• new_shape (str) – Name of shape, e.g., ELLIPSE, RECTANGLE, etc (seeget_node_shapes())
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_shape_default('ELLIPSE', style_name='galFiltered Style')''>>> set_node_shape_default('ELLIPSE')''
py4cytoscape.style_defaults.set_node_size_default
set_node_size_default(new_size, style_name='default', base_url='http://localhost:1234/v1')Set the default node font size.
Parameters
• new_size (int) – Numeric value for size
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 173
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_size_default(20, style_name='galFiltered Style')''>>> set_node_size_default(20)''
py4cytoscape.style_defaults.set_node_tooltip_default
set_node_tooltip_default(new_tooltip, style_name='default', base_url='http://localhost:1234/v1')Set the default node tooltip.
Parameters
• new_tooltip (str) – String tooltip for unmapped nodes.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_tooltip_default('test tooltip', style_name='galFiltered Style')''>>> set_node_tooltip_default('test tooltip')''
174 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_defaults.set_node_width_default
set_node_width_default(new_width, style_name='default', base_url='http://localhost:1234/v1')Set the default node width.
Parameters
• new_width (int) – Numeric value for width
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_width_default(20, style_name='galFiltered Style')''>>> set_node_width_default(20)''
Edge Style Defaults
get_edge_selection_color_default([. . . ]) Retrieve the default selected edge color.set_edge_color_default(new_color[, . . . ]) Set the default edge color.set_edge_font_face_default(new_font[,. . . ])
Set the default edge font.
set_edge_font_size_default(new_size[,. . . ])
Set the default edge font size.
set_edge_label_color_default(new_color[,. . . ])
Set the default edge label color.
set_edge_label_default(new_label[, . . . ]) Set the default edge label.set_edge_label_opacity_default(new_opacity)Set default opacity value for all unmapped edges.set_edge_line_style_default(new_line_style) Set the default edge style.set_edge_line_width_default(new_width[,. . . ])
Set the default edge width.
set_edge_opacity_default(new_opacity[,. . . ])
Set default opacity value for all unmapped edges.
set_edge_selection_color_default(new_color)Set the default selected edge color.set_edge_source_arrow_color_default(new_color)Set the default edge source arrow color.
continues on next page
5.3. Reference 175
py4cytoscape Documentation, Release 0.0.1
Table 36 – continued from previous pageset_edge_source_arrow_shape_default(new_shape)Set the default edge source arrow shape.set_edge_target_arrow_color_default(new_color)Set the default edge target arrow color.set_edge_target_arrow_shape_default(new_shape)Set the default edge target arrow shape.set_edge_tooltip_default(new_tooltip[, . . . ]) Set the default edge tooltip.
py4cytoscape.style_defaults.get_edge_selection_color_default
get_edge_selection_color_default(style_name='default', base_url='http://localhost:1234/v1')Retrieve the default selected edge color.
Parameters
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_edge_selection_color_default(style_name='galFiltered Style')''>>> get_edge_selection_color_default()''
py4cytoscape.style_defaults.set_edge_color_default
set_edge_color_default(new_color, style_name='default', base_url='http://localhost:1234/v1')Set the default edge color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
176 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_edge_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_edge_font_face_default
set_edge_font_face_default(new_font, style_name='default', base_url='http://localhost:1234/v1')Set the default edge font.
Parameters
• new_font (str) – String specification of font face, style and size, e.g., ‘“SansSerif,plain,12” or “Dialog,plain,10”
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_font_face_default('Dialog.italic,plain,12', style_name='galFiltered→˓Style')''>>> set_edge_font_face_default('Dialog.italic,plain,12')''
5.3. Reference 177
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_defaults.set_edge_font_size_default
set_edge_font_size_default(new_size, style_name='default', base_url='http://localhost:1234/v1')Set the default edge font size.
Parameters
• new_size (int) – Numeric value for size
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_font_size_default(20, style_name='galFiltered Style')''>>> set_edge_font_size_default(20)''
py4cytoscape.style_defaults.set_edge_label_color_default
set_edge_label_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default edge label color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
178 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_edge_label_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_edge_label_default
set_edge_label_default(new_label, style_name='default', base_url='http://localhost:1234/v1')Set the default edge label.
Parameters
• new_label (str) – String label for unmapped edges.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_default('test label', style_name='galFiltered Style')''>>> set_node_label_default('test label')''
py4cytoscape.style_defaults.set_edge_label_opacity_default
set_edge_label_opacity_default(new_opacity, style_name='default',base_url='http://localhost:1234/v1')
Set default opacity value for all unmapped edges.
Parameters
• new_opacity (int) – Numeric values between 0 and 255; 0 is invisible.
• style_name (str) – Name of style; default is “default” style
5.3. Reference 179
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_opacity_default(205, style_name='galFiltered Style')''>>> set_edge_label_opacity_default(10)''
py4cytoscape.style_defaults.set_edge_line_style_default
set_edge_line_style_default(new_line_style, style_name='default',base_url='http://localhost:1234/v1')
Set the default edge style.
Parameters
• new_line_style (str) – Name of line style, e.g., SOLID, LONG_DASH, etc (seeget_line_styles())
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
180 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_line_width_default('SOLID', style_name='galFiltered Style')''>>> set_edge_line_width_default('ZIGZAG')''
py4cytoscape.style_defaults.set_edge_line_width_default
set_edge_line_width_default(new_width, style_name='default', base_url='http://localhost:1234/v1')Set the default edge width.
Parameters
• new_width (int) – Numeric value for width.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_line_width_default(20, style_name='galFiltered Style')''>>> set_edge_line_width_default(10)''
py4cytoscape.style_defaults.set_edge_opacity_default
set_edge_opacity_default(new_opacity, style_name='default', base_url='http://localhost:1234/v1')Set default opacity value for all unmapped edges.
Parameters
• new_opacity (int) – Numeric values between 0 and 255; 0 is invisible.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 181
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_opacity_default(205, style_name='galFiltered Style')''>>> set_edge_opacity_default(10)''
py4cytoscape.style_defaults.set_edge_selection_color_default
set_edge_selection_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default selected edge color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
182 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_selection_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_edge_selection_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_edge_source_arrow_color_default
set_edge_source_arrow_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default edge source arrow color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_source_arrow_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_edge_source_arrow_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_edge_source_arrow_shape_default
set_edge_source_arrow_shape_default(new_shape, style_name='default',base_url='http://localhost:1234/v1')
Set the default edge source arrow shape.
Parameters
• new_shape (str) – Name of shape, e.g., ARROW, T, etc (see get_arrow_shapes())
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 183
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_source_arrow_shape_default('ARROW', style_name='galFiltered Style')''>>> set_edge_source_arrow_shape_default('ARROW')''
py4cytoscape.style_defaults.set_edge_target_arrow_color_default
set_edge_target_arrow_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default edge target arrow color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
184 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_target_arrow_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_edge_target_arrow_color_default('#CCCCCC')''
py4cytoscape.style_defaults.set_edge_target_arrow_shape_default
set_edge_target_arrow_shape_default(new_shape, style_name='default',base_url='http://localhost:1234/v1')
Set the default edge target arrow shape.
Parameters
• new_shape (str) – Name of shape, e.g., ARROW, T, etc (see get_arrow_shapes())
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_target_arrow_shape_default('ARROW', style_name='galFiltered Style')''>>> set_edge_target_arrow_shape_default('ARROW')''
py4cytoscape.style_defaults.set_edge_tooltip_default
set_edge_tooltip_default(new_tooltip, style_name='default', base_url='http://localhost:1234/v1')Set the default edge tooltip.
Parameters
• new_tooltip (str) – String tooltip for unmapped edges.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 185
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_tooltip_default('test tooltip', style_name='galFiltered Style')''>>> set_edge_tooltip_default('test tooltip')''
Network Style Defaults
get_background_color_default([style_name,. . . ])
Retrieve the default background color.
set_background_color_default(new_color[,. . . ])
Set the default background color.
py4cytoscape.style_defaults.get_background_color_default
get_background_color_default(style_name='default', base_url='http://localhost:1234/v1')Retrieve the default background color.
Parameters
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
186 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_background_color_default(style_name='galFiltered Style')''>>> get_background_color_default()''
py4cytoscape.style_defaults.set_background_color_default
set_background_color_default(new_color, style_name='default',base_url='http://localhost:1234/v1')
Set the default background color.
Parameters
• new_color (str) – color as hex code, e.g., #FD5903
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_background_color_default('#CCCCCC', style_name='galFiltered Style')''>>> set_background_color_default('#CCCCCC')''
Style Dependencies
# Functions for getting and setting style DEPEDENDENCIES, organized into sections:
I. General functions for getting and setting dependencies
II. Specific functions for setting particular dependencies
5.3. Reference 187
py4cytoscape Documentation, Release 0.0.1
General Style Dependencies
get_style_dependencies([style_name,base_url])
Get the values of dependencies in a style.
set_style_dependencies([style_name, . . . ]) Set the values of dependencies in a style, overriding anyprior setting.
py4cytoscape.style_dependencies.get_style_dependencies
get_style_dependencies(style_name='default', base_url='http://localhost:1234/v1')Get the values of dependencies in a style.
Parameters
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns contains all dependencies and their current boolean value
Return type dict
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_style_dependencies(style_name='galFiltered Style'){'arrowColorMatchesEdge': False, 'nodeCustomGraphicsSizeSync': True,→˓'nodeSizeLocked': True}>>> get_style_dependencies(){'arrowColorMatchesEdge': False, 'nodeCustomGraphicsSizeSync': True,→˓'nodeSizeLocked': False}
py4cytoscape.style_dependencies.set_style_dependencies
set_style_dependencies(style_name='default', dependencies={}, base_url='http://localhost:1234/v1')Set the values of dependencies in a style, overriding any prior setting.
Parameters
• style_name (str) – Name of style; default is “default” style
• dependencies (dict) – A list of style dependencies, see Available Dependenciesbelow. Note: each dependency is set by a boolean, True or False
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
188 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Returns contains the views property with a value of the current view’s SUID (e.g., {‘views’:[275240]})
Return type dict
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_style_dependencies(dependencies={'arrowColorMatchesEdge': True}, style_→˓name='galFiltered Style'){'views': [275240]}>>> get_style_dependencies(dependencies={'arrowColorMatchesEdge': True,→˓'nodeCustomGraphicsSizeSync': False}){'views': [275240]}
Available Dependencies: arrowColorMatchesEdge, nodeCustomGraphicsSizeSync, nodeSizeLocked
Custom Graphics
sync_node_custom_graphics_size(new_state[,. . . ])
Set a boolean value to have the size of custom graphicsmatch that of the node.
py4cytoscape.style_dependencies.sync_node_custom_graphics_size
sync_node_custom_graphics_size(new_state, style_name='default',base_url='http://localhost:1234/v1')
Set a boolean value to have the size of custom graphics match that of the node.
Parameters
• new_state (bool) – Whether to sync node custom graphics size
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns contains the views property with a value of the current view’s SUID (e.g., {‘views’:[275240]})
Return type dict
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 189
py4cytoscape Documentation, Release 0.0.1
Examples
>>> sync_node_custom_graphics_size(True, style_name='galFiltered Style'){'views': [275240]}>>> sync_node_custom_graphics_size(False){'views': [275240]}
Node Style Dependencies
lock_node_dimensions(new_state[, . . . ]) Set a boolean value to have node width and height fixedto a single size value.
py4cytoscape.style_dependencies.lock_node_dimensions
lock_node_dimensions(new_state, style_name='default', base_url='http://localhost:1234/v1')Set a boolean value to have node width and height fixed to a single size value.
Parameters
• new_state (bool) – Whether to lock node width and height
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns contains the views property with a value of the current view’s SUID (e.g., {‘views’:[275240]})
Return type dict
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> lock_node_dimensions(True, style_name='galFiltered Style'){'views': [275240]}>>> lock_node_dimensions(False){'views': [275240]}
190 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Edge Style Dependencies
match_arrow_color_to_edge(new_state[, . . . ]) Set a boolean value to have arrow shapes share the samecolor as the edge.
py4cytoscape.style_dependencies.match_arrow_color_to_edge
match_arrow_color_to_edge(new_state, style_name='default', base_url='http://localhost:1234/v1')Set a boolean value to have arrow shapes share the same color as the edge.
Parameters
• new_state (bool) – Whether to match arrow color to edge.
• style_name (str) – Name of style; default is “default” style
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns contains the views property with a value of the current view’s SUID (e.g., {‘views’:[275240]})
Return type dict
Raises
• CyError – if style name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> match_arrow_color_to_edge(True, style_name='galFiltered Style'){'views': [275240]}>>> match_arrow_color_to_edge(False){'views': [275240]}
Style Mappings
Functions for defining MAPPINGS between table column values and visual properties, organized into sections:
I. General functions for creating and applying mappings for node, edge and network properties
II. Specific functions for defining particular node, edge and network properties
5.3. Reference 191
py4cytoscape Documentation, Release 0.0.1
General Style Mappings
delete_style_mapping(style_name, vi-sual_prop)
Delete a specified visual style mapping from specifiedstyle.
get_style_all_mappings(style_name[,base_url])
Fetch all visual property mapping in a style.
get_style_mapping(style_name, visual_prop[,. . . ])
Fetch a visual property mapping in a style.
map_visual_property(visual_prop, . . . [, . . . ]) Create a mapping between an attribute and a visualproperty.
update_style_mapping(style_name, mapping[,. . . ])
Update a visual property mapping in a style.
py4cytoscape.style_mappings.delete_style_mapping
delete_style_mapping(style_name, visual_prop, base_url='http://localhost:1234/v1')Delete a specified visual style mapping from specified style.
Parameters
• style_name (str) – name for style
• visual_prop (str) – name of visual property to delete
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ or None (if property doesn’t exist)
Return type str or None
Raises
• CyError – if style doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> delete_style_mapping('galFiltered Style', 'node label')''
py4cytoscape.style_mappings.get_style_all_mappings
get_style_all_mappings(style_name, base_url='http://localhost:1234/v1')Fetch all visual property mapping in a style.
The property mappings are the same as a dict created by map_visual_property().
Parameters
• style_name (str) – name for style
192 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of dicts of the type created by map_visual_property()
Return type list
Raises
• CyError – if style or property name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_style_all_mappings('galFiltered Style')[{"mappingType": "passthrough", "mappingColumn": "name", "mappingColumnType":→˓"String", "visualProperty": "NODE_LABEL"},{"mappingType": "passthrough", "mappingColumn": "interaction", "mappingColumnType→˓": "String", "visualProperty": "EDGE_LABEL"}]
See also:
map_visual_property()
py4cytoscape.style_mappings.get_style_mapping
get_style_mapping(style_name, visual_prop, base_url='http://localhost:1234/v1')Fetch a visual property mapping in a style.
The property mapping is the same as a dict created by map_visual_property().
Parameters
• style_name (str) – name for style
• visual_prop (str) – the name of the visual property
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns see map_visual_property()
Return type dict
Raises
• CyError – if style or property name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 193
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_style_mapping('galFiltered Style', 'node label'){"mappingType": "passthrough", "mappingColumn": "COMMON", "mappingColumnType":→˓"String", "visualProperty": "NODE_LABEL"}
See also:
map_visual_property()
py4cytoscape.style_mappings.map_visual_property
map_visual_property(visual_prop, table_column, mapping_type, table_column_values=[], vi-sual_prop_values=[], network=None, base_url='http://localhost:1234/v1')
Create a mapping between an attribute and a visual property.
Generates the appropriate data structure for the “mapping” parameter in update_style_mapping().
The paired list of values must be of the same length or mapping will fail. For gradient mapping, you mayinclude two additional visual_prop_values in the first and last positions to map respectively to valuesless than and greater than those specified in table_column_values. Mapping will also fail if the data typeof table_column_values does not match that of the existing table_column. Note that all importednumeric data are stored as Integers or Doubles in Cytosacpe tables; and character or mixed data are stored asStrings.
Parameters
• visual_prop (str) – name of visual property to map
• table_column (str) – name of table column to map
• mapping_type (str) – continuous, discrete or passthrough (c,d,p)
• table_column_values (list) – list of values paired with visual_prop_values;skip for passthrough mapping
• visual_prop_values (list) – list of values paired with table_column_values;skip for passthrough mapping
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘mappingType’: type of mapping, ‘mappingColumn’: column to map, ‘mappingColumn-Type’: column data type, ‘visualProperty’: name of property, cargo}
Return type dict
Raises
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
194 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> map_visual_property('node fill color', 'gal1RGexp', 'c', [-2.426, 0.0, 2.058],→˓ ['#0066CC', '#FFFFFF','#FFFF00']){'mappingType': 'continuous', 'mappingColumn': 'gal1RGexp', 'mappingColumnType':→˓'Double', 'visualProperty': 'NODE_FILL_COLOR', 'points': [{'value': -2.426,→˓'lesser': '#0066CC', 'equal': '#0066CC', 'greater': '#0066CC'}, {'value': 0.0,→˓'lesser': '#FFFFFF', 'equal': '#FFFFFF', 'greater': '#FFFFFF'}, {'value': 2.058,→˓ 'lesser': '#FFFF00', 'equal': '#FFFF00', 'greater': '#FFFF00'}]}>>> map_visual_property('node shape', 'degree.layout', 'd', [1, 2], ['ellipse',→˓'rectangle']){'mappingType': 'discrete', 'mappingColumn': 'degree.layout', 'mappingColumnType→˓': 'Integer', 'visualProperty': 'NODE_SHAPE', 'map': [{'key': 1, 'value':→˓'ellipse'}, {'key': 2, 'value': 'rectangle'}]}>>> map_visual_property('node label', 'COMMON', 'p'){'mappingType': 'passthrough', 'mappingColumn': 'COMMON', 'mappingColumnType':→˓'String', 'visualProperty': 'NODE_LABEL'}
Note: For the return value, mapping type can be ‘continuous’, ‘discrete’ or ‘passthrough’. For themappingColumn, the name of the column. For the mappingColumnType, the Cytoscape data type (Dou-ble, Integer, String, Boolean). For the visualProperty, the canonical name of the visual property. Thecargo depends on the mapping type. For ‘continuous’, it’s a list of way points as ‘points’: [waypoint,waypoint, . . . ] where a waypoint is {‘value’: a Double, ‘lesser’: a color, ‘equal’: a color, ‘greater’: a color}.For ‘discrete’, it’s a list of mappings as ‘map’: [key-value, key-value, . . . ] where a key-value is {‘key’: columndata value, ‘value’: value appropriate for visualProperty}.
See also:
update_style_mapping(), get_visual_property_names()
py4cytoscape.style_mappings.update_style_mapping
update_style_mapping(style_name, mapping, base_url='http://localhost:1234/v1')Update a visual property mapping in a style.
Updates the visual property mapping, overriding any prior mapping. Creates a visual property mappingif it doesn’t already exist in the style. Requires visual property mappings to be previously created, seemap_visual_property().
Parameters
• style_name (str) – name for style
• mapping (dict) – a single visual property mapping, see map_visual_property()
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if style doesn’t exist
5.3. Reference 195
py4cytoscape Documentation, Release 0.0.1
• TypeError – if mapping isn’t a visual property mapping
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> update_style_mapping('galFiltered Style', map_visual_property('node label',→˓'name', 'p'))''
See also:
map_visual_property()
Node Style Mappings
set_node_border_color_mapping(table_column)Map table column values to colors to set the node bordercolor.
set_node_border_opacity_mapping(table_column)Set opacity for node border only.set_node_border_width_mapping(table_column)Map table column values to widths to set the node bor-
der width.set_node_color_mapping(table_column[, . . . ]) Map table column values to colors to set the node fill
color.set_node_combo_opacity_mapping(table_column)Set opacity for node fill, border and label all together.set_node_fill_opacity_mapping(table_column)Set opacity for node fill only.set_node_font_face_mapping(table_column[,. . . ])
Sets font face for node labels.
set_node_font_size_mapping(table_column[,. . . ])
Map table column values to sizes to set the node size.
set_node_height_mapping(table_column[,. . . ])
Map table column values to the node heights.
set_node_label_color_mapping(table_column[,. . . ])
Map table column values to colors to set the node bordercolor.
set_node_label_mapping(table_column[, . . . ]) Pass the values from a table column to display as nodelabels.
set_node_label_opacity_mapping(table_column)Sets opacity for node label only.set_node_shape_mapping(table_column[, . . . ]) Map table column values to shapes to set the node
shape.set_node_size_mapping(table_column[, . . . ]) Map table column values to node sizes.set_node_tooltip_mapping(table_column[,. . . ])
Pass the values from a table column to display as nodetooltips.
set_node_width_mapping(table_column[, . . . ]) Map table column values to the node widths.
196 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_border_color_mapping
set_node_border_color_mapping(table_column, table_column_values=None, colors=None, map-ping_type='c', default_color=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to colors to set the node border color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• colors (list) – list of hex colors
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_color (str) – Hex color to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_color_mapping('AverageShortestPathLength', [1.0, 16.36], ['→˓#FBE723', '#440256'], style_name='galFiltered Style')''>>> set_node_border_color_mapping('Degree', ['1', '2'], ['#FFFF00', '#00FF00'], 'd→˓', style_name='galFiltered Style')''>>> set_node_border_color_mapping('ColorCol', mapping_type='p', default_color='→˓#654321', style_name='galFiltered Style')''
5.3. Reference 197
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_border_opacity_mapping
set_node_border_opacity_mapping(table_column, table_column_values=None,opacities=None, mapping_type='c', de-fault_opacity=None, style_name='default', network=None,base_url='http://localhost:1234/v1')
Set opacity for node border only.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• opacities (list) – int values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_opacity (int) – Opacity value to set as default for all unmapped values
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_opacity_mapping('AverageShortestPathLength', table_column_→˓values=[1.0, 16.36], opacities=[50, 100], style_name='galFiltered Style')''>>> set_node_border_opacity_mapping('Degree', table_column_values=['1', '2'],→˓opacities=[50, 100], mapping_type='d', style_name='galFiltered Style')''>>> set_node_border_opacity_mapping('PassthruCol', mapping_type='p', default_→˓opacity=225, style_name='galFiltered Style')''
198 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_border_width_mapping
set_node_border_width_mapping(table_column, table_column_values=None, widths=None, map-ping_type='c', default_width=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to widths to set the node border width.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• widths (list) – List of width values to map to table_column_values
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_width (int) – Width value to set as default for all unmapped values
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_border_width_mapping('AverageShortestPathLength', table_column_→˓values=[1.0, 16.36], widths=[5, 10], style_name='galFiltered Style')''>>> set_node_border_width_mapping('Degree', table_column_values=['1', '2'],→˓widths=[5, 10], mapping_type='d', style_name='galFiltered Style')''>>> set_node_border_width_mapping('PassthruCol', mapping_type='p', default_→˓width=3, style_name='galFiltered Style')''
5.3. Reference 199
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_color_mapping
set_node_color_mapping(table_column, table_column_values=None, colors=None, map-ping_type='c', default_color=None, style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to colors to set the node fill color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• colors (list) – list of hex colors to map to table_column_values
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_color (str) – Hex color to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_color_mapping('AverageShortestPathLength', [1.0, 16.36], ['#FBE723',→˓'#440256'], style_name='galFiltered Style')''>>> set_node_color_mapping('Degree', ['1', '2'], ['#FFFF00', '#00FF00'], 'd',→˓style_name='galFiltered Style')''>>> set_node_color_mapping('ColorCol', mapping_type='p', default_color='#654321',→˓style_name='galFiltered Style')''
200 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_combo_opacity_mapping
set_node_combo_opacity_mapping(table_column, table_column_values=None, opacities=None,mapping_type='c', default_opacity=None, style_name='default',network=None, base_url='http://localhost:1234/v1')
Set opacity for node fill, border and label all together.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• opacities (list) – int values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_opacity (int) – Opacity value to set as default for all unmapped values
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_combo_opacity_mapping('AverageShortestPathLength', table_column_→˓values=[1.0, 16.36], opacities=[50, 100], style_name='galFiltered Style')''>>> set_node_combo_opacity_mapping('Degree', table_column_values=['1', '2'],→˓opacities=[50, 100], mapping_type='d', style_name='galFiltered Style')''>>> set_node_combo_opacity_mapping('PassthruCol', mapping_type='p', default_→˓opacity=225, style_name='galFiltered Style')''
5.3. Reference 201
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_fill_opacity_mapping
set_node_fill_opacity_mapping(table_column, table_column_values=None, opacities=None,mapping_type='c', default_opacity=None, style_name='default',network=None, base_url='http://localhost:1234/v1')
Set opacity for node fill only.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• opacities (list) – int values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_opacity (int) – Opacity value to set as default for all unmapped values
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_fill_opacity_mapping('AverageShortestPathLength', table_column_→˓values=[1.0, 16.36], opacities=[50, 100], style_name='galFiltered Style')''>>> set_node_fill_opacity_mapping('Degree', table_column_values=['1', '2'],→˓opacities=[50, 100], mapping_type='d', style_name='galFiltered Style')''>>> set_node_fill_opacity_mapping('PassthruCol', mapping_type='p', default_→˓opacity=225, style_name='galFiltered Style')''
202 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_font_face_mapping
set_node_font_face_mapping(table_column, table_column_values=None, fonts=None, map-ping_type='d', default_font=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Sets font face for node labels.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• fonts (list) – List of string specifications of font face, style and size, e.g.,[“SansSerif,plain,12”, “Dialog,plain,10”]
• mapping_type (str) – discrete or passthrough (d,p); default is discrete
• default_font (str) – String specification of font face, style and size, e.g.,“SansSerif,plain,12” or “Dialog,plain,10”
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_font_face_mapping('Degree', table_column_values=['1', '2'], fonts=[→˓'Arial,plain,12', 'Arial Bold,bold,12'], mapping_type='d', style_name=→˓'galFiltered Style')''>>> set_node_font_face_mapping('PassthruCol', mapping_type='p', default_font=→˓'Arial,plain,12', style_name='galFiltered Style')''
5.3. Reference 203
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_font_size_mapping
set_node_font_size_mapping(table_column, table_column_values=None, sizes=None, map-ping_type='c', default_size=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to sizes to set the node size.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• sizes (list) – List of size values to map to table_column_values
• mapping_type (str) – discrete or passthrough (d,p); default is discrete
• default_size (int) – Size value to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_font_size_mapping('AverageShortestPathLength', table_column_→˓values=[1.0, 16.36], sizes=[20, 80], style_name='galFiltered Style')''>>> set_node_font_size_mapping('Degree', table_column_values=['1', '2'],→˓sizes=[40, 90], mapping_type='d', style_name='galFiltered Style')''>>> set_node_font_size_mapping('PassthruCol', mapping_type='p', default_size=20,→˓style_name='galFiltered Style')''
204 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_height_mapping
set_node_height_mapping(table_column, table_column_values=None, heights=None, map-ping_type='c', default_height=None, style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to the node heights.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• heights (list) – List of height values to map to table_column_values
• mapping_type (str) – discrete or passthrough (d,p); default is discrete
• default_height (int) – Height value to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_height_mapping('AverageShortestPathLength', table_column_values=[1.0,→˓ 16.36], sizes=[120, 180], style_name='galFiltered Style')''>>> set_node_height_mapping('Degree', table_column_values=['1', '2'], sizes=[140,→˓190], mapping_type='d', style_name='galFiltered Style')''>>> set_node_height_mapping('PassthruCol', mapping_type='p', default_size=120,→˓style_name='galFiltered Style')''
5.3. Reference 205
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_label_color_mapping
set_node_label_color_mapping(table_column, table_column_values=None, colors=None, map-ping_type='c', default_color=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to colors to set the node border color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• colors (list) – values between 0 and 255; 0 is invisible
• mapping_type (str) – discrete or passthrough (d,p); default is discrete
• default_color (str) – Hex color to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_color_mapping('AverageShortestPathLength', [1.0, 16.36], ['→˓#FBE723', '#440256'], style_name='galFiltered Style')''>>> set_node_label_color_mapping('Degree', ['1', '2'], ['#FFFF00', '#00FF00'], 'd→˓', style_name='galFiltered Style')''>>> set_node_label_color_mapping('ColorCol', mapping_type='p', default_color='→˓#654321', style_name='galFiltered Style')''
206 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_label_mapping
set_node_label_mapping(table_column, style_name='default', network=None,base_url='http://localhost:1234/v1')
Pass the values from a table column to display as node labels.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_mapping('name', style_name='galFiltered Style')''>>> set_node_label_mapping('name')''
py4cytoscape.style_mappings.set_node_label_opacity_mapping
set_node_label_opacity_mapping(table_column, table_column_values=None, opacities=None,mapping_type='c', default_opacity=None, style_name='default',network=None, base_url='http://localhost:1234/v1')
Sets opacity for node label only.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• opacities (list) – int values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_opacity (int) – Opacity value to set as default for all unmapped values
• style_name (str) – name for style
5.3. Reference 207
py4cytoscape Documentation, Release 0.0.1
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_label_opacity_mapping('AverageShortestPathLength', table_column_→˓values=[1.0, 16.36], opacities=[50, 100], style_name='galFiltered Style')''>>> set_node_label_opacity_mapping('Degree', table_column_values=['1', '2'],→˓opacities=[50, 100], mapping_type='d', style_name='galFiltered Style')''>>> set_node_label_opacity_mapping('PassthruCol', mapping_type='p', default_→˓opacity=225, style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_node_shape_mapping
set_node_shape_mapping(table_column, table_column_values=None, shapes=None, de-fault_shape=None, style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to shapes to set the node shape.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• shapes (list) – List of shapes to map to table_column_values. Seeget_node_shapes()
• default_shape (str) – Shape to set as default. See get_node_shapes()
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
208 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_shape_mapping('Degree', table_column_values=['1', '2'], shapes=[→˓'TRIANGLE', 'OCTAGON'], default_shape='ELLIPSE', style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_node_size_mapping
set_node_size_mapping(table_column, table_column_values=None, sizes=None, map-ping_type='c', default_size=None, style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to node sizes.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• sizes (list) – List of sizes of nodes
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_size (int) – Size value to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 209
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_node_size_mapping('AverageShortestPathLength', table_column_values=[1.0,→˓16.36], sizes=[60, 100], style_name='galFiltered Style')''>>> set_node_size_mapping('Degree', table_column_values=['1', '2'], sizes=[60,→˓100], mapping_type='d', style_name='galFiltered Style')''>>> set_node_size_mapping('PassthruCol', mapping_type='p', default_opacity=40,→˓style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_node_tooltip_mapping
set_node_tooltip_mapping(table_column, style_name='default', network=None,base_url='http://localhost:1234/v1')
Pass the values from a table column to display as node tooltips.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_tooltip_mapping('PassthruCol', style_name='galFiltered Style')''
210 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_node_width_mapping
set_node_width_mapping(table_column, table_column_values=None, widths=None, map-ping_type='c', default_width=None, style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to the node widths.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• widths (list) – List of widths values to map to table_column_values
• mapping_type (str) – discrete or passthrough (d,p); default is discrete
• default_width (int) – Width value to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_node_width_mapping('AverageShortestPathLength', table_column_values=[1.0,→˓16.36], sizes=[120, 180], style_name='galFiltered Style')''>>> set_node_width_mapping('Degree', table_column_values=['1', '2'], sizes=[140,→˓190], mapping_type='d', style_name='galFiltered Style')''>>> set_node_width_mapping('PassthruCol', mapping_type='p', default_size=120,→˓style_name='galFiltered Style')''
5.3. Reference 211
py4cytoscape Documentation, Release 0.0.1
Edge Style Mappings
set_edge_color_mapping(table_column[, . . . ])set_edge_font_face_mapping(table_column[,. . . ])
Sets font face for edge labels.
set_edge_font_size_mapping(table_column[,. . . ])
Map table column values to sizes to set the edge size.
set_edge_label_color_mapping(table_column[,. . . ])
Map table column values to colors to set the edge bordercolor.
set_edge_label_mapping(table_column[, . . . ]) Pass the values from a table column to display as edgelabels.
set_edge_label_opacity_mapping(table_column)Sets opacity for edge label only.set_edge_line_style_mapping(table_column[,. . . ])
Map table column values to styles to set the edge style.
set_edge_line_width_mapping(table_column[,. . . ])
Map table column values to widths to set the node bor-der width.
set_edge_opacity_mapping(table_column[,. . . ])
Map table column values to opacities to set the edgeopacity.
set_edge_source_arrow_color_mapping(table_column)Map table column values to colors to set the source ar-row color.
set_edge_source_arrow_mapping(table_column)Map table column values to shapes to set the source ar-row shape.
set_edge_source_arrow_shape_mapping(table_column)Map table column values to colors to set the source ar-row color.
set_edge_target_arrow_color_mapping(table_column)Map table column values to colors to set the target arrowcolor.
set_edge_target_arrow_maping(table_column[,. . . ])
Map table column values to shapes to set the target ar-row shape.
set_edge_target_arrow_shape_mapping(table_column)Map table column values to colors to set the target arrowcolor.
set_edge_tooltip_mapping(table_column[,. . . ])
Pass the values from a table column to display as edgetooltips.
py4cytoscape.style_mappings.set_edge_color_mapping
set_edge_color_mapping(table_column, table_column_values=None, colors=None, map-ping_type='c', default_color=None, style_name='default', network=None,base_url='http://localhost:1234/v1')
py4cytoscape.style_mappings.set_edge_font_face_mapping
set_edge_font_face_mapping(table_column, table_column_values=None, fonts=None, map-ping_type='d', default_font=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Sets font face for edge labels.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
212 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• fonts (list) – List of string specifications of font face, style and size, e.g.,[“SansSerif,plain,12”, “Dialog,plain,10”]
• mapping_type (str) – discrete or passthrough (d,p); default is discrete
• default_font (str) – String specification of font face, style and size, e.g.,“SansSerif,plain,12” or “Dialog,plain,10”
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_font_face_mapping('interaction', table_column_values=['pp', 'pd'],→˓fonts=['Arial,plain,12', 'Arial Bold,bold,12'], mapping_type='d', style_name=→˓'galFiltered Style')''>>> set_edge_font_face_mapping('PassthruCol', mapping_type='p', default_font=→˓'Arial,plain,12', style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_edge_font_size_mapping
set_edge_font_size_mapping(table_column, table_column_values=None, sizes=None, map-ping_type='c', default_size=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to sizes to set the edge size.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• sizes (list) – List of size values to map to table_column_values
• mapping_type (str) – discrete or passthrough (d,p); default is discrete
• default_size (int) – Size value to set as default
• style_name (str) – name for style
5.3. Reference 213
py4cytoscape Documentation, Release 0.0.1
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_font_size_mapping('EdgeBetweenness', table_column_values=[2.0, 20000.→˓0], sizes=[20, 80], style_name='galFiltered Style')''>>> set_edge_font_size_mapping('interaction', table_column_values=['pp', 'pd'],→˓sizes=[40, 90], mapping_type='d', style_name='galFiltered Style')''>>> set_edge_font_size_mapping('PassthruCol', mapping_type='p', default_size=20,→˓style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_edge_label_color_mapping
set_edge_label_color_mapping(table_column, table_column_values=None, colors=None, map-ping_type='c', default_color=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to colors to set the edge border color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• colors (list) – values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuou
• default_color (str) – Hex color to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
214 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_color_mapping('EdgeBetweenness', [2.0, 20000.0], ['#FBE723', '→˓#440256'], style_name='galFiltered Style')''>>> set_edge_label_color_mapping('interaction', ['pp', 'pd'], ['#FFFF00', '#00FF00→˓'], 'd', style_name='galFiltered Style')''>>> set_edge_label_color_mapping('ColorCol', mapping_type='p', default_color='→˓#654321', style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_edge_label_mapping
set_edge_label_mapping(table_column, style_name='default', network=None,base_url='http://localhost:1234/v1')
Pass the values from a table column to display as edge labels.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 215
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_label_mapping('name', style_name='galFiltered Style')''>>> set_edge_label_mapping('name')''
py4cytoscape.style_mappings.set_edge_label_opacity_mapping
set_edge_label_opacity_mapping(table_column, table_column_values=None, opacities=None,mapping_type='c', default_opacity=None, style_name='default',network=None, base_url='http://localhost:1234/v1')
Sets opacity for edge label only.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• opacities (list) – int values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_opacity (int) – Opacity value to set as default for all unmapped values
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_label_opacity_mapping('EdgeBetweenness', [2.0, 20000.0],→˓opacities=[50, 100], style_name='galFiltered Style')''>>> set_edge_label_opacity_mapping('interaction', ['pp', 'pd'], opacities=[50,→˓100], mapping_type='d', style_name='galFiltered Style')''>>> set_edge_label_opacity_mapping('PassthruCol', mapping_type='p', default_→˓opacity=225, style_name='galFiltered Style')''
216 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_mappings.set_edge_line_style_mapping
set_edge_line_style_mapping(table_column, table_column_values=None, line_styles=None, de-fault_line_style='SOLID', style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to styles to set the edge style.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• line_styles (list) – List of styles to map to table_column_values. Seeget_line_styles()
• default_line_style (str) – Style to set as default. See get_line_styles()
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_line_style_mapping('interaction', table_column_values=['pp','pd'],→˓shapes=['ZIGZAG', 'SINEWAVE'], default_shape='EQUAL_DASH', style_name=→˓'galFiltered Style')''
py4cytoscape.style_mappings.set_edge_line_width_mapping
set_edge_line_width_mapping(table_column, table_column_values=None, widths=None, map-ping_type='c', default_width=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to widths to set the node border width.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
5.3. Reference 217
py4cytoscape Documentation, Release 0.0.1
• widths (list) – List of width values to map to table_column_values
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_width (int) – Width value to set as default for all unmapped values
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_line_width_mapping('EdgeBetweenness', table_column_values=[2.0,→˓20000.0], widths=[5, 10], style_name='galFiltered Style')''>>> set_edge_line_width_mapping('interaction', table_column_values=['pp','pd'],→˓widths=[5, 10], mapping_type='d', style_name='galFiltered Style')''>>> set_edge_line_width_mapping('PassthruCol', mapping_type='p', default_width=3,→˓style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_edge_opacity_mapping
set_edge_opacity_mapping(table_column, table_column_values=None, opacities=None, map-ping_type='c', default_opacity=None, style_name='default', net-work=None, base_url='http://localhost:1234/v1')
Map table column values to opacities to set the edge opacity.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• opacities (list) – int values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuous
• default_opacity (int) – Opacity value to set as default for all unmapped values
• style_name (str) – name for style
218 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_opacity_mapping('EdgeBetweenness', table_column_values=[2.0, 20000.→˓0], opacities=[50, 100], style_name='galFiltered Style')''>>> set_edge_opacity_mapping('interaction', table_column_values=['pp','pd'],→˓opacities=[50, 100], mapping_type='d', style_name='galFiltered Style')''>>> set_edge_opacity_mapping('PassthruCol', mapping_type='p', default_opacity=225,→˓ style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_edge_source_arrow_color_mapping
set_edge_source_arrow_color_mapping(table_column, table_column_values=None, col-ors=None, mapping_type='c', default_color=None,style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to colors to set the source arrow color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• colors (list) – values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuoue
• default_color (str) – Hex color to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 219
py4cytoscape Documentation, Release 0.0.1
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_source_arrow_color_mapping('EdgeBetweenness', [2.0, 20000.0], ['→˓#FBE723', '#440256'], style_name='galFiltered Style')''>>> set_edge_source_arrow_color_mapping('interaction', ['pp','pd'], ['#FFFF00', '→˓#00FF00'], 'd', style_name='galFiltered Style')''>>> set_edge_source_arrow_color_mapping('ColorCol', mapping_type='p', default_→˓color='#654321', style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_edge_source_arrow_mapping
set_edge_source_arrow_mapping(table_column, table_column_values=None, shapes=None, de-fault_shape='ARROW', style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to shapes to set the source arrow shape.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• shapes (list) – List of shapes to map to table_column_values. Seeget_arrow_shapes()
• default_shape (str) – Style to set as default. See get_arrow_shapes()
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
220 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_source_arrow_mapping('interaction', table_column_values=['pp','pd'],→˓shapes=['CIRCLE', 'ARROW'], default_shape='NONE', style_name='galFiltered Style→˓')''
py4cytoscape.style_mappings.set_edge_source_arrow_shape_mapping
set_edge_source_arrow_shape_mapping(table_column, table_column_values=None,shapes=None, default_shape=None,style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to colors to set the source arrow color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• shapes (list) – List of arrow shapes to map to table_column_values. Seeget_arrow_shapes()
• default_shape (str) – Shape to set as default. See get_arrow_shapes()
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 221
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_source_arrow_shape_mapping('interaction', table_column_values=['pp',→˓'pd'], shapes=['DIAMOND', 'CIRCLE'], style_name='galFiltered Style')''
Note: This is the same function as set_edge_source_arrow_mapping()
See also:
set_edge_source_arrow_mapping()
py4cytoscape.style_mappings.set_edge_target_arrow_color_mapping
set_edge_target_arrow_color_mapping(table_column, table_column_values=None, col-ors=None, mapping_type='c', default_color=None,style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to colors to set the target arrow color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• colors (list) – values between 0 and 255; 0 is invisible
• mapping_type (str) – continuous, discrete or passthrough (c,d,p); default is continuoue
• default_color (str) – Hex color to set as default
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
222 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_target_arrow_color_mapping('EdgeBetweenness', [2.0, 20000.0], ['→˓#FBE723', '#440256'], style_name='galFiltered Style')''>>> set_edge_target_arrow_color_mapping('interaction', ['pp','pd'], ['#FFFF00', '→˓#00FF00'], 'd', style_name='galFiltered Style')''>>> set_edge_target_arrow_color_mapping('ColorCol', mapping_type='p', default_→˓color='#654321', style_name='galFiltered Style')''
py4cytoscape.style_mappings.set_edge_target_arrow_maping
set_edge_target_arrow_maping(table_column, table_column_values=None, shapes=None, de-fault_shape='ARROW', style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to shapes to set the target arrow shape.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• shapes (list) – List of shapes to map to table_column_values. Seeget_arrow_shapes()
• default_shape (str) – Style to set as default. See get_arrow_shapes()
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 223
py4cytoscape Documentation, Release 0.0.1
Examples
>>> set_edge_target_arrow_maping('interaction', table_column_values=['pp','pd'],→˓shapes=['CIRCLE', 'ARROW'], default_shape='NONE', style_name='galFiltered Style→˓')''
py4cytoscape.style_mappings.set_edge_target_arrow_shape_mapping
set_edge_target_arrow_shape_mapping(table_column, table_column_values=None,shapes=None, default_shape=None,style_name='default', network=None,base_url='http://localhost:1234/v1')
Map table column values to colors to set the target arrow color.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• table_column_values (list) – List of values from Cytoscape table to be used inmapping
• shapes (list) – List of arrow shapes to map to table_column_values. Seeget_arrow_shapes()
• default_shape (str) – Shape to set as default. See get_arrow_shapes()
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_source_arrow_target_mapping('interaction', table_column_values=['pp',→˓'pd'], shapes=['DIAMOND', 'CIRCLE'], style_name='galFiltered Style')''
Note: This is the same function as set_edge_target_arrow_mapping()
See also:
224 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
set_edge_target_arrow_mapping()
py4cytoscape.style_mappings.set_edge_tooltip_mapping
set_edge_tooltip_mapping(table_column, style_name='default', network=None,base_url='http://localhost:1234/v1')
Pass the values from a table column to display as edge tooltips.
Parameters
• table_column (str) – Name of Cytoscape table column to map values from
• style_name (str) – name for style
• network (SUID or str or None) – Name or SUID of a network or view. Default isthe “current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘’ if successful or None if error
Return type str or None
Raises
• CyError – if table column doesn’t exist, table column values doesn’t match values list, orinvalid style name, network or mapping type
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> set_edge_tooltip_mapping('PassthruCol', style_name='galFiltered Style')''
Style Values
Functions for retrieving current values for visual properties.
I. General functions for getting node, edge and network properties
II. Specific functions for getting particular node, edge and network properties
Node Style Values
get_node_color([node_names, network,base_url])
Retrieve the actual fill color of specified nodes.
get_node_height([node_names, network,base_url])
Retrieve the actual height of specified nodes.
get_node_position([node_names, network, . . . ]) Retrieve the actual x,y position of specified nodes.get_node_property([node_names, . . . ]) Get values for any node property of the specified nodes.
continues on next page
5.3. Reference 225
py4cytoscape Documentation, Release 0.0.1
Table 45 – continued from previous pageget_node_size([node_names, network, base_url]) Retrieve the actual size of specified nodes.get_node_width([node_names, network,base_url])
Retrieve the actual width of specified nodes.
py4cytoscape.style_values.get_node_color
get_node_color(node_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual fill color of specified nodes.
Parameters
• node_names (list) – List of node names or node SUIDs. Default is None for all nodes.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {node-name: fill-color} for each node in node_names parameter
Return type dict
Raises
• CyError – if network name or node doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_node_color()>>> {'YOR215C': '#FFFFEC', 'YBL026W': '#FCFDFE', 'YOL149W': '#FFFFE3', ...}>>> get_node_color(['YOR215C', 'YBL026W', 'YOL149W'])>>> {'YOR215C': '#FFFFEC', 'YBL026W': '#FCFDFE', 'YOL149W': '#FFFFE3'}>>> get_node_color([395406, 395407, 395404])>>> {395406: '#FFFFEC', 395407: '#FCFDFE', 395404: '#FFFFE3'}>>> get_node_color(node_names='YOR215C', network='galFiltered.sif')>>> {'YYOR215C': '#FFFFEC'}
py4cytoscape.style_values.get_node_height
get_node_height(node_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual height of specified nodes.
Parameters
• node_names (list) – List of node names or node SUIDs. Default is None for all nodes.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
226 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {node-name: height} for each node in node_names parameter
Return type dict
Raises
• CyError – if network name or node doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_node_height()>>> {'YOR215C': 50.0, 'YBL026W': 50.0, 'YOL149W': 50.0, ...}>>> get_node_height(['YOR215C', 'YBL026W', 'YOL149W'])>>> {'YOR215C': 50.0, 'YBL026W': 50.0, 'YOL149W': 50.0}>>> get_node_height([395406, 395407, 395404])>>> {395406: 50.0, 395407: 50.0, 395404: 50.0}>>> get_node_height(node_names='YOR215C', network='galFiltered.sif')>>> {'YYOR215C': 46.470588235294116}
py4cytoscape.style_values.get_node_position
get_node_position(node_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual x,y position of specified nodes.
Parameters
• node_names (list) – List of node names or node SUIDs. Default is None for all nodes.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns with index as node_names values and columns x and y containing coordinates
Return type dataframe
Raises
• CyError – if network name or node doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 227
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_node_position()>>> x y>>> YIL052C 2628.866343678256 1180.9601936051579>>> YDL215C 1723.7108261001308 2230.935871095392>>> YLR432W 1660.9524948013027 2387.6488532731264>>> ...>>> get_node_position(['YDR429C', 'YMR005W', 'YDR142C'])>>> x y>>> YDR429C 2628.866343678256 1180.9601936051579>>> YMR005W 1723.7108261001308 2230.935871095392>>> YDR142C 1660.9524948013027 2387.6488532731264>>> get_node_position([432646, 432647, 432644])>>> x y>>> 432646 2628.866343678256 1180.9601936051579>>> 432647 1723.7108261001308 2230.935871095392>>> 432644 1660.9524948013027 2387.6488532731264>>> get_node_position(node_names='YER112W', network='galFiltered.sif')>>> x y>>> YER112W 2151.8481399429043 2326.677814454767
py4cytoscape.style_values.get_node_property
get_node_property(node_names=None, visual_property=None, network=None,base_url='http://localhost:1234/v1')
Get values for any node property of the specified nodes.
Parameters
• node_names (list) – List of node names or node SUIDs. Default is None for all nodes.
• visual_property (str) – Name of a visual property. Seeget_visual_property_names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {node-name: prop_value} for each node in node_names parameter
Return type dict
Raises
• CyError – if network name, node name or property name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
228 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_node_property(visual_property='NODE_LABEL')>>> {'YIL070C': 'MAM33', 'YHR198C': 'YHR198C', ...}>>> get_node_property(visual_property='NODE_LABEL', node_names=['YIL070C',→˓'YHR198C'])>>> {'YIL070C': 'MAM33', 'YHR198C': 'YHR198C'}>>> get_node_property(visual_property='NODE_LABEL', node_names=[391173, 391172,→˓391175])>>> {391173: 'RPL11B', 391172: 'SXM1', 391175: 'MPT1'}>>> get_node_property(visual_property='NODE_LABEL', node_names='YER112W', network=→˓'galFiltered.sif')>>> {'YER112W': 'LSM4'}
py4cytoscape.style_values.get_node_size
get_node_size(node_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual size of specified nodes.
Parameters
• node_names (list) – List of node names or node SUIDs. Default is None for all nodes.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {node-name: size} for each node in node_names parameter
Return type dict
Raises
• CyError – if network name or node doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_node_size()>>> {'YOR215C': 50.0, 'YBL026W': 50.0, 'YOL149W': 50.0, ...}>>> get_node_size(['YOR215C', 'YBL026W', 'YOL149W'])>>> {'YOR215C': 50.0, 'YBL026W': 50.0, 'YOL149W': 50.0}>>> get_node_size([395406, 395407, 395404])>>> {395406: 50.0, 395407: 50.0, 395404: 50.0}>>> get_node_size(node_names='YOR215C', network='galFiltered.sif')>>> {'YYOR215C': 50.0}
5.3. Reference 229
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_values.get_node_width
get_node_width(node_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual width of specified nodes.
Parameters
• node_names (list) – List of node names or node SUIDs. Default is None for all nodes.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {node-name: width} for each node in node_names parameter
Return type dict
Raises
• CyError – if network name or node doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_node_width()>>> {'YOR215C': 50.0, 'YBL026W': 50.0, 'YOL149W': 50.0, ...}>>> get_node_width(['YOR215C', 'YBL026W', 'YOL149W'])>>> {'YOR215C': 50.0, 'YBL026W': 50.0, 'YOL149W': 50.0}>>> get_node_width([395406, 395407, 395404])>>> {395406: 50.0, 395407: 50.0, 395404: 50.0}>>> get_node_width(node_names='YOR215C', network='galFiltered.sif')>>> {'YYOR215C': 46.470588235294116}
Edge Style Values
get_edge_color([edge_names, network,base_url])
Retrieve the actual line color of specified edges.
get_edge_line_style([edge_names, network,. . . ])
Retrieve the actual line style of specified edges.
get_edge_line_width([edge_names, network,. . . ])
Retrieve the actual line width of specified edge.
get_edge_property([edge_names, . . . ]) Get values for any edge property of the specified edges.get_edge_target_arrow_shape([edge_names,. . . ])
Retrieve the actual target arrow shape of specifiededges.
230 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_values.get_edge_color
get_edge_color(edge_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual line color of specified edges.
Parameters
• edge_names (list) – List of edge names or edge SUIDs. Default is None for all edges.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {edge-name: line-color} for each edge in edge_names parameter
Return type dict
Raises
• CyError – if network name or edge doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_edge_color()>>> {'YMR117C (pp) YCL032W': '#808080', 'YMR255W (pp) YGL122C': '#808080',→˓'YNL214W (pp) YGL153W': '#808080', ...}>>> get_edge_color(['YHR084W (pd) YFL026W', 'YHR084W (pd) YDR461W', 'YMR255W (pp)→˓YGL122C'])>>> {'YHR084W (pd) YFL026W': '#808080', 'YHR084W (pd) YDR461W': '#808080',→˓'YMR255W (pp) YGL122C': '#808080'}>>> get_edge_color([421382, 421383, 421380])>>> {421382: '#808080', 421383: '#808080', 421380: '#808080'}>>> get_edge_color(edge_names='YOR355W (pp) YNL091W', network='galFiltered.sif')>>> {'YOR355W (pp) YNL091W': '#808080'}
py4cytoscape.style_values.get_edge_line_style
get_edge_line_style(edge_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual line style of specified edges.
Parameters
• edge_names (list) – List of edge names or edge SUIDs. Default is None for all edges.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {edge-name: line-style} for each edge in edge_names parameter
Return type dict
5.3. Reference 231
py4cytoscape Documentation, Release 0.0.1
Raises
• CyError – if network name or edge doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_edge_line_style()>>> {'YMR117C (pp) YCL032W': 'SOLID', 'YMR255W (pp) YGL122C': 'SOLID', 'YNL214W→˓(pp) YGL153W': 'SOLID', ...}>>> get_edge_line_style(['YHR084W (pd) YFL026W', 'YHR084W (pd) YDR461W', 'YMR255W→˓(pp) YGL122C'])>>> {'YHR084W (pd) YFL026W': 'SOLID', 'YHR084W (pd) YDR461W': 'SOLID', 'YMR255W→˓(pp) YGL122C': 'SOLID'}>>> get_edge_line_style([421382, 421383, 421380])>>> {421382: 'SOLID', 421383: 'SOLID', 421380: 'SOLID'}>>> get_edge_line_style(edge_names='YOR355W (pp) YNL091W', network='galFiltered.→˓sif')>>> {'YOR355W (pp) YNL091W': 'SOLID'}
py4cytoscape.style_values.get_edge_line_width
get_edge_line_width(edge_names=None, network=None, base_url='http://localhost:1234/v1')Retrieve the actual line width of specified edge.
Parameters
• edge_names (list) – List of edge names or edge SUIDs. Default is None for all edges.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {edge-name: width} for each edge in edge_names parameter
Return type dict
Raises
• CyError – if network name or node doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
232 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_edge_line_width()>>> {'YLR197W (pp) YOR310C': 2.0, 'YIL074C (pp) YNL311C': 2.0, ...}>>> get_edge_line_width(['YHR084W (pd) YFL026W', 'YHR084W (pd) YDR461W', 'YMR255W→˓(pp) YGL122C'])>>> {'YHR084W (pd) YFL026W': 2.0, 'YHR084W (pd) YDR461W': 2.0, 'YMR255W (pp)→˓YGL122C': 2.0}>>> get_edge_line_width([421382, 421383, 421380])>>> {421382: 2.0, 421383: 2.0, 421380: 2.0}>>> get_edge_line_width(edge_names='YOR355W (pp) YNL091W', network='galFiltered.→˓sif')>>> {'YOR355W (pp) YNL091W': 2.0}
py4cytoscape.style_values.get_edge_property
get_edge_property(edge_names=None, visual_property=None, network=None,base_url='http://localhost:1234/v1')
Get values for any edge property of the specified edges.
This method retrieves the actual property of the node, given the current visual style, factoring together anydefault, mapping and bypass setting.
Parameters
• edge_names (list) – List of edge names or node SUIDs. Default is None for all edges.
• visual_property (str) – Name of a visual property. Seeget_visual_property_names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {edge-name: prop_value} for each edge in edge_names parameter
Return type dict
Raises
• CyError – if network name, edge name or property name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_edge_property(visual_property='EDGE_LABEL')>>> {'YJR022W (pp) YNL050C': 'pp', 'YKR026C (pp) YGL122C': 'pp', ...}>>> get_edge_property(visual_property='EDGE_LABEL', edge_names=['YCL067C (pd)→˓YIL015W', 'YCR084C (pp) YCL067C'])>>> {'YCL067C (pd) YIL015W': 'pd', 'YCR084C (pp) YCL067C': 'pp'}>>> get_edge_property(visual_property='EDGE_LABEL', edge_names=[393222, 393223])>>> {393222: 'pd', 393223: 'pp'}
(continues on next page)
5.3. Reference 233
py4cytoscape Documentation, Release 0.0.1
(continued from previous page)
>>> get_edge_property(visual_property='EDGE_LABEL', edge_names='YDR277C (pp)→˓YJR022W', network='galFiltered.sif')>>> {'YDR277C (pp) YJR022W': 'pp'}
py4cytoscape.style_values.get_edge_target_arrow_shape
get_edge_target_arrow_shape(edge_names=None, network=None,base_url='http://localhost:1234/v1')
Retrieve the actual target arrow shape of specified edges.
Parameters
• edge_names (list) – List of edge names or edge SUIDs. Default is None for all edges.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as a collection of {edge-name: arrow-shape} for each edge in edge_names parameter
Return type dict
Raises
• CyError – if network name or edge doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_edge_target_arrow_shape()>>> {'YMR117C (pp) YCL032W': 'NONE', 'YMR255W (pp) YGL122C': 'NONE', 'YNL214W→˓(pp) YGL153W': 'NONE', ...}>>> get_edge_target_arrow_shape(['YHR084W (pd) YFL026W', 'YHR084W (pd) YDR461W',→˓'YMR255W (pp) YGL122C'])>>> {'YHR084W (pd) YFL026W': 'NONE', 'YHR084W (pd) YDR461W': 'NONE', 'YMR255W→˓(pp) YGL122C': 'NONE'}>>> get_edge_target_arrow_shape([421382, 421383, 421380])>>> {421382: 'NONE', 421383: 'NONE', 421380: 'NONE'}>>> get_edge_target_arrow_shape(edge_names='YOR355W (pp) YNL091W', network=→˓'galFiltered.sif')>>> {'YOR355W (pp) YNL091W': 'NONE'}
234 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Network Style Values
get_network_center([network, base_url]) Retrieve the center of specified network.get_network_property(visual_property[, . . . ]) Get values for any network property.get_network_zoom([network, base_url]) Retrieve the scale factor of specified network.
py4cytoscape.style_values.get_network_center
get_network_center(network=None, base_url='http://localhost:1234/v1')Retrieve the center of specified network.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns as {x: x-coord, y: y-coord} for center of network
Return type dict
Raises
• CyError – if network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_network_center()>>> {'x': 2628.866343678256, 'y': 1180.9601936051579}>>> get_network_center(network='galFiltered.sif')>>> {'x': 2628.866343678256, 'y': 1180.9601936051579}
py4cytoscape.style_values.get_network_property
get_network_property(visual_property, network=None, base_url='http://localhost:1234/v1')Get values for any network property.
This method retrieves the actual property of the network, given the current visual style, factoring together anydefault, mapping and bypass setting.
Parameters
• visual_property (str) – Name of a visual property. Seeget_visual_property_names
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
5.3. Reference 235
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns value of visual property
Return type float
Raises
• CyError – if network name or property name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_network_property('NETWORK_SCALE_FACTOR')>>> 0.6299925248514752>>> get_network_property(visual_property='NETWORK_SCALE_FACTOR', network=→˓'galFiltered.sif')>>> 0.6299925248514752
py4cytoscape.style_values.get_network_zoom
get_network_zoom(network=None, base_url='http://localhost:1234/v1')Retrieve the scale factor of specified network.
Parameters
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns for zoom factor
Return type float
Raises
• CyError – if network name doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
236 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_network_zoom()>>> 0.6299925248514752>>> get_network_zoom(network='galFiltered.sif')>>> 0.6299925248514752
5.3.13 Tables
Functions for managing TABLE columns and table column functions, like map and rename, as well as loading andextracting table data in Cytoscape.
Column Manipulation
delete_table_column(column[, table, . . . ]) Delete a column from node, edge or network tables.get_table_column_names([table, namespace,. . . ])
Retrieve the names of all columns in a table.
get_table_column_types([table, namespace,. . . ])
Retrieve the types of all columns in a table.
get_table_columns([table, columns, . . . ]) Retrieve one or more columns of data from node, edgeor network tables.
rename_table_column(column, new_name[, . . . ]) Set a new name for a column.
py4cytoscape.tables.delete_table_column
delete_table_column(column, table='node', namespace='default', network=None,base_url='http://localhost:1234/v1')
Delete a column from node, edge or network tables.
Parameters
• column (str) – Name of the column to delete
• table (str) – Name of table, e.g., node (default), edge, network
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Note: No error is returned if the column doesn’t exist in the table
Raises
5.3. Reference 237
py4cytoscape Documentation, Release 0.0.1
• HTTPError – if table or namespace doesn’t exist in network
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> delete_table_column('BetweennessCentrality')''>>> delete_table_column('EdgeBetweenness', table='edge')''>>> delete_table_column('BetweennessCentrality', network='My Network')''
py4cytoscape.tables.get_table_column_names
get_table_column_names(table='node', namespace='default', network=None,base_url='http://localhost:1234/v1')
Retrieve the names of all columns in a table.
Parameters
• table (str) – Name of table, e.g., node, edge, network; default is “node”
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns list of column names
Return type list
Raises
• HTTPError – if table or namespace or table doesn’t exist in network
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_table_column_names()['SUID', 'shared name', 'name', 'selected', 'AverageShortestPathLength', ... ]>>> get_table_column_names('edge')['SUID', 'shared name', 'shared interaction', 'name', 'selected', 'interaction',→˓'EdgeBetweenness']>>> get_table_column_names('network', network='My Network')['SUID', 'shared name', 'name', 'selected', '__Annotations', 'publication',→˓'Dataset Name', 'Dataset URL']
238 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.tables.get_table_column_types
get_table_column_types(table='node', namespace='default', network=None,base_url='http://localhost:1234/v1')
Retrieve the types of all columns in a table.
Parameters
• table (str) – Name of table, e.g., node, edge, network; default is “node”
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns where the column name is the key and the data type is the value
Return type dict
Raises
• HTTPError – if table or namespace or table doesn’t exist in network
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_table_column_types(){'SUID': 'Long', 'shared name': 'String', 'name': 'String', 'selected': 'Boolean',→˓ 'AverageShortestPathLength': 'Double', ...}>>> get_table_column_types('edge'){'SUID': 'Long', 'shared name': 'String', 'shared interaction': 'String', 'name':→˓'String', ... }>>> get_table_column_types('network', network='My Network'){'SUID': 'Long', 'shared name': 'String', 'name': 'String', 'selected': 'Boolean',→˓ '__Annotations': 'List', ...}
py4cytoscape.tables.get_table_columns
get_table_columns(table='node', columns=None, namespace='default', network=None,base_url='http://localhost:1234/v1')
Retrieve one or more columns of data from node, edge or network tables.
The ‘SUID’ column is always retrieved along with specified columns. The ‘SUID’ values are used as index inthe returned dataframe.
Parameters
• table (str) – Name of table, e.g., node (default), edge, network
• columns (str or list or None) – Names of columns to retrieve values from as listobject or comma-separated list; default is all columns
5.3. Reference 239
py4cytoscape Documentation, Release 0.0.1
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns requested columns (including SUID), and rows for each node/edge or network.
Return type dataframe
Raises
• HTTPError – if table or namespace doesn’t exist in network
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> get_table_columns()SUID shared name name ... gal4RGsig gal80Rsig isExcludedFromPaths
3072 3072 YDL081C YDL081C ... 0.048133 5.9631e-06 False3073 3073 YGL166W YGL166W ... 0.0012181 0.032147 False...>>> get_table_columns(columns='name')
SUID shared name name ... gal4RGsig gal80Rsig isExcludedFromPaths3072 3072 YDL081C YDL081C ... 0.048133 5.9631e-06 False3073 3073 YGL166W YGL166W ... 0.0012181 0.032147 False...>>> get_table_columns(columns=['gal1RGexp', 'Eccentricity', 'Stress'])
gal1RGexp Eccentricity Stress4608 -0.262 17 04609 -0.704 17 2092...>>> get_table_columns(columns='Stress, NumberOfDirectedEdges')
Stress NumberOfDirectedEdges4608 0 14609 2092 2...>>> get_table_columns(columns='Stress, bogus')
Stress bogus4608 0 NaN4609 2092 NaN...
Note: For requested columns not present in the table, the column is still returned but is full of nan values.
240 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.tables.rename_table_column
rename_table_column(column, new_name, table='node', namespace='default', network=None,base_url='http://localhost:1234/v1')
Set a new name for a column.
Parameters
• column (str) – Name of the column to rename
• new_name (str) – New name for the specified column
• table (str) – name of Cytoscape table to load data into, e.g., node, edge or network;default is “node”
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• HTTPError – if table or namespace or table doesn’t exist in network, or if column doesn’texist in table, or new_name already exists
• CyError – if network name or SUID doesn’t exist, or if mapping parameter is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> rename_table_column('AverageShortestPathLength', 'xAveragex')''>>> rename_table_column('AverageShortestPathLength', 'xAveragex', table='edge',→˓namespace='default', network='My Network')''
Column Mapping
map_table_column(column, species, map_from,. . . )
Map Table Column.
5.3. Reference 241
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.tables.map_table_column
map_table_column(column, species, map_from, map_to, force_single=True, table='node', names-pace='default', network=None, base_url='http://localhost:1234/v1')
Map Table Column.
Perform identifier mapping using an existing column of supported identifiers to populate a new column withidentifiers mapped to the originals.
Supported species: Human, Mouse, Rat, Frog, Zebrafish, Fruit fly, Mosquito, Worm, Arabidopsis thaliana,Yeast, E. coli, Tuberculosis. Supported identifier types (depending on species): Ensembl, Entrez Gene, Uniprot-TrEMBL, miRBase, UniGene, HGNC (symbols), MGI, RGD, SGD, ZFIN, FlyBase, WormBase, TAIR.
Parameters
• column (str) – Name of column containing identifiers of type specified by map.from
• species (str) – Common name for species associated with identifiers, e.g., Human. Seedetails.
• map_from (str) – Type of identifier found in specified column. See details.
• map.to (str) – Type of identifier to populate in new column. See details.
• force.single (bool) – Whether to return only first result in cases of one-to-manymappings; otherwise the new column will hold lists of identifiers. Default is TRUE.
• table (str) – name of Cytoscape table to load data into, e.g., node, edge or network;default is “node”
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns contains map_from and map_to columns.
Return type dataframe
Warning: If map_to is not unique, it will be suffixed with an incrementing number in parentheses, e.g.,if mapIdentifiers is repeated on the same network. However, the original map_to column will be returnedregardless.
Raises
• HTTPError – if table or namespace or table doesn’t exist in network
• CyError – if network name or SUID doesn’t exist, or if mapping parameter is invalid
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
242 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> map_table_column('name','Yeast','Ensembl','SGD')name SGD
17920 YER145C S00000094717921 YMR058W S00000466217922 YJL190C S000003726...
Data Values
get_table_value(table, row_name, column[, . . . ]) Retrieve the value from a specific row and column fromnode, edge or network tables.
load_table_data(data[, data_key_column, . . . ]) Loads data into Cytoscape tables keyed by row.
py4cytoscape.tables.get_table_value
get_table_value(table, row_name, column, namespace='default', network=None,base_url='http://localhost:1234/v1')
Retrieve the value from a specific row and column from node, edge or network tables.
Parameters
• table (str) – Name of table, e.g., node (default), edge, network
• row_name (str) – Node, edge or network name, i.e., the value in the “name” column
• column (str) – Name of column to retrieve values from
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns the value of the table cell, cast to float, int, bool or str depending on column type
Return type obj
Raises
• HTTPError – if table or namespace doesn’t exist in network or if cell contains a numerictype but no number
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
5.3. Reference 243
py4cytoscape Documentation, Release 0.0.1
Examples
>>> get_table_value('node', 'YDL194W', 'COMMON')'SNF3'>>> get_table_value('edge', 'YLR197W (pp) YOR310C', 'EdgeBetweenness', network=→˓'My Network')2.0>>> get_table_value('node', 'YDL194W', 'IsSingleNode')False
py4cytoscape.tables.load_table_data
load_table_data(data, data_key_column='row.names', table='node', table_key_column='name', names-pace='default', network=None, base_url='http://localhost:1234/v1')
Loads data into Cytoscape tables keyed by row.
This function loads data into Cytoscape node/edge/network tables provided a common key, e.g., name.Data.frame column names will be used to set Cytoscape table column names. Numeric values will be storedas Doubles in Cytoscape tables. Integer values will be stored as Integers. Character or mixed values will bestored as Strings. Logical values will be stored as Boolean. Lists are stored as Lists by CyREST v3.9+. Existingcolumns with the same names will keep original type but values will be overwritten.
Parameters
• data (dataframe) – each row is a node and columns contain node attributes
• data_key_column (str) – name of data.frame column to use as key; ‘ default is“row.names”
• table (str) – name of Cytoscape table to load data into, e.g., node, edge or network;default is “node”
• namespace (str) – Namespace of table. Default is “default”.
• network (SUID or str or None) – Name or SUID of a network. Default is the“current” network active in Cytoscape.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns ‘Success: Data loaded in <table name> table’ or ‘Failed to load data: <reason>’
Return type str
Raises
• HTTPError – if table or namespace or table doesn’t exist in network
• CyError – if network name or SUID doesn’t exist
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
244 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> data = df.DataFrame(data={'id':['New1','New2','New3'], 'newcol':[1,2,3]})>>> load_table_data(data, data_key_column='id', table='node', table_key_column=→˓'name')'Failed to load data: Provided key columns do not contain any matches'>>> data = df.DataFrame(data={'id':['YDL194W','YDR277C','YBR043C'], 'newcol':[1,2,→˓3]})>>> load_table_data(data, data_key_column='id', table='node', table_key_column=→˓'name', network='galfiltered.sif')'Success: Data loaded in defaultnode table'
5.3.14 Tools
Functions related to TOOLS found in the Tools Menu in Cytoscape.
Browser Control
cybrowser_close([id, base_url]) Cybrowser Close.cybrowser_dialog([id, text, title, url, . . . ]) Launch Cytoscape’s internal web browser in a separate
windowcybrowser_hide([id, base_url]) Cybrowser Hide.cybrowser_list([base_url]) Cybrowser List.cybrowser_send([id, script, base_url]) Cybrowser Send.cybrowser_show([id, text, title, url, base_url]) Cybrowser Show.cybrowser_version([base_url]) Display the version of the CyBrowser app.
py4cytoscape.tools.cybrowser_close
cybrowser_close(id=None, base_url='http://localhost:1234/v1')Cybrowser Close.
Close an internal web browser and remove all content. Provide an id for the browser you want to close.
Parameters
• id (str) – The identifier for the browser window to close
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
5.3. Reference 245
py4cytoscape Documentation, Release 0.0.1
Examples
>>> cybrowser_close('CyGame'){}
py4cytoscape.tools.cybrowser_dialog
cybrowser_dialog(id=None, text=None, title=None, url=None, base_url='http://localhost:1234/v1')Launch Cytoscape’s internal web browser in a separate window
Provide an id for the window if you want subsequent control of the window e.g., via cybrowser hide.
Parameters
• id (str) – The identifier for the new browser window
• text (str) – HTML text to initially load into the browser
• title (str) – Text to be shown in the title bar of the browser window
• url (str) – The URL the browser should load
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘id’: id} where id is the one provided as a parameter to this function
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cybrowser_dialog(id='Test Window', title='Hello Africa', text='<HTML><HEAD>→˓<TITLE>Hello</TITLE></HEAD><BODY>Hello, world!</BODY></HTML>'){'id': 'Test Window'}>>> cybrowser_dialog(id='CytoWindow', title='Cytoscape Home Page', url='http://→˓www.cytoscape.org'){'id': 'CytoWindow'}
See also:
cybrowser_show(), cybrowser_hide()
py4cytoscape.tools.cybrowser_hide
cybrowser_hide(id=None, base_url='http://localhost:1234/v1')Cybrowser Hide.
Hide an existing browser, whether it’s in the Results panel or a separate window.
Parameters
• id (str) – The identifier for the browser window to hide
246 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {}
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cybrowser_hide('CyGame'){}
See also:
cybrowser_show(), cybrowser_dialog()
py4cytoscape.tools.cybrowser_list
cybrowser_list(base_url='http://localhost:1234/v1')Cybrowser List.
List all browsers that are currently open, whether as a dialog or in the results panel.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns [{‘id’: id, ‘title’: title, ‘url’: current url}]
Return type list
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cybrowser_list()[{'id': 'CytoManual ID', 'title': 'CytoManual Page', 'url': 'http://manual.→˓cytoscape.org/en/stable/'}, {'id': ...} ...]
Note: In the return value, there is a dict for each browser window, and the id and title were provided in thecybrowser_show() call, and the url is for the page currently loaded in the browser window
5.3. Reference 247
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.tools.cybrowser_send
cybrowser_send(id=None, script='', base_url='http://localhost:1234/v1')Cybrowser Send.
Send the text to the browser indicated by the id and return the response, if any. Note that the JSON result fieldcould either be a bare string or JSON formatted text.
Parameters
• id (str) – The identifier for the new browser window
• script (str) – Note that only string results are returned.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘browserId’: id, ‘result’: result}
Return type dict
Raises
• CyError – if the browser could not execute the command
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> cybrowser_send(id='Test Window', script='navigator.userAgent'){'browserId': 'Test Window', 'result': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)→˓AppleWebKit/608.1 (KHTML, like Gecko) JavaFX/13 Safari/608.1 CyBrowser/1.2.0'}>>> cybrowser_send(id='CytoWindow', script="window.location='http://google.com'"){'browserId': 'CytoWindow', 'result': 'http://google.com'}
Note: In the return result, id is the one provided as a parameter to this function and result is the stringreturned as a result of executing the script
See also:
cybrowser_show(), cybrowser_hide(), cybrowser_dialog()
py4cytoscape.tools.cybrowser_show
cybrowser_show(id=None, text=None, title=None, url=None, base_url='http://localhost:1234/v1')Cybrowser Show.
Launch Cytoscape’s internal web browser in a pane in the Result Panel. Provide an id for the window if youwant subsequent control of the window via cybrowser hide.
Parameters
• id (str) – The identifier for the new browser window
• text (str) – HTML text to initially load into the browser
• title (str) – Text to be shown in the title bar of the browser window
248 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• url (str) – The URL the browser should load
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘id’: id} where id is the one provided as a parameter to this function
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cybrowser_show(id='Test Window', title='Hello Africa', text='<HTML><HEAD>→˓<TITLE>Hello</TITLE></HEAD><BODY>Hello, world!</BODY></HTML>'){'id': 'Test Window'}>>> cybrowser_show(id='CytoWindow', title='Cytoscape Home Page', url='http://www.→˓cytoscape.org'){'id': 'CytoWindow'}
See also:
cybrowser_dialog(), cybrowser_hide()
py4cytoscape.tools.cybrowser_version
cybrowser_version(base_url='http://localhost:1234/v1')Display the version of the CyBrowser app.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘version’: app version} where app version is the CyBrowser app version
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> cybrowser_version(){'version': '1.2.0'}
5.3. Reference 249
py4cytoscape Documentation, Release 0.0.1
Diffusion
diffusion_advanced([heat_column_name, time,. . . ])
Diffusion Advanced.
diffusion_basic([base_url]) Diffusion Basic.
py4cytoscape.tools.diffusion_advanced
diffusion_advanced(heat_column_name=None, time=None, base_url='http://localhost:1234/v1')Diffusion Advanced.
Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculatenetwork propagation. Results are returned and represented by columns in the node table. Advanced operationsupports parameters.
Columns are created for each execution of Diffusion and their names are returned in the response. Thenodes you would like to use as input should be selected. This will be used to generate the contents of thediffusion_input column, which represents the query vector and corresponds to h in the diffusion equa-tion.
Parameters
• heat_column_name (str) – A node column name intended to override the default tablecolumn diffusion_input. This represents the query vector and corresponds to h in thediffusion equation.
• time (str) – The extent of spread over the network. This corresponds to t in the diffusionequation.
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘heatColumn’: ‘diffusion_output_heat’, ‘rankColumn’: ‘diffusion_output_rank’} whereheatColumn is the name of the node table column containing each node’s calculated heat andrankColumn is the name of the node table column containing the node’s (0-based) rank
Return type dict
Raises
• CyError – if an invalid parameter is passed
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> diffusion_advanced(heat_column_name='diffusion_output_heat', time=0.1){'heatColumn': 'diffusion_output_1_heat', 'rankColumn': 'diffusion_output_1_rank'}
250 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.tools.diffusion_basic
diffusion_basic(base_url='http://localhost:1234/v1')Diffusion Basic.
Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculatenetwork propagation. Results are returned and represented by columns in the node table.
Columns are created for each execution of Diffusion and their names are returned in the response. Thenodes you would like to use as input should be selected. This will be used to generate the contents of thediffusion_input column, which represents the query vector and corresponds to h in the diffusion equa-tion.
Parameters base_url (str) – Ignore unless you need to specify a custom domain, port or versionto connect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns {‘heatColumn’: ‘diffusion_output_heat’, ‘rankColumn’: ‘diffusion_output_rank’} whereheatColumn is the name of the node table column containing each node’s calculated heat andrankColumn is the name of the node table column containing the node’s (0-based) rank
Return type dict
Raises requests.exceptions.RequestException – if can’t connect to Cytoscape or Cy-toscape returns an error
Examples
>>> diffusion_basic(){'heatColumn': 'diffusion_output_heat', 'rankColumn': 'diffusion_output_rank'}
5.3.15 User Interface
Functions affecting the USER INTERFACE, such as panel management.
Panels
dock_panel(panel_name[, base_url]) Dock a panel back into the UI of Cytoscape.float_panel(panel_name[, base_url]) Pop out a panel from the UI of Cytoscape.hide_all_panels([base_url]) Hide control, table, tool and results panels.hide_panel(panel_name[, base_url]) Hide a panel in the UI of Cytoscape.
py4cytoscape.user_interface.dock_panel
dock_panel(panel_name, base_url='http://localhost:1234/v1')Dock a panel back into the UI of Cytoscape.
Parameters
• panel_name (str) – Name of the panel. Multiple ways of referencing panels issupported: (WEST == control panel, control, c), (SOUTH == table panel, table, ta),(SOUTH_WEST == tool panel, tool, to), (EAST == results panel, results, r)
5.3. Reference 251
py4cytoscape Documentation, Release 0.0.1
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if panel name is not recognized
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> dock_panel('control panel')''>>> dock_panel('WEST')''
py4cytoscape.user_interface.float_panel
float_panel(panel_name, base_url='http://localhost:1234/v1')Pop out a panel from the UI of Cytoscape.
Other panels will expand into the space.
Parameters
• panel_name (str) – Name of the panel. Multiple ways of referencing panels issupported: (WEST == control panel, control, c), (SOUTH == table panel, table, ta),(SOUTH_WEST == tool panel, tool, to), (EAST == results panel, results, r)
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns
’‘
Return type str
Raises
• CyError – if panel name is not recognized
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
252 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Examples
>>> float_panel('control panel')''>>> float_panel('WEST')''
py4cytoscape.user_interface.hide_all_panels
hide_all_panels(base_url='http://localhost:1234/v1')Hide control, table, tool and results panels.
Parameters
• panel_name (str) – Name of the panel. Multiple ways of referencing panels issupported: (WEST == control panel, control, c), (SOUTH == table panel, table, ta),(SOUTH_WEST == tool panel, tool, to), (EAST == results panel, results, r)
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
Returns None
Raises
• CyError – if panel name is not recognized
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> hide_all_panels()''>>> hide_all_panels()''
py4cytoscape.user_interface.hide_panel
hide_panel(panel_name, base_url='http://localhost:1234/v1')Hide a panel in the UI of Cytoscape.
Other panels will expand into the space.
Parameters
• panel_name (str) – Name of the panel. Multiple ways of referencing panels issupported: (WEST == control panel, control, c), (SOUTH == table panel, table, ta),(SOUTH_WEST == tool panel, tool, to), (EAST == results panel, results, r)
• base_url (str) – Ignore unless you need to specify a custom domain, port or version toconnect to the CyREST API. Default is http://localhost:1234 and the latest version of theCyREST API supported by this version of py4cytoscape.
5.3. Reference 253
py4cytoscape Documentation, Release 0.0.1
Returns
’‘
Return type str
Raises
• CyError – if panel name is not recognized
• requests.exceptions.RequestException – if can’t connect to Cytoscape orCytoscape returns an error
Examples
>>> hide_panel('control panel')''>>> hide_panel('WEST')''
5.3.16 Utils
Utility functions useful across multiple modules.
Translation to/from SUIDs
edge_name_to_edge_suid(edge_names[, . . . ])edge_suid_to_edge_name(edge_suids[, . . . ])node_name_to_node_suid(node_names[, . . . ])node_suid_to_node_name(node_suids[, . . . ])
py4cytoscape.py4cytoscape_utils.edge_name_to_edge_suid
edge_name_to_edge_suid(edge_names, network=None, base_url='http://localhost:1234/v1')
py4cytoscape.py4cytoscape_utils.edge_suid_to_edge_name
edge_suid_to_edge_name(edge_suids, network=None, base_url='http://localhost:1234/v1')
py4cytoscape.py4cytoscape_utils.node_name_to_node_suid
node_name_to_node_suid(node_names, network=None, base_url='http://localhost:1234/v1')
254 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.py4cytoscape_utils.node_suid_to_node_name
node_suid_to_node_name(node_suids, network=None, base_url='http://localhost:1234/v1')
Miscellaneous
build_url([base_url, command]) Append a command (if it exists) to a base URLcyPalette([name])is_not_hex_color(color)table_column_exists(table_column, table[, . . . ])verify_supported_versions([cyrest, . . . ])
py4cytoscape.py4cytoscape_utils.build_url
build_url(base_url='http://localhost:1234/v1', command=None)Append a command (if it exists) to a base URL
py4cytoscape.py4cytoscape_utils.cyPalette
cyPalette(name='set1')
py4cytoscape.py4cytoscape_utils.is_not_hex_color
is_not_hex_color(color)
py4cytoscape.py4cytoscape_utils.table_column_exists
table_column_exists(table_column, table, network=None, base_url='http://localhost:1234/v1')
py4cytoscape.py4cytoscape_utils.verify_supported_versions
verify_supported_versions(cyrest=1, cytoscape=3.6, base_url='http://localhost:1234/v1')
5.4 Logging
py4cytoscape logging is based on the Python logging package, which is based on JUnit. py4cytoscape emits logentries in SysLog format. For example:
[INFO] py4...S: HTTP DELETE(http://localhost:1234/v1/networks)[INFO] py4...S: OK[200]
[INFO] is the priority level.
py4...S the name of the py4cytoscape package.
5.4. Logging 255
py4cytoscape Documentation, Release 0.0.1
The count of | indicates the nesting level of the currently executing code, where || indicates log entries called fromcode at the | level.
The remainder of the message contains the logged information. In the example above, an HTTP DELETE call islogged along with the HTTP server’s reply.
Logger configuration is available in the py4cytoscape_logger_settings.py module. py4cytoscape emitstwo independent logging streams: Summary (to the console) and Detail (to a file in the logs directory).
By default, Summary logging is the short form (priority INFO), which shows HTTP calls and results. You can disableSummary logging by setting _SUMMARY_LOG_LEVEL to NOTSET, and you can enable full logging by setting it toDEBUG.
By default, Detail logging is the long form (priority DEBUG), and is controlled by the _DETAIL_LOG_LEVEL setting.
Here is an example of Detail logging involving nested calls:
2020-06-06 15:29:55,721 [DEBUG] py4...: Calling cytoscape_version_info(base_url=→˓'http://localhost:1234/v1')2020-06-06 15:29:55,721 [DEBUG] py4...: Calling cyrest_get('version', base_url='http:/→˓/localhost:1234/v1')2020-06-06 15:29:55,721 [DEBUG] py4...: HTTP GET(http://localhost:1234/v1/version)2020-06-06 15:29:55,737 [DEBUG] py4...: OK[200], content: {"apiVersion":"v1",→˓"cytoscapeVersion":"3.9.0-SNAPSHOT"}2020-06-06 15:29:55,738 [DEBUG] py4...: Returning 'cyrest_get': {'apiVersion': 'v1',→˓'cytoscapeVersion': '3.9.0-SNAPSHOT'}2020-06-06 15:29:55,738 [DEBUG] py4...: Returning 'cytoscape_version_info': {→˓'apiVersion': 'v1', 'cytoscapeVersion': '3.9.0-SNAPSHOT'}
5.4.1 Runtime Control
For convenience, Summary logging can be controlled using an environment variable or at execution time. By default,Summary logging is enabled, but can be disabled:
set PY4CYTOSCAPE_SUMMARY_LOGGER=False
At execution time, it can be disabled by calling set_summary_logger(). This is handy within a busy code blockor when running in a Notebook environment. For example:
old_state = set_summary_logger(False)# ... make several py4cytoscape calls ...
set_summary_logger(old_state)
5.5 Release Log
5.5.1 py4cytoscape 0.0.1
Release date: 01 Jan 2020
Initial release, matches API signatures for RCy3
256 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
Release notes
5.5.2 Announcement: py4cytoscape 0.0.1
We’re happy to announce the release of py4cytoscape 0.0.1!
. . . reword this to describe py4cytoscape modules . . .
NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions ofcomplex networks.
For more information, please visit our website and our gallery of examples. Please send comments and questions tothe networkx-discuss mailing list.
5.5.3 Highlights
This release is the result of over two years of work with 1212 commits and 193 merges by 86 contributors. Highlightsinclude:
• We have made major changes to the methods in the Multi/Di/Graph classes. There is a migration guide forpeople moving from 1.X to 2.0.
• We updated the documentation system.
5.5.4 API Changes
• Base Graph Class Changes With the release of NetworkX 2.0 we are moving towards a view/iterator reportingAPI. We used to have two methods for the same property of the graph, one that returns a list and one thatreturns an iterator. With 2.0 we have replaced them with a view. A view is a read-only object that is quick tocreate, automatically updated, and provides basic access like iteration, membership and set operations whereappropriate. For example, G.nodes() used to return a list and G.nodes_iter() an iterator. Now G.nodes() returns a view and G.nodes_iter() is removed. G.degree() returns a view with (node,degree) iteration, so that dict(G.degree()) returns a dict keyed by node with degree as value. The oldbehavior
>>> G = nx.complete_graph(5)>>> G.nodes()[0, 1, 2, 3, 4]>>> G.nodes_iter()<dictionary-keyiterator at ...>
has changed to
>>> G = nx.complete_graph(5)>>> G.nodes()NodeView((0, 1, 2, 3, 4))>>> list(G.nodes())[0, 1, 2, 3, 4]
New feature include lookup of node and edge data from the views, property access without parentheses, and setoperations.
>>> G.add_node(3, color='blue')>>> G.nodes[3]{'color': 'blue'}
(continues on next page)
5.5. Release Log 257
py4cytoscape Documentation, Release 0.0.1
(continued from previous page)
>>> G.nodes & {3, 4, 5}{3, 4}
The following methods have changed:
– Graph/MultiGraph
* G.nodes()
* G.edges()
* G.neighbors()
* G.adjacency_list() and G.adjacency_iter() to G.adjacency()
* G.degree()
* G.subgraph()
* G.copy()
* G.__class__() should be replaced with G.fresh_copy()
– DiGraph/MultiDiGraph
* G.nodes()
* G.edges()
* G.in_edges()
* G.out_edges()
* G.degree()
* G.in_degree()
* G.out_degree()
* G.reverse()
The following deprecated methods will be removed in a future release (3.0?).
– G.node, G.edge (replaced by G.nodes, G.edges)
– G.add_path, G.add_cycle, G.add_star (Now nx.add_path(G,...)
– G.selfloop_edges, G.nodes_with_selfloops, G.number_of_selfloops (Nownx.selfloop_edges(G), etc)
Many subclasses have been changed accordingly such as:
– AntiGraph
– OrderedGraph and friends
– Examples such as ThinGraph that inherit from Graph
• [#2107] The Graph class methods add_edge and add_edges_from no longer allow the use of theattr_dict parameter. Instead use keyword arguments. Thus G.add_edge(1, 2, {'color':'red'}) becomes G.add_edge(1, 2, color='red'). Note that this only works if the attribute nameis a string. For non-string attributes you will need to add the edge and then update manually using e.g. G.edges[1, 2].update({0: "zero"})
• [#1577] In addition to minimum spanning trees, a new function for calculating maximum spanningtrees is now provided. The new API consists of four functions: minimum_spanning_edges,maximum_spanning_edges, minimum_spanning_tree, and maximum_spanning_tree. All of
258 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
these functions accept an algorithm parameter which specifies the algorithm to use when finding the min-imum or maximum spanning tree. Currently, Kruskal’s and Prim’s algorithms are implemented, defined as‘kruskal’ and ‘prim’, respectively. If nothing is specified, Kruskal’s algorithm is used. For example, to calculatethe maximum spanning tree of a graph using Kruskal’s algorithm, the function maximum_spanning_treehas to be called like:
>>> nx.maximum_spanning_tree(G, algorithm='kruskal')
The algorithm parameter is new and appears before the existing weight parameter. So existing code thatdid not explicitly name the optional weight parameter will need to be updated:
>>> nx.minimum_spanning_tree(G, 'mass') # old>>> nx.minimum_spanning_tree(G, weight='mass') # new
In the above, we are still relying on the the functions being imported into the top-level namespace. We do nothave immediate plans to deprecate this approach, but we recommend the following instead:
>>> from networkx.algorithms import tree# recommended>>> tree.minimum_spanning_tree(G, algorithm='kruskal', weight='mass')>>> tree.minimum_spanning_edges(G, algorithm='prim', weight='mass')
• [#1445] Most of the shortest_path algorithms now raise a NodeNotFound exception when a source ora target are not present in the graph.
• [#2326] Centrality algorithms were harmonized with respect to the default behavior of the weight parameter.The default value of the weight keyword argument has been changed from weight to None. This affects thefollowing centrality functions:
– approximate_current_flow_betweenness_centrality()
– current_flow_betweenness_centrality()
– current_flow_betweenness_centrality_subset()
– current_flow_closeness_centrality()
– edge_current_flow_betweenness_centrality()
– edge_current_flow_betweenness_centrality_subset()
– eigenvector_centrality()
– eigenvector_centrality_numpy()
– katz_centrality()
– katz_centrality_numpy()
• [#2420] New community detection algorithm provided. Fluid Communities is an asynchronous algorithm basedon the simple idea of fluids interacting in an environment, expanding and pushing each other. The algorithmis completely described in “Fluid Communities: A Competitive and Highly Scalable Community DetectionAlgorithm”.
• [#2510 and #2508] single_source_dijkstra, multi_source_dijkstra and functions that usethese now have new behavior when target is specified. Instead of returning dicts for distances and pathsa 2-tuple of (distance, path) is returned. When target is not specified the return value is still 2 dicts.
• [#2553] set_node_attributes() and set_edge_attributes() now accept dict-of-dict inputof shape {node/edge: {name: value}} in addition to previous valid inputs: {node/edge:value} and value. The order of the parameters changed also: The second parameter “values” is the valueargument and the third parameter “name” is the name of the attribute. “name” has default value None in which
5.5. Release Log 259
py4cytoscape Documentation, Release 0.0.1
case “values” must be the newly allowed form containing names. Previously “name” came second withoutdefault, and “values” came third.
• [#2604] Move selfloop methods out of base classes to networkx functions. G.number_of_selfloops(),G.selfloop_edges(), G.nodes_with_selfloops() are now nx.number_of_selfloops(G),nx.selfloop_edges(G), nx.nodes_with_selfloops(G).
G.node and G.edge are removed. Their functionality are replaced by G.nodes and G.edges.
• [#2558] Previously, the function from_pandas_dataframe assumed that the dataframe has edge-list like structures, but to_pandas_dataframe generates an adjacency matrix. We now providefour functions from_pandas_edgelist, to_pandas_edgelist, from_pandas_adjacency, andto_pandas_adjacency.
• [#2620] Removed draw_nx, please use draw or draw_networkx.
• [#1662] Rewrote topolgical_sort as a generator. It no longer accepts reverse or nbunch argumentsand is slightly faster. Added lexicographical_topological_sort, which accepts a key.
5.5.5 Deprecations
The following deprecated functions will be removed in 2.1.
• The function bellman_ford has been deprecated in favor of bellman_ford_predecessor_and_distance.
• The functions to_pandas_dataframe and from_pandas_dataframe have been deprecatedin favor of to_pandas_adjacency, from_pandas_adjacency, to_pandas_edgelist, andfrom_pandas_edgelist.
5.5.6 Contributors to this release
• Niels van Adrichem
• Kevin Arvai
• Ali Baharev
• Moritz Emanuel Beber
• Livio Bioglio
• Jake Bogerd
• Moreno Bonaventura
• Raphaël Bournhonesque
• Matthew Brett
• James Clough
• Marco Cognetta
• Jamie Cox
• Jon Crall
• Robert Davidson
• Nikhil Desai
• DonQuixoteDeLaMancha
• Dosenpfand
260 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• Allen Downey
• Enrico
• Jens Erat
• Jeffrey Finkelstein
• Minas Gjoka
• Aravind Gollakota
• Thomas Grainger
• Aric Hagberg
• Harry
• Yawara ISHIDA
• Bilal AL JAMMAL
• Ryan James
• Omer Katz
• Janis Klaise
• Valentin Lorentz
• Alessandro Luongo
• Francois Malassenet
• Arya McCarthy
• Michael-E-Rose
• Peleg Michaeli
• Jarrod Millman
• Chris Morin
• Sanggyu Nam
• Nishant Nikhil
• Rhile Nova
• Ramil Nugmanov
• Juan Nunez-Iglesias
• Pim Otte
• Ferran Parés
• Richard Penney
• Phobia
• Tristan Poupard
• Sebastian Pucilowski
• Alexander Rodriguez
• Michael E. Rose
• Alex Ryan
5.5. Release Log 261
py4cytoscape Documentation, Release 0.0.1
• Zachary Sailer
• René Saitenmacher
• Felipe Schneider
• Dan Schult
• Scinawa
• Michael Seifert
• Mohammad Hossein Sekhavat
• Mridul Seth
• SkyTodInfi
• Stacey Smolash
• Jordi Torrents
• Martin Törnwall
• Jannis Vamvas
• Luca Verginer
• Prayag Verma
• Peter Wills
• Ianto Lin Xi
• Heqing Ya
• aryamccarthy
• chebee7i
• definitelyuncertain
• jfinkels
• juliensiebert
• leotrs
• leycec
• mcognetta
• numpde
• root
• salotz
• scott-vsi
• thegreathippo
• vpodpecan
• yash14123
• Neil Girdhar
262 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
5.5.7 Pull requests merged in this release
• Gml read fix. (#1962)
• Small changes leftover from #1847 (#1966)
• Fix k_core for directed graphs. Add tests (#1963)
• Communicability fix (#1958)
• Allows weight functions in shortest path functions (#1690)
• minor doc changes on weighted.py (#1969)
• Fix minimum_st_edge_cut documentation. (#1977)
• Fix all_node_cuts corner cases: cycle and complete graphs. (#1976)
• Change add_path/star/cycle from methods to functions (#1970)
• branch ‘edge-subgraph’ from @jfinkels (#1740)
• Corrected eppstein matching (#1955)
• Nose ignore docstrings (#1980)
• Edited Doc Makefile so clean doesn’t delete the examples folder (#1967)
• bug fix in convert_matrix.py (#1983)
• Avoid unnecessary eigenval sort in pagerank_numpy (#1986)
• Fix a typo in install.rst (#1991)
• Adds unorderable nodes test for dag_longest_path. (#1999)
• Improve drawing test scripts (typos, newlines, methods) (#1992)
• Improves test coverage for A* shortest path. (#1988)
• Improves test coverage for avg degree connectivity (#1987)
• Fix Graph() docstring to reflect input flexibility (#2006)
• Fix sphinx autosummary doc generation errors. (#2026)
• Improve gexf.py (#2010)
• Readme.rst should mention Decorator package is required. (#2009)
• fix_duplicate_kwarg: Fix a duplicate kwarg that was causing to_agraph. . . (#2005)
• Cleans documentation for graph6 and sparse6 I/O. (#2002)
• Remove http server example (#2001)
• Generalize and improve docstrings of node_link.py (#2000)
• fix issue #1948 and PEP8 formatting (#2031)
• Uses weight function for dijkstra_path_length. (#2033)
• Change default role for sphinx to ‘obj’ (#2027)
• fixed typo s/abritrary/arbitrary/ (#2035)
• Fix bug in dtype-valued matrices (#2038)
• Adds example for using Graph.nodes() with default (#2040)
• Clarifies some examples for relabel_nodes(). (#2041)
5.5. Release Log 263
py4cytoscape Documentation, Release 0.0.1
• Cleans code and documentation for graph power. (#2042)
• Cleans the classes.function module. (#2043)
• UnboundLocalError if called with an empty graph (#2047)
• Standardized Bellman-Ford function calls (#1910)
• Nobody is in IRC (#2059)
• Uses add_weighted_edges_from function in MST test. (#2061)
• Adds multi-source Dijkstra’s algorithm (#2073)
• Adds Voronoi cells algorithm (#2074)
• Fixes several issues with the Girvan-Newman partitioning function. Fixes #1703, #1725, #1799 (#1972)
• Moves is_path from utils to simple_paths. (#1921)
• add max_iter and tol parameter for numpy version (#2013)
• Remove draw_graphviz function. Fixes #1997 (#2077)
• Fixes #1998 edge_load function needs documentation. (#2075)
• Update fixcoverage.py (#2080)
• Support digraphs in approximate min vertex cover (#2039)
• Simplifies code in functions for greedy coloring. (#1680)
• Allows arbitrary metric in geometric generators. (#1679)
• Fix spring_layout for single node graph. (#2081)
• Updates set_{node,edge}_attributes and docs. (#1935)
• Fixes tests for maximal matching. (#1919)
• Adds LFM benchmark graph generator for communities (#1727)
• Adds global and local efficiency functions. (#1521)
• Apply alphas to individual nodes (#1289)
• Code and tests for temporal VF2 (#1653)
• extend convert_bool in gexf.py and graphml.py to all valid boolean (#1063)
• Remove encoded . . . to plain ascii (#2086)
• Use not_implemented_for() for in_degree_centrality() and out_degree_centrality() (#2084)
• Issue 2072 weighted modularity (#2088)
• Simplifies eigenvector centrality implementation. (#1708)
• Fjmalass nodes as tuples (#2089)
• Generator rename (#2090)
• Ensure links in doc `See also` sections (#2082)
• Document integer-only numeric mixing (#2085)
• doc sphinx error removal (#2091)
• Correct see also links (#2095)
• Adjust layout.py function signatures, docs, exposure (#2096)
264 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• Adds missing __all__ attributes. (#2098)
• Fixes 2 bugs in dominance frontier code (#2092)
• Created two new files: joint_degree_seq.py and test_joint_degree_seq.. . . (#2011)
• Adds Boruvka’s minimum spanning tree algorithm. (#1873)
• Adds global/local reaching centrality functions. (#2099)
• Remove conflicts from #1894 (Update Exception Classes) (#2100)
• Add Exceptions for missing source in shortest_path (#2102)
• Docs for compose now warn about MultiGraph edgekeys (#2101)
• Improve Notes section on simplex and friends docs. (#2104)
• Add Dinitz’ algorithm for maximum flow problems. (#1978)
• Removed duplicated method/doc (add_edges_from) (#1)
• Bugfix for generic_multiedge_match (Issue #2114) (#2124)
• Fix for 2015. (#2)
• add_node, add_edge attr_dict change. (#2132)
• Handle graph name attribute in relabel_nodes (#2136)
• Fix fruchterman reingold bug and add more tests to layouts. (#2141)
• Adds exception: failed power iteration convergence (#2143)
• Tweak iteration logic of HITS (#2142)
• Fix PageRank personalize docstring (#2148)
• Set default source=None for dfs_tree (#2149)
• Fix docs for maximal_matching and tensor_product (#2158)
• Isolate edge key generation in multigraphs (#2150)
• Sort centralities together and outsource dispersion (#2083)
• Changed classic generators to use generators instead of lists (#2167)
• Adds beam search traversal algorithm with example (#2129)
• Turan graph (#2172)
• Removes irrelevant Notes section from docstring (#2178)
• Corrects logarithm base in example (#2179)
• Minor correction in documentation (#2180)
• Add Boykov Kolmogorov algorithm for maximum flow problems. (#2122)
• Remove temporary files after tests are run. (#2202)
• Add support for subgraphs with no edges in convert_matrix.to_scipy_sparse_matrix. (#2199)
• Add support for reading adjacency matrix in readwrite.pajek.parse_pajek. (#2200)
• Moves Graph Atlas to data file. (#2064)
• Refactor Dinitz’ algorithm implementation. (#2196)
• Use arrays instead of matrices in scipy.linalg.expm() (#2208)
5.5. Release Log 265
py4cytoscape Documentation, Release 0.0.1
• Making in_edges equivalent to out_edges (#2206)
• Fix tests failing because of ordering issues. (#2207)
• Fix code escaping. (#2214)
• Add adjlist_outer_dict_factory. (#2222)
• Typo in scale free network generator documentation (#2225)
• Add link to nx.drawing.layout instead of mentionning nx.layout. (#2224)
• Example not working in tutorial (#2230)
• don’t assume nodes are sortable when running dag_longest_path (#2228)
• Correct typo (#2236)
• Use ego graph when computing local efficiency (#2246)
• Make harmonic centrality more memory-efficient (#2247)
• have dag_longest_path_length return path length, not edge count (#2237)
• Added transitive_reduction in dag (#2215)
• alpha kwarg not used in pylab label drawing, added it here. (#2269)
• Make PyDot Support Great Again (#2272)
• Unnecessary array copying in katz_centrality_numpy ? (#2287)
• Switch to faster smallest-last algorithm implementation. (#2268)
• Adds example for getting all simple edge paths. Fixes #718 (#2260)
• Remove obsolete testing tools. (#2303)
• Correct error in minimum_spanning_arborescence (#2285)
• Yield string, not dict, in dfs_labeled_edges. (#2277)
• Removes unnecessary convert_to_(un)directed func (#2259)
• Complete multipartite graph docs (#2221)
• fix LPA bug, see issues/2219 (#2227)
• Generalized degree (#2220)
• Turan docs (#2218)
• Fix broken link to the description of the P2G format. (#2211)
• Test ordering (#2209)
• add example of node weights (#2250)
• added paramether nbunch (#2253)
• Adds unit tests for using dtype with to_numpy_matrix (#2257)
• Adds chain decomposition algorithm. (#2284)
• add the Hoffman-Singleton graph (#2275)
• Allow grid_graph generator to accept tuple dim argument (#2320)
• psuedo -> pseudo (fixing typo) (#2322)
• Corrects navigable small world graph param docs (#2321)
266 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
• Fix bug in find_cycle. (#2324)
• flip source target (#2309)
• Simpler version of digitsrep(..) function (#2330)
• change articulation_points so that it only returns every vertex once (#2333)
• Use faster random geometric graph implementation. (#2337)
• Allow community asyn_lpa test to have two answers (#2339)
• Fix broken links and remove pdf files from Makefile (#2344)
• Documents orderable node requirement for isom. (#2302)
• Adds modularity measure for communities. (#1729)
• Simplifies degree sequence graph generators. (#1866)
• Adds tree encoding and decoding functions. (#1874)
• Corrects number_of_edges docs for directed graphs (#2360)
• Adds multigraph keys to Eulerian circuits (#2359)
• Update predecessors/successors in edge subgraph (#2373)
• Fix for #2364 (#2372)
• Raise an Exception for disconnected Graphs in bipartite.sets (#2375)
• fixes typo in NetworkXNotImplemented (#2385)
• Check alternating paths using iterative DFS in to_vertex_cover. (#2386)
• Fix typos in generating NXError in networkx.linalg.graphmatrix.incidence_matrix (#2395)
• [Fixes #2342] remove calls to plt.hold(), deprecated in mpl2.0 (#2397)
• Fix broken links (#2414)
• Fix all tests for 3.6 (#2413)
• Improve bipartite documentation. (#2402)
• correct logic in GEXFWriter (#2399)
• list optional dependencies in setup.py (#2398)
• Gitwash update (#2371)
• Added cytoscape JSON handling (#2351)
• Fix for issues #2328 and #2332 (#2366)
• Workaround for gdal python3.6 at travis and more doctests fixes (#2416)
• Fixed bug on custom attrs usage: unavailable iteritems method for dict. (#2461)
• Fix sphinx errors and class outlines (#2480)
• Note the precondition that graphs are directed and acyclic (#2500)
• Add CONTRIBUTE file (#2501)
• Remove external module (#2521)
• Ensure make html doesn’t fail build on exit (#2530)
• Cherry pick missing commits (#2535)
5.5. Release Log 267
py4cytoscape Documentation, Release 0.0.1
• Document release process (#2539)
• Update copyright (#2551)
• Remove deprecated code (#2536)
• Improve docs (#2555)
• WIP: Add note on how to estimate appropriate values for alpha (#2583)
• Travis refactor (#2596)
• Create separate functions for df as edge-lists and adjacency matrices (#2558)
• Use texext for math_dollar (#2609)
• Add drawing tests (#2617)
• Add threshold tests (#2622)
• Update docs (#2623)
• Prep beta release (#2624)
• Refactor travis tests and deploy docs with travis (#2647)
• matplotlib 2.1 deprecated is_string_like (#2659)
• topolgical_sort, lexicographical_topological_sort (#1662)
5.6 License
Released under the MIT License:
Copyright (c) 2018-2020 The Cytoscape ConsortiumBarry Demchak <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of thissoftware and associated documentation files (the "Software"), to deal in the Softwarewithout restriction, including without limitation the rights to use, copy, modify,merge, publish, distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject to the followingconditions:
The above copyright notice and this permission notice shall be included in all copiesor substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR APARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
268 Chapter 5. Documentation
py4cytoscape Documentation, Release 0.0.1
5.7 Credits
py4cytoscape was originally written by Barry Demchak with the help of many others, particularly the developersof RCy3, on which py4cytoscape is based. Thanks to everyone who has improved py4cytoscape by contribut-ing code, bug reports (and fixes), documentation, and input on design, features, and the future of py4cytoscape.
5.7.1 Contributions
This section aims to provide a list of people and projects that have contributed to py4cytoscape. It is intended tobe an inclusive list, and anyone who has contributed and wishes to make that contribution known is welcome to addan entry into this file. Generally, no name should be added to this list without the approval of the person associatedwith that name.
Creating a comprehensive list of contributors can be difficult, and the list within this file is almost certainly incomplete.Contributors include testers, bug reporters, contributors who wish to remain anonymous, funding sources, academicadvisors, end users, and even build/integration systems.
Do you want to make your contribution known? If you have commit access, edit this file and add your name. If youdo not have commit access, feel free to open an issue, submit a pull request, or get in contact with one of the officialteam members.
Original Authors
Keiichiro OnoJorge BouçasKozo NishidaBarry Demchak
Contributors
Optionally, add your desired name and include a few relevant links. The order is partially historical, and now, mostlyarbitrary.
• Keiichiro Ono, GitHub: keiono
• Jorge Bouças, GitHub: jorgeboucas
• Kozo Nishida, GitHub: kozo2
• Barry Demchak, GitHub: bdemchak
• Alex Pico, GitHub: AlexanderPico
• Mark Grimes, GitHub: mark-grimes
• Julia Gustavsen, GitHub: jooolia
• Shraddha Pai, GitHub: shraddhapai
• Ruth Isserlin, GitHub: risserlin
• Paul Shannon, GitHub: paul-shannon
• Tanja Muetze, GitHub: tmuetze
• Georgi Kolishkovski
• David Otasek
5.7. Credits 269
py4cytoscape Documentation, Release 0.0.1
The NetworkX documentation is excellent, and we borrowed both wording and structure liberally.
5.7.2 Support
py4cytoscape and those who have contributed to py4cytoscape have received support throughout the yearsfrom a variety of sources. We list them below. If you have provided support to py4cytoscape and a supportacknowledgment does not appear below, please help us remedy the situation, and similarly, please let us know if you’dlike something modified or corrected.
Funding
py4cytoscape acknowledges support from the following:
• US National Institute of General Medical Sciences (NIGMS), award number R01 GM070743, PI: Trey Ideker
• National Resource for Network Biology (NRNB), award number P41 GM103504, PI: Trey Ideker
• Torrey Pines Software, Inc, President: Barry Demchak
5.8 Citing
There is no paper (yet) that describes py4cytoscape.
270 Chapter 5. Documentation
PYTHON MODULE INDEX
ppy4cytoscape.apps, 14py4cytoscape.collections, 21py4cytoscape.commands, 23py4cytoscape.cy_ndex, 33py4cytoscape.cytoscape_system, 37py4cytoscape.exceptions, 40py4cytoscape.filters, 40py4cytoscape.groups, 46py4cytoscape.layouts, 54py4cytoscape.network_selection, 81py4cytoscape.network_views, 96py4cytoscape.networks, 61py4cytoscape.py4cytoscape_utils, 254py4cytoscape.session, 101py4cytoscape.style_bypasses, 111py4cytoscape.style_defaults, 151py4cytoscape.style_dependencies, 187py4cytoscape.style_mappings, 191py4cytoscape.style_values, 225py4cytoscape.styles, 103py4cytoscape.tables, 237py4cytoscape.tools, 245py4cytoscape.user_interface, 251
273
INDEX
Aadd_cy_edges() (in module py4cytoscape.networks),
64add_cy_nodes() (in module py4cytoscape.networks),
61add_to_group() (in module py4cytoscape.groups),
46apply_filter() (in module py4cytoscape.filters), 40
Bbuild_url() (in module
py4cytoscape.py4cytoscape_utils), 255bundle_edges() (in module py4cytoscape.layouts),
54
Cclear_edge_bends() (in module
py4cytoscape.layouts), 55clear_edge_property_bypass() (in module
py4cytoscape.style_bypasses), 131clear_network_center_bypass() (in module
py4cytoscape.style_bypasses), 146clear_network_property_bypass() (in mod-
ule py4cytoscape.style_bypasses), 147clear_network_zoom_bypass() (in module
py4cytoscape.style_bypasses), 147clear_node_opacity_bypass() (in module
py4cytoscape.style_bypasses), 114clear_node_property_bypass() (in module
py4cytoscape.style_bypasses), 114clear_selection() (in module
py4cytoscape.network_selection), 81clone_network() (in module
py4cytoscape.networks), 68close_session() (in module py4cytoscape.session),
101collapse_group() (in module
py4cytoscape.groups), 51command_echo() (in module
py4cytoscape.commands), 29command_open_dialog() (in module
py4cytoscape.commands), 30
command_pause() (in modulepy4cytoscape.commands), 30
command_quit() (in modulepy4cytoscape.commands), 31
command_run_file() (in modulepy4cytoscape.commands), 31
command_sleep() (in modulepy4cytoscape.commands), 32
commands_api() (in modulepy4cytoscape.commands), 32
commands_get() (in modulepy4cytoscape.commands), 27
commands_help() (in modulepy4cytoscape.commands), 27
commands_post() (in modulepy4cytoscape.commands), 28
commands_run() (in modulepy4cytoscape.commands), 29
copy_visual_style() (in modulepy4cytoscape.styles), 104
create_column_filter() (in modulepy4cytoscape.filters), 43
create_composite_filter() (in modulepy4cytoscape.filters), 44
create_degree_filter() (in modulepy4cytoscape.filters), 45
create_group() (in module py4cytoscape.groups),47
create_group_by_column() (in modulepy4cytoscape.groups), 48
create_igraph_from_network() (in modulepy4cytoscape.networks), 75
create_network_from_data_frames() (inmodule py4cytoscape.networks), 76
create_network_from_igraph() (in modulepy4cytoscape.networks), 77
create_network_from_networkx() (in modulepy4cytoscape.networks), 78
create_networkx_from_network() (in modulepy4cytoscape.networks), 79
create_subnetwork() (in modulepy4cytoscape.networks), 68
275
py4cytoscape Documentation, Release 0.0.1
create_visual_style() (in modulepy4cytoscape.styles), 104
cybrowser_close() (in module py4cytoscape.tools),245
cybrowser_dialog() (in modulepy4cytoscape.tools), 246
cybrowser_hide() (in module py4cytoscape.tools),246
cybrowser_list() (in module py4cytoscape.tools),247
cybrowser_send() (in module py4cytoscape.tools),248
cybrowser_show() (in module py4cytoscape.tools),248
cybrowser_version() (in modulepy4cytoscape.tools), 249
CyError, 40cyPalette() (in module
py4cytoscape.py4cytoscape_utils), 255cyrest_api() (in module py4cytoscape.commands),
33cyrest_delete() (in module
py4cytoscape.commands), 24cyrest_get() (in module py4cytoscape.commands),
25cyrest_post() (in module py4cytoscape.commands),
25cyrest_put() (in module py4cytoscape.commands),
26cytoscape_api_versions() (in module
py4cytoscape.cytoscape_system), 38cytoscape_free_memory() (in module
py4cytoscape.cytoscape_system), 37cytoscape_memory_status() (in module
py4cytoscape.cytoscape_system), 37cytoscape_number_of_cores() (in module
py4cytoscape.cytoscape_system), 38cytoscape_ping() (in module
py4cytoscape.cytoscape_system), 39cytoscape_version_info() (in module
py4cytoscape.cytoscape_system), 39
Ddelete_all_networks() (in module
py4cytoscape.networks), 69delete_duplicate_edges() (in module
py4cytoscape.network_selection), 88delete_group() (in module py4cytoscape.groups),
49delete_network() (in module
py4cytoscape.networks), 70delete_selected_edges() (in module
py4cytoscape.network_selection), 89
delete_selected_nodes() (in modulepy4cytoscape.network_selection), 82
delete_self_loops() (in modulepy4cytoscape.network_selection), 90
delete_style_mapping() (in modulepy4cytoscape.style_mappings), 192
delete_table_column() (in modulepy4cytoscape.tables), 237
delete_visual_style() (in modulepy4cytoscape.styles), 105
diffusion_advanced() (in modulepy4cytoscape.tools), 250
diffusion_basic() (in module py4cytoscape.tools),251
disable_app() (in module py4cytoscape.apps), 14dock_panel() (in module
py4cytoscape.user_interface), 251
Eedge_name_to_edge_suid() (in module
py4cytoscape.py4cytoscape_utils), 254edge_suid_to_edge_name() (in module
py4cytoscape.py4cytoscape_utils), 254enable_app() (in module py4cytoscape.apps), 15expand_group() (in module py4cytoscape.groups),
52export_filters() (in module py4cytoscape.filters),
41export_image() (in module
py4cytoscape.network_views), 96export_network() (in module
py4cytoscape.networks), 80export_network_to_ndex() (in module
py4cytoscape.cy_ndex), 34export_visual_styles() (in module
py4cytoscape.styles), 106
Ffit_content() (in module
py4cytoscape.network_views), 97float_panel() (in module
py4cytoscape.user_interface), 252
Gget_all_edges() (in module
py4cytoscape.networks), 65get_all_nodes() (in module
py4cytoscape.networks), 62get_app_information() (in module
py4cytoscape.apps), 19get_app_status() (in module py4cytoscape.apps),
15get_app_updates() (in module py4cytoscape.apps),
16
276 Index
py4cytoscape Documentation, Release 0.0.1
get_arrow_shapes() (in modulepy4cytoscape.styles), 109
get_available_apps() (in modulepy4cytoscape.apps), 20
get_background_color_default() (in modulepy4cytoscape.style_defaults), 186
get_collection_list() (in modulepy4cytoscape.collections), 21
get_collection_name() (in modulepy4cytoscape.collections), 22
get_collection_networks() (in modulepy4cytoscape.collections), 22
get_collection_suid() (in modulepy4cytoscape.collections), 23
get_disabled_apps() (in modulepy4cytoscape.apps), 16
get_edge_color() (in modulepy4cytoscape.style_values), 231
get_edge_count() (in modulepy4cytoscape.networks), 66
get_edge_info() (in modulepy4cytoscape.networks), 66
get_edge_line_style() (in modulepy4cytoscape.style_values), 231
get_edge_line_width() (in modulepy4cytoscape.style_values), 232
get_edge_property() (in modulepy4cytoscape.style_values), 233
get_edge_selection_color_default() (inmodule py4cytoscape.style_defaults), 176
get_edge_target_arrow_shape() (in modulepy4cytoscape.style_values), 234
get_filter_list() (in modulepy4cytoscape.filters), 42
get_first_neighbors() (in modulepy4cytoscape.networks), 63
get_group_info() (in modulepy4cytoscape.groups), 52
get_installed_apps() (in modulepy4cytoscape.apps), 17
get_layout_name_mapping() (in modulepy4cytoscape.layouts), 57
get_layout_names() (in modulepy4cytoscape.layouts), 58
get_layout_property_names() (in modulepy4cytoscape.layouts), 58
get_layout_property_type() (in modulepy4cytoscape.layouts), 59
get_layout_property_value() (in modulepy4cytoscape.layouts), 59
get_line_styles() (in modulepy4cytoscape.styles), 109
get_network_center() (in modulepy4cytoscape.style_values), 235
get_network_count() (in modulepy4cytoscape.networks), 70
get_network_list() (in modulepy4cytoscape.networks), 71
get_network_name() (in modulepy4cytoscape.networks), 71
get_network_ndex_id() (in modulepy4cytoscape.cy_ndex), 36
get_network_property() (in modulepy4cytoscape.style_values), 235
get_network_suid() (in modulepy4cytoscape.networks), 72
get_network_view_suid() (in modulepy4cytoscape.network_views), 98
get_network_views() (in modulepy4cytoscape.network_views), 99
get_network_zoom() (in modulepy4cytoscape.style_values), 236
get_node_color() (in modulepy4cytoscape.style_values), 226
get_node_count() (in modulepy4cytoscape.networks), 64
get_node_height() (in modulepy4cytoscape.style_values), 226
get_node_position() (in modulepy4cytoscape.style_values), 227
get_node_property() (in modulepy4cytoscape.style_values), 228
get_node_selection_color_default() (inmodule py4cytoscape.style_defaults), 164
get_node_shapes() (in modulepy4cytoscape.styles), 110
get_node_size() (in modulepy4cytoscape.style_values), 229
get_node_width() (in modulepy4cytoscape.style_values), 230
get_selected_edge_count() (in modulepy4cytoscape.network_selection), 91
get_selected_edges() (in modulepy4cytoscape.network_selection), 91
get_selected_node_count() (in modulepy4cytoscape.network_selection), 83
get_selected_nodes() (in modulepy4cytoscape.network_selection), 83
get_style_all_mappings() (in modulepy4cytoscape.style_mappings), 192
get_style_dependencies() (in modulepy4cytoscape.style_dependencies), 188
get_style_mapping() (in modulepy4cytoscape.style_mappings), 193
get_table_column_names() (in modulepy4cytoscape.tables), 238
get_table_column_types() (in modulepy4cytoscape.tables), 239
Index 277
py4cytoscape Documentation, Release 0.0.1
get_table_columns() (in modulepy4cytoscape.tables), 239
get_table_value() (in modulepy4cytoscape.tables), 243
get_uninstalled_apps() (in modulepy4cytoscape.apps), 17
get_visual_property_default() (in modulepy4cytoscape.style_defaults), 152
get_visual_property_names() (in modulepy4cytoscape.styles), 110
get_visual_style_names() (in modulepy4cytoscape.styles), 107
Hhide_all_panels() (in module
py4cytoscape.user_interface), 253hide_edges() (in module
py4cytoscape.style_bypasses), 132hide_nodes() (in module
py4cytoscape.style_bypasses), 115hide_panel() (in module
py4cytoscape.user_interface), 253hide_selected_edges() (in module
py4cytoscape.style_bypasses), 133hide_selected_nodes() (in module
py4cytoscape.style_bypasses), 116
Iimport_filters() (in module py4cytoscape.filters),
42import_network_from_file() (in module
py4cytoscape.networks), 80import_network_from_ndex() (in module
py4cytoscape.cy_ndex), 34import_visual_styles() (in module
py4cytoscape.styles), 107install_app() (in module py4cytoscape.apps), 18invert_edge_selection() (in module
py4cytoscape.network_selection), 92invert_node_selection() (in module
py4cytoscape.network_selection), 84is_not_hex_color() (in module
py4cytoscape.py4cytoscape_utils), 255
Llayout_copycat() (in module
py4cytoscape.layouts), 55layout_network() (in module
py4cytoscape.layouts), 56list_groups() (in module py4cytoscape.groups), 53load_table_data() (in module
py4cytoscape.tables), 244lock_node_dimensions() (in module
py4cytoscape.style_dependencies), 190
Mmap_table_column() (in module
py4cytoscape.tables), 242map_visual_property() (in module
py4cytoscape.style_mappings), 194match_arrow_color_to_edge() (in module
py4cytoscape.style_dependencies), 191module
py4cytoscape.apps, 14py4cytoscape.collections, 21py4cytoscape.commands, 23py4cytoscape.cy_ndex, 33py4cytoscape.cytoscape_system, 37py4cytoscape.exceptions, 40py4cytoscape.filters, 40py4cytoscape.groups, 46py4cytoscape.layouts, 54py4cytoscape.network_selection, 81py4cytoscape.network_views, 96py4cytoscape.networks, 61py4cytoscape.py4cytoscape_utils, 254py4cytoscape.session, 101py4cytoscape.style_bypasses, 111py4cytoscape.style_defaults, 151py4cytoscape.style_dependencies, 187py4cytoscape.style_mappings, 191py4cytoscape.style_values, 225py4cytoscape.styles, 103py4cytoscape.tables, 237py4cytoscape.tools, 245py4cytoscape.user_interface, 251
Nnode_name_to_node_suid() (in module
py4cytoscape.py4cytoscape_utils), 254node_suid_to_node_name() (in module
py4cytoscape.py4cytoscape_utils), 255
Oopen_app_store() (in module py4cytoscape.apps),
20open_session() (in module py4cytoscape.session),
102
Ppy4cytoscape.apps
module, 14py4cytoscape.collections
module, 21py4cytoscape.commands
module, 23py4cytoscape.cy_ndex
module, 33py4cytoscape.cytoscape_system
278 Index
py4cytoscape Documentation, Release 0.0.1
module, 37py4cytoscape.exceptions
module, 40py4cytoscape.filters
module, 40py4cytoscape.groups
module, 46py4cytoscape.layouts
module, 54py4cytoscape.network_selection
module, 81py4cytoscape.network_views
module, 96py4cytoscape.networks
module, 61py4cytoscape.py4cytoscape_utils
module, 254py4cytoscape.session
module, 101py4cytoscape.style_bypasses
module, 111py4cytoscape.style_defaults
module, 151py4cytoscape.style_dependencies
module, 187py4cytoscape.style_mappings
module, 191py4cytoscape.style_values
module, 225py4cytoscape.styles
module, 103py4cytoscape.tables
module, 237py4cytoscape.tools
module, 245py4cytoscape.user_interface
module, 251
Rremove_from_group() (in module
py4cytoscape.groups), 50remove_node_custom_graphics() (in module
py4cytoscape.style_defaults), 154rename_network() (in module
py4cytoscape.networks), 73rename_table_column() (in module
py4cytoscape.tables), 241
Ssave_session() (in module py4cytoscape.session),
102select_all_edges() (in module
py4cytoscape.network_selection), 93
select_all_nodes() (in modulepy4cytoscape.network_selection), 85
select_edges() (in modulepy4cytoscape.network_selection), 93
select_edges_adjacent_to_selected_nodes()(in module py4cytoscape.network_selection),94
select_edges_connecting_selected_nodes()(in module py4cytoscape.network_selection),95
select_first_neighbors() (in modulepy4cytoscape.network_selection), 86
select_nodes() (in modulepy4cytoscape.network_selection), 86
select_nodes_connected_by_selected_edges()(in module py4cytoscape.network_selection),87
set_background_color_default() (in modulepy4cytoscape.style_defaults), 187
set_current_network() (in modulepy4cytoscape.networks), 74
set_current_view() (in modulepy4cytoscape.network_views), 99
set_edge_color_bypass() (in modulepy4cytoscape.style_bypasses), 134
set_edge_color_default() (in modulepy4cytoscape.style_defaults), 176
set_edge_color_mapping() (in modulepy4cytoscape.style_mappings), 212
set_edge_font_face_bypass() (in modulepy4cytoscape.style_bypasses), 134
set_edge_font_face_default() (in modulepy4cytoscape.style_defaults), 177
set_edge_font_face_mapping() (in modulepy4cytoscape.style_mappings), 212
set_edge_font_size_bypass() (in modulepy4cytoscape.style_bypasses), 135
set_edge_font_size_default() (in modulepy4cytoscape.style_defaults), 178
set_edge_font_size_mapping() (in modulepy4cytoscape.style_mappings), 213
set_edge_label_bypass() (in modulepy4cytoscape.style_bypasses), 136
set_edge_label_color_bypass() (in modulepy4cytoscape.style_bypasses), 137
set_edge_label_color_default() (in modulepy4cytoscape.style_defaults), 178
set_edge_label_color_mapping() (in modulepy4cytoscape.style_mappings), 214
set_edge_label_default() (in modulepy4cytoscape.style_defaults), 179
set_edge_label_mapping() (in modulepy4cytoscape.style_mappings), 215
set_edge_label_opacity_bypass() (in mod-
Index 279
py4cytoscape Documentation, Release 0.0.1
ule py4cytoscape.style_bypasses), 138set_edge_label_opacity_default() (in mod-
ule py4cytoscape.style_defaults), 179set_edge_label_opacity_mapping() (in mod-
ule py4cytoscape.style_mappings), 216set_edge_line_style_bypass() (in module
py4cytoscape.style_bypasses), 138set_edge_line_style_default() (in module
py4cytoscape.style_defaults), 180set_edge_line_style_mapping() (in module
py4cytoscape.style_mappings), 217set_edge_line_width_bypass() (in module
py4cytoscape.style_bypasses), 139set_edge_line_width_default() (in module
py4cytoscape.style_defaults), 181set_edge_line_width_mapping() (in module
py4cytoscape.style_mappings), 217set_edge_opacity_bypass() (in module
py4cytoscape.style_bypasses), 140set_edge_opacity_default() (in module
py4cytoscape.style_defaults), 181set_edge_opacity_mapping() (in module
py4cytoscape.style_mappings), 218set_edge_property_bypass() (in module
py4cytoscape.style_bypasses), 112set_edge_selection_color_default() (in
module py4cytoscape.style_defaults), 182set_edge_source_arrow_color_bypass() (in
module py4cytoscape.style_bypasses), 141set_edge_source_arrow_color_default()
(in module py4cytoscape.style_defaults), 183set_edge_source_arrow_color_mapping()
(in module py4cytoscape.style_mappings), 219set_edge_source_arrow_mapping() (in mod-
ule py4cytoscape.style_mappings), 220set_edge_source_arrow_shape_bypass() (in
module py4cytoscape.style_bypasses), 142set_edge_source_arrow_shape_default()
(in module py4cytoscape.style_defaults), 183set_edge_source_arrow_shape_mapping()
(in module py4cytoscape.style_mappings), 221set_edge_target_arrow_color_bypass() (in
module py4cytoscape.style_bypasses), 142set_edge_target_arrow_color_default()
(in module py4cytoscape.style_defaults), 184set_edge_target_arrow_color_mapping()
(in module py4cytoscape.style_mappings), 222set_edge_target_arrow_maping() (in module
py4cytoscape.style_mappings), 223set_edge_target_arrow_shape_bypass() (in
module py4cytoscape.style_bypasses), 143set_edge_target_arrow_shape_default()
(in module py4cytoscape.style_defaults), 185set_edge_target_arrow_shape_mapping()
(in module py4cytoscape.style_mappings), 224set_edge_tooltip_bypass() (in module
py4cytoscape.style_bypasses), 144set_edge_tooltip_default() (in module
py4cytoscape.style_defaults), 185set_edge_tooltip_mapping() (in module
py4cytoscape.style_mappings), 225set_layout_properties() (in module
py4cytoscape.layouts), 60set_network_center_bypass() (in module
py4cytoscape.style_bypasses), 148set_network_property_bypass() (in module
py4cytoscape.style_bypasses), 149set_network_zoom_bypass() (in module
py4cytoscape.style_bypasses), 150set_node_border_color_bypass() (in module
py4cytoscape.style_bypasses), 117set_node_border_color_default() (in mod-
ule py4cytoscape.style_defaults), 165set_node_border_color_mapping() (in mod-
ule py4cytoscape.style_mappings), 197set_node_border_opacity_bypass() (in mod-
ule py4cytoscape.style_bypasses), 118set_node_border_opacity_default() (in
module py4cytoscape.style_defaults), 165set_node_border_opacity_mapping() (in
module py4cytoscape.style_mappings), 198set_node_border_width_bypass() (in module
py4cytoscape.style_bypasses), 118set_node_border_width_default() (in mod-
ule py4cytoscape.style_defaults), 166set_node_border_width_mapping() (in mod-
ule py4cytoscape.style_mappings), 199set_node_color_bypass() (in module
py4cytoscape.style_bypasses), 119set_node_color_default() (in module
py4cytoscape.style_defaults), 167set_node_color_mapping() (in module
py4cytoscape.style_mappings), 200set_node_combo_opacity_mapping() (in mod-
ule py4cytoscape.style_mappings), 201set_node_custom_bar_chart() (in module
py4cytoscape.style_defaults), 155set_node_custom_box_chart() (in module
py4cytoscape.style_defaults), 156set_node_custom_heat_map_chart() (in mod-
ule py4cytoscape.style_defaults), 157set_node_custom_line_chart() (in module
py4cytoscape.style_defaults), 158set_node_custom_linear_gradient() (in
module py4cytoscape.style_defaults), 159set_node_custom_pie_chart() (in module
py4cytoscape.style_defaults), 160set_node_custom_position() (in module
280 Index
py4cytoscape Documentation, Release 0.0.1
py4cytoscape.style_defaults), 161set_node_custom_radial_gradient() (in
module py4cytoscape.style_defaults), 162set_node_custom_ring_chart() (in module
py4cytoscape.style_defaults), 163set_node_fill_opacity_bypass() (in module
py4cytoscape.style_bypasses), 120set_node_fill_opacity_default() (in mod-
ule py4cytoscape.style_defaults), 167set_node_fill_opacity_mapping() (in mod-
ule py4cytoscape.style_mappings), 202set_node_font_face_bypass() (in module
py4cytoscape.style_bypasses), 121set_node_font_face_default() (in module
py4cytoscape.style_defaults), 168set_node_font_face_mapping() (in module
py4cytoscape.style_mappings), 203set_node_font_size_bypass() (in module
py4cytoscape.style_bypasses), 122set_node_font_size_default() (in module
py4cytoscape.style_defaults), 169set_node_font_size_mapping() (in module
py4cytoscape.style_mappings), 204set_node_height_bypass() (in module
py4cytoscape.style_bypasses), 122set_node_height_default() (in module
py4cytoscape.style_defaults), 169set_node_height_mapping() (in module
py4cytoscape.style_mappings), 205set_node_label_bypass() (in module
py4cytoscape.style_bypasses), 123set_node_label_color_bypass() (in module
py4cytoscape.style_bypasses), 124set_node_label_color_default() (in module
py4cytoscape.style_defaults), 170set_node_label_color_mapping() (in module
py4cytoscape.style_mappings), 206set_node_label_default() (in module
py4cytoscape.style_defaults), 171set_node_label_mapping() (in module
py4cytoscape.style_mappings), 207set_node_label_opacity_bypass() (in mod-
ule py4cytoscape.style_bypasses), 125set_node_label_opacity_default() (in mod-
ule py4cytoscape.style_defaults), 171set_node_label_opacity_mapping() (in mod-
ule py4cytoscape.style_mappings), 207set_node_opacity_bypass() (in module
py4cytoscape.style_bypasses), 126set_node_property_bypass() (in module
py4cytoscape.style_bypasses), 111set_node_selection_color_default() (in
module py4cytoscape.style_defaults), 172set_node_shape_bypass() (in module
py4cytoscape.style_bypasses), 126set_node_shape_default() (in module
py4cytoscape.style_defaults), 173set_node_shape_mapping() (in module
py4cytoscape.style_mappings), 208set_node_size_bypass() (in module
py4cytoscape.style_bypasses), 127set_node_size_default() (in module
py4cytoscape.style_defaults), 173set_node_size_mapping() (in module
py4cytoscape.style_mappings), 209set_node_tooltip_bypass() (in module
py4cytoscape.style_bypasses), 128set_node_tooltip_default() (in module
py4cytoscape.style_defaults), 174set_node_tooltip_mapping() (in module
py4cytoscape.style_mappings), 210set_node_width_bypass() (in module
py4cytoscape.style_bypasses), 129set_node_width_default() (in module
py4cytoscape.style_defaults), 175set_node_width_mapping() (in module
py4cytoscape.style_mappings), 211set_style_dependencies() (in module
py4cytoscape.style_dependencies), 188set_visual_property_default() (in module
py4cytoscape.style_defaults), 152set_visual_style() (in module
py4cytoscape.styles), 108sync_node_custom_graphics_size() (in mod-
ule py4cytoscape.style_dependencies), 189
Ttable_column_exists() (in module
py4cytoscape.py4cytoscape_utils), 255toggle_graphics_details() (in module
py4cytoscape.network_views), 100
Uunhide_all() (in module
py4cytoscape.style_bypasses), 151unhide_edges() (in module
py4cytoscape.style_bypasses), 145unhide_nodes() (in module
py4cytoscape.style_bypasses), 130uninstall_app() (in module py4cytoscape.apps), 18update_app() (in module py4cytoscape.apps), 19update_network_in_ndex() (in module
py4cytoscape.cy_ndex), 35update_style_defaults() (in module
py4cytoscape.style_defaults), 153update_style_mapping() (in module
py4cytoscape.style_mappings), 195
Index 281