This is a basic dendrogram.

The dataset used to build this figure is made by

- 3 species : Dicoccoides / Dicoccum / Durum
- 2 treatments : High or Low Nitrogen
- 4 samples per specie per treatment.
- For each sample we measure the expression of 5 genes

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Dataset sample=paste(rep("sample_",24) , seq(1,24) , sep="") specie=c(rep("dicoccoides" , 8) , rep("dicoccum" , 8) , rep("durum" , 8)) treatment=rep(c(rep("High",4 ) , rep("Low",4)),3) data=data.frame(sample,specie,treatment) for (i in seq(1:5)){ gene=sample(c(1:40) , 24 ) data=cbind(data , gene) colnames(data)[ncol(data)]=paste("gene_",i,sep="") } data[data$treatment=="High" , c(4:8)]=data[data$treatment=="High" , c(4:8)]+100 data[data$specie=="durum" , c(4:8)]=data[data$specie=="durum" , c(4:8)]-30 data |

The dendrogram permits to vizualise distances between samples, grouping close samples together. Le’ts calculate this distances :

1 2 3 4 5 |
# Euclidean distance rownames(data)=data[,1] dist=dist(data[ , c(4:8)] , diag=TRUE) |

Now that we have the distances between each pairs of sample, how does it work to build the Tree ?

PRINCIPLE : We have distances between objects. We seek the smallest distance between 2 objects. We aggregate the 2 objects in a cluster. These 2 points are replaced by theyr barycenter.Then we seek the two points or cluster that have the smallest distance. We repeat until having only one cluster containing every points. There are several ways to calculate the distance between 2 clusters ( using the max between 2 points of the clusters, or the mean, or the min, or ward (default) ).

This method is implemented in the hclust function.

1 2 3 4 |
# hierarchical clustering hc=hclust(dist) |

Then we just have to plot this the dendrogram

1 2 3 4 |
# Representation plot(hc) |

Not what you are looking for ? Make a new search !

`[mediatagger]`

## Leave a Reply