copyVisualStyle: copyVisualStyle

Description Usage Arguments Value Author(s) See Also Examples

Description

Once you have designed a visual style, you may wish to duplicate it, perhaps in preparation for adding further mapping rules. Another scenario arises when style rules have been added to the 'default' style, and you wish to create a Cytoscape session file with your current network and this default style. However, the default style is not saved into a session, only explicitly named styles are. Use this method to achieve this.

Usage

1
copyVisualStyle(obj, from.style, to.style)

Arguments

obj

a CytoscapeConnectionClass object or CytoscapeWindow object.

from.style

a character string specifying the name of an existing style you wish to copy.

to.style

a character string, the name of an as yet non-existent style.

Value

Nothing.

Author(s)

Tanja Muetze, Georgi Kolishovski, Paul Shannon

See Also

getVisualStyleNames setVisualStyle

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
  ## Not run: 

    # create the usual demo graph and Cytoscape window, then
    # specify that all the edges should be 5 pixels wide.  This affects the 'default' style only
    # in order to save this style for later use, copy it to a 
    # new style named 'fatEdgeStyle'
    # the related method 'setVisualStyle' must be called in order for
    # the fatEdgestyle to be associated with this window (and saved
    # into the CytoscapeSession file from the Cytoscape application's
    # File menu)

  # first, delete existing windows to save memory:
  deleteAllWindows(CytoscapeConnection())

  window.name = 'demo.copyVisualStyle'
  cw = CytoscapeWindow (window.name, graph=makeSimpleGraph ())
  setDefaultEdgeLineWidth (cw, 5);
  displayGraph (cw)
  redraw (cw)
  layoutNetwork(cw)

     # create a unique style name, using millisecond precision, so should be unique
  time.msec = proc.time()[['elapsed']]
  new.unique.style.name = paste ('fatEdgeStyle', time.msec, sep='.')

  copyVisualStyle (cw, 'default', new.unique.style.name) 
  new.names = getVisualStyleNames (cw)
  setVisualStyle (cw, new.unique.style.name)

   # save the session from the Cytoscape application menu. The new
   # style name will be saved along with the network and its attributes

## End(Not run)

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