Search code examples
bioinformaticscytoscape

How can I set a different color of Cytoscape network node center?


I have a network (figure A),
(source: aacrjournals.org)
.

In this figure, every node center (I am confused, is it a sub-node?) has its color that is differential to node fill color, how can I do this? Thank you.


Solution

  • Interesting figure. Just looking at it, I can imagine a few ways to get this effect. It's not a common visualization from Cytoscape, however, so I guarantee which (if any) of these approaches were actually used.

    1. Separate nodes. One could create extra nodes, position them at the center of other nodes and accomplish this. This sounds error prone to me, however, and would not be recommended, especially for networks with more than a couple dozen nodes.
    2. Node border. You can map border thickness and color to columns independent of node fill. This is probably the way I would have displayed this data. However, given the thin black border on their nodes, I suspect they did not do this.
    3. Pie charts. You can use the enhancedGraphics app (http://apps.cytoscape.org/apps/enhancedgraphics) to create filled circles (e.g., a single value) at the center of nodes. The app supports highly customizeable syntax so you can size each pie independent of the node size. This isn't the simplest approach, but it would give you exactly the image you see.

    And of course you can do any of these options programmatically in R using RCy3 (https://bioconductor.org/packages/release/bioc/html/RCy3.html). See functions like:

    • setNodeColorMapping
    • setNodeSizeMapping
    • setNodeBorderColorMapping
    • setNodeBorderWidthMapping

    And vignettes like: