<p>Please follow the code in <a href="https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/index.html" rel="nofollow noreferrer">WGCNA tutorial</a> section 2c. Since the analysis ran in blockwise manner, you need to plot the dendrograms for each block separately and subset the module colors to each block. The example code is in the tutorial.</p>

CC BY-SA 4.0
2023-08-18T14:56:39.983Z
2023-08-18T14:56:39.983Z
Peter Langfelder
<h1>检查长度</h1>
<p>length(net<span class="math-container">$colors)
length(net$</span>dendrograms[[1]]$order)</p>
<h1>如果颜色向量太短，重复颜色以匹配顺序向量的长度</h1>
<p>net<span class="math-container">$colors &lt;- rep(net$</span>colors, length.out = length(net<span class="math-container">$dendrograms[[1]]$</span>order))</p>

CC BY-SA 4.0
2024-10-20T00:23:08.503Z
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Community
CC BY-SA 4.0
2024-10-19T11:29:30.907Z
2024-10-19T11:29:30.907Z
zhangboyang
<pre class="lang-r prettyprint-override"><code>plotDendroAndColors(bwnet$dendrograms[[1]], cbind(bwnet$unmergedColors, bwnet$colors),
                    c(&quot;unmerged&quot;, &quot;merged&quot;),
                    dendroLabels = FALSE,
                    addGuide = TRUE,
                    hang= 0.03,
                    guideHang = 0.05)
</code></pre>
<p>I am getting the following error. colrs modules are not coming in  dendrogram graph. I am using 4gb ram laptop. is this problem because of laptop or my mistake in understanding code.</p>
<pre class="lang-r prettyprint-override"><code>Error in .plotOrderedColorSubplot(order = order, colors = colors,
rowLabels = rowLabels, : Length of colors vector not compatible with
number of objects in 'order'. madam getting this error.
</code></pre>
<p>My total genes are 15456. Under blockwisemodule I chose 5000</p>

CC BY-SA 4.0
2023-08-13T16:54:38.990Z
Welcome to the site. Firstly, what data set is this? Weighted correlation network analysis (WGCNA) whilst published in a bioinformatics journal could be applied to any data set, i.e. not necessarily a biological data set. The context of this question is quite important. WGCNA (2008) is not widely used and there could be alternative approaches.
M__
<r><bioconductor><wgcna>
WGCNA error: Length of colors vector not compatible with number of objects in 'order'
# WGCNA error: Length of colors vector not compatible with number of objects in 'order'

(Asked by: username_0 on 2023-08-13)

plotDendroAndColors(bwnet$dendrograms[[1]], cbind(bwnet$unmergedColors, bwnet$colors),
                    c("unmerged", "merged"),
                    dendroLabels = FALSE,
                    addGuide = TRUE,
                    hang= 0.03,
                    guideHang = 0.05)

I am getting the following error. colrs modules are not coming in  dendrogram graph. I am using 4gb ram laptop. is this problem because of laptop or my mistake in understanding code.
Error in .plotOrderedColorSubplot(order = order, colors = colors,
rowLabels = rowLabels, : Length of colors vector not compatible with
number of objects in 'order'. madam getting this error.

My total genes are 15456. Under blockwisemodule I chose 5000

**Tags:** r, bioconductor, wgcna
> **Comments:**
> **username_1**: Welcome to the site. Firstly, what data set is this? Weighted correlation network analysis (WGCNA) whilst published in a bioinformatics journal could be applied to any data set, i.e. not necessarily a biological data set. The context of this question is quite important. WGCNA (2008) is not widely used and there could be alternative approaches.  

---

## 2 answers

### Answer by username_2 on 2023-08-18. Score: 1

Please follow the code in [WGCNA tutorial](https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/index.html) section 2c. Since the analysis ran in blockwise manner, you need to plot the dendrograms for each block separately and subset the module colors to each block. The example code is in the tutorial.


---

### Answer by username_3 on 2024-10-19. Score: 0

# 检查长度

length(net$colors)
length(net$dendrograms[[1]]$order)

# 如果颜色向量太短，重复颜色以匹配顺序向量的长度

net$colors <- rep(net$colors, length.out = length(net$dendrograms[[1]]$order))

> **Comments:**
> **username_4**: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  

---

