Can somebody explain why I am seeing certain clusters overlap? I tried reproducing the results in Python and in R and I'm seeing a similar pattern.
I have 2 main questions:
(1) Do the colors from WGCNA get repeated? It looks like the 2nd red cluster from the left should be a different color based on my Python plots. Did I plot something incorrectly or is this a known bug of either WGCNA or dynamicTreeCut?
(2) If not (1), why are the clusters overlapping? Is there a parameter I can adjust that controls for this?
Here is the link to the dataframe: https://drive.google.com/file/d/1vp_jx8CfD90bvFcS6sbWN59U-_DQa48L/view?usp=sharing
Here's my Rcode:
library(dynamicTreeCut)
library(fastcluster)
library(WGCNA)
# Read in dataframe
read_dataframe = function(path, sep="\t") {
df = read.table(path, sep=sep, row.names=1, header = TRUE, check.names=FALSE)
return(df)
}
df_adj = read_dataframe("~/adj.tsv")
# Convert to dissimilarity
df_dism = 1 - df_adj
# Compute hierarchical clustering linkage
Z = hclust(as.dist(df_dism), method="ward.D2")
# Cut the dendrogram
treecut_output = cutreeDynamic(
dendro=Z,
method="hybrid",
distM=df_dism,
minClusterSize = 10,
deepSplit=2,
)
# Plot dendrogram
plotDendroAndColors(
dendro=Z,
colors=treecut_output,
)
Here is my python representation using the same parameters: