Question: WGCNA: outputting multiple hubgenes from a module
gravatar for RNAseqer
5 weeks ago by
RNAseqer 130
RNAseqer 130 wrote:

I know that WGCNA has the function chooseTopHubInEachModule() to pick the gene with the single highest connectivity within a module, but does it have a function to output several hubgenes from a module? Im looking through the manual and it certainly seems like it should be a straightforward task but I'm having some trouble executing it, so I thought I'd just ask if anyone had done this before.

wgcna hubgenes • 95 views
ADD COMMENTlink modified 5 weeks ago by Kevin Blighe61k • written 5 weeks ago by RNAseqer 130
gravatar for Kevin Blighe
5 weeks ago by
Kevin Blighe61k
University College London
Kevin Blighe61k wrote:


I would honestly just hack the function code and create my own function, if I were you. The code is simple:


function (datExpr, colorh, omitColors = "grey", power = 2, type = "signed", 
    isIndex = FALSE
    modules = names(table(colorh))
    if (![1])) 
        modules = modules[!is.element(modules, omitColors)]
    if (is.null(colnames(datExpr))) {
        colnames(datExpr) = 1:dim(datExpr)[2]
        isIndex = TRUE
    hubs = rep(NA, length(modules))
    names(hubs) = modules
    for (m in modules) {
        adj = adjacency(datExpr[, colorh == m], power = power, 
            type = type, ...)
        hub = which.max(rowSums(adj))
        hubs[m] = colnames(adj)[hub]
    if (isIndex) {
        hubs = as.numeric(hubs)
        names(hubs) = modules

The line that you'll probably want to change is:

hub = which.max(rowSums(adj))

Note that there are many hub-selection metrics.


ADD COMMENTlink written 5 weeks ago by Kevin Blighe61k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 666 users visited in the last hour