Description Usage Arguments Value Author(s) Examples
Given a CytoscapeWindow containing a graph, this method adds new nodes, edges, and their attributes. Thus, it is the way to extend a graph – to merge a new graph with an existing one. A typical use would be to add a second KEGG pathway to a CytoscapeWindow upon discovering that two KEGG pathways overlap, which share some enzymes and some reactions. No existing attributes are overwritten.
1 | addGraphToGraph(obj, other.graph)
|
obj |
a |
other.graph |
a |
None.
Tanja Muetze, Georgi Kolishovski, Paul Shannon
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## Not run:
# first, delete existing windows to save memory:
deleteAllWindows(CytoscapeConnection())
window.name <- 'demo addGraphToGraph'
cw3 <- CytoscapeWindow (window.name, graph=makeSimpleGraph ())
displayGraph (cw3)
redraw (cw3)
layoutNetwork(cw3)
# create a new graph, which adds two nodes, and edges between them
# and an existing node, A
g2 <- new("graphNEL", edgemode = "directed")
g2 <- graph::addNode ('A', g2)
g2 <- graph::addNode ('D', g2)
g2 <- graph::addNode ('E', g2)
g2 <- initNodeAttribute (g2, "label", "char", "default node label")
g2 <- initEdgeAttribute (g2, "edgeType", "char", "unspecified")
g2 <- initEdgeAttribute (g2, "probability", "numeric", 0.0)
nodeData (g2, 'D', 'label') <- 'Gene D'
nodeData (g2, 'E', 'label') <- 'Gene E'
g2 <- graph::addEdge ('D', 'E', g2)
g2 <- graph::addEdge ('A', 'E', g2)
edgeData (g2, 'D', 'E', 'probability') <- 0.95
edgeData (g2, 'D', 'E', 'edgeType') <- 'literature'
edgeData (g2, 'A', 'E', 'edgeType') <- 'inferred'
addGraphToGraph (cw3, g2)
redraw (cw3)
layoutNetwork(cw3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.