showClass("COMMUNAL")
## create artificial data set with 3 distinct clusters
set.seed(1)
V1 = c(abs(rnorm(100, 2)), abs(rnorm(100, 50)), abs(rnorm(100, 140)))
V2 = c(abs(rnorm(100, 2, 8)), abs(rnorm(100, 55, 4)), abs(rnorm(100, 105, 1)))
data <- t(data.frame(V1, V2))
colnames(data) <- paste("Sample", 1:ncol(data), sep="")
rownames(data) <- paste("Gene", 1:nrow(data), sep="")
## run COMMUNAL with defaults
result <- COMMUNAL(data=data, ks=seq(2,5)) # result is a COMMUNAL object
k <- 3 # suppose optimal cluster number is 3
clusters <- result$getClustering(k) # extract clusters
mat.key <- clusterKeys(clusters, k=k) # get core clusters
examineCounts(mat.key) # all algorithms agree
core <- returnCore(mat.key, agreement.thresh=50) # find 'core' cluster assignments
table(core) # the 'core' cluster sizes
result$measures # access validation measuresRun the code above in your browser using DataLab