How To Analyse A Dendrogram In R?
3
2
Entering edit mode
12.5 years ago
Mkl ▴ 100

Hi all,

How to compare the values of two nodes and how can I get the difference between two nodes from a Dendrogram? Is there any method available in R for comparing two nodes?

r • 4.1k views
ADD COMMENT
2
Entering edit mode
12.5 years ago

Not an R solution but you can do this type of calculations using BioPerl (look at node depth in Bio::TreeIO module) or ETE (Python).

ADD COMMENT
1
Entering edit mode
12.5 years ago

You can identify the point with the identify() method, which actually works for many other plots too. Say, I have a matrix with two columns, and plot the second against the first column, I can then interactively click points with identify() where double click ends the selection. Example code:

> plot(h2[,1], h2[,2])
> identify(h2)
[1] 2
> h2[2,]
[1] "93" "95"
ADD COMMENT
1
Entering edit mode
12.5 years ago

You probably want the distance between the two nodes as calculated in the distance matrix. Note that the distance matrix is what you're plotting in a dendrogram.

d = dist(M)
dd = as.matrix(d)
dd[which(labels(d)=='sample.1'), which(labels(d)=='sample.2')]
ADD COMMENT
0
Entering edit mode

Exactly the answer I would want to see when I read this question. It is indeed the distance matrix that one needs/uses when plotting/analyzing dendrograms. Thanks, David, for raising this important point.

ADD REPLY

Login before adding your answer.

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