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?