Question: plotEigengeneNetworks WGCNA add ME labels to left side of figure
0
gravatar for normingt
7 months ago by
normingt10
normingt10 wrote:

How do I add ME labels (ex. MEcyan) to the left hand side of my eigengene adjacency heatmap? I’ve seen this figure produced in publications. Is there an argument for the plotEigengeneNetworks function that I can use?

Here is my script that produces the heatmap with colours for labels, but lacks the text labels:

plotEigengeneNetworks(MEs, "APOE astrocytes eigengene adjacency heatmap", setMargins=TRUE, plotHeatmaps=TRUE, plotDendrograms=FALSE)

I tried colorLabels=FALSE and nothing changed.

I tried ySymbols=names(MEs) which gave an error that the number of ySymbols must match the number of rows in the adjacency matrix.

I tried to figure out how to create the eigengene adjacency matrix on my own so that I could use the WGCNA function labeledHeatmap and have more control, but I could not figure out how to do this.

Thank you! Louisa

wgcna ploteigengenenetworks R • 405 views
ADD COMMENTlink modified 6 months ago • written 7 months ago by normingt10
1

Thanks so much Kevin. I think I’ll try your function. Have a great weekend.

ADD REPLYlink written 6 months ago by normingt10

Cross-posted: https://support.bioconductor.org/p/126141/

ADD REPLYlink written 7 months ago by Kevin Blighe60k
0
gravatar for Kevin Blighe
7 months ago by
Kevin Blighe60k
Kevin Blighe60k wrote:

I think that the issue is just that particular function, which is a wrapper for multiple other WGCNA functions. You could probably just edit the code for that function and create your own version of it, or perform the module-to-trait correlations by invoking labeledHeatmap() separately, as shown in this part of the WGCNA tutorial: Relating consensus modules to external microarray sample information and exporting network analysis results (opens PDF).

aaaa

If all else fails, I've got a function on GitHub that can probably work for you, too: https://github.com/kevinblighe/CorLevelPlot

Kevin

ADD COMMENTlink written 7 months ago by Kevin Blighe60k

Thanks Kevin for your insight and suggestions. Since I do not know C++ to alter the code or have phenotype data, I see that I have 2 options. I can create faux phenotype data, create a labeledHeatmap as detailed the WGCNA tutorial you linked, and use Adobe photoshop to add the ME names to my eigengene adhacency heatmap. However, I am unsure if an edited figure would pass the editorial review process. Therefore my better bet could be to try your correlation heatmap function.

ADD REPLYlink written 7 months ago by normingt10

Hey, you could try my function, however, for the 'editing' idea, I mean to edit the R code. For example, you can access / view the function code by doing this:

require(WGCNA)
plotEigengeneNetworks
function (multiME, setLabels, letterSubPlots = FALSE, Letters = NULL, 
    excludeGrey = TRUE, greyLabel = "grey", plotDendrograms = TRUE, 
    plotHeatmaps = TRUE, setMargins = TRUE, marDendro = NULL, 
    marHeatmap = NULL, colorLabels = TRUE, signed = TRUE, heatmapColors = NULL, 
    plotAdjacency = TRUE, printAdjacency = FALSE, cex.adjacency = 0.9, 
    coloredBarplot = TRUE, barplotMeans = TRUE, barplotErrors = FALSE, 
    plotPreservation = "standard", zlimPreservation = c(0, 1), 
    printPreservation = FALSE, cex.preservation = 0.9, ...) 
{
    size = checkSets(multiME, checkStructure = TRUE)
    if (!size$structureOK) {
        multiME = fixDataStructure(multiME)
    }
    if (is.null(Letters)) 
        Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    if (is.null(heatmapColors)) 
        if (signed) {
            heatmapColors = blueWhiteRed(50)
        }
        else {
            heatmapColors = heat.colors(30)
        }
    nSets = length(multiME)
    cex = par("cex")
    mar = par("mar")
    nPlotCols = nSets
    nPlotRows = as.numeric(plotDendrograms) + nSets * as.numeric(plotHeatmaps)
    if (nPlotRows == 0) 
        stop("Nothing to plot: neither dendrograms not heatmaps requested.")
    par(mfrow = c(nPlotRows, nPlotCols))
    par(cex = cex)
    if (excludeGrey) 
        for (set in 1:nSets) multiME[[set]]$data = multiME[[set]]$data[, 
            substring(names(multiME[[set]]$data), 3) != greyLabel]
    plotPresTypes = c("standard", "hyperbolic", "both")
...

You would then copy that code, edit it, and then create a new function called, e.g., plotEigengeneNetworks_edit() - this can become messy, though. Otherwise, you could just initialise the function parameters yourself and then go through it line by line until you get to the relevant parts.

I'm not sure what you need to change exactly, though.

ADD REPLYlink written 7 months ago by Kevin Blighe60k
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: 2226 users visited in the last hour