This is a test version of Biostars. For the public version, visit https://www.biostars.org.
WGCNA - consensus analysis - cutreeStatic - no samples selected

Hello!

I'm currently trying to identify consensus gene sets between two different tissue types, Muscle/PBMC, using WGCNA.

I have two normalized count matrices from DESeq2 for each tissue type. I simply transposed them and made a list as written in the tutorial.

> nSets = 2;
> 
> setLabels = c("Muscle", "PBMC")
> shortLabels = c("Muscle", "PBMC")
> 
> multiExpr = vector(mode = "list", length = nSets)
> 
> multiExpr[[1]] = list(data = as.data.frame(t(cntNorm_muscle)));
> multiExpr[[2]] = list(data = as.data.frame(t(cntNorm_pbmc)));
> 
> exprSize = checkSets(multiExpr)
> exprSize
$nSets
[1] 2

$nGenes
[1] 23418

$nSamples
[1] 36 36

$structureOK
[1] TRUE

While following the steps in the tutorial, I encountered a problem that 'cutreeStatic' failed to pick the samples to be kept. nSamples were 0 0.

> for (set in 1:nSets)
+ {
+   # Find clusters cut by the line
+   labels <- cutreeStatic(sampleTrees[[set]], cutHeight = cutHeights[set])
+   # Keep the largest one (labeled by the number 1)
+   keep <- (labels==1)
+   multiExpr[[set]]$data <- multiExpr[[set]]$data[keep, ]
+ }
> 
> collectGarbage();
> # Check the size of the leftover data
> exprSize = checkSets(multiExpr)
> exprSize
$nSets
[1] 2

$nGenes
[1] 19004

$nSamples
[1] 0 0

$structureOK
[1] TRUE

I sat the cutheight high enough to cover all samples still I got 0 0 samples. I also check the cutreeStatic results and found none of samples were label with 1. How come WGCNA couldn't cut the trees as intended? Can anyone help me?

> cutreeStatic(sampleTrees[[1]], cutHeight = cutHeights[1])
 [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> cutreeStatic(sampleTrees[[2]], cutHeight = cutHeights[2])
 [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

FYI,

> cutHeights
[1] 6e+05 6e+05

> sampleTrees[[1]]$height
 [1]  16484.18  25836.46  32216.74  35307.74  35905.62  37133.48  37950.88  41846.43  43549.16  55866.53  61818.43  62851.72
[13]  64316.41  64653.67  65689.82  69606.64  70672.40  73954.10  76376.41  85008.73  86168.49  90321.42  91414.92 112718.35
[25] 115076.76 118800.65 126296.05 130568.74 149581.57 152108.47 165931.89 188281.41 238617.13 287446.07 585708.12

> sampleTrees[[2]]$height
 [1]   16499.12   24565.24   25181.20   28051.09   35179.36   36054.75   40314.80   47953.41   50462.81   50464.60   53223.79
[12]   53403.29   58119.68   59881.10   75830.31   88511.20   90003.12   90048.38  101188.62  105594.16  106010.83  107061.76
[23]  112152.86  112711.72  134007.36  144897.14  172335.21  197200.68  203269.72  252626.52  281625.70  420075.13  512717.55
[34] 1190471.26 3384086.76
rna-seq wgcna

2 answers

This may be too late to help you but maybe I can help others encountering the same issue. I was running into the same problem and the work-around I found was using the "cutree" function instead of "cutreeStatic" and it worked exactly as expected.

Hi,

Thanks, jfaberha - I was having the same problem, I used the function cutree instead of cutreeStatic and it omitted the problem however I still got the error:

Error in cutree(sampleTrees[[set]], cutHeight = cutHeights[set]) : unused argument (cutHeight = cutHeights[set])

But it looks like it does not affect further computations :)

Log in to answer this question.