## Not run:
# ## 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
# 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) # method to extract clusters
# mat.key <- clusterKeys(clusters) # get core clusters
# examineCounts(mat.key) # help decide agreement.thresh
# core <- returnCore(mat.key, agreement.thresh=50) # find 'core' clusters (all algs agree)
# table(core) # the 'core' clusters
#
# ## Additional arguments are passed down to clValid, NMF, ConsensusClusterPlus
# result <- COMMUNAL(data=data, ks=2:5,
# clus.methods=c("diana", "ccp-hc", "nmf"), reps=20, nruns=2)
#
# ## To identify k, use clusterRange and plotRange3D to visualize validation measures
# data(BRCA.100) # 533 tissues to cluster, with measurements of 100 genes each
# varRange <- c(10,25,50,75,100)
# meas <- c("Connectivity", "average.between",
# "ch", "sindex", "avg.silwidth",
# "average.within", "dunn", "widestgap",
# "wb.ratio", "entropy", "dunn2",
# "pearsongamma", "g3", "within.cluster.ss",
# "min.separation", "max.diameter")
# BRCA.results <- clusterRange(BRCA.100, ks=2:6, varRange=varRange, validation=meas)
#
# goodMeasures <- getNonCorrNonMonoMeasures(BRCA.results)
# goodAlgs <- getGoodAlgs(BRCA.results)
#
# plot.data <- plotRange3D(BRCA.results, goodAlgs=goodAlgs, goodMeasures = goodMeasures)
# ## End(Not run)
Run the code above in your browser using DataLab