Skip to content

Setup Guide

dotasek edited this page Apr 30, 2021 · 12 revisions

CyREST is a Core App

Since Cytoscape 3.3.0, CyREST is a part of the Cytoscape core distribution; there is no need to install it separately. If a newer version of CyREST is available, you can follow these instructions to upgrade it.

System Requirements

Once you install the latest version of Cytoscape, you can use cyREST out of the box. You don't have to install any additional software.

Testing cyREST

Two quick methods for testing if cyREST is available are listed below. Note that the port number in these examples is cyREST's default port: 1234. If your cyREST port is different, replace any instances of 1234 in these examples with the current port number.

Testing cyREST with a Web Browser

To test if cyREST is active with a Web Browser, such as Google Chrome, you can use the following steps:

  1. Start Cytoscape

  2. Open web browser

  3. Enter the following URL:

    http://localhost:1234/v1
    
  4. If your browser displays a status message like the following, you are ready to use cyREST!

{
    "apiVersion": "v1",
    "numberOfCores": 8,
    "memoryStatus": {
        "usedMemory": 532,
        "freeMemory": 1430,
        "totalMemory": 1963,
        "maxMemory": 28217 }
}

Testing cyREST from the command line with curl

To test cyREST from the command line, open a terminal in your operating system and execute the following commands:

❯❯❯ :~$ curl -v GET --header 'Accept: application/json' 'http://localhost:1234/v1'
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 1234 (#0)
> GET /v1 HTTP/1.1
> Host: localhost:1234
> User-Agent: curl/7.55.1
> Accept: application/json
> 
< HTTP/1.1 200 OK
< Content-Length: 126
< Content-Type: application/json;charset=utf-8
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: origin, content-type, accept, authorization
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEAD
< Server: Jetty(8.1.15.v20140411)
< 
* Connection #0 to host localhost left intact
{"apiVersion":"v1","numberOfCores":1,"memoryStatus":{"usedMemory":306,"freeMemory":1673,"totalMemory":1979,"maxMemory":14710}}

Upgrading cyREST

Although cyREST is a part of Cytoscape's Core Apps, you can upgrade it separately once a new version of cyREST is available. There are two ways to do it:

  1. Start Cytoscape
  2. Upgrade cyREST:
    • Option 1: Update from the App Manager
      1. Open the App Manager (Apps → App Manager...)
      2. Select the Check for Updates tab
      3. If newer version of cyREST is available, it will appear in the list
      4. Select cyREST and click Update Selected
    • Option 2: Update from the App Store
      1. Open the App Store page for cyREST
      2. If you can see orange Upgrade button, a newer version is available
      3. Click Upgrade

Changing port number

By default, cyREST opens port 1234 for communication with other applications. This can be changed by editing Cytoscape Properties.

Changing port number from Cytoscape Desktop

  1. Click Edit → Preferences → Properties...
  2. Click Add
  3. Type rest.port and click OK
  4. Type port number, like 8080, and click OK
  5. Restart Cytoscape
  6. Access the port (e.g. http://localhost:8080/v1) and make sure cyREST opens the specified port

Changing port number from command line

You can also change the port number by passing a command-line argument when you start Cytoscape. For example, to change the port number from 1234 to 8080, you can follow these steps:

  1. Open a terminal in your operating system.
  2. cd to your Cytoscape installation directory
  3. Enter the following command:
    • Windows: ./cytoscape.bat -R 8080
    • Mac/Linux: ./cytoscape.sh -R 8080
  4. Use browser/curl/etc. to access the port 8080 to make sure you can access Cytoscape from the new port, as described here.

Additional Info

For more advanced topics in using cyREST, such as the integration with scripting languages such as R and Python, and adding Cytoscape Automation to Cytoscape Apps, please visit the Cytoscape Automation repository.