Programmatic Access to Cytoscape Features
In this chapter, you will learn how to use Cytoscape from command line and scripts. These features replace Scripting module in the past versions of Cytoscape.
Command REST API
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 your analysis is based on point-and-click GUI operation. Recording workflows is the key feature for reproducible data analysis, 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:
REST API for Commands
In addition to running Command scripts, Command module has REST API to access those
By default, this feature is disables. To run REST server for Commands, please follow these steps:
- Open a terminal session:
PowerShell (For windows)
Terminal or iTerm2 (For Mac)
- Terminal (For Linux)
- 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
./cytoscape.sh -R 8888For Windows
./cytoscape.bat -R 8888
- For Mac/Linux
- Open the following URL with your web browser:
- If yo see list of available commands, you are ready to use Command API
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.
Currently, cyREST is available as an App for Cytoscape 3.2.1 and later.
Debugging your workflows