createStyle: Create a style from components

Description Usage Arguments Details Value See Also Examples

View source: R/createStyle.R

Description

Creates a style from defaults and predefined mappings.

Usage

1
2
createStyle(style.name, defaults, mappings,
  base.url = "http://localhost:1234/v1")

Arguments

style.name

(char) name for style

defaults

(list) key-value pairs for default mappings.

mappings

(list) visual property mappings, see mapVisualProperty

base.url

cyrest base url for communicating with cytoscape

Details

Requires attribute mappings to be previously created, see mapVisualProperty.

Value

None

See Also

applyStyle, mapVisualProperty

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#first there has to be a network to apply style to
example(createNetwork)

#then prepare style variables
style.name = "myStyle"
defaults <- list(NODE_SHAPE="diamond",
                 NODE_SIZE=30,
                 EDGE_TRANSPARENCY=120,
                 NODE_LABEL_POSITION="W,E,c,0.00,0.00")
nodeLabels <- mapVisualProperty('node label','id','p')
nodeFills <- mapVisualProperty('node fill color','group','d',c("A","B"), c("#FF9900","#66AAAA"))
arrowShapes <- mapVisualProperty('Edge Target Arrow Shape','interaction','d',
                                 c("activates","inhibits","interacts"),c("Arrow","T","None"))
edgeWidth <- mapVisualProperty('edge width','weight','p')

#and then create the style
createStyle(style.name, defaults, list(nodeLabels,nodeFills,arrowShapes,edgeWidth))

#finsh by applying the style
example(applyStyle)

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