In which format do you get the dendrogram out of the C code? If it's possible to get it as a newick or nexus formatted tree, you can get it easily into R with read.tree() or read.nexus() in the ape package. newick2phylog() from the ade4 package can be helpful as well, as you get a phylog object and you can use the functions of the ade4 package for plotting radial dendrograms.
Hope this helps. Cheers Joris On Thu, Jun 17, 2010 at 1:50 PM, Carson Farmer <carson.far...@gmail.com> wrote: > Dear list, > > I am trying to plot a radial dendrogram using the ape package, which > requires my data to be of class 'phylo'. Currently I have my > dendrogram stored as an object of class 'dendrogram' which was > produced from an outside bit of C code, but was made into an object of > class 'igraph.eigenc' and converted to a dendrogram using > 'as.dendrogram()' from the igraph package. I would like to find a way > to convert this dendrogram to a 'phylo' object, either directly, or > through conversion via 'hclust'. I have tried creating an 'hclust' > object 'manually' but keep running into "Error: segfault from C stack > overflow" when I try to plot it: > >> result <- list() >> result$merge<-merges >> result$method <- NULL >> result$dist.method <- "modularity" >> result$height <- seq(length(merges[,1]),1,-1) >> result$order <- seq(length(merges[,1])+1) >> result$call <- "some call" >> class(result) <- "hclust" >> plot(result) > > where merges is a two column matrix of cluster joins that looks > something like this: > >> merges > [,1] [,2] > [1,] 0 2 > [2,] 3 1 > > The dendrogram object was created using something like this: > >> result <- list() >> class(result) <- "igraph.eigenc" >> result$merges <- merges >> result$membership <- membership >> dend <- as.dendrogram(result) > > where merges is as above, and membership is: > >> membership > [1] 0 0 0 0 0 2 2 2 2 2 1 1 1 1 1 > > Any thoughts on how to convert a dendrogram object to an hclust or > phylo object, or barring that, another way to plot a radial dendrogam > in R? > > Regards, > > Carson > > -- > Carson J. Q. Farmer > ISSP Doctoral Fellow > National Centre for Geocomputation > National University of Ireland, Maynooth, > http://www.carsonfarmer.com/ > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.