library(gplots)
data(ligophorus_shape)
data(spcolmap)
dendrogram <- hclust(dist(ligophorus_shape))
#check dendrogram and note cut-off for the two main clades
plot(dendrogram)
clade_id <- cutree(dendrogram, h=0.5)
f_s <- numeric(ncol(ligophorus_shape))
for(i in 1:ncol(ligophorus_shape)){
dat <- stack(ligophorus_shape[,i])
#replace species label with clade label
dat[,2] <- clade_id
f_s[i] <- t.test(values~ind, data=dat)$statistic
}
rank_s <- order(f_s, decreasing=TRUE)
heatmapAnnot(ligophorus_shape[,rank_s],labcol=spcolmap$color,
xlab="Specimens", genus="L. ")
Run the code above in your browser using DataLab