[BioC] two-line labels in GO graphs

Florian Hahne fhahne at fhcrc.org
Thu Mar 13 20:27:49 CET 2008


Hi Robert,
For some strange reason, graphviz strips the linebreaks from the  
labels when it returns things, however it uses them when computing the  
graph layout. In the latest Rgraphviz devel version we introduced a  
slightly revised interface for graph plotting and you might want to  
take a look at the new vignette there.

Basically, what you want to do is set the labels in the nodeRenderInfo  
slot of your graph object and plot that using layoutGraph and  
renderGraph

nodeRenderInfo(g) <- list(label=yourLabels)

g <- layoutGraph(g)
renderGraph(g)

This should keep the linebreaks

Cheers,
Florian

On 13.03.2008, at 09:00, Marc Carlson <mcarlson at fhcrc.org> wrote:

> Robert Castelo wrote:
>> dear list,
>>
>> i would like to produce a GO graph where the labels of the nodes are
>> formed by the GO identifier and the GO term and these two pieces of
>> information appear in two different lines within the node, in order  
>> to
>> draw nodes somewhat narrower than if i have these two pieces in one
>> single line.
>>
>> the following code does the job putting GO ID and GO term in the same
>> line separated by one space character:
>>
>> library(GOstats)
>> library(Rgraphviz)
>>
>> goterms <- eapply(GOTERM,Term)
>> g <- GOGraph("GO:0016265",GOBPPARENTS)
>> g <- removeNode("all",g)
>> mt <- match(nodes(g),names(goterms))
>> nodattr <- makeNodeAttrs(g,label=paste(nodes(g),goterms[mt],sep=" "),
>>                         shape="ellipse",fillcolor="#f2f2f2",
>>                         fixedsize=FALSE)
>> plot(g,nodeAttrs=nodattr)
>>
>>
>> if i replace the space character " " by "\n" in the 'sep' parameter  
>> of
>> the 'makeNodeAttrs' function, i do not get the desired behavior, it  
>> just
>> shows the GO ID.
>>
>> anyone has tried this or has an idea how it could be done ?
>>
>>
>>
>> my sessionInfo():
>>
>> R version 2.6.0 (2007-10-03)
>> x86_64-unknown-linux-gnu
>>
>> locale:
>> C
>>
>> attached base packages:
>> [1] splines   tools     stats     graphics  grDevices utils
>> datasets
>> [8] methods   base
>>
>> other attached packages:
>> [1] Rgraphviz_1.16.0    GOstats_2.4.0       Category_2.4.0
>> [4] genefilter_1.16.0   survival_2.32       RBGL_1.14.0
>> [7] annotate_1.16.1     xtable_1.5-2        GO.db_2.0.2
>> [10] AnnotationDbi_1.0.6 RSQLite_0.6-4       DBI_0.2-4
>> [13] Biobase_1.16.1      graph_1.16.1
>>
>> loaded via a namespace (and not attached):
>> [1] cluster_1.11.9  rcompgen_0.1-15
>>
>>
>> thanks!!
>> robert.
>>
>> _______________________________________________
>> 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
>>
>>
>
> First of all thanks for pointing this out. I have looked into why this
> was happening and have found the cause to be the source files that  
> come
> from ftp.geneontology.org . As you observed, the error appears to only
> affect the direct term to term association mapping for this one  
> term. I
> have notified them of the error and I anticipate that it will probably
> be cleaned up very soon.
>
> Marc
>
> _______________________________________________
> 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