Size: 2164
Comment:
|
Size: 3884
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
In this section, you will learn how to use programmatic access features for advanced Cytoscape users. | |
Line 4: | Line 3: |
==== Topics ==== | 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. |
Line 6: | Line 5: |
* Commands * RESTful API * Command REST API * cyREST |
== Topics == * '''''Commands''''' * '''RESTful API''' * '''Command REST API''' * '''cyREST''' |
Line 13: | Line 14: |
=== Background === Cytoscape has intuitive graphical user interface for interactive network data integration, analysis, and visualization. It is a great way to exploratory analyze your data sets, but what happens if you have hundreds of data files? It is virtually impossible to apply same operations to hundreds of networks manually with GUI. |
== 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 cyREST. |
Line 16: | Line 17: |
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. Latest version of Cytoscape has several options to script and automate your workflows. |
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. === Commands === {{attachment:CommandTool.png}} |
Line 19: | Line 24: |
=== Options === There are two ways to access Cytoscape programmatically: Commands and RESTful API. ==== Commands ==== [[attachment:CommandTool.png]] '''''Commands''''' is the built-in Cytoscape feature to automate your workflow as a simple script. You can learn more about this feature in this section: |
'''''Commands''''' is the built-in Cytoscape feature to automate your workflow as simple script. You can learn more about this feature in this section: |
Line 32: | Line 29: |
===== Sample Scripts ===== {{{ (TBD) }}} |
=== 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. For such use cases, accessing Cytoscape via REST API is the right option. |
Line 37: | Line 32: |
==== 1. REST API for Commands ==== In addition to running Command scripts, Command module has REST API to access available commands. |
|
Line 38: | Line 35: |
==== RESTful API ==== In some cases, you may need to use fully featured programming languages, such as Python, R, Ruby, or JavaScript, ===== Commands REST API ===== In addition to running scripts, Commands have REST API to access the By default, this feature is disables. To run REST server for Commands, please follow these steps: |
By default, this feature is disabled. To run REST API server for Commands, please follow these steps: |
Line 48: | Line 39: |
* Terminal or [[|iTerm]] (For Mac) | * Terminal or [[https://www.iterm2.com/|iTerm2]] (For Mac) |
Line 50: | Line 41: |
1. Start Cytoscape from command-line: | 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): |
Line 54: | Line 45: |
./cytoscape.sh | ./cytoscape.sh -R 8888 |
Line 59: | Line 50: |
./cytoscape.bat | ./cytoscape.bat -R 8888 |
Line 62: | Line 53: |
1. | 1. Open the following URL with your web browser: |
Line 64: | Line 55: |
{{{ }}} |
{{{ http://localhost:8888/cytoscape/commands }}} |
Line 67: | Line 59: |
(TBD) |
1. If you see list of available commands, you are ready to use Command API {{attachment:CommandAPI.png}} |
Line 70: | Line 64: |
===== cyREST ===== | ==== 2. cyREST ==== |
Line 72: | Line 66: |
cyREST is available from | {{https://raw.githubusercontent.com/idekerlab/cyREST/master/docs/images/logo300.png}} |
Line 74: | Line 68: |
'''[[http://apps.cytoscape.org/apps/cyrest|cyREST]] is a language-agnostic, programmer-friendly RESTful API module for Cytoscape'''. If you want to build your own workflow with [[http://www.r-project.org/|R]], [[https://www.python.org/|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. {{attachment:jupyter.png}} (Sample [[http://nbviewer.ipython.org/github/idekerlab/py2cytoscape/blob/develop/examples/New_wrapper_api_sample.ipynb|Jupyter Notebook]] written with cyREST and [[https://github.com/idekerlab/py2cytoscape|py2cytoscape]]) Currently, cyREST is available as an App for Cytoscape 3.2.1 and later. Please visit the link below for more information. * [[http://apps.cytoscape.org/apps/cyrest|cyREST App Store page]] ---- |
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 cyREST.
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.
Commands
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. 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:
- 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 8888
For Windows./cytoscape.bat -R 8888
- For Mac/Linux
- Open the following URL with your web browser:
http://localhost:8888/cytoscape/commands
- If you see list of available commands, you are ready to use Command API
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
(TBD)