# 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
Run the code above in your browser using DataLab