The R markdown is available from the pulldown menu for Code at the upper-right, choose “Download Rmd”, or download the Rmd from GitHub.


Why use Jupyter Bridge

  • Users do not need to worry about dependencies and environment.
  • Easily share notebook-based workflows and data sets
  • Workflows can reside in the cloud, access cloud resources, and yet still use Cytoscape features.

How Jupyter Bridge works

Jupyter-Bridge enables a workflow running on remote Jupyter to execute functions on a PC-local Cytoscape – the remote Jupyter runs the request through Jupyter-Bridge, where it is picked up by Javascript code running on the Jupyter web page in the PC-local browser, which in turn calls Cytoscape. The Cytoscape response travels the reverse route.

Page-1 Rectangle.8 Rectangle Rounded rectangle.10 Jupyter Web Page in Browser Jupyter Web Page in Browser Sheet.2 Workstation Workstation Rounded rectangle Cytoscape Cytoscape Sheet.5 Sheet.9 localhost (127.0.0.1) localhost (127.0.0.1) Dynamic connector.12 Sheet.13 ZeroMQ ZeroMQ Rounded rectangle.15 Jupyter-Bridge browser component Jupyter-Bridge browser component Rounded rectangle.16 CyREST CyREST Rectangle.17 Sheet.18 Server Server Rounded rectangle.30 Py4cytoscape library Py4cytoscape library Dynamic connector.19 Sheet.23 Sheet.11 Sheet.4 Sheet.6 Rounded rectangle.7 Jupyter-Bridge Jupyter-Bridge Sheet.14 Server Server Dynamic connector.20 Dynamic connector.34 Sheet.35 Rounded rectangle.36 Jupyter Notebook Jupyter Notebook Sheet.37 Sheet.38
Jupyter-Bridge allows a remote Jupyter Notebook to communicate with a workstation-based Cytoscape as if the Notebook were running on the Cytoscape workstation. A Jupyter Notebook passes a Cytoscape call to an independent Jupyter-Bridge server where it’s picked up by the Jupyter-Bridge browser component and is passed to Cytoscape. The Cytoscape response is returned via the opposite flow. As a result, workflows can reside in the cloud, access cloud resources, and yet still leverage Cytoscape features. Jupyter Bridge supports py4cytoscape (Python library for communicating with Cytoscape) first, and now RCy3 also support Jupyter-Bridge.

Visit the source code of Juputer Bridge for more information.

Prerequisites (Local machine)

RCy3 works by connecting with Cytoscape. You will need to install and launch Cytoscape in your local machine:

Prerequisites (Cloud server)

There are a lot of cloud computing services online, such as Google Colab, Amazon EMR Notebook, Microsoft Azure, CoCalc and your own JupyterHub. You can choose your favorite one.

Here we use Google Colab to demonstrate. Visit this link to create a new empty R Notebook, and make sure to run code below in the cloud.

Copy codes below to build connection between Jupyter notebook (cloud) and Cytoscape (local).

Make sure to run code below in the cloud!!!

Installation

Install the latest version of RCy3 from Bioconductor.

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("RCy3")
library(RCy3)

Connect to local Cytoscape

First, build connection between the jupyter notebook and local Cytoscape.

browserClientJs <- getBrowserClientJs()
IRdisplay::display_javascript(browserClientJs)

Check connection

Then, launch Cytoscape and keep it running whenever using RCy3 and Jupyter Bridge. Confirm that you have everything installed and running:

cytoscapeVersionInfo()
cytoscapePing()

Done! Now you can execute a workflow in a remote server-based Jupyter Notebook to leverage your workstation’s Cytoscape. You can also easily share notebook-based workflows and data sets.

Use case: Run differentially expressed genes network analysis in the cloud

Visit the Jupyter Bridge RCy3 and Differentially Expressed Genes Network Analysis for the detailed workflow.

LS0tCnRpdGxlOiAiSnVweXRlciBCcmlkZ2UgYW5kIFJDeTMiCmF1dGhvcjogIllpaGFuZyBYaW4sIEFsZXggUGljbyIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKYGBge3Igc2V0dXAsIGluY2x1ZGU9RkFMU0V9CmtuaXRyOjpvcHRzX2NodW5rJHNldChlY2hvID0gVFJVRSkKYGBgCipUaGUgUiBtYXJrZG93biBpcyBhdmFpbGFibGUgZnJvbSB0aGUgcHVsbGRvd24gbWVudSBmb3IqIENvZGUgKmF0IHRoZSB1cHBlci1yaWdodCwgY2hvb3NlICJEb3dubG9hZCBSbWQiLCBvciBbZG93bmxvYWQgdGhlIFJtZCBmcm9tIEdpdEh1Yl0oaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL2N5dG9zY2FwZS9jeXRvc2NhcGUtYXV0b21hdGlvbi9tYXN0ZXIvZm9yLX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