thanks and I have a small question. I'm able to get the hub genes from the modules before merging i.e. from 34 modules. But I would like to know how to get the hub genes from the merged modules i.e. 17 modules. How to do it? The below code gave me hub genes from one of the modules before merging.
MEList = moduleEigengenes(datExpr, colors = dynamicColors)
MEs = MEList$eigengenes
# Calculate dissimilarity of module eigengenes
MEDiss = 1-cor(MEs); ### Is this correct?? Should use absolute correlation ???? YES ###
library(flashClust)
# Cluster module eigengenes
METree = flashClust(as.dist(MEDiss), method = "average");
# Plot the result
sizeGrWindow(7, 6)
plot(METree, main = "Clustering of module eigengenes", xlab = "", sub = "")
## merge: choose a height cut of 0.2, corresponding to correlation of 0.8, to merge
MEDissThres = 0.2
# Plot the cut line into the dendrogram
abline(h=MEDissThres, col = "red")
# Call an automatic merging function
merge = mergeCloseModules(datExpr,
dynamicColors, cutHeight = MEDissThres, verbose = 3)
# The merged module colors
mergedColors = merge$colors;
# Eigengenes of the new merged modules:
mergedMEs = merge$newMEs;
# Numeric module labels
moduleLabels = merge$colors
# Convert labels to colors
moduleColors = labels2colors(moduleLabels)
plotEigengeneNetworks(mergedMEs, "", marDendro = c(0,4,1,2), marHeatmap = c(3,4,1,2))
# calculate the module membership values
datKME=signedKME(datExpr, MEs)
FilterGenes= abs(datKME$kMEturquoise)>0.8
table(FilterGenes)
head(datExpr)[1:5,1:5]
dimnames(data.frame(datExpr))[[2]][FilterGenes]
So above I'm able to get the hub genes from module turquoise, but this module is before merging. After merging I see that this module and some other modules are clustered together. And I want to get hub genes from the clustered module. How to do it?