WGCNA for diferent stages (I-IV)
Entering edit mode
9 weeks ago
txtbookir ▴ 10

I wanted to share my issue with WGCNA. any help would be very valuable for me

I wanted to know that for identifying modules related with Stage I to Stage IV, how can i binarize these stages into 0, 1, 2, 3, respectively? i have to to this on excel as below:

enter image description here

and then in the bellow code?how to change it?

x = rep(c("stage_I", "stage_II", "stage_III", "stage_IV"), each = 4)
# Binarize it into pairwise indicators
out = binarizeCategoricalVariable(x,
includePairwise = TRUE, 
includeLevelVsAll = FALSE);
# Print the variable and the indicators
data.frame(x, out);

And is this a good idea? before seeing your good suggestion i wanted to separately analyze per-proccessed DEGs from TCGAbiolink with WGCNA, but for TCGA-COADREAD, 4 different analysis for stages is required, and this is a bad idea.

thank you

TCGA WGCNA • 252 views
Entering edit mode
9 weeks ago

You can run WGCNA separately for each Stage, or you can run WGCNA using all Stages combined. In the 'combined' approach, once you derive your WGCNA modules, you would then 'correlate' the modules to the clinical data, i.e., run a logistic regression between Stage and Module: Module ~ Stage. In this situation, you should encode Stage as a categorical variable, and order it logically. For example:

metadata$Stage <- factor(metadata$Stage,
  levels = c('stage1','stage2','stage3','stage4'))

WGCNA is quite flexible and there are many ways to use its function. I believe there is a tutorial where they go over this part (clinical trait correlation):

We also did it, here:


Entering edit mode

great help, thanks a million.


Login before adding your answer.

Traffic: 2419 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6