addGraphToGraph: addGraphToGraph

Description Usage Arguments Value Author(s) Examples

Description

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.

Usage

1
addGraphToGraph(obj, other.graph)

Arguments

obj

a CytoscapeWindowClass object.

other.graph

a graph object.

Value

None.

Author(s)

Tanja Muetze, Georgi Kolishovski, Paul Shannon

Examples

 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)

tmuetze/Bioconductor_RCy3_the_new_RCytoscape documentation built on May 31, 2019, 4:39 p.m.