-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTrait Correlation.R
More file actions
91 lines (91 loc) · 3.98 KB
/
Trait Correlation.R
File metadata and controls
91 lines (91 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
lnames_0 = load(file = "PFC_Anxiety_dataInput.RData");
#The variable lnames contains the names of loaded variables.
lnames_0
# Load network data saved in the second part.
lnames_0 <- load(file = "PFCdata_autonetwork.RData")
lnames_0
nGenespfc = ncol(datExpr0);
nSamplespfc = nrow(datExpr0);
# Recalculate MEs with color labels
MEs_0 = moduleEigengenes(datExpr_0, moduleColors0)$eigengenes
MEs0 = orderMEs(MEs_0)
moduleTraitCor0 = cor(MEs0, datTraits0);
moduleTraitPvalue0 = corPvalueStudent(moduleTraitCor0, nSamplespfc);
textMatrix0 = paste(signif(moduleTraitCor0, 2), "\n(",
signif(moduleTraitPvalue0, 1), ")", sep = "");
dim(textMatrix0) = dim(moduleTraitCor0)
par(mar = c(3.5,6,0.89,0.2));
# Display the correlation values within a heatmap plot
labeledHeatmap(Matrix = moduleTraitCor0,
xLabels = names(datTraits0),
yLabels = names(MEs0),
ySymbols = names(MEs0),
colorLabels = FALSE,
colors = greenWhiteRed(50),
textMatrix = textMatrix0,
setStdMargins = FALSE,
cex.text = 0.7,
zlim = c(-1,1),
main = paste("Module-anxiety relationships-PFC"))
#-------------------------------------------------------------------------
#NAC
lnames_1 = load(file = "NAC_Anxiety_dataInput.RData");
#The variable lnames contains the names of loaded variables.
lnames_1
# Load network data saved in the second part.
lnames_1 <- load(file = "NACdata_autonetwork.RData")
lnames_1
nGenesnac = ncol(datExpr_1_corr);
nSamplesnac = nrow(datExpr_1_corr);
# Recalculate MEs with color labels
MEs_1 = moduleEigengenes(datExpr_1_corr, moduleColors1)$eigengenes
MEs1 = orderMEs(MEs_1)
moduleTraitCor1 = cor(MEs1, datTraits1);
moduleTraitPvalue1 = corPvalueStudent(moduleTraitCor1, nSamplesnac);
textMatrix1 = paste(signif(moduleTraitCor1, 2), "\n(",
signif(moduleTraitPvalue1, 1), ")", sep = "");
dim(textMatrix1) = dim(moduleTraitCor1)
par(mar = c(1.5,6,0.89,0.2));
# Display the correlation values within a heatmap plot
labeledHeatmap(Matrix = moduleTraitCor1,
xLabels = names(datTraits1),
yLabels = names(MEs1),
ySymbols = names(MEs1),
colorLabels = FALSE,
colors = greenWhiteRed(50),
textMatrix = textMatrix1,
setStdMargins = FALSE,
cex.text = 0.5,
zlim = c(-1,1),
main = paste("Module-anxiety relationships-NAC"))
##-------------
##VTA
lnames_2 = load(file = "VTA_Anxiety_dataInput.RData");
#The variable lnames contains the names of loaded variables.
lnames_2
# Load network data saved in the second part.
lnames_2 <- load(file = "VTAdata_autonetwork.RData")
lnames_2
nGenesvta = ncol(datExpr_2_corr);
nSamplesvta = nrow(datExpr_2_corr);
# Recalculate MEs with color labels
MEs_2 = moduleEigengenes(datExpr_2_corr, moduleColors2)$eigengenes
MEs2 = orderMEs(MEs_2)
moduleTraitCor2 = cor(MEs2, datTraits2);
moduleTraitPvalue2 = corPvalueStudent(moduleTraitCor2, nSamplesvta);
textMatrix2 = paste(signif(moduleTraitCor2, 2), "\n(",
signif(moduleTraitPvalue2, 1), ")", sep = "");
dim(textMatrix2) = dim(moduleTraitCor2)
par(mar = c(1.5,6,0.89,0.2));
# Display the correlation values within a heatmap plot
labeledHeatmap(Matrix = moduleTraitCor2,
xLabels = names(datTraits2),
yLabels = names(MEs2),
ySymbols = names(MEs2),
colorLabels = FALSE,
colors = greenWhiteRed(50),
textMatrix = textMatrix2,
setStdMargins = FALSE,
cex.text = 0.5,
zlim = c(-1,1),
main = paste("Module-anxiety relationships-VTA"))