'edgeType' -- a special edge attribute

Sometimes attributes that you define on a graph in R do not show up in Cytoscape. Here is the most frequent -- and perhaps only -- cause of this problem, along with its solution.

Both Cytoscape and RCytoscape attach special significance to one particular edge attribute: this attribute, in both cases, determines the type of the edge. It is easy to get confused, however, because a different attribute is used in the two enviroments:

To get the behavior that most people want in Cytoscape, we recommend that you always define an edge attribute titled edgeType in your R graph.


   g <- initEdgeAttribute (graph=g, attribute.name='edgeType', attribute.type='char', default.value='undefined')
RCytoscape maps this attribute to the (similarly privileged) Cytoscape edge attribute, 'interaction' which defines the edge type in Cytoscape.

For example, if you have code like this in R (from RCytoscape::makeSimpleGraph ())



    g = new("graphNEL", edgemode = "directed")
    g = graph::addNode("A", g)
    g = graph::addNode("B", g)
    g = graph::addNode("C", g)

    g = initEdgeAttribute(g, "edgeType", "char", "undefined")

    g = graph::addEdge("A", "B", g)
    g = graph::addEdge("B", "C", g)
    g = graph::addEdge("C", "A", g)

    edgeData(g, "A", "B", "edgeType") = "phosphorylates"
    edgeData(g, "B", "C", "edgeType") = "synthetic lethal"

Inspect the edge attributes of this graph in Cytoscape, and you see



Choosing 'edgeType' rather than 'interaction' as the privileged edge attribute leads to some redundancy here, adding to the redundancy Cytoscape already displayed, but might be justified by the generality of 'edgeType' over 'interaction'.