cyjShiny: cyjShiny cyjShiny

View source: R/cyjShiny.R

cyjShinyR Documentation

cyjShiny cyjShiny

Description

This widget wraps cytoscape.js, a full-featured Javsscript network library for visualization and analysis.

Usage

cyjShiny(
  graph,
  layoutName,
  styleFile = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL
)

Arguments

graph

a graph in json format; converters from graphNEL and data.frame/s offered ("see also" below)

layoutName

character one of:"preset", "cose", "cola", "circle", "concentric", "breadthfirst", "grid", "random"

styleFile,

default NULL, can name a standard javascript cytoscape.js style file

width

integer initial width of the widget.

height

integer initial height of the widget.

elementId

string the DOM id into which the widget is rendered, default NULL is best.

Value

a reference to an htmlwidget.

See Also

dataFramesToJSON

graphNELtoJSON

Examples

tbl.nodes <- data.frame(
  id = c("A", "B", "C"),
  type = c("kinase", "TF", "glycoprotein"),
  lfc = c(-3, 1, 1),
  count = c(0, 0, 0),
  stringsAsFactors = FALSE
)

tbl.edges <- data.frame(
  source = c("A", "B", "C"),
  target = c("B", "C", "A"),
  interaction = c("phosphorylates", "synthetic lethal", "unknown"),
  stringsAsFactors = FALSE
)

  #  simple legitimate graph, nodes implied, but no node attributes
graph.json.v1 <- dataFramesToJSON(tbl.edges)
  # nodes and edges both explicit,  attributes specified
graph.json.v2 <- dataFramesToJSON(tbl.edges, tbl.nodes)

g <- graphNEL(nodes = c("A", "B", "C"), edgemode = "directed")
g <- addEdge("A", "B", g)
graph.json.v3 <- graphNELtoJSON(g)

# output$cyjShiny <- renderCyjShiny(cyjShiny(graph.json.v[123]))

cyjShiny documentation built on March 31, 2023, 10:24 p.m.