Differences between revisions 14 and 15
Revision 14 as of 2015-06-24 01:44:57
Size: 3884
Editor: bdemchak
Comment:
Revision 15 as of 2015-06-24 02:12:23
Size: 4808
Editor: bdemchak
Comment:
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
Cytoscape's intuitive graphical user interface is useful for ''interactive'' network data integration, analysis, and visualization. It provides great features 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 the same operations to hundreds of networks manually using a GUI. 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. Cytoscape has several options that support scripting and automating your workflows: Commands and cyREST. Cytoscape's intuitive graphical user interface is useful for ''interactive'' network data integration, analysis, and visualization. It provides great features 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 the same operations to hundreds of networks manually using a GUI. 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. Cytoscape has several options that support scripting and automating your workflows: Commands and RESTful API.
Line 17: Line 17:
The Command feature allows you to script a number of Cytoscape commands and menu items, and commands can have parameter values that would normally be provided by a user via Cytoscape dialog box. For example, ''session open file="C:\myfile.cys"'' loads a session from a file similarly to the File | Open menu item. The Command feature allows you to script a number of Cytoscape commands and menu items, and commands can have parameter values that would normally be provided by a user via Cytoscape dialog box. For example, ''session open file="C:\myfile.cys"'' loads a session from a file similarly to the '''File → Open''' menu item. You can create a command script file that Cytoscape can execute via the '''Tools → Execute Command File''' menu item or on the Cytoscape command line at startup.

The RESTful API feature allows you to access Cytoscape from a separate application, thereby orchestrating Cytoscape operations from that application. The application may be written in a general programming language (e.g., Python) that keeps its own data structures, performs complex flow control, or directly manipulates Cytoscape nodes, edges, attributes, and visual styles.

The Command feature is useful for executing sequences of commands, whereas the RESTful API feature is useful when Cytoscape is to be used as a service relative to an application.
Line 30: Line 34:
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. In some cases, you may need to use fully featured programming languages, such as Python, R, Ruby, or JavaScript to script your workflow. Such languages enable complex control and data structures, and Cytoscape would be called as a service. For such use cases, accessing Cytoscape via REST API is the right option.
Line 33: Line 37:
In addition to running Command scripts, Command module has REST API to access available commands. In addition to running Command scripts, Command module has REST API to enable command execution from another program.
Line 35: Line 39:
By default, this feature is disabled. To run REST API server for Commands, please follow these steps: By default, this feature is disabled. To enable the REST API server for Commands, please follow these steps:
Line 38: Line 42:
    * PowerShell (For windows)     * PowerShell or Command (For windows)
Line 41: Line 45:
 1. Start Cytoscape from command-line. You need to specify port number as a parameter (In this example, port 8888 will be opened for Command):  1. Start Cytoscape from command-line. You must specify a TCP/IP port number as a parameter -- in this example, port 8888 will be opened for Command:
Line 53: Line 57:
 1. Open the following URL with your web browser:  1. To test the Command interface, open the following URL with your web browser:
Line 75: Line 79:
Currently, cyREST is available as an App for Cytoscape 3.2.1 and later. Please visit the link below for more information. Currently, cyREST is available as an App for Cytoscape 3.2.1 and later, and requires the Java 8 (or later) virtual machine. Please visit the link below for more information.
Line 81: Line 85:

==== Debugging your workflows ====
(TBD)

Programmatic Access to Cytoscape Features

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

Topics

  • Commands

  • RESTful API

    • Command REST API

    • cyREST


Background

Cytoscape's intuitive graphical user interface is useful for interactive network data integration, analysis, and visualization. It provides great features 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 the same operations to hundreds of networks manually using a GUI. 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. Cytoscape has several options that support scripting and automating your workflows: Commands and RESTful API.

The Command feature allows you to script a number of Cytoscape commands and menu items, and commands can have parameter values that would normally be provided by a user via Cytoscape dialog box. For example, session open file="C:\myfile.cys" loads a session from a file similarly to the File → Open menu item. You can create a command script file that Cytoscape can execute via the Tools → Execute Command File menu item or on the Cytoscape command line at startup.

The RESTful API feature allows you to access Cytoscape from a separate application, thereby orchestrating Cytoscape operations from that application. The application may be written in a general programming language (e.g., Python) that keeps its own data structures, performs complex flow control, or directly manipulates Cytoscape nodes, edges, attributes, and visual styles.

The Command feature is useful for executing sequences of commands, whereas the RESTful API feature is useful when Cytoscape is to be used as a service relative to an application.

Commands

  • CommandTool.png

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

RESTful API

In some cases, you may need to use fully featured programming languages, such as Python, R, Ruby, or JavaScript to script your workflow. Such languages enable complex control and data structures, and Cytoscape would be called as a service. 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 enable command execution from another program.

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

  1. Open a terminal session:
    • PowerShell or Command (For windows)

    • Terminal or iTerm2 (For Mac)

    • Terminal (For Linux)
  2. Start Cytoscape from command-line. You must specify a TCP/IP port number as a parameter -- in this example, port 8888 will be opened for Command:
    • For Mac/Linux
      ./cytoscape.sh -R 8888
      For Windows
      ./cytoscape.bat -R 8888
  3. To test the Command interface, 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

https://raw.githubusercontent.com/idekerlab/cyREST/master/docs/images/logo300.png

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.

  • jupyter.png

(Sample Jupyter Notebook written with cyREST and py2cytoscape)

Currently, cyREST is available as an App for Cytoscape 3.2.1 and later, and requires the Java 8 (or later) virtual machine. Please visit the link below for more information.


Cytoscape_3/UserManual/ProgrammaticAccess (last edited 2016-04-26 22:22:57 by server2)

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