[BioC] GOstats: Coloring nodes in the induced GO graph

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Oct 3 04:19:04 CEST 2007


On 10/2/07, Tim Smith <tim_smith_666 at yahoo.com> wrote:
> Hi,
>
> I looked at the documentation for GOstats and wanted to replicate the graph where different nodes are colored differently depending on their p-values.
>
> With the following code segment I can get the GO graph, but how do I color the nodes?
>
> -----------------------------------------------------------------
> library(Rgrahviz)
> library(GOstats)
>
> g4 <- GOGraph(c("GO:0003680", "GO:0003701"), GOMFPARENTS)
> plot(g4)
> -------------------------------------------------------------------------------------
>
> Also, is it possible to get the descriptive term (e.g.'AT binding' instead of "GO:0003680") in the graph?
>


Here's one way (adapting code from http://www.bioconductor.org/pub/docs/mogr/):

node.attrs <-
    makeNodeAttrs(g4, shape="ellipse",
                  label = substr(nodes(g4), 6, 10),
                  fillcolor = sample(colors(), length(nodes(g4))))

plot(agopen(g4,
            recipEdges="distinct", layoutType="dot",
            nodeAttrs = node.attrs, name = "foo"))

You would of course use more meaningful labels and colors in the call
to makeNodeAttrs().

-Deepayan



More information about the Bioconductor mailing list