two-line labels in GO graphs
1
0
Entering edit mode
Robert Castelo ★ 3.4k
@rcastelo
Last seen 3 days ago
Barcelona/Universitat Pompeu Fabra
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.
GO graph GO graph • 1.6k views
ADD COMMENT
0
Entering edit mode
Marc Carlson ★ 7.2k
@marc-carlson-2264
Last seen 8.3 years ago
United States
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
ADD COMMENT
0
Entering edit mode
Marc Carlson 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 > > Oops sorry, I responded to the wrong email with this post. Please ignore this. How embarrassing. :P Marc
ADD REPLY
0
Entering edit mode
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
ADD REPLY
0
Entering edit mode
hi Florian, thanks for your answer, could you point out to me how can i install this latest Rgraphviz devel version? (i've googled "Rgraphviz devel" but i couldn't identify anything meaninful to me) thanks! robert. On Thu, 2008-03-13 at 12:27 -0700, Florian Hahne wrote: > 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 >
ADD REPLY
0
Entering edit mode
Hi Robert, there are at least two ways to obtain the current development versions of Bioconductor packages (BioC v2.2): 1. from within R-devel (2.7.0) using the biocLite function (BioC 2.2 is the matching version of Bioconductor for R2.7.0) 2. from the Bioconductor web site, follow the links Download -> BioC 2.2 (devel) -> Software -> Rgraphviz, which will direct you to here: http://www.bioconductor.org/packages/2.2/bioc/html/Rgraphviz.html Regards, Joern Robert Castelo wrote: > hi Florian, > > thanks for your answer, could you point out to me how can i install this > latest Rgraphviz devel version? (i've googled "Rgraphviz devel" but i > couldn't identify anything meaninful to me) > > thanks! > robert. >
ADD REPLY
0
Entering edit mode
hi Joern, thanks for the info. however, this latest version of Rgraphviz says that it depends Graphviz version >= 2.2 at SystemRequirements level and according to the url where one can download the latest Graphviz source distribution: http://www.graphviz.org/Download_source.php the latest stable version is 2.18 and the development snapshot version is 2.19 is this SystemRequirements dependence correct? thanks, robert. On Fri, 2008-03-14 at 12:08 +0000, Joern Toedling wrote: > Hi Robert, > there are at least two ways to obtain the current development versions > of Bioconductor packages (BioC v2.2): > 1. from within R-devel (2.7.0) using the biocLite function (BioC 2.2 is > the matching version of Bioconductor for R2.7.0) > 2. from the Bioconductor web site, follow the links Download -> BioC 2.2 > (devel) -> Software -> Rgraphviz, which will direct you to here: > http://www.bioconductor.org/packages/2.2/bioc/html/Rgraphviz.html > Regards, > Joern > > Robert Castelo wrote: > > hi Florian, > > > > thanks for your answer, could you point out to me how can i install this > > latest Rgraphviz devel version? (i've googled "Rgraphviz devel" but i > > couldn't identify anything meaninful to me) > > > > thanks! > > robert. > > > >
ADD REPLY
0
Entering edit mode
Yes, I think the dependency is stated correct. Please note that Graphviz 2.18 is a successor to 2.2, 2.3,...,2.17 and its version number is not meant as 2.1.8. So you should be alright with that version of Graphviz or indeed any Graphviz version >= 2.2. Regards, Joern Robert Castelo wrote: > hi Joern, > > thanks for the info. however, this latest version of Rgraphviz says that > it depends Graphviz version >= 2.2 at SystemRequirements level and > according to the url where one can download the latest Graphviz source > distribution: > > http://www.graphviz.org/Download_source.php > > the latest stable version is 2.18 and the development snapshot version > is 2.19 > > is this SystemRequirements dependence correct? > > thanks, > robert. >
ADD REPLY
0
Entering edit mode
hi Joern and Florian, the perspective of having to upgrade Graphviz has sharpened my limited bioconductor/Rgraphviz hacking capabilities and i've found the way to get multi-line labels using my current version of RGraphviz. i post this just in case is of interest to anybody. the newline character '\n' i was giving to the separator 'sep' parameter in the paste function should be written as '\\\n'. doing it this way my former example works: 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="\\\n"), shape="ellipse",fillcolor="#f2f2f2", fixedsize=FALSE) plot(g,nodeAttrs=nodattr) ... and no, writing '\\n' doesn't work. i leave for the experts finding out why the backslash should be scaped this way '\\\n'. i came across this using agopen and agwrite to write myself a dot file to use my current version of graphviz in command- line since i found out that it was indeed multi-line capable but then i saw that in the dot file, the newline characters '\n' in the labels where being interpreted instead of, let's say, quoted, so i just thgout of trying to "escape". best regards, robert. On Tue, 2008-03-18 at 18:26 +0000, Joern Toedling wrote: > Yes, I think the dependency is stated correct. Please note that Graphviz > 2.18 is a successor to 2.2, 2.3,...,2.17 and its version number is not > meant as 2.1.8. So you should be alright with that version of Graphviz > or indeed any Graphviz version >= 2.2. > Regards, > Joern > > Robert Castelo wrote: > > hi Joern, > > > > thanks for the info. however, this latest version of Rgraphviz says that > > it depends Graphviz version >= 2.2 at SystemRequirements level and > > according to the url where one can download the latest Graphviz source > > distribution: > > > > http://www.graphviz.org/Download_source.php > > > > the latest stable version is 2.18 and the development snapshot version > > is 2.19 > > > > is this SystemRequirements dependence correct? > > > > thanks, > > robert. > > > >
ADD REPLY

Login before adding your answer.

Traffic: 590 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6