1
$\begingroup$

I am trying to find hub genes for modules made using WGCNA:

hub = chooseTopHubInEachModule(datExpr, moduleColors)

But I am getting error:

Error in hubs[m] <- colnames(adj)[hub] : replacement has length zero

Thank you for the help1

$\endgroup$
2
  • $\begingroup$ Cross-posted on biostars: biostars.org/p/9486378 Please don't shotgun post on multiple fora. See this discussion: bioinformatics.meta.stackexchange.com/questions/265/… $\endgroup$
    – Ram RS
    Aug 24, 2021 at 21:57
  • $\begingroup$ Can you please share the code, how you fixed this problem? I am facing the same problem and my data has colnames. Any help will be appreciated. Thanks $\endgroup$
    – Mazbi
    Jan 17, 2023 at 21:18

1 Answer 1

1
$\begingroup$

The most likely culprit here is that your expression data (the datExpr input to chooseTopHubInEachModule) has no colnames. Check that your data do have appropriate column names. Also check that the module color vector you supply has at least actual module (type table(moduleColors) and check that you have at least one module apart from "grey" or 0).

$\endgroup$
2
  • $\begingroup$ thanks as it worked. I have another question for extracting genes within modules of interest. I used unsigned network and interested in two modules for a trait. Earlier I made scatter plot and extracted the genes in all the modules. But now I only want to extract genes in these two modules for further analysis. I am not able to find a tutorial with more than one module. Can you please suggest something? Thank you1 $\endgroup$ Aug 27, 2021 at 16:20
  • $\begingroup$ Well, there are a few sections of the tutorial that may help. You can export the entire network analysis results (which you should do anyway) as illustrated in section 3d and then restrict the table (or just the gene identifiers) to the two modules you want. Alternatively, section 4a shows how to export gene identifiers in selected modules. $\endgroup$ Aug 28, 2021 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.