- faq
- tools
- coding
Cytoscape: How to use the API with R?ΒΆ
Question
As you have Cytoscape available in the Research Environment, can I always use it via an API using R?
Answer
Yes, the Cytoscape API is also functioning within our Research Environment. However, this requires some setting up, so please carefully follow the steps below for R/3.6.1.
1) Start up Cytoscape (Before you start up Rstudio)
Open the terminal and start up cytoscape by typing:
/tools/apps/cytoscape/3.7.1/Cytoscape_v3.7.1/cytoscape.sh
2) Start up Rstudio
Open a new terminal and start up Rstudio by typing:
3) Load the correct environment in R
R will require various packages to be loaded into your environment. Please add this to your R script, and run:
install.packages("BiocManager") # This has a variable time to initiate the install
library(BiocManager)
BiocManager::install("RCy3")
library(RCy3)
library(igraph)
4) Basic checks
To run some basic checks to see if it worked, please run the following in R:
cytoscapePing() # This should confirm the connection.
cytoscapeVersionInfo() # This will provide session and version info
cytoscape.base.url <- "http://localhost:1234/v1" # Sets the default page
RCy3::cyrestGET(base.url = cytoscape.base.url) # Provides detailed session info. If this (or similar) output
# is not equal to your session, you may need to start over again.
print(paste("Cytoscape Base URL: ",cytoscape.base.url, sep = ""))
5) Test functionality
To test whether your connection works, we are using an example provided by Cytoscape.
Please run the following lines in R:
This should result in Cytoscape constructing the network.
If the above is all fine, you are now set to use the Cytoscape API within our Research Environment!
Last updated
This page was last updated on the 18 Dec 2020.