setNodeLabelColorDirectR Documentation

setNodeLabelColorDirect

Description

In the specified CytoscapeWindow, set the color of the labels of the specified node or nodes. This method bypasses the vizmap, and excludes this node, for the duration of the current Cytoscape session, from further manipulation by vizmap color rules.

This method did not make it into RCytoscape 1.2, so an ad hoc version is described and only described here for those who want to copy the code into an R file of their own. With the next release of RCytoscape, this method will become a proper method of the CytoscapeWindow class, with anidentical functional interface.

Usage

setNodeLabelColorDirect(obj, node.names, new.color)

Source Code: Copy and 'source' this into your R environment


setNodeLabelColorDirect = function (cw, nodes, new.color) {
  if (length (nodes) == 1)
  nodes = rep (nodes, 2)
  converted.color = RCytoscape:::hexColorToInt (new.color)
  if (length (converted.color) == 1 && is.na (converted.color)) {
     write (sprintf ('illegal color string "%s" in setNodeLabelColorDirect'), stderr ())
     return ()
     }
  result = xml.rpc (cw@uri, "Cytoscape.setNodeLabelColor", cw@window.id, nodes,
                    as.integer (converted.color$red), as.integer (converted.color$green),
                    as.integer (converted.color$blue))
  invisible (result)
  }

Arguments

obj a CytoscapeWindowClass object.
node.names a String list object.
new.color an String object, using the standard hexadecimal form, eg, '#FF88AA'

Value

None.

Author(s)

Paul Shannon

See Also

setNodeColorDirect

Examples

  cw <- new.CytoscapeWindow ('setNodeColorDirect.test', graph=makeSimpleGraph())
  displayGraph (cw)
  redraw (cw)
  layoutNetwork (cw, 'jgraph-spring')
  setNodeLabelColorDirect (cw, 'A', '#FF00FF')
  redraw (cw)