A WGCNA analysis, need to build a matrix later, take TCGA_AML_Members and consMembers for fisher test
2
0
Entering edit mode
2.9 years ago

I am doing a WGCNA analysis, and there is a piece of code in it: I need to build a matrix later, take TCGA_AML_Members and consMembers for fisher test:

Numbers of femaleand consensus modules

nTCGA_AML_Mods =length(TCGA_AML_Modules)

nConsMods =length(consModules)

Initialize tablesof p-values and of the corresponding counts

pTable = matrix(0,nrow = nTCGA_AML_Mods, ncol = nConsMods);

CountTbl =matrix(0, nrow = nTCGA_AML_Mods, ncol = nConsMods);

Execute all pairwaisecomparisons

for (Tmod in 1: nTCGA_AML_Mods)

for (Cmod in 1: nConsMods)

{

TCGA_AML_Members =(TCGA_AML_Colors == TCGA_AML_Modules[Tmod]);

consMembers =(moduleColors == consModules[Cmod]);

pTable[Tmod, Cmod]= -log10(fisher.test(TCGA_AML_Members, consMembers, alternative = "greater")$p.value);

CountTbl[Tmod, Cmod]= sum(TCGA_AML_Colors == TCGA_AML_Modules[Tmod] & moduleColors ==consModules[Cmod])

}

Error in fisher. Test(TCGA_AML_Members, consMembers, alternative = "greater") :

how can i do this?

R fisher test WGCNA • 968 views
ADD COMMENT
0
Entering edit mode
2.9 years ago

enter image description here

ADD COMMENT
0
Entering edit mode
2.9 years ago
LChart 5.1k

Fisher test needs a 2x2 table. Try fisher.test(table(TCGA, cons), ...). You also may need to use factor(TCGA, levels=(0,1)) for each argument, or else cases where there aren't any overlap will result in a 1x2 table and break the function.

ADD COMMENT

Login before adding your answer.

Traffic: 2840 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6