[BioC] adding a color key scale to a DAG graph for Gene ontologies
lilong at isb-sib.ch
lilong at isb-sib.ch
Wed Jan 10 16:27:30 CET 2007
Hi,
By default, the whole drawing space is open for the layout algorithm to
use. There's no guarantee that the bottom is free unless you do something
special to leave the bottom out as a separate drawing space.
In any case, if you want to work on the available info, you can look into
the data stored in Ragraph to find the info you need. For your example:
o. colored_graph at boundingBox gives you the diagonal points for the drawing
space,
o. colored_graph at AgNode[[i]] gives you the drawing info for i-th node,
such as height/rWidth/etc,
o. colored_graph at AgEdge[[j]] gives you the drawing info for j-th edge,
then you could build your color scale based on that.
Li
> Hi,
>
> I am making DAG graphs for gene ontologies using GOGraph.
> I color the nodes (elliptic) with different colors depending on the
> p-values
> that I get for the
> ontogy represented in the node from hyperGTest.
> I would like to add a key color scale on the bottom left or right of the
> graph.
>
> For this I need to position it and scale it so that it does not overlaps
> with the graph itself.
> How can I get the position of the nodes in the graphic window ? and the
> size
> of the ellipses?
>
>
> This is the code I am using:
>
> basic_graph <- GOGraph(goid, GOBPPARENTS) ##
> Biological
> process´
>
> Attrs <- list()
> node_color <- c(rep(NA,length(nodes(basic_graph))))
> node_color[1:length(goid)] <- heat.colors(length(goid))
> Attrs$fillcolor <- node_color
> node_fontsize <- c(rep(100,length(nodes(basic_graph))))
> Attrs$fontsize <- node_fontsize
> node_shape <- rep("ellipse",
> length(nodes(basic_graph)))
> Attrs$shape <- node_shape
> node_fixedsize <- rep(FALSE, length(nodes(basic_graph)))
> Attrs$fixedsize <- node_fixedsize
>
> Attrs <- lapply(Attrs, function(x) {
> names(x) <- nodes(basic_graph)
> x
> })
>
> basic_nodes <- buildNodeList(basic_graph, nodeAttrs = Attrs)
> basic_edges <- buildEdgeList(basic_graph)
>
>
> colored_graph <- agopen(name = "foo", nodes = basic_nodes, edges =
> basic_edges, edgeMode = "undirected")
>
> plot(colored_graph)
>
> Regards
>
>
>
> Marco Zucchelli
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
More information about the Bioconductor
mailing list