Programmatic Access to Cytoscape Features

In this chapter, you will learn how to use Cytoscape from the command line and scripts. These features replace Scripting module in the past versions of Cytoscape.



Cytoscape has intuitive graphical user interface for interactive network data integration, analysis, and visualization. It is a great way for exploratory data analysis, but what happens if you have hundreds of data files or need to ask someone to execute your data analysis workflows? It is virtually impossible to apply same operations to hundreds of networks manually with GUI, and more importantly, although you can save your results as session files, you cannot save your workflows if you perform your data analysis with point-and-click GUI operations. To resolve this issue, recording workflows is the key feature for reproducible data analysis workflows, but it was a missing feature in past versions for Cytoscape. The latest version of Cytoscape has several options to script and automate your workflows.

Options for Programmatic Access

There are two ways to access Cytoscape programmatically: Commands and RESTful API.


Commands is the built-in Cytoscape feature to automate your workflow as simple script. You can learn more about this feature in this section:


In some cases, you may need to use fully featured programming languages, such as Python, R, Ruby, or JavaScript to script your workflow. For such use cases, accessing Cytoscape via REST API is the right option.

1. REST API for Commands

In addition to running Command scripts, Command module has REST API to access available commands.

By default, this feature is disabled. To run REST API server for Commands, please follow these steps:

  1. Open a terminal session:
  2. Start Cytoscape from command-line. You need to specify port number as a parameter (In this example, port 8888 will be opened for Command):
    • For Mac/Linux
      ./ -R 8888
      For Windows
      ./cytoscape.bat -R 8888
  3. Open the following URL with your web browser:
    • http://localhost:8888/cytoscape/commands
  4. If you see list of available commands, you are ready to use Command API
    • CommandAPI.png

2. cyREST

cyREST is a language-agnostic, programmer-friendly RESTful API module for Cytoscape. If you want to build your own workflow with R, Python or other programming languages along with Cytoscape, this is the option for you. You can use popular tools, including IPython/Jupyter Notebook and RStudio as your orchestration tool for your data visualization workflow with Cytoscape.

(Sample Jupyter Notebook written with cyREST and py2cytoscape)

Currently, cyREST is available as an App for Cytoscape 3.2.1 and later. Please visit the link below for more information.

Debugging your workflows


Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux