Jose Hleap Lozano
2011-Apr-01 20:47 UTC
[R] hc2Newick is different than th hclust dendrogram
Hi R helpers... I am having troubles because of the discrepancy between the dendrogram plotted from hclust and what is wrote in the hc2Newick file. I've got a matrix C:> hc <- hclust(dist(C)) > plot(hc)with the:> write(hc2Newick(hc),file='test.newick')both things draw completely different "trees"... I have also tried with the raw distance matrix D and also the agnes function, but the same happens. The hclus and agnes dendrogram is logical, whereas the newick tree is not. Thanks for any help! -- Jose Sergio Hleap Lozano, M. Sc. Ph. D. Student, Dalhousie University Researcher, SQUALUS Foundation
Jose Hleap Lozano
2011-Apr-04 12:24 UTC
[R] hc2Newick is different than th hclust dendrogram
Hi R helpers... I am having troubles because of the discrepancy between the dendrogram plotted from hclust and what is wrote in the hc2Newick file. I've got a matrix C: hc <- hclust(dist(C)) plot(hc) with the: write(hc2Newick(hc),file='test.newick') both things draw completely different "trees"... I have also tried with the raw distance matrix D and also the agnes function, but the same happens. The hclus and agnes dendrogram is logical, whereas the newick tree is not. Thanks for any help! PS> attached C matrix that is a 112x112 matrix -- Jose Sergio Hleap Lozano, M. Sc. Ph. D. Student, Dalhousie University Researcher, SQUALUS Foundation
Well, I could not call them "entirely different". See attached (tree-tv from TreeView, tree-r from R). Yes, I had to rotate and mirror the tree in TreeView but that's all. And yes, I have to ignore the tree length values from the file. Maybe it is better to post your inquiry to the Bioconductor list (from where hc2newick apparently arrives in package 'ctc'). Some humble suggestions: - don't call a text file .Rdata! Rdata is a specific binary format read using load() and saved using save(). - add to the description of your problem how to read the data, i.e.: z <- scan('data.Rdata') C <- matrix(z, 112, 112, byrow=TRUE) - add to your problem description all the packages you loaded to make the example work, i.e.: library('ctc') Hope it helps mario On 04-Apr-11 21:47, Jose Hleap Lozano wrote:> It was... I have it in my sent box is called data.Rdata... > > I am attaching it again! > > Thanks-- Ing. Mario Valle Data Analysis and Visualization Group | http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 -------------- next part -------------- A non-text attachment was scrubbed... Name: tree-tv.png Type: image/png Size: 7035 bytes Desc: tree-tv.png URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110405/1691e84b/attachment.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: tree-r.png Type: image/png Size: 14855 bytes Desc: tree-r.png URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110405/1691e84b/attachment-0001.png>