source("http://bioinformatics.mdanderson.org/OOMPA/oompaLite.R")
oompaLite() #A package needed for plotting colored dendrograms
oompaLite() #A package needed for plotting colored dendrograms
Package Class Discovery
Clorored dendrogram
source("http://bioinformatics.mdanderson.org/OOMPA/oompaLite.R") oompaLite()
oompainstall()
library(ClassDiscovery)
# simulate data from three different groups
d1 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
d2 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
d3 <- matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
dd <- cbind(d1, d2, d3)
# perform hierarchical clustering using correlation
hc <- hclust(distanceMatrix(dd, 'pearson'), method='average')
cols <- rep(c('red', 'green', 'blue'), each=10)
labs <- paste('X', 1:30, sep='')
# plot the dendrogram with color-coded groups
plotColoredClusters(hc, labs=labs, cols=cols)
#cleanup
rm(d1, d2, d3, dd, hc, cols, labs)
No comments:
Post a Comment