View source: R/Explore_Module_Trait_Correlations.R
| getMEtraitCor | R Documentation |
getMEtraitCor() calculates correlation coefficients and p-values
between eigennode values for all modules and all sample traits and saves it
as a .txt file. Correlations are performed using either pearson or
bicor methods.
getMEtraitCor(
MEs,
colData,
corType = c("bicor", "pearson"),
maxPOutliers = 0.1,
robustY = FALSE,
save = TRUE,
file = "ME_Trait_Correlation_Stats.txt",
verbose = TRUE
)
MEs |
A |
colData |
A |
corType |
A |
maxPOutliers |
A |
robustY |
A |
save |
A |
file |
A |
verbose |
A |
getMEtraitCor() is designed to be used in combination with
getModules(). The correlation calculations are performed by
WGCNA::corAndPvalue() and WGCNA::bicorAndPvalue(). getMEtraitCor()
can also be used to calculate pairwise correlation coefficients and p-values
between module eigennode values, or between top adjusted PCs and sample
traits (see examples).
A data.frame giving correlation statistics for each
module-trait pair.
getModules() to build a comethylation network and identify
modules of comethylated regions.
getCor() to calculate correlation coefficients.
getDendro() and plotDendro() to generate and visualize
dendrograms.
plotMEtraitCor() to visualize ME-trait correlations.
## Not run:
# Get Comethylation Modules
modules <- getModules(methAdj, power = sft$powerEstimate, regions = regions,
corType = "pearson", file = "Modules.rds")
# Test Correlations between Module Eigennodes and Sample Traits
MEs <- modules$MEs
MEtraitCor <- getMEtraitCor(MEs, colData = colData, corType = "bicor",
file = "ME_Trait_Correlation_Stats.txt")
# Examine Correlations between Modules
moduleCorStats <- getMEtraitCor(MEs, colData = MEs, corType = "bicor",
robustY = TRUE,
file = "Module_Correlation_Stats.txt")
# Compare Top PCs to Sample Traits
MEtraitCor <- getMEtraitCor(PCs, colData = colData, corType = "bicor",
file = "PC_Trait_Correlation_Stats.txt")
PCdendro <- getDendro(PCs, distance = "bicor")
PCtraitDendro <- getCor(PCs, y = colData, corType = "bicor", robustY = FALSE) %>%
getDendro(transpose = TRUE)
plotMEtraitCor(PCtraitCor, moduleOrder = PCdendro$order,
traitOrder = PCtraitDendro$order,
file = "PC_Trait_Correlation_Heatmap.pdf")
# Examine Correlations between Sample Traits
traitDendro <- getCor(MEs, y = colData, corType = "bicor",
robustY = FALSE) %>%
getDendro(transpose = TRUE)
plotDendro(traitDendro, labelSize = 3.5, expandY = c(0.65,0.08),
file = "Trait_Dendrogram.pdf")
# Visualize Correlations between Module Eigennodes and Sample Traits
moduleDendro <- getDendro(MEs, distance = "bicor")
plotMEtraitCor(MEtraitCor, moduleOrder = moduleDendro$order,
traitOrder = traitDendro$order,
file = "ME_Trait_Correlation_Heatmap.pdf")
plotMEtraitCor(MEtraitCor, moduleOrder = moduleDendro$order,
traitOrder = traitDendro$order, topOnly = TRUE,
label.type = "p", label.size = 4, label.nudge_y = 0,
legend.position = c(1.11, 0.795),
colColorMargins = c(-1,4.75,0.5,10.1),
file = "Top_ME_Trait_Correlation_Heatmap.pdf", width = 8.5,
height = 4.25)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.