Question: WGCNA package in R: dendogram plot error
4
gravatar for zyr123
2.7 years ago by
zyr12340
zyr12340 wrote:

Hi, I am new to WGCNA and I am trying to plot a dendogram using WGCNA package in R.

plotDendroAndColors(sampleTree2, traitColors,
>                     groupLabels = names(datTraits),
>                     main = "Sample dendrogram and trait heatmap")

This is the error I get:

Error in plotOrderedColors(dendro$order, colors = colors, rowLabels = rowLabels, : ERROR: length of colors vector not compatible with number of objects in 'order'.

Any ideas on how to resolve this? Many thanks!

R wgcna • 2.7k views
ADD COMMENTlink modified 2.2 years ago by pakajpol10 • written 2.7 years ago by zyr12340

Zyr123, Were you able to fix the problem, I'm having the same problem. Thanks!

ADD REPLYlink written 2.3 years ago by DataFanatic140

Also running into the same issue. Anyone able to get is working? Thanks!

mine was running this part though:

> plotDendroAndColors(geneTree,
>                     cbind(moduleColors, bwModuleColors),
>                     c("Single block", "2 blocks"),
>                     main = "Single block gene dendrogram and module colors",
>                     dendroLabels = FALSE, hang = 0.03,
>                     addGuide = TRUE, guideHang = 0.05)

Error in plotOrderedColors(dendro$order, colors = colors, rowLabels = rowLabels, : ERROR: length of colors vector not compatible with number of objects in 'order'.

This is my net

net = blockwiseModules(datExpr, power = 6,
                       TOMType = "unsigned", minModuleSize = 30,
                       reassignThreshold = 0, mergeCutHeight = 0.25,
                       numericLabels = TRUE, pamRespectsDendro = FALSE,
                       saveTOMs = TRUE,
                       saveTOMFileBase = "All_sample_TOM", 
                       verbose = 3)

And this is my bwnet

bwnet = blockwiseModules(datExpr, maxBlockSize = 2000,
                         power = 6, TOMType = "unsigned", minModuleSize = 30,
                         reassignThreshold = 0, mergeCutHeight = 0.25,
                         numericLabels = TRUE,
                         saveTOMs = TRUE,
                         saveTOMFileBase = "All_sample_TOM-blockwise",
                         verbose = 3)

I have 6720 genes (RNA-Seq data)

ADD REPLYlink modified 2.2 years ago • written 2.2 years ago by madzayasodara10
1
gravatar for pakajpol
2.2 years ago by
pakajpol10
pakajpol10 wrote:

Hi,

blockwiseModules function have a default max block size of 5000. Thus your data is split in 2 blocks ...2 dendrograms are produced each for cca. half of your genes...the module membership objects (moduleColors, bwModuleColors) however are both of the total length. So when you call a dendrogram it's "order" object is shorter than objects (moduleColors, bwModuleColors) and you get an error.

fix: 1) set maxBlochSize=7000 and you will get a single dendro for all genes 2) or subset the genes in (moduleColors, bwModuleColors) to contain only the ones in block 1 and then match dendro1 with sub setted moduleColors

and read this : https://labs.genetics.ucla.edu/horvath/htdocs/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-02-networkConstr-blockwise.pdf

ADD COMMENTlink written 2.2 years ago by pakajpol10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1977 users visited in the last hour