yaConsensus | R Documentation |
This function mainly generates a list of "hclust" objects for downstream analysis.
yaConsensus(ddata, runs = 1000, epsilon = 0.65, is_by_sample = TRUE,
distMethod = "euclidean", hcMethod = "ward.D2", prefix = NULL)
ddata |
either a data matrix (samples in rows, and features in columns), or a "dist" object. |
runs |
an integer value for the number of samplings. |
epsilon |
a real value indicating the sampling rate. |
is_by_sample |
a logical value indicating if the sampling is by samples (TRUE) or features (FALSE). |
distMethod |
a character indicating the kind of distance for the inner clustering. It can be any of the methods from the |
hcMethod |
a character indicating the linkage mathod of the inner clustering. It can be any of the methods from the |
prefix |
string specifying a prefix to store the results in a .RData file. |
This function can run sequentially or in parallel. In this case, it is necessary to register a cluster of CPUs according to doParallel protocol.
To get the consensus clustering, the output of the function has to be processed with the plot() function. The consensus dissimilarity follows from the algorithm of Monti et al. (2003). The consensus clustering is from a hierarchical procedure (hclust) with "complete" linkage (outer hc method).
A named list with the following slots:
distMethod |
matches the input |
hcMethod |
matches the input |
lables |
a string list with the names of the samples |
bySample |
matches 'is_by_sample' input parameter |
epsilon |
matches the input |
subsetDimension |
actual dimension of the subsets |
runs |
matches the input |
hclust |
a list of 'hclust' objects |
elapsed_time |
time (in seconds) required |
ncores |
the number of cores used |
The plot function in the example provides an invisible result with detail ans statistics of the experiment.
Stefano M. Pagnotta
Monti et al. (2003) - Consensus Clustering: A Resampling-Based Method for Class Discovery and Visualization of Gene Expression Microarray Data - Machine Learning 52(1-2):91-118 <DOI: 10.1023/A:1023949509487>
dist
, hclust
, doParallel::doParallel()
## Generate data and annotation
n <- 50; m <- 3000
ddata <- matrix(rnorm(n * m), ncol = m)
ddata[1:20, ] <- ddata[1:20, ] + 0.2
row.names(ddata) <- c(paste0("A", 1:20), paste0("B", 1:30))
ddist <- dist(ddata)
annotation <- data.frame(row.names = rownames(ddata), clust = substr(rownames(ddata), 1, 1))
annotation.colorCode <- c("red", "blue")
names(annotation.colorCode) <- c("A", "B")
####### run in sequential mode
####### sampling the samples ....
(aConsensus <- yaConsensus(ddist))
plot(aConsensus, G = 2)
ans <- plot(aConsensus, G = 2,
annotation = annotation,
annotation.colorCode = annotation.colorCode)
summary(ans)
summary(ans, given = "clust")
####### sampling the features ....
(aConsensus <- yaConsensus(ddata, runs= 20, epsilon = 0.2, is_by_sample = FALSE))
ans <- plot(aConsensus, G = 2,
annotation = annotation,
annotation.colorCode = annotation.colorCode,
matching_clustering = "clust")
summary(ans, given = "clust")
####### run in parallel mode
## uncomment to run
# require(doParallel)
# cpu_cluster <- makeCluster(3)
# registerDoParallel(cpu_cluster)
# (aConsensus <- yaConsensus(ddist))
# plot(aConsensus, G = 2)
#stopCluster(cpu_cluster)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.