Fwd: KEGGgraph / Rgraphviz dot layout
1
0
Entering edit mode
@unger-kristian-3624
Last seen 10.2 years ago
Hi there I am trying to optimise an output of pathway analysis and I am halfway successful doing this using KEGGgraph. The most useful layout for my purposes is the "dot" layout. The only problem I have is that I cannot change the layout parameters for the nodes such as 'width', 'height' or anything. Please find the code I am using in the following: nAttrs <- list(); nAttrs$fillcolor <- makeAttr(mapkG, "lightgrey", list(green=as.character(merge[,1]),red=as.character(merge2[,1]) ,yellow=as.character(merge3[,1])))#green=n[1:5])) #merge1,2 and 3 are strings of KEGG gene IDs which appear green, red and yellow in the plot nAttrs$label <- nodesNames nAttrs$height <-"3" names(nAttrs$height) <- "height" nAttrs$fontsize <- "20" names(nAttrs$fontsize) <- "fontsize" plot(mapkG, "dot", nodeAttrs=nAttrs) I tried to set the node attributes height and fontsize by writing the values into nAttrs$height and nAttrs$fontsize. Doing this an error message ('Error in buildNodeList(graph, nodeAttrs, subGList, attrs$node) : the character vector must have names") came up. I added the names and the plot was generated without any errors but there still was not any effect on height and fontsize of the nodes. It would be great if someone could give me some ideas on this! Best wishes Kristian > sessionInfo() R version 2.11.1 (2010-05-31) i686-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 [9] LC_ADDRESS=en_GB.utf8 LC_TELEPHONE=en_GB.utf8 [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=en_GB.utf8 attached base packages: [1] grid stats graphics grDevices utils datasets methods [8] base other attached packages: [1] biomaRt_2.4.0 KEGGgraph_1.4.0 XML_3.2-0 [4] org.Hs.eg.db_2.4.1 RSQLite_0.9-4 DBI_0.2-5 [7] AnnotationDbi_1.10.2 Biobase_2.8.0 Rgraphviz_1.26.0 [10] graph_1.28.0 rj_0.5.0-5 loaded via a namespace (and not attached): [1] RCurl_1.4-3 rJava_0.8-7 tools_2.11.1 -- _____ Dr Kristian Unger Imperial College London [[alternative HTML version deleted]]
KEGGgraph KEGGgraph • 2.0k views
ADD COMMENT
0
Entering edit mode
@jitao-david-zhang-3188
Last seen 7.8 years ago
Hi dear Kristian, Try 'makeNodeAttrs' function (Rgraphviz). If you are interested, you can have a look at the source file (Rnw) of KEGGGgraphApp.Rnw shipped along with the KEGGgraph package (/inst/doc/KEGGgraphApp.Rnw), there you may find how to use it. For the width and height, some experience suggests that 'fixedsize' option of nodeAttrs could be tweaked. If you had further questions, please feel free to attach a souce code which one could test and we could see how it works. Best wishes, David 2010/12/16 Unger, Kristian <k.unger@imperial.ac.uk> > Hi there > > I am trying to optimise an output of pathway analysis and I am halfway > successful doing this using KEGGgraph. The most useful layout for my > purposes is the "dot" layout. The only problem I have is that I cannot > change the layout parameters for the nodes such as 'width', 'height' or > anything. > > Please find the code I am using in the following: > > nAttrs <- list(); > nAttrs$fillcolor <- makeAttr(mapkG, "lightgrey", > list(green=as.character(merge[,1]),red=as.character(merge2[,1]) > ,yellow=as.character(merge3[,1])))#green=n[1:5])) > #merge1,2 and 3 are strings of KEGG gene IDs which appear green, red and > yellow in the plot > nAttrs$label <- nodesNames > > nAttrs$height <-"3" > names(nAttrs$height) <- "height" > nAttrs$fontsize <- "20" > names(nAttrs$fontsize) <- "fontsize" > > plot(mapkG, "dot", nodeAttrs=nAttrs) > > I tried to set the node attributes height and fontsize by writing the > values into nAttrs$height and nAttrs$fontsize. Doing this an error > message ('Error in buildNodeList(graph, nodeAttrs, subGList, attrs$node) > : the character vector must have names") came up. I added the names and > the plot was generated without any errors but there still was not any > effect on height and fontsize of the nodes. > > It would be great if someone could give me some ideas on this! > > Best wishes > > Kristian > > > sessionInfo() > R version 2.11.1 (2010-05-31) > i686-pc-linux-gnu > > locale: > [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C > [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 > [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 > [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 > [9] LC_ADDRESS=en_GB.utf8 LC_TELEPHONE=en_GB.utf8 > [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=en_GB.utf8 > > attached base packages: > [1] grid stats graphics grDevices utils datasets methods > [8] base > > other attached packages: > [1] biomaRt_2.4.0 KEGGgraph_1.4.0 XML_3.2-0 > [4] org.Hs.eg.db_2.4.1 RSQLite_0.9-4 DBI_0.2-5 > [7] AnnotationDbi_1.10.2 Biobase_2.8.0 Rgraphviz_1.26.0 > [10] graph_1.28.0 rj_0.5.0-5 > > loaded via a namespace (and not attached): > [1] RCurl_1.4-3 rJava_0.8-7 tools_2.11.1 > > > -- > _____ > > Dr Kristian Unger > > Imperial College London > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Jitao David Zhang Pre-doc staff of Computational Biology and Biostatistics Division of Molecular Genome Analysis DKFZ, Heidelberg D-69120, Germany http://www.NextBioMotif.com/ [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Thank you very much David! Following your hint I learned to set the attributes using the following code: nA <- makeNodeAttrs(mapkG, label=nodesNames, fixedsize=F, width=20, height=20, font=20, fontsize=20) plot(mapkG, "dot", nodeAttrs=nA) Unfortunately, changing he height/width or fontsize (after setting fixedsize to FALSE) does not change the output. Best wishes Kristian On 16/12/10 16:14, Jitao David Zhang wrote: > Hi dear Kristian, > > Try 'makeNodeAttrs' function (Rgraphviz). If you are interested, you > can have a look at the source file (Rnw) of KEGGGgraphApp.Rnw shipped > along with the KEGGgraph package (/inst/doc/KEGGgraphApp.Rnw), there > you may find how to use it. > > For the width and height, some experience suggests that 'fixedsize' > option of nodeAttrs could be tweaked. > > If you had further questions, please feel free to attach a souce > code which one could test and we could see how it works. > > Best wishes, > David > > > > 2010/12/16 Unger, Kristian <k.unger@imperial.ac.uk> <mailto:k.unger@imperial.ac.uk>> > > Hi there > > I am trying to optimise an output of pathway analysis and I am halfway > successful doing this using KEGGgraph. The most useful layout for my > purposes is the "dot" layout. The only problem I have is that I cannot > change the layout parameters for the nodes such as 'width', > 'height' or > anything. > > Please find the code I am using in the following: > > nAttrs <- list(); > nAttrs$fillcolor <- makeAttr(mapkG, "lightgrey", > list(green=as.character(merge[,1]),red=as.character(merge2[,1]) > ,yellow=as.character(merge3[,1])))#green=n[1:5])) > #merge1,2 and 3 are strings of KEGG gene IDs which appear green, > red and > yellow in the plot > nAttrs$label <- nodesNames > > nAttrs$height <-"3" > names(nAttrs$height) <- "height" > nAttrs$fontsize <- "20" > names(nAttrs$fontsize) <- "fontsize" > > plot(mapkG, "dot", nodeAttrs=nAttrs) > > I tried to set the node attributes height and fontsize by writing the > values into nAttrs$height and nAttrs$fontsize. Doing this an error > message ('Error in buildNodeList(graph, nodeAttrs, subGList, > attrs$node) > : the character vector must have names") came up. I added the > names and > the plot was generated without any errors but there still was not any > effect on height and fontsize of the nodes. > > It would be great if someone could give me some ideas on this! > > Best wishes > > Kristian > > > sessionInfo() > R version 2.11.1 (2010-05-31) > i686-pc-linux-gnu > > locale: > [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C > [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 > [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 > [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 > [9] LC_ADDRESS=en_GB.utf8 LC_TELEPHONE=en_GB.utf8 > [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=en_GB.utf8 > > attached base packages: > [1] grid stats graphics grDevices utils datasets > methods > [8] base > > other attached packages: > [1] biomaRt_2.4.0 KEGGgraph_1.4.0 XML_3.2-0 > [4] org.Hs.eg.db_2.4.1 RSQLite_0.9-4 DBI_0.2-5 > [7] AnnotationDbi_1.10.2 Biobase_2.8.0 Rgraphviz_1.26.0 > [10] graph_1.28.0 rj_0.5.0-5 > > loaded via a namespace (and not attached): > [1] RCurl_1.4-3 rJava_0.8-7 tools_2.11.1 > > > -- > _____ > > Dr Kristian Unger > > Imperial College London > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org <mailto:bioconductor@r-project.org> > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > > -- > Jitao David Zhang > Pre-doc staff of Computational Biology and Biostatistics > Division of Molecular Genome Analysis > DKFZ, Heidelberg D-69120, Germany > > http://www.NextBioMotif.com/ -- _____ Dr Kristian Unger Bioinformaticist Chernobyl Tissue Bank Department of Surgery and Cancer Imperial College London Rm G02, Ground floor G Block Hammersmith Hospital Du Cane Road, London W12 0HS Tel +44-20-8383-2443 Mob +44-795-1080619 http://www1.imperial.ac.uk/medicine/people/k.unger/ http://www.chernobyltissuebank.com [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Hi dear Kristian, Guessing blindly... font seems to be too much large, and try fixedsize=TRUE? If not it might be a 'dot' specific problem? I don't know, since I have almost usually always used other layouts. In extreme case (really...) you could try to output the graph file and edit it somewhere else, if the visualization is important to you. A hint may be the 'igraph' package (converting file formats and output different file formats) and 'yEd' (a general network/graph viewer and editor). If further questions arises please feel free to send an complete example code, which can be performed stand-alone. We can then analyze the problem together. Best wishes,David 2010/12/16 Unger, Kristian <k.unger@imperial.ac.uk> > Thank you very much David! > > Following your hint I learned to set the attributes using the following > code: > > nA <- makeNodeAttrs(mapkG, label=nodesNames, fixedsize=F, width=20, > height=20, font=20, fontsize=20) > plot(mapkG, "dot", nodeAttrs=nA) > > Unfortunately, changing he height/width or fontsize (after setting > fixedsize to FALSE) does not change the output. > > Best wishes > > Kristian > > > On 16/12/10 16:14, Jitao David Zhang wrote: > > Hi dear Kristian, > > Try 'makeNodeAttrs' function (Rgraphviz). If you are interested, you can > have a look at the source file (Rnw) of KEGGGgraphApp.Rnw shipped along with > the KEGGgraph package (/inst/doc/KEGGgraphApp.Rnw), there you may find how > to use it. > > For the width and height, some experience suggests that 'fixedsize' > option of nodeAttrs could be tweaked. > > If you had further questions, please feel free to attach a souce code > which one could test and we could see how it works. > > Best wishes, > David > > > > 2010/12/16 Unger, Kristian <k.unger@imperial.ac.uk> > >> Hi there >> >> I am trying to optimise an output of pathway analysis and I am halfway >> successful doing this using KEGGgraph. The most useful layout for my >> purposes is the "dot" layout. The only problem I have is that I cannot >> change the layout parameters for the nodes such as 'width', 'height' or >> anything. >> >> Please find the code I am using in the following: >> >> nAttrs <- list(); >> nAttrs$fillcolor <- makeAttr(mapkG, "lightgrey", >> list(green=as.character(merge[,1]),red=as.character(merge2[,1]) >> ,yellow=as.character(merge3[,1])))#green=n[1:5])) >> #merge1,2 and 3 are strings of KEGG gene IDs which appear green, red and >> yellow in the plot >> nAttrs$label <- nodesNames >> >> nAttrs$height <-"3" >> names(nAttrs$height) <- "height" >> nAttrs$fontsize <- "20" >> names(nAttrs$fontsize) <- "fontsize" >> >> plot(mapkG, "dot", nodeAttrs=nAttrs) >> >> I tried to set the node attributes height and fontsize by writing the >> values into nAttrs$height and nAttrs$fontsize. Doing this an error >> message ('Error in buildNodeList(graph, nodeAttrs, subGList, attrs$node) >> : the character vector must have names") came up. I added the names and >> the plot was generated without any errors but there still was not any >> effect on height and fontsize of the nodes. >> >> It would be great if someone could give me some ideas on this! >> >> Best wishes >> >> Kristian >> >> > sessionInfo() >> R version 2.11.1 (2010-05-31) >> i686-pc-linux-gnu >> >> locale: >> [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C >> [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 >> [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 >> [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 >> [9] LC_ADDRESS=en_GB.utf8 LC_TELEPHONE=en_GB.utf8 >> [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=en_GB.utf8 >> >> attached base packages: >> [1] grid stats graphics grDevices utils datasets methods >> [8] base >> >> other attached packages: >> [1] biomaRt_2.4.0 KEGGgraph_1.4.0 XML_3.2-0 >> [4] org.Hs.eg.db_2.4.1 RSQLite_0.9-4 DBI_0.2-5 >> [7] AnnotationDbi_1.10.2 Biobase_2.8.0 Rgraphviz_1.26.0 >> [10] graph_1.28.0 rj_0.5.0-5 >> >> loaded via a namespace (and not attached): >> [1] RCurl_1.4-3 rJava_0.8-7 tools_2.11.1 >> >> >> -- >> _____ >> >> Dr Kristian Unger >> >> Imperial College London >> >> >> >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor@r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > > > -- > Jitao David Zhang > Pre-doc staff of Computational Biology and Biostatistics > Division of Molecular Genome Analysis > DKFZ, Heidelberg D-69120, Germany > > http://www.NextBioMotif.com/ > > > -- > _____ > > Dr Kristian Unger > > Bioinformaticist Chernobyl Tissue Bank > > Department of Surgery and Cancer > > Imperial College London > > Rm G02, Ground floor G Block > Hammersmith Hospital > Du Cane Road, > London W12 0HS > > Tel +44-20-8383-2443 > > Mob +44-795-1080619 > http://www1.imperial.ac.uk/medicine/people/k.unger/ http://www.chernobyltissuebank.com > > -- Jitao David Zhang Pre-doc staff of Computational Biology and Biostatistics Division of Molecular Genome Analysis DKFZ, Heidelberg D-69120, Germany http://www.NextBioMotif.com/ [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

Traffic: 634 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