I am working with Hovarth's tutorial (https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/index.html) to explore connections between gene expression and formed modules using a network analysis approach (R package WGCNA) in my RNAseq data set.
While exploring step 5 of Part 1 (Network visualization using WGCNA functions; See R script here: https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-05-Visualization.R) I receive an error that I cannot seem to figure out. See below for code:
# Calculate topological overlap
dissTOM = 1-TOMsimilarityFromExpr(datExprSe, power = 6);
# Transform dissTOM with a power to make moderately strong connections more visible in the heatmap
plotTOM = dissTOM^7;
# Set diagonal to NA for a cleaner, more readable plot
diag(plotTOM) = NA;
# Call the plot function
sizeGrWindow(9,9) # left as Hovarth default
TOMplot(plotTOM, geneTree, moduleColors, main = "Network heatmap plot, all genes") # After running this I get the error seen below in bold
Error in x[, iy] : subscript out of bounds
Note: I ran the entire tutorial without issue using Hovarth's data set and code. My input is modeled after how their tutorial was created. Any help/advice is welcome!
I am having exactly the same issue.
This happen because the gene tree and plotTOM have different number of genes. I would open a new thread and post the entire code used to generate
datExprSe
,geneTree
andmoduleColors