WGNCA colors for bar plots
1
0
Entering edit mode
@akridgerunner-7719
Last seen 7.9 years ago
United States

Hello, this isn't quite a WGCNA question as it involves plotting WGCNA output, but I'll ask nonetheless. I'm trying to make a bar plot of KME values for a given probe within the network modules:

KME.colors
as.matrix(KME.vals)
dev.off()
par(mar = c(10, 5, 5, 5)); # bottom, left, top, right margins
barplot( as.matrix(KME.vals), main=paste( probe, "WGCNA KME values"), col=KME.colors, las=3,
         ylab="Probe correlation to module")

Which outputs:

> KME.colors
 [1] "orange"        "purple"        "grey"          "blue"          "lightyellow"   "red"           "darkgrey"     
 [8] "greenyellow"   "darkgreen"     "skyblue"       "lightcyan"     "darkorange"    "tan"           "cyan"         
[15] "lightgreen"    "royalblue"     "pink"          "midnightblue"  "yellow"        "grey60"        "darkturquoise"
[22] "salmon"        "brown"         "white"         "magenta"       "black"         "green"         "darkred"      
[29] "turquoise"    
> as.matrix(KME.vals)
                  KMEorange   KMEpurple     KMEgrey    KMEblue KMElightyellow     KMEred KMEdarkgrey KMEgreenyellow
MCM4 (turquoise) 0.01462564 -0.02791667 -0.04086319 0.09019856     -0.1279744 -0.1456679   -0.147187     -0.1590669
                 KMEdarkgreen KMEskyblue KMElightcyan KMEdarkorange     KMEtan    KMEcyan KMElightgreen KMEroyalblue
MCM4 (turquoise)   -0.1958627 -0.2175926   -0.2381884     0.2432537 -0.2707614 -0.2782734    -0.2814852    0.3066307
                    KMEpink KMEmidnightblue KMEyellow  KMEgrey60 KMEdarkturquoise KMEsalmon KMEbrown KMEwhite
MCM4 (turquoise) -0.3369391      -0.3858618 0.4087018 -0.4163105       -0.4432651 0.4635529 0.468053 0.475234
                 KMEmagenta  KMEblack   KMEgreen KMEdarkred KMEturquoise
MCM4 (turquoise) -0.4954438 0.5961958 -0.6153285 -0.6885074    0.8033355

But every single bar in the resulting figure is orange, so for some reason the barplot() function doesn't like my KME.colors vector. What to do?

Oh and while we're on this the KME of the module a probe has been placed within should be the closest to 1, correct? And the least correlated module KME must be closest to -1?

Thanks, Rob

WGCNA • 1.2k views
ADD COMMENT
1
Entering edit mode
@peter-langfelder-4469
Last seen 23 days ago
United States

This seems to be a feature (bug) of barplot. See ?barplot, description of "col". Leave out the as.matrix and you should get the colors correctly.

Probes should have a relatively high kME to their own module, although sometimes they will have higher kME to another module (because the clustering is based on TOM, not on correlations). I don't know what "least correlated module" means - if you define it by lowest kME, then by definition yes.

 

Peter

ADD COMMENT

Login before adding your answer.

Traffic: 765 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