Skip to content

Upgrading Existing Scripts

Alexander Pico edited this page Feb 12, 2020 · 17 revisions

The major version change from RCy3 1.x.x to 2.x.x involves a major conceptual change in translating Cytoscape into R via CyREST. This allows for easier R script writing and package maintenance. Unfortunately, this also means that existing scripts written against older versions of RCy3 will not work and the upgrade can not be automated.

Here are some tips for upgrading existing scripts to work with RCy3 2.0.0 and greater.

  1. CytosacpeConnection and CytoscapeWindow classes are no longer used.
    • You can delete all references to CytoscapeConnection and cc variables.
    • In some cases, you can replace references to CytoscapeWindow with createNetworkFromGraph, which returns a network SUID (rather than an R object). In general, you can either swap in network SUIDs for CytoscapeWindow or cw variables. And in most cases where you are dealing with the current network (i.e., currently selected network in Cytoscape), you can simply delete cw from your code.
  2. Most functions containing "Window" in their name have been renamed to "Network". E.g., getWindowList -> getNetworkList and deleteWindow -> deleteNetwork. Most of these have been deprecated so they will work for a while longer, but will eventually be removed from the package and should be updated.
  3. Visual style setting methods have been updated to more consistently match Cytoscape's terminology.
    • All "Direct" methods (e.g., setNodeShapeDirect) have been renamed "Bypass" (e.g., setNodeShapeBypass).
    • All "Default" methods (e.g., setDefaultNodeShape) have been renamed like setNodeShapeDefault.
    • All "Rule" methods (e.g., setNodeShapeRule) have been renamed to "Mappings" (e.g., setNodeShapeMapping).
  4. All the graphNEL-specific functions are now defunct. Since you no longer need to manage a CytoscapeWindow, you no longer use functions like sendNodes, sendNodeAttribute, addGraphToGraph. Instead, these functions will need to be replaced with createNetwork... functions and loadTableData.
  5. The functions for get/setNodePositions and save/restoreLayout have been replaced with a single layoutCopycat function.
  6. The redraw function is no longer needed. In order to set a layout, you can simply use setVisualStyle.

Table of renamed and replaced functions

old function new function comments
createWindow createNetworkFromGraph returns network SUID rather than an object
createWindowFromSelection createSubnetwork("selected")
copyCytoscapeNetwork cloneNetwork
CytoscapeWindow createNetworkFromGraph returns network SUID rather than an object
deleteAllWindows deleteAllNetworks
deleteWindow deleteNetwork
deleteEdgeAttribute deleteTableColumn(attribute.name,'edge')
deleteNodeAttribute deleteTableColumn(attribute.name,'node')
existing.CytoscapeWindow getNetworkSuid
fitSelectedContent fitContent(selected.only = TRUE)
getAllNodeAttributes getTableColumns()
getAllEdgeAttributes getTableColumns('edge')
getCenter getNetworkCenter
getCommandNames commandsHelp
getCommandsWithinNamespace commandsHelp(namespace)
getDirectlyModifiableVisualProperties getVisualPropertyNames
getEdgeAttribute getTableValue('edge',edge.name, attribute.name)
getEdgeAttributeNames getTableColumnNames('edge')
getGraphFromCyWindow createGraphFromNetwork
getNodeAttribute getTableValue('node',node.name, attribute.name)
getNodeAttributeNames getTableColumnNames('node')
getNodePositions getNodePosition
getWindowCount getNetworkCount
getWindowID getNetworkSuid
getWindowList getNetworkList
getZoom getNetworkZoom
ping cytoscapePing
pluginVersion cytoscapeVersionInfo the new function offers additional info
renameCytoscapeNetwork renameNetwork
saveImage exportImage
save/restoreLayout layoutCopyCat
saveNetwork saveSession
selectEdgesConnectedBySelectedNodes selectEdgesConnectingSelectedNodes
selectFirstNeighborsOfSelectedNodes selectFirstNeighbors
setCenter setNetworkCenterBypass
setNodePositions setNodePropertyBypass NODE_X_LOCATION, NODE_Y_LOCATION
setDefault... set...Default
set...Direct set...Bypass bug fixed: bypasses are now persistent
set...Rule set...Mapping
setZoom setNetworkZoomBypass
sfn selectFirstNeighbors
showGraphicsDetails toggleGraphicsDetails

Table of defunct functions no longer supported

defunct function comments
addCyEdge
addCyNode
addGraphToGraph
connectToNewestCyWindow
cy2.edge.names
cyPlot
demoSimpleGraph see makeSimpleGraph
displayGraph see createNetworkFromGraph
eda
eda.names
getAdjacentEdgeNames use selectNodes, selectEdgesAdjacentToSelectedNodes
getAttributeClassNames
getDefaultEdgeReverseSelectionColor no longer exists in Cytoscape
getDefaultNodeReverseSelectionColor no longer exists in Cytoscape
getGraph see createGraphFromNetwork
getNodePosition see getNodeProperty
getViewCoordinates
initEdgeAttribute
initNodeAttribute
makeRandomGraph see makeSimpleGraph
noa
noa.names
predictTimeToDisplayGraph
raiseWindow
sendEdges
sendNodes
setCommandProperties see commandsRun
setDefaultEdgeReverseSelectionColor no longer exists in Cytoscape
setDefaultNodeReverseSelectionColor no longer exists in Cytoscape
setEdgeAttributes see loadTableData
setGraph
setNodeAttributes see loadTableData
setNodePosition see setNodePropertyBypass
setTooltipDismissDelay
setTooltipInitialDelay
setWindowSize

It is just not going to work!

If this upgrade simply takes too much or effort for your needs, then you can continue to rely on the last versions of RCy3 prior to 2.0: