How to keep track of gene names during WGCNA analysis for cutTreedynamic() and moduleEigengene()?
Entering edit mode
yifangt ▴ 20
Last seen 3.9 years ago

I want to save the assignment of each gene on corresponding modules after cutreeDynamic(), and similarly, for merged moduleEigengenes().  I used cbind() [or merge() ] function to combine the gene names and the module/color symbols. Although in this case the order of the rows is always the same, this seems not safe to me.

The purpose I do this is to get the hub genes of each module, and keep track of the genes which are merged.

What is the correct way for this purpose without the rownames in the data.frame during analysis?

Which is the part I may have missed with WGCNA to keep track the genes/rownames of the data during analysis?

datExpr=read.csv("final_expression_table.csv", head=TRUE)      
rownames(datExpr) <-datExpr$geneName

geneName      DRR003149 DRR003150 DRR003151 DRR003152
gene0000118.1       2.0       1.8       0.7       0.7
gene0000248.1       0.0       0.0       0.0       0.0
gene0000960.1       3.5       2.6       2.9       2.8
gene0001800.1       2.1       1.7       1.2       0.7
gene0001800.2       3.8       8.8       9.0       6.6

dynamicMods = cutreeDynamic(dendro= geneTree, distM= dissTOM, deepSplit=2, pamRespectsDendro= FALSE, minClusterSize= minModuleSize)
dynamicColors= labels2colors(dynamicMods)

genesMatchcolors <- cbind(dynamicColors, names(datExpr))

write.csv(genesMatchcolors, file="gene_names_dynamicColors_match.csv")

MEList= moduleEigengenes(datExpr, colors= dynamicColors, softPower = 7)
MEs= MEList$eigengenes

write.csv(cbind(MEList, names(datExpr)), file="gene_names_module_match.csv")
write.csv(MEs, file="Module_Eigengenes_dataframe.csv")


Thanks a lot!

WGCNA cbind merge match gene names and Eigengene/module/colorlabels • 981 views

Login before adding your answer.

Traffic: 557 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