Question: Eigen genes using WGCNA
2
gravatar for shivangi.agarwal800
3 months ago by
shivangi.agarwal80040 wrote:

Hi

I am using WGCNA to calculate eigen genes using tutorial https://horvath.genetics.ucla.edu/html/CoexpressionNetwork/Rpackages/WGCNA/Tutorials/FemaleLiver-02-networkConstr-man.pdf I just want to check or list out name of eigen gene in each module, but I could not. Can anyone suggest?

Regards

eigengenes wgcna • 435 views
ADD COMMENTlink modified 6 weeks ago by Biostar ♦♦ 20 • written 3 months ago by shivangi.agarwal80040
1

Paste what you have tried; otherwise, nobody will respond.

ADD REPLYlink written 3 months ago by Kevin Blighe33k

Agree with Kevin's point.

you can try with this code to extract modules..

Extract modules

module_colors= setdiff(unique(dynamicColors), "grey")
for (color in module_colors){
    module=SubGeneNames[which(dynamicColors==color)]
    write.table(module, paste("module_",color, ".txt",sep=""), sep="\t", row.names=FALSE, col.names=FALSE,quote=FALSE)

}
ADD REPLYlink written 3 months ago by Mike1.1k
mydata = read.csv("data.csv", sep = "\t");
datExpr0 = as.data.frame(t(mydata[, -c(1)]));
rownames(datExpr0) = names(mydata)[-c(1)];
sampleTree = hclust(dist(datExpr0), method = "average");
table(clust)
traitData = read.csv("trait2.csv");
allTraits = traitData[,];
femaleSamples = rownames(datExpr);
traitRows = match(femaleSamples, allTraits$CaseID);
datTraits = allTraits[traitRows,-1];
rownames(datTraits) = allTraits[traitRows,1];
# Re-cluster samples
sampleTree2 = hclust(dist(datExpr), method = "average")
# Convert traits to a color representation: white means low, red means high, grey means missing entry
traitColors = numbers2colors(datTraits, signed = FALSE);
# Choose a set of soft-thresholding powers
powers = c(c(1:10), seq(from = 12, to=20, by=2))
sft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5)
# Plot the results:
sizeGrWindow(9, 5)
par(mfrow = c(1,2));
cex1 = 0.9;
# Scale-free topology fit index as a function of the soft-thresholding power
plot(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
     xlab="Soft Threshold (power)",ylab="Scale Free Topology Model Fit,signed R^2",type="n",
     main = paste("Scale independence"));
text(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
     labels=powers,cex=cex1,col="red");
abline(h=0.90,col="red")
plot(sft$fitIndices[,1], sft$fitIndices[,5],
     xlab="Soft Threshold (power)",ylab="Mean Connectivity", type="n",
     main = paste("Mean connectivity"))
text(sft$fitIndices[,1], sft$fitIndices[,5], labels=powers, cex=cex1,col="red")
softPower = 10;
adjacency = adjacency(datExpr, power = softPower);
TOM = TOMsimilarity(adjacency);
dissTOM = 1-TOM
geneTree = hclust(as.dist(dissTOM), method = "average");
minModuleSize = 30;
dynamicMods = cutreeDynamic(dendro = geneTree, distM = dissTOM,
                            deepSplit = 2, pamRespectsDendro = FALSE,
                            minClusterSize = minModuleSize);
table(dynamicMods)
dynamicColors = labels2colors(dynamicMods)
table(dynamicColors)
# Calculate eigengenes
MEList = moduleEigengenes(datExpr, colors = dynamicColors)
MEs = MEList$eigengenes
MEDiss = 1-cor(MEs);
METree = hclust(as.dist(MEDiss), method = "average");
MEDissThres = 0.25
# Plot the cut line into the dendrogram
abline(h=MEDissThres, col = "red")
# Call an automatic merging function
merge = mergeCloseModules(datExpr, dynamicColors, cutHeight = MEDissThres, verbose = 3)
# The merged module colors
mergedColors = merge$colors;
# Eigengenes of the new merged modules:
mergedMEs = merge$newMEs;
moduleColors = mergedColors
colorOrder = c("grey", standardColors(50));
moduleLabels = match(moduleColors, colorOrder)-1;

MEList$eigengenes$MEblack
  [1]  0.0241169910 -0.0120321545  0.0151839828 -0.0096772173 -0.0406240823 -0.0340541878 -0.0212249015 -0.0236107441

I just want to print name of eigengene in each module, I have tried using MEList, MEs, MEList$eigengenes but could not get the name of gene, when I tried using MEList$eigengenes$MEsblack, it printed result as above. But I want to have name of that eigengene in each module.

ADD REPLYlink modified 12 weeks ago by Kevin Blighe33k • written 12 weeks ago by shivangi.agarwal80040

Hi Mike

I want to extract eigengenes in each module and not modules, I have given all codes I followed and the one I tried for eigengenes extraction, but could not do. Please look into it.

Thanks in advance

ADD REPLYlink written 12 weeks ago by shivangi.agarwal80040

This script will give you name of genes in each module

ADD REPLYlink written 12 weeks ago by Mike1.1k

Ya MiKe you are right But I want to also know the name of eigengene in each module.

Regards

ADD REPLYlink written 12 weeks ago by shivangi.agarwal80040

Hello

Can anyone tell how to print out the ME (module eigengenes) while using WGCNA?

Regards Shivangi

ADD REPLYlink written 12 weeks ago by shivangi.agarwal80040
1

Please don't post another question as an answer. We will get around to it when we have time. We are volunteers here, each with our own full-time job (or jobs) and struggles that we face.

ADD REPLYlink written 12 weeks ago by Kevin Blighe33k

Ok,I am sorry Kevin. But, it is not the other question, it is the same question.

With regards

ADD REPLYlink written 12 weeks ago by shivangi.agarwal80040

Please use ADD REPLY/ADD COMMENT when responding to existing posts to keep threads logically organized. Do not use SUBMIT ANSWER to add comments.

ADD REPLYlink written 12 weeks ago by genomax59k

OK genomax, thanks for the information. Actually, I am new to it.. Anyway, thanks

With regards

ADD REPLYlink written 12 weeks ago by shivangi.agarwal80040
0
gravatar for Kevin Blighe
12 weeks ago by
Kevin Blighe33k
Republic of Ireland
Kevin Blighe33k wrote:

I have looked up previous WGCNA code that I used and you should be able to produce the gene-to-eigengene colour assignments via:

data.frame(colnames(datExpr), mergedColors)

Kevin

ADD COMMENTlink modified 26 days ago • written 12 weeks ago by Kevin Blighe33k

Thanks Kevin for your reply. When I used the code as mentioned by you,

 data.frame(colnames(datExpr), mergedColors)

it gave me like,

 colnames.datExpr. mergedColors
1                1-Dec         grey
2                1-Mar         grey
3               12-Sep         grey
4                4-Sep         grey
5                 A1BG         grey
6                  A2M         blue
7                 AACS         grey
8                AADAC         grey
9              AADACL2         grey
10             AADACL3       purple
11             AADACL4         grey
12                AASS         grey
13            AB074188         grey
14            AB209061          red

But, I want the name of eigen-gene in each module calculated by WGCNA to merge modules.

Means I want to print the name of ME (module eigen-gene) in each of the module created by WGCNA. I assume that if there are 20 modules, there must be 20 eigen-genes, each from one module. I just want to have them.

Thanks in advance.

ADD REPLYlink modified 12 weeks ago by RamRS19k • written 12 weeks ago by shivangi.agarwal80040

...but, black is just MEblack, grey is MEgrey, et cetera.

An eigen-gene is an abstraction of a gene - the eigen-gene values are unit-less and are derived via PCA.

Conversely, a module is an abstraction of an eigenvector.

ADD REPLYlink written 12 weeks ago by Kevin Blighe33k

Hi Kevin, I have a small question about WGCNA, could you please give me some advice? the post are at: Different result from WGCNA tutorial I.

ADD REPLYlink written 12 weeks ago by afli140

You have some gene names converted to dates:

https://genomebiology.biomedcentral.com/articles/10.1186/s13059-016-1044-7

ADD REPLYlink written 12 weeks ago by h.mon21k
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: 1275 users visited in the last hour