getDendro()
computes the distance between the rows of a matrix and
performs hierarchical clustering. Possible distance measures include
euclidean
, pearson
, and bicor
. The function also
optionally transposes the matrix.
Usage
getDendro(
x,
transpose = FALSE,
distance = c("euclidean", "pearson", "bicor"),
maxPOutliers = 0.1,
verbose = TRUE
)
Arguments
- x
A
numeric matrix
.- transpose
A
logical(1)
specifying whether to transpose thematrix
.- distance
A
character(1)
indicating which distance measure to use. Possible values includeeuclidean
,pearson
, andbicor
.- maxPOutliers
A
numeric(1)
specifying the maximum percentile that can be considered outliers on each side of the median for thebicor
statistic.- verbose
A
logical(1)
indicating whether messages should be printed.
Value
An stats::hclust object that describes the clustering tree.
Details
Euclidean distance is calculated by stats::dist()
, where
method = "euclidean"
, while Pearson correlation and biweight
midcorrelation (bicor) are computed by WGCNA::cor()
and WGCNA::bicor()
,
respectively. The cor
and bicor
are then subtracted from 1 to
calculate the dissimilarity. Hierarchical clustering is done by
stats::hclust()
, where method = "average"
.
See also
plotDendro()
to visualize dendrograms fromgetDendro()
.
Examples
if (FALSE) {
# Assess Sample Similarity
getDendro(methAdj, distance = "euclidean") %>%
plotDendro(file = "Sample_Dendrogram.pdf", expandY = c(0.25,0.08))
# Examine Correlations between Modules
moduleDendro <- getDendro(MEs, distance = "bicor")
plotDendro(moduleDendro, labelSize = 4, nBreaks = 5,
file = "Module_ME_Dendrogram.pdf")
# Characterize Correlations between Samples
sampleDendro <- getDendro(MEs, transpose = TRUE, distance = "bicor")
plotDendro(sampleDendro, labelSize = 3, nBreaks = 5,
file = "Sample_ME_Dendrogram.pdf")
# Examine Correlations between Traits
traitDendro <- getCor(MEs, y = colData, corType = "bicor",
robustY = FALSE) %>%
getDendro(transpose = TRUE)
plotDendro(traitDendro, labelSize = 3.5, expandY = c(0.65,0.08),
file = "Trait_Dendrogram.pdf")
}