createNetwork: Create a network from R objects

Description Usage Arguments Details Value See Also Examples

View source: R/createNetwork.R

Description

Takes data frames for nodes and edges, as well as naming parameters to generate the JSON data format required by the "networks" POST operation via CyREST. Returns the network.suid and applies the perferred layout set in Cytoscape preferences.

Usage

1
2
3
createNetwork(nodes = NULL, edges = NULL, network.name = "MyNetwork",
  collection.name = "MyNetworkCollection",
  base.url = "http://localhost:1234/v1", ...)

Arguments

nodes

(data.frame) see details and examples below; default NULL to derive nodes from edge sources and targets

edges

(data.frame) see details and examples below; default NULL for disconnected set of nodes

network.name

(char) network name

collection.name

(char) network collection name

base.url

cyrest base url for communicating with cytoscape

...

params for nodeSet2JSON() and edgeSet2JSON()

Details

NODES should contain a column named: id. This name can be overridden by the arg: node.id.list. Additional columns are loaded as node attributes. EDGES should contain columns named: source, target and interaction. These names can be overridden by args: source.id.list, target.id.list, interaction.type.list. Additional columns are loaded as edge attributes. The 'interaction' list can contain a single value to apply to all rows; and if excluded altogether, the interaction type wiil be set to "interacts with". NOTE: attribute values of types (num) and (int) will be imported as (Double); (chr) as (String); and (logical) as (Boolean).

Value

(int) network SUID

See Also

createSubnetwork

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
nodes <- data.frame(id=c("node 0","node 1","node 2","node 3"),
           group=c("A","A","B","B"), # optional
           stringsAsFactors=FALSE)
edges <- data.frame(source=c("node 0","node 0","node 0","node 2"),
           target=c("node 1","node 2","node 3","node 3"),
           interaction=c("inhibits","interacts","activates","interacts"),  # optional
           weight=c(5,3,5,9), # optional
           stringsAsFactors=FALSE)

createNetwork(nodes,edges)

cytoscape/r2cytoscape documentation built on May 4, 2019, 6:36 p.m.