Title: | Display and manipulate graphs in cytoscape.js |
---|---|
Description: | Interactive viewing and exploration of graphs, connecting R to Cytoscape.js, using websockets. |
Authors: | Paul Shannon |
Maintainer: | Paul Shannon <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.29.0 |
Built: | 2024-11-18 04:08:33 UTC |
Source: | https://github.com/bioc/RCyjs |
addGraph
send these nodes and edges (with attributes) to RCyjs for display
## S4 method for signature 'RCyjs' addGraph(obj, graph)
## S4 method for signature 'RCyjs' addGraph(obj, graph)
obj |
an RCyjs instance |
graph |
a graphNEL |
This version transmits a graph (nodes, edges and attributes) to the browser by writing the data to a file, and sending that filename to be read in the browser by javascript.
nothing
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=g) g <- simpleDemoGraph() setGraph(rcy, g) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=g) g <- simpleDemoGraph() setGraph(rcy, g) }
addGraphFromFile
add graph from specified file, which contains a cytoscape.js JSON graph
## S4 method for signature 'RCyjs' addGraphFromFile(obj, jsonFileName)
## S4 method for signature 'RCyjs' addGraphFromFile(obj, jsonFileName)
obj |
an RCyjs instance |
jsonFileName |
path to the file |
More description
nothin
if(interactive()){ rcy <- RCyjs() filename <- system.file(package="RCyjs", "extdata", "sampleGraph.json") addGraphFromFile(rcy, filename) layout(rcy, "cose") fit(rcy, 200) }
if(interactive()){ rcy <- RCyjs() filename <- system.file(package="RCyjs", "extdata", "sampleGraph.json") addGraphFromFile(rcy, filename) layout(rcy, "cose") fit(rcy, 200) }
clearSelection
deselect all selected nodes, all selected edges, or both
## S4 method for signature 'RCyjs' clearSelection(obj, which = "both")
## S4 method for signature 'RCyjs' clearSelection(obj, which = "both")
obj |
an RCyjs object |
which |
a character string: "both" (the default), "nodes" or "edges" |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, c("A", "B")) clearSelection(rcy) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, c("A", "B")) clearSelection(rcy) }
createTestGraph
With as many nodes and edges as you wish, but neither edge nor node attributes.
createTestGraph(nodeCount, edgeCount)
createTestGraph(nodeCount, edgeCount)
nodeCount |
1 or more |
edgeCount |
0 or more |
a graphNEL with nodeCount
nodes and edgeCount
edges
g <- createTestGraph(5, 3)
g <- createTestGraph(5, 3)
Create a cytoscape.js JSON graph from one or two data.frames.
dataFramesToJSON(tbl.edges, tbl.nodes = NULL)
dataFramesToJSON(tbl.edges, tbl.nodes = NULL)
tbl.edges |
data.frame, with source, target and interaction columns, others option for edge attributes |
tbl.nodes |
data.frame, options, useful for orphan nodes, and necessary for adding node attributes |
deleteGraph
Remove all nodes and edges, the elements of the current graph.
## S4 method for signature 'RCyjs' deleteGraph(obj)
## S4 method for signature 'RCyjs' deleteGraph(obj)
obj |
RCyjs instance |
This method will remove any previous graph in the browser
nothing
if(interactive()){ sampleGraph <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=sampleGraph) deletetGraph(rcy) }
if(interactive()){ sampleGraph <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=sampleGraph) deletetGraph(rcy) }
deleteSelectedNodes
put somewhat more detailed description here
## S4 method for signature 'RCyjs' deleteSelectedNodes(obj)
## S4 method for signature 'RCyjs' deleteSelectedNodes(obj)
obj |
an RCyjs instance |
multi-line description goes here with continuations on subsequent lines if you like
explain what the method returns
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) deleteSelectedNodes(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) deleteSelectedNodes(rcy) }
eda
retrieve the node/attribute-value pairs, for the specified node attribute category
eda(graph, edge.attribute.name)
eda(graph, edge.attribute.name)
graph |
a graphNEL |
edge.attribute.name |
a character string |
character strings, the names of the unique edge attribute categories on the graph
if(interactive()){ g <- simpleDemoGraph() edaNames(g) # discover the attribute category names eda(g, "edgeType") eda(g, "score") }
if(interactive()){ g <- simpleDemoGraph() edaNames(g) # discover the attribute category names eda(g, "edgeType") eda(g, "score") }
edaNames
the names of the unique edge attribute categories on the graph (not their values)
edaNames(graph)
edaNames(graph)
graph |
a graphNEL |
character strings, the names of the unique edge attribute categories on the graph
if(interactive()){ g <- simpleDemoGraph() edaNames(g) }
if(interactive()){ g <- simpleDemoGraph() edaNames(g) }
fit
zoom in (or out) to display all nodes in the current graph
## S4 method for signature 'RCyjs' fit(obj, padding = 30)
## S4 method for signature 'RCyjs' fit(obj, padding = 30)
obj |
an RCyjs instance |
padding |
numeric, in pixels |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) setZoom(rcy, 0.5) # zoom out fit(rcy) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) setZoom(rcy, 0.5) # zoom out fit(rcy) }
fitSelection
zoom in to include only currently selected nodes
## S4 method for signature 'RCyjs' fitSelection(obj, padding = 30)
## S4 method for signature 'RCyjs' fitSelection(obj, padding = 30)
obj |
an RCyjs instance |
padding |
numeric, in pixels |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, "A") fitSelection(rcy, padding=100) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, "A") fitSelection(rcy, padding=100) }
getEdgeCount
the number of edges in the current cytoscape.js graph
## S4 method for signature 'RCyjs' getEdgeCount(obj)
## S4 method for signature 'RCyjs' getEdgeCount(obj)
obj |
RCyjs instance |
numeric count
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getEdgeCount(rcy) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getEdgeCount(rcy) }
getJSON
a JSON string from the browser, describing the graph in cytoscape.js terms
## S4 method for signature 'RCyjs' getJSON(obj)
## S4 method for signature 'RCyjs' getJSON(obj)
obj |
an RCyjs instance |
a JSON string
if(interactive()){ sampleGraph <- simpleDemoGraph() rcy <- RCyjs(title="getJSON", graph=sampleGraph) s <- getJSON(rcy) s.asList <- fromJSON(s) # easier to inspect if you wish toa }
if(interactive()){ sampleGraph <- simpleDemoGraph() rcy <- RCyjs(title="getJSON", graph=sampleGraph) s <- getJSON(rcy) s.asList <- fromJSON(s) # easier to inspect if you wish toa }
getLayoutStrategies
return a list of those currently offered
## S4 method for signature 'RCyjs' getLayoutStrategies(obj)
## S4 method for signature 'RCyjs' getLayoutStrategies(obj)
obj |
an RCyjs instance |
a list of character strings
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="layouts", graph=g) strategies <- getLayoutStrategies(rcy) }
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="layouts", graph=g) strategies <- getLayoutStrategies(rcy) }
getNodeCount
the number of nodes in the current cytoscape.js graph
## S4 method for signature 'RCyjs' getNodeCount(obj)
## S4 method for signature 'RCyjs' getNodeCount(obj)
obj |
RCyjs instance |
numeric count
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodeCount(rcy) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodeCount(rcy) }
getNodes
returns a data.frame, one row per node, providing id and (if present) name and
label columns
## S4 method for signature 'RCyjs' getNodes(obj, which = "all")
## S4 method for signature 'RCyjs' getNodes(obj, which = "all")
obj |
an RCyjs instance |
which |
a character string, either "all", "visible" or "hidden" |
Every node is guaranteed to have an "id" attribute. Becuase "name" and "label" are commonly used as well, they are returned as columns in the data.frame if present
a data.frame with at least and "id" column
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodes(rcy) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodes(rcy) }
getPosition
for all or specified nodes
## S4 method for signature 'RCyjs' getPosition(obj, nodeIDs = NA)
## S4 method for signature 'RCyjs' getPosition(obj, nodeIDs = NA)
obj |
an RCyjs instance |
nodeIDs |
a vector of character strings, default NA |
a data.frame with "id", "x" and "y" columns
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="getPosition", graph=g) layout(rcy, "cose") tbl.pos <- getPosition(rcy) tbl.posA <- getPosition(rcy, "A") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="getPosition", graph=g) layout(rcy, "cose") tbl.pos <- getPosition(rcy) tbl.posA <- getPosition(rcy, "A") }
getSelectedNodes
get the selected nodes
## S4 method for signature 'RCyjs' getSelectedNodes(obj)
## S4 method for signature 'RCyjs' getSelectedNodes(obj)
obj |
an RCyjs instance |
a data.frame with (at least) an id column
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) nodes.to.select <- getNodes(rcy)$id selectNodes(rcy, nodes.to.select) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) nodes.to.select <- getNodes(rcy)$id selectNodes(rcy, nodes.to.select) }
getSupportedEdgeDecoratorShapes
return a list of those currently offered
## S4 method for signature 'RCyjs' getSupportedEdgeDecoratorShapes(obj)
## S4 method for signature 'RCyjs' getSupportedEdgeDecoratorShapes(obj)
obj |
an RCyjs instance |
a list of character strings
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="shapes", graph=g) shapes <- getSupportedEdgeDecoratorShapes(rcy) }
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="shapes", graph=g) shapes <- getSupportedEdgeDecoratorShapes(rcy) }
getSupportedNodeShapes
return a list of those currently offered
## S4 method for signature 'RCyjs' getSupportedNodeShapes(obj)
## S4 method for signature 'RCyjs' getSupportedNodeShapes(obj)
obj |
an RCyjs instance |
a list of character strings
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="shapes", graph=g) shapes <- getSupportedNodeShapes(rcy) }
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="shapes", graph=g) shapes <- getSupportedNodeShapes(rcy) }
getZoom
learn the zoom level of the current display
## S4 method for signature 'RCyjs' getZoom(obj)
## S4 method for signature 'RCyjs' getZoom(obj)
obj |
an RCyjs instance |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getZoom(rcy) Sys.sleep(1) setZoom(rcy, 5) getZoom(rcy) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getZoom(rcy) Sys.sleep(1) setZoom(rcy, 5) getZoom(rcy) }
Convert R graphNEL object to cytoscape.js JSON.
graphNELtoJSON.string(g)
graphNELtoJSON.string(g)
g |
a graphNEL |
## Not run: g.json <- graphNELtoJSON.string(graphNEL()) ## End(Not run)
## Not run: g.json <- graphNELtoJSON.string(graphNEL()) ## End(Not run)
hAlign
horizontally align selected nodes
## S4 method for signature 'RCyjs' hAlign(obj)
## S4 method for signature 'RCyjs' hAlign(obj)
obj |
an RCyjs instance |
The shared y coordinate will be the mean of the y coordinates of selected nodes. The x coordinates are preserved.
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") selectNodes(rcy, nodes(g)[1:2]) hAlign(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") selectNodes(rcy, nodes(g)[1:2]) hAlign(rcy) }
hideAllEdges
## S4 method for signature 'RCyjs' hideAllEdges(obj)
## S4 method for signature 'RCyjs' hideAllEdges(obj)
obj |
an RCyjs instance |
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") hideAllEdges() showAll(rcy, "edges") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") hideAllEdges() showAll(rcy, "edges") }
hideEdges
hide all edges of the specified type
## S4 method for signature 'RCyjs' hideEdges(obj, edgeType)
## S4 method for signature 'RCyjs' hideEdges(obj, edgeType)
obj |
an RCyjs instance |
edgeType |
a character string |
edgeType is a crucial feature for RCyjs. We assume it is an attribute found on every edge in every graph.
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodes(rcy) edaNames(rcy) # includes "edgeType" eda(rcy, "edgeType") # includes "phosphorylates" hideEdges(rcy, edgeType="phosphorylates") showEdges(rcy, edgeType="phosphorylates") }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodes(rcy) edaNames(rcy) # includes "edgeType" eda(rcy, "edgeType") # includes "phosphorylates" hideEdges(rcy, edgeType="phosphorylates") showEdges(rcy, edgeType="phosphorylates") }
hideNodes
hide the named nodes from view
## S4 method for signature 'RCyjs' hideNodes(obj, nodeIDs)
## S4 method for signature 'RCyjs' hideNodes(obj, nodeIDs)
obj |
an RCyjs instance |
The hidden nodes are not deleted from the graph
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) hideNodes(rcy) getNodes(rcy, "hidden") getNodes(rcy, "visible") showAll(rcy, which="nodes") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) hideNodes(rcy) getNodes(rcy, "hidden") getNodes(rcy, "visible") showAll(rcy, which="nodes") }
hideSelectedNodes
hide selected nodes from view
## S4 method for signature 'RCyjs' hideSelectedNodes(obj)
## S4 method for signature 'RCyjs' hideSelectedNodes(obj)
obj |
an RCyjs instance |
The hidden nodes are not deleted from the graph
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) hideSelectedNodes(rcy) getNodes(rcy, "hidden") getNodes(rcy, "visible") showAll(rcy, which="nodes") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) hideSelectedNodes(rcy) getNodes(rcy, "hidden") getNodes(rcy, "visible") showAll(rcy, which="nodes") }
invertNodeSelection
deselect all selected nodes, select all previously unselected nodes
## S4 method for signature 'RCyjs' invertNodeSelection(obj)
## S4 method for signature 'RCyjs' invertNodeSelection(obj)
obj |
an RCyjs instance |
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) invertNodeSelection(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] selectNodes(rcy, target) invertNodeSelection(rcy) }
layout
apply a layout algorithm to the current grap
## S4 method for signature 'RCyjs' layout(obj, strategy = "random")
## S4 method for signature 'RCyjs' layout(obj, strategy = "random")
obj |
an RCyjs instance |
strategy |
a character string, one of the supported algorithms |
explain what the method returns
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="layouts", graph=g) strategies <- getLayoutStrategies(rcy) for(strategy in stategies){ layout(rcy, strategy) Sys.sleep(1) } }
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="layouts", graph=g) strategies <- getLayoutStrategies(rcy) for(strategy in stategies){ layout(rcy, strategy) Sys.sleep(1) } }
layoutSelectionInGrid
arrange selected nodes in this region
## S4 method for signature 'RCyjs' layoutSelectionInGrid(obj, x, y, w, h)
## S4 method for signature 'RCyjs' layoutSelectionInGrid(obj, x, y, w, h)
obj |
an RCyjs instance |
x |
numeric this will be the top left x coordinate of the grid |
y |
numeric the top right |
w |
numeric width of the grid |
h |
numeric height of the grid |
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) loadStyleFile(rcy, system.file(package="RCyjs", "extdata", "sampleStyle2.js")); selectNodes(rcy, nodes(g)) layoutSelectionInGrid(rcy, -1000, 10, 100, 400) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) loadStyleFile(rcy, system.file(package="RCyjs", "extdata", "sampleStyle2.js")); selectNodes(rcy, nodes(g)) layoutSelectionInGrid(rcy, -1000, 10, 100, 400) }
layoutSelectionInGridInferAnchor
the top-most, left-most of the selected nodes is the anchor
## S4 method for signature 'RCyjs' layoutSelectionInGridInferAnchor(obj, w, h)
## S4 method for signature 'RCyjs' layoutSelectionInGridInferAnchor(obj, w, h)
obj |
an RCyjs instance |
w |
numeric, the width of the grid box |
h |
numeric, the height of the grid box |
anchor (the top left) of the grid is the location of the topmost/leftmost node, then arrange all the selected nodes in a box anchored here.
explain what the method returns
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) loadStyleFile(rcy, system.file(package="RCyjs", "extdata", "sampleStyle2.js")); selectNodes(rcy, nodes(g)) layoutSelectionInGrid(rcy, -1000, 10, 100, 400) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) loadStyleFile(rcy, system.file(package="RCyjs", "extdata", "sampleStyle2.js")); selectNodes(rcy, nodes(g)) layoutSelectionInGrid(rcy, -1000, 10, 100, 400) }
loadStyleFile
load a named JSON cytoscape.js style file into the browser
## S4 method for signature 'RCyjs' loadStyleFile(obj, filename)
## S4 method for signature 'RCyjs' loadStyleFile(obj, filename)
obj |
an RCyjs instance |
filename |
contains json in the proper cytoscape.js format |
nothing
https://js.cytoscape.org/#style
Though we provide access to individual styling rules (see below) we often find it convenient to express all aspects of a visual style in a single JSON file
if(interactive()){ rcy <- demo() filename <- system.file(package="RCyjs", "extdata", "sampleStyle1.js"); loadStyleFile(rcy, filename) }
if(interactive()){ rcy <- demo() filename <- system.file(package="RCyjs", "extdata", "sampleStyle1.js"); loadStyleFile(rcy, filename) }
noa
retrieve the node/attribute-value pairs, for the specified node attribute category
noa(graph, node.attribute.name)
noa(graph, node.attribute.name)
graph |
a graphNEL |
node.attribute.name |
a character string |
character strings, the names of the unique edge attribute categories on the graph
if(interactive()){ g <- simpleDemoGraph() noa(g, "lfc") }
if(interactive()){ g <- simpleDemoGraph() noa(g, "lfc") }
noaNames
the names of the unique node attribute categories on the graph (not their values)
noaNames(graph)
noaNames(graph)
graph |
a graphNEL |
character strings, the names of the unique node attribute categories on the graph
if(interactive()){ g <- simpleDemoGraph() noaNames(g) }
if(interactive()){ g <- simpleDemoGraph() noaNames(g) }
The RCyjs class provides an R interface to cytoscape.js, a rich, interactive, full-featured, javascript network (graph) library. One constructs an RCyjs instance on a specified port (default 9000), the browser code is loaded, and a websocket connection opened.
RCyjs( portRange = 16000:16100, title = "RCyjs", graph = graphNEL(), quiet = TRUE )
RCyjs( portRange = 16000:16100, title = "RCyjs", graph = graphNEL(), quiet = TRUE )
portRange |
The constructor looks for a free websocket port in this range. 16000:16100 by default |
title |
Used for the web browser window, "RCyjs" by default |
graph |
a Biocondcutor graphNEL object |
quiet |
A logical variable controlling verbosity during execution |
An object of the RCyjs class
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) setNodeLabelRule(rcy, "label"); setNodeSizeRule(rcy, "count", c(0, 30, 110), c(20, 50, 100)); setNodeColorRule(rcy, "count", c(0, 100), c(colors$green, colors$red), mode="interpolate") redraw(rcy) layout(rcy, "cose") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) setNodeLabelRule(rcy, "label"); setNodeSizeRule(rcy, "count", c(0, 30, 110), c(20, 50, 100)); setNodeColorRule(rcy, "count", c(0, 100), c(colors$green, colors$red), mode="interpolate") redraw(rcy) layout(rcy, "cose") }
Read in a JSON network file, identify (or add) elements field return JSON
readAndStandardizeJSONNetworkFile(filename)
readAndStandardizeJSONNetworkFile(filename)
file |
a json file |
Read in a JSON file, extract the selector elements, return JSON
readAndStandardizeJSONStyleFile(filename)
readAndStandardizeJSONStyleFile(filename)
file |
a json file |
redraw
re-render the graph, using the latest style rules and assignements
## S4 method for signature 'RCyjs' redraw(obj)
## S4 method for signature 'RCyjs' redraw(obj)
obj |
an RCyjs instance |
explain what the method returns
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeAttributes(rcy, "lfc", c("A", "B", "C"), c(0, 0, 0)) redraw(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeAttributes(rcy, "lfc", c("A", "B", "C"), c(0, 0, 0)) redraw(rcy) }
restoreLayout
restore a previously-saved layout
## S4 method for signature 'RCyjs' restoreLayout(obj, filename = "layout.RData")
## S4 method for signature 'RCyjs' restoreLayout(obj, filename = "layout.RData")
obj |
an RCyjs instance |
filename |
a character string, default "layout.RData" |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) layout(rcy, "grid") saveLayout(rcy, filename="gridLayout.RData") layout(rcy, "circle") restoreLayout(rcy, "gridLayout.RData") }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) layout(rcy, "grid") saveLayout(rcy, filename="gridLayout.RData") layout(rcy, "circle") restoreLayout(rcy, "gridLayout.RData") }
saveJPG
write current cytoscape view, at current resolution, to a JPG file.
## S4 method for signature 'RCyjs' saveJPG(obj, filename, resolutionFactor = 1)
## S4 method for signature 'RCyjs' saveJPG(obj, filename, resolutionFactor = 1)
obj |
an RCyjs instance |
filename |
a character string |
resolutionFactor |
numeric, default 1, higher values multiply resolution beyond screen dpi |
no return value
if(interactive()){ rcy <- RCyjs(title="layouts", graph=createTestGraph(nodeCount=20, edgeCount=20)) style.filename <- system.file(package="RCyjs", "extdata", "sampleStyle1.js"); loadStyleFile(rcy, style.filename) layout(rcy, "cose") fit(rcy) filename <- tempfile(fileext=".jpg") saveJPG(rcy, filename, resolutionFactor) }
if(interactive()){ rcy <- RCyjs(title="layouts", graph=createTestGraph(nodeCount=20, edgeCount=20)) style.filename <- system.file(package="RCyjs", "extdata", "sampleStyle1.js"); loadStyleFile(rcy, style.filename) layout(rcy, "cose") fit(rcy) filename <- tempfile(fileext=".jpg") saveJPG(rcy, filename, resolutionFactor) }
saveLayout
to a named file
## S4 method for signature 'RCyjs' saveLayout(obj, filename = "layout.RData")
## S4 method for signature 'RCyjs' saveLayout(obj, filename = "layout.RData")
obj |
a RCyjs instance |
filename |
"layout.RData" by default |
All node positions are saved to a functionally opaque RData object, in a file whose name you supply. These files are used by restoreLayout.
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) layout(rcy, "grid") saveLayout(rcy, filename="gridLayout.RData") layout(rcy, "circle") restoreLayout(rcy, "gridLayout.RData") }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) layout(rcy, "grid") saveLayout(rcy, filename="gridLayout.RData") layout(rcy, "circle") restoreLayout(rcy, "gridLayout.RData") }
savePNG
write current cytoscape view, at current resolution, to a PNG file.
## S4 method for signature 'RCyjs' savePNG(obj, filename)
## S4 method for signature 'RCyjs' savePNG(obj, filename)
obj |
an RCyjs instance |
filename |
a character string |
no return value
if(interactive()){ rcy <- RCyjs(title="layouts", graph=createTestGraph(nodeCount=20, edgeCount=20)) style.filename <- system.file(package="RCyjs", "extdata", "sampleStyle1.js"); loadStyleFile(rcy, style.filename) layout(rcy, "cose") fit(rcy) filename <- tempfile(fileext=".png") savePNG(rcy, filename) }
if(interactive()){ rcy <- RCyjs(title="layouts", graph=createTestGraph(nodeCount=20, edgeCount=20)) style.filename <- system.file(package="RCyjs", "extdata", "sampleStyle1.js"); loadStyleFile(rcy, style.filename) layout(rcy, "cose") fit(rcy) filename <- tempfile(fileext=".png") savePNG(rcy, filename) }
selectFirstNeighborsOfSelectedNodes
## S4 method for signature 'RCyjs' selectFirstNeighborsOfSelectedNodes(obj)
## S4 method for signature 'RCyjs' selectFirstNeighborsOfSelectedNodes(obj)
obj |
an RCyjs instance |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, "A") getSelectedNodes(rcy) # just one selectFirstNeighborsOfSelectedNodes() getSelectedNodes(rcy) # now three }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, "A") getSelectedNodes(rcy) # just one selectFirstNeighborsOfSelectedNodes() getSelectedNodes(rcy) # now three }
selectNodes
by node id
## S4 method for signature 'RCyjs' selectNodes(obj, nodeIDs)
## S4 method for signature 'RCyjs' selectNodes(obj, nodeIDs)
obj |
an RCyjs instance |
nodeIDs |
character strings |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, c("A", "B")) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, c("A", "B")) }
setBackgroundColor
of the entire cytoscape.js div
## S4 method for signature 'RCyjs' setBackgroundColor(obj, newValue)
## S4 method for signature 'RCyjs' setBackgroundColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
a character string, any valid CSS color |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) setBackgroundColor(rcy, "lightblue") }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) setBackgroundColor(rcy, "lightblue") }
setDefaultEdgeColor
## S4 method for signature 'RCyjs' setDefaultEdgeColor(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultEdgeColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
a character string, any valid CSS color |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeColor", graph=g) layout(rcy, "cose") setDefaultNodeFontColor(rcy, "red") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeColor", graph=g) layout(rcy, "cose") setDefaultNodeFontColor(rcy, "red") }
setDefaultEdgeLineColor
## S4 method for signature 'RCyjs' setDefaultEdgeLineColor(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultEdgeLineColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
a character string, and valid CSS color |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeLineColor", graph=g) layout(rcy, "cose") setDefaultEdgeLineColor(rcy, "red") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeLineColor", graph=g) layout(rcy, "cose") setDefaultEdgeLineColor(rcy, "red") }
setDefaultEdgeLineStyle
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setDefaultEdgeLineStyle(obj, newValue = c("solid", "dotted", "dashed"))
## S4 method for signature 'RCyjs' setDefaultEdgeLineStyle(obj, newValue = c("solid", "dotted", "dashed"))
obj |
an RCyjs instance |
newValue |
a character string, one of "solid", "dotted", or "dashed" |
multi-line description goes here with continuations on subsequent lines if you like
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeLineStyle", graph=g) layout(rcy, "cose") setDefaultEdgeLineColor(rcy, "dashed") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeLineStyle", graph=g) layout(rcy, "cose") setDefaultEdgeLineColor(rcy, "dashed") }
setDefaultEdgeSourceArrowColor
## S4 method for signature 'RCyjs' setDefaultEdgeSourceArrowColor(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultEdgeSourceArrowColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
a character string, and valid CSS color |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeSourceArrowColor", graph=g) layout(rcy, "cose") setDefaultEdgeSourceArrowColor(rcy, "red") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeSourceArrowColor", graph=g) layout(rcy, "cose") setDefaultEdgeSourceArrowColor(rcy, "red") }
setDefaultEdgeSourceArrowShape
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setDefaultEdgeSourceArrowShape( obj, newValue = c("triangle", "triangle-tee", "triangle-cross", "triangle-backcurve", "vee", "tee", "square", "circle", "diamond", "none") )
## S4 method for signature 'RCyjs' setDefaultEdgeSourceArrowShape( obj, newValue = c("triangle", "triangle-tee", "triangle-cross", "triangle-backcurve", "vee", "tee", "square", "circle", "diamond", "none") )
obj |
an RCyjs instance |
newValue |
a character string, one of "triangle", "triangle-tee", "triangle-cross", "triangle-backcurve", "vee", "tee", "square", "circle", "diamond", "none" |
multi-line description goes here with continuations on subsequent lines if you like
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeSourceArrowShape", graph=g) layout(rcy, "cose") setDefaultEdgeSourceArrowShape(rcy, "tee") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeSourceArrowShape", graph=g) layout(rcy, "cose") setDefaultEdgeSourceArrowShape(rcy, "tee") }
setDefaultEdgeTargetArrowColor
## S4 method for signature 'RCyjs' setDefaultEdgeTargetArrowColor(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultEdgeTargetArrowColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
a character string, and valid CSS color |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeTargetArrowColor", graph=g) layout(rcy, "cose") setDefaultEdgeTargetArrowColor(rcy, "red") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeTargetArrowColor", graph=g) layout(rcy, "cose") setDefaultEdgeTargetArrowColor(rcy, "red") }
setDefaultEdgeTargetArrowShape
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setDefaultEdgeTargetArrowShape( obj, newValue = c("triangle", "triangle-tee", "triangle-cross", "triangle-backcurve", "vee", "tee", "square", "circle", "diamond", "none") )
## S4 method for signature 'RCyjs' setDefaultEdgeTargetArrowShape( obj, newValue = c("triangle", "triangle-tee", "triangle-cross", "triangle-backcurve", "vee", "tee", "square", "circle", "diamond", "none") )
obj |
an RCyjs instance |
newValue |
a character string, one of "triangle", "triangle-tee", "triangle-cross", "triangle-backcurve", "vee", "tee", "square", "circle", "diamond", "none" |
multi-line description goes here with continuations on subsequent lines if you like
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeTargetArrowShape", graph=g) layout(rcy, "cose") setDefaultEdgeTargetArrowShape(rcy, "tee") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeTargetArrowShape", graph=g) layout(rcy, "cose") setDefaultEdgeTargetArrowShape(rcy, "tee") }
setDefaultEdgeWidth
in pixels
## S4 method for signature 'RCyjs' setDefaultEdgeWidth(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultEdgeWidth(obj, newValue)
obj |
an RCyjs instance |
newValue |
a numeric |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeWidth", graph=g) layout(rcy, "cose") setDefaultEdgeWidth(rcy, 1) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultEdgeWidth", graph=g) layout(rcy, "cose") setDefaultEdgeWidth(rcy, 1) }
setDefaultNodeBorderColor
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setDefaultNodeBorderColor(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeBorderColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
any CSS color |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeBorderColor", graph=g) layout(rcy, "cose") setDefaultNodeBorderColor(rcy, "red") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeBorderColor", graph=g) layout(rcy, "cose") setDefaultNodeBorderColor(rcy, "red") }
setDefaultNodeBorderWidth
in pixels
## S4 method for signature 'RCyjs' setDefaultNodeBorderWidth(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeBorderWidth(obj, newValue)
obj |
an RCyjs instance |
newValue |
numeric, in pixels |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeBorderWidth", graph=g) layout(rcy, "cose") setDefaultNodeBorderWidth(rcy, 2) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeBorderWidth", graph=g) layout(rcy, "cose") setDefaultNodeBorderWidth(rcy, 2) }
setDefaultNodeColor
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setDefaultNodeColor(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
a character string, any valid CSS color name |
multi-line description goes here with continuations on subsequent lines if you like
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeColor", graph=g) layout(rcy, "cose") setDefaultNodeColor(rcy, "lightblue") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeColor", graph=g) layout(rcy, "cose") setDefaultNodeColor(rcy, "lightblue") }
setDefaultNodeFontColor
## S4 method for signature 'RCyjs' setDefaultNodeFontColor(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeFontColor(obj, newValue)
obj |
an RCyjs instance |
newValue |
any CSS color |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeColor", graph=g) layout(rcy, "cose") setDefaultNodeFontColor(rcy, "red") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeColor", graph=g) layout(rcy, "cose") setDefaultNodeFontColor(rcy, "red") }
setDefaultNodeFontSize
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setDefaultNodeFontSize(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeFontSize(obj, newValue)
obj |
an RCyjs instance |
newValue |
numeric, in points |
multi-line description goes here with continuations on subsequent lines if you like
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeFontSize", graph=g) layout(rcy, "cose") setDefaultNodeFontSize(rcy, 8) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeFontSize", graph=g) layout(rcy, "cose") setDefaultNodeFontSize(rcy, 8) }
setDefaultNodeHeight
set all nodes to the same specifed width, in pixels
## S4 method for signature 'RCyjs' setDefaultNodeHeight(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeHeight(obj, newValue)
obj |
an RCyjs instance |
newValue |
a numeric, in pixels |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeHeight", graph=g) layout(rcy, "cose") setDefaultNodeHeight(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeHeight", graph=g) layout(rcy, "cose") setDefaultNodeHeight(rcy, 80) }
setDefaultNodeShape
change the shape of all nodes
## S4 method for signature 'RCyjs' setDefaultNodeShape( obj, newValue = c("ellipse", "triangle", "rectangle", "roundrectangle", "bottomroundrectangle", "cutrectangle", "barrel", "rhomboid", "diamond", "pentagon", "hexagon", "concavehexagon", "heptagon", "octagon", "star", "tag", "vee") )
## S4 method for signature 'RCyjs' setDefaultNodeShape( obj, newValue = c("ellipse", "triangle", "rectangle", "roundrectangle", "bottomroundrectangle", "cutrectangle", "barrel", "rhomboid", "diamond", "pentagon", "hexagon", "concavehexagon", "heptagon", "octagon", "star", "tag", "vee") )
obj |
an RCyjs instance |
newValue |
a character string, one of "ellipse", "triangle", "rectangle", "roundrectangle", "bottomroundrectangle","cutrectangle", "barrel", "rhomboid", "diamond", "pentagon", "hexagon", "concavehexagon", "heptagon", "octagon", "star", "tag", "vee" |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeShape", graph=g) layout(rcy, "cose") setDefaultNodeShape(rcy, "barrel") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodeShape", graph=g) layout(rcy, "cose") setDefaultNodeShape(rcy, "barrel") }
setDefaultNodeSize
set all nodes to the same specifed size, in pixels
## S4 method for signature 'RCyjs' setDefaultNodeSize(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeSize(obj, newValue)
obj |
an RCyjs instance |
newValue |
a numeric, in pixels |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodesSize", graph=g) layout(rcy, "cose") setDefaultNodeSize(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodesSize", graph=g) layout(rcy, "cose") setDefaultNodeSize(rcy, 80) }
setDefaultNodeWidth
set all nodes to the same specifed width, in pixels
## S4 method for signature 'RCyjs' setDefaultNodeWidth(obj, newValue)
## S4 method for signature 'RCyjs' setDefaultNodeWidth(obj, newValue)
obj |
an RCyjs instance |
newValue |
a numeric, in pixels |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodesWidth", graph=g) layout(rcy, "cose") setDefaultNodeWidth(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodesWidth", graph=g) layout(rcy, "cose") setDefaultNodeWidth(rcy, 80) }
setDefaultStyle
use some sensible rendering options for all elements of the graph
## S4 method for signature 'RCyjs' setDefaultStyle(obj)
## S4 method for signature 'RCyjs' setDefaultStyle(obj)
obj |
an RCyjs instance |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodesSize", graph=g) layout(rcy, "cose") setDefaultStyle(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setDefaultNodesSize", graph=g) layout(rcy, "cose") setDefaultStyle(rcy) }
setEdgeAttributes
on the graph in the browse
## S4 method for signature 'RCyjs' setEdgeAttributes(obj, attribute, sourceNodes, targetNodes, edgeTypes, values)
## S4 method for signature 'RCyjs' setEdgeAttributes(obj, attribute, sourceNodes, targetNodes, edgeTypes, values)
obj |
an RCyjs instance |
attribute |
a character string |
sourceNodes |
vector of character strings |
targetNodes |
vector of character strings |
edgeTypes |
vector of character strings |
values |
vector of character strings |
Edges are specified by sourceNode/targetNode/edgeType triples.
no return value
setEdgeStyle
plain & fast (haystack) vs fancy & slower (bezier)
## S4 method for signature 'RCyjs' setEdgeStyle(obj, mode = c("bezier", "haystack"))
## S4 method for signature 'RCyjs' setEdgeStyle(obj, mode = c("bezier", "haystack"))
obj |
an RCyjs instance |
mode |
a character string, either "bezier" or "haystack" |
cytoscape.js offers two kinds of edge rendering - a tradeoff in richess and speed edge target decorations (arrows, tee, etc) are only rendered with the "bezier" style
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) loadStyleFile(rcy, system.file(package="RCyjs", "extdata", "sampleStyle2.js")) setEdgeStyle(rcy, "bezier") redraw(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) loadStyleFile(rcy, system.file(package="RCyjs", "extdata", "sampleStyle2.js")) setEdgeStyle(rcy, "bezier") redraw(rcy) }
setGraph
Establish a new graph in RCyjs, removing any previous graph
## S4 method for signature 'RCyjs' setGraph(obj, graph)
## S4 method for signature 'RCyjs' setGraph(obj, graph)
obj |
RCyjs instance |
graph |
a graphNEL |
This method will remove any previous graph in the browser, adding a new one. Setting visual properties and performing layout must follow.
nothing
if(interactive()){ sampleGraph <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo") setGraph(rcy, sampleGraph) }
if(interactive()){ sampleGraph <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo") setGraph(rcy, sampleGraph) }
setNodeAttributes
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setNodeAttributes(obj, attribute, nodes, values)
## S4 method for signature 'RCyjs' setNodeAttributes(obj, attribute, nodes, values)
obj |
an RCyjs instance |
attribute |
a character string |
nodes |
character strings - node ids |
values |
scalar values, all of one type (all numeric, or all character, or all integer, ...) |
multi-line description goes here with continuations on subsequent lines if you like
explain what the method returns
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeAttributes(rcy, "lfc", c("A", "B", "C"), c(0, 0, 0)) redraw(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeAttributes(rcy, "lfc", c("A", "B", "C"), c(0, 0, 0)) redraw(rcy) }
setNodeBorderColor
set the specified nodes to the specifed node border color
## S4 method for signature 'RCyjs' setNodeBorderColor(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeBorderColor(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
legal CSS color names (one or more) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeBorderColor", graph=g) layout(rcy, "cose") setNodeBorderColor(rcy, "green") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeBorderColor", graph=g) layout(rcy, "cose") setNodeBorderColor(rcy, "green") }
setNodeBorderWidth
set the specified nodes to the same specifed node border width, in pixels
## S4 method for signature 'RCyjs' setNodeBorderWidth(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeBorderWidth(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
numeric, in pixels (one, or as many as there are nodeIDs) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeBorderWidth", graph=g) layout(rcy, "cose") setNodeBorderWidth(rcy, 3) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeBorderWidth", graph=g) layout(rcy, "cose") setNodeBorderWidth(rcy, 3) }
setNodeColor
set the specified nodes to the specifed color
## S4 method for signature 'RCyjs' setNodeColor(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeColor(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
a character string, legal CSS color names (one or more) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeColor", graph=g) layout(rcy, "cose") setNodeColor(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeColor", graph=g) layout(rcy, "cose") setNodeColor(rcy, 80) }
setNodeColorRule
control node color via values of the specified attribute
## S4 method for signature 'RCyjs' setNodeColorRule( obj, attribute, control.points, colors, mode = c("interpolate", "lookup") )
## S4 method for signature 'RCyjs' setNodeColorRule( obj, attribute, control.points, colors, mode = c("interpolate", "lookup") )
obj |
an RCyjs instance |
attribute |
a character string, the node attribute category whose value controls color |
control.points |
a list of all possible values of the attribute |
colors |
the corresponding node color, one specified for each of the control.points |
mode |
a character string, either "interpolate" or "lookup" |
for interpolate mode, in which the node attribute should be a continusously varying numerical quantity in-between colors are calculated for in-between values. for lookup mode, in which the node attribute is a discrete string variable, simple color lookup is performed.
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeColorRule(rcy, "count", c(0, 100), c("green", "red"), mode="interpolate") redraw(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeColorRule(rcy, "count", c(0, 100), c("green", "red"), mode="interpolate") redraw(rcy) }
setNodeFontColor
set the specified nodes to the same specifed node font color
## S4 method for signature 'RCyjs' setNodeFontColor(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeFontColor(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
a character string, a legal CSS color name (one or more) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeFontColor", graph=g) layout(rcy, "cose") setNodeFontColor(rcy, "red") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeFontColor", graph=g) layout(rcy, "cose") setNodeFontColor(rcy, "red") }
setNodeFontSize
set the specified nodes to the same specifed node font size
## S4 method for signature 'RCyjs' setNodeFontSize(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeFontSize(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
a numeric, in pixels (one, or as many as there are nodeIDs) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeFontSize", graph=g) layout(rcy, "cose") setNodeFontSize(rcy, 5) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeFontSize", graph=g) layout(rcy, "cose") setNodeFontSize(rcy, 5) }
setNodeHeight
set the specified nodes to the specifed heights, in pixels
## S4 method for signature 'RCyjs' setNodeHeight(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeHeight(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
a numeric, in pixels (one, or as many as there are nodeIDs) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodesHeight", graph=g) layout(rcy, "cose") setNodeHeight(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodesHeight", graph=g) layout(rcy, "cose") setNodeHeight(rcy, 80) }
setNodeLabelAlignment
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setNodeLabelAlignment(obj, horizontal, vertical)
## S4 method for signature 'RCyjs' setNodeLabelAlignment(obj, horizontal, vertical)
obj |
an RCyjs instance |
horizontal |
character string |
vertical |
character string |
multi-line description goes here with continuations on subsequent lines if you like
explain what the method returns
setNodeLabelRule
put somewhat more detailed description here
## S4 method for signature 'RCyjs' setNodeLabelRule(obj, attribute)
## S4 method for signature 'RCyjs' setNodeLabelRule(obj, attribute)
obj |
an RCyjs instance |
attribute |
a character string, the node attribute to display as label |
multi-line description goes here with continuations on subsequent lines if you like
explain what the method returns
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="layouts", graph=g) setNodeLabelRule(rcy, "label"); }
if(interactive()){ g <- createTestGraph(nodeCount=20, edgeCount=20) rcy <- RCyjs(title="layouts", graph=g) setNodeLabelRule(rcy, "label"); }
setNodeShape
set the specified nodes to specifed shapes
## S4 method for signature 'RCyjs' setNodeShape(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeShape(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
a character string, one of the legitimate cytoscape.js node shapes |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeShape", graph=g) layout(rcy, "cose") setNodeShape(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodeShape", graph=g) layout(rcy, "cose") setNodeShape(rcy, 80) }
setNodeSize
set the specified nodes to the specifed sizes, in pixels
## S4 method for signature 'RCyjs' setNodeSize(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeSize(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
a numeric, in pixels (one, or as many as there are nodeIDs) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodesSize", graph=g) layout(rcy, "cose") setNodeSize(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodesSize", graph=g) layout(rcy, "cose") setNodeSize(rcy, 80) }
setNodeSizeRule
control node size via values of the specified attribute
## S4 method for signature 'RCyjs' setNodeSizeRule(obj, attribute, control.points, node.sizes)
## S4 method for signature 'RCyjs' setNodeSizeRule(obj, attribute, control.points, node.sizes)
obj |
an RCyjs instance |
attribute |
a character string, the node attribute category whose value controls size |
control.points |
a list of values of the attribute |
node.sizes |
the corresponding node size, one specified for each of the control.points |
actual node sizes are interpolated via the specified relationship of control.points node.sizes
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeSizeRule(rcy, "count", c(0, 30, 110), c(20, 50, 100)); redraw(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") fit(rcy, 100) setNodeSizeRule(rcy, "count", c(0, 30, 110), c(20, 50, 100)); redraw(rcy) }
setNodeWidth
set the specified nodes to the specifed widths, in pixels
## S4 method for signature 'RCyjs' setNodeWidth(obj, nodeIDs, newValues)
## S4 method for signature 'RCyjs' setNodeWidth(obj, nodeIDs, newValues)
obj |
an RCyjs instance |
nodeIDs |
a character string (one or more) |
newValues |
a numeric, in pixels (one, or as many as there are nodeIDs) |
no value returned
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodesWidth", graph=g) layout(rcy, "cose") setNodeWidth(rcy, 80) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="setNodesWidth", graph=g) layout(rcy, "cose") setNodeWidth(rcy, 80) }
setPosition
of nodes by their id
## S4 method for signature 'RCyjs' setPosition(obj, tbl.pos)
## S4 method for signature 'RCyjs' setPosition(obj, tbl.pos)
obj |
an RCyjs instance |
tbl.pos |
a data.frame with three columns: id, x, y |
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="getPosition", graph=g) layout(rcy, "cose") tbl.pos <- getPosition(rcy) # shift all the nodes to the right tbl.pos$x <- tbl.pos$x + 50 setPosition(rcy, tbl.pos) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="getPosition", graph=g) layout(rcy, "cose") tbl.pos <- getPosition(rcy) # shift all the nodes to the right tbl.pos$x <- tbl.pos$x + 50 setPosition(rcy, tbl.pos) }
setZoom
zoom in or out
## S4 method for signature 'RCyjs' setZoom(obj, newValue)
## S4 method for signature 'RCyjs' setZoom(obj, newValue)
obj |
an RCyjs instance |
newValue |
numeric, typically be 0.1 (zoomed way out, nodes are small) and 10 (zoomed way in, nodes are large) |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) setZoom(rcy, 0.2) Sys.sleep(1) setZoom(rcy, 5) }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) setZoom(rcy, 0.2) Sys.sleep(1) setZoom(rcy, 5) }
sfn
select first neighbors of the currently selected nodes
## S4 method for signature 'RCyjs' sfn(obj)
## S4 method for signature 'RCyjs' sfn(obj)
obj |
an RCyjs instance |
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, "A") getSelectedNodes(rcy) # just one sfn() getSelectedNodes(rcy) # now three }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) selectNodes(rcy, "A") getSelectedNodes(rcy) # just one sfn() getSelectedNodes(rcy) # now three }
showAll
show any hidden objects: nodes, edges, or both
## S4 method for signature 'RCyjs' showAll(obj, which = c("both", "nodes", "edges"))
## S4 method for signature 'RCyjs' showAll(obj, which = c("both", "nodes", "edges"))
obj |
an RCyjs instance |
which |
a character string, either "nodes", "edges" or "both" |
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") selectNodes(rcy, getNodes(rcy)$id) hideSelectedNodes(rcy) showAll(rcy, "nodes") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") selectNodes(rcy, getNodes(rcy)$id) hideSelectedNodes(rcy) showAll(rcy, "nodes") }
showEdges
if hidden, edges of the specified type will be made visible
## S4 method for signature 'RCyjs' showEdges(obj, edgeType)
## S4 method for signature 'RCyjs' showEdges(obj, edgeType)
obj |
an RCyjs instance |
edgeType |
a character string |
edgeType is a crucial feature for RCyjs. We assume it is an attribute found on every edge in every graph.
no return value
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodes(rcy) edaNames(rcy) # includes "edgeType" eda(rcy, "edgeType") # includes "phosphorylates" hideEdges(rcy, edgeType="phosphorylates") showEdges(rcy, edgeType="phosphorylates") }
if(interactive()){ rcy <- RCyjs(title="rcyjs demo", graph=simpleDemoGraph()) getNodes(rcy) edaNames(rcy) # includes "edgeType" eda(rcy, "edgeType") # includes "phosphorylates" hideEdges(rcy, edgeType="phosphorylates") showEdges(rcy, edgeType="phosphorylates") }
showNodes
show the named nodes from view
## S4 method for signature 'RCyjs' showNodes(obj, nodeIDs)
## S4 method for signature 'RCyjs' showNodes(obj, nodeIDs)
obj |
an RCyjs instance |
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] hideNodes(rcy, "A") getNodes(rcy, "hidden") getNodes(rcy, "visible") showNodes(rcy, "A") getNodes(rcy, "visible") }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) target <- nodes(g)[1] hideNodes(rcy, "A") getNodes(rcy, "hidden") getNodes(rcy, "visible") showNodes(rcy, "A") getNodes(rcy, "visible") }
simpleDemoGraph
simpleDemoGraph()
simpleDemoGraph()
a graphNEL with 3 nodes and 3 edges
g <- simpleDemoGraph()
g <- simpleDemoGraph()
vAlign
vertically align selected nodes
## S4 method for signature 'RCyjs' vAlign(obj)
## S4 method for signature 'RCyjs' vAlign(obj)
obj |
an RCyjs instance |
The shared x coordinate will be the mean of the x coordinates of selected nodes. The y coordinates are preserved.
no return value
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") selectNodes(rcy, nodes(g)[1:2]) vAlign(rcy) }
if(interactive()){ g <- simpleDemoGraph() rcy <- RCyjs(title="rcyjs demo", graph=g) layout(rcy, "cose") selectNodes(rcy, nodes(g)[1:2]) vAlign(rcy) }