plotMEtraitCor | R Documentation |
plotMEtraitCor()
takes a data.frame
of correlation statistics
for module eigennodes and traits from getMEtraitCor()
, plots it as a
heatmap, and saves it as a .pdf.
plotMEtraitCor(
MEtraitCor,
moduleOrder = 1:length(unique(MEtraitCor$module)),
traitOrder = 1:length(unique(MEtraitCor$trait)),
topOnly = FALSE,
nTop = 15,
p = 0.05,
label.type = c("star", "p"),
label.size = 8,
label.nudge_y = -0.38,
colors = blueWhiteRed(100, gamma = 0.9),
limit = NULL,
axis.text.size = 12,
legend.position = c(1.08, 0.915),
legend.text.size = 12,
legend.title.size = 16,
colColorMargins = c(-0.7, 4.21, 1.2, 11.07),
save = TRUE,
file = "ME_Trait_Correlation_Heatmap.pdf",
width = 11,
height = 9.5,
verbose = TRUE
)
MEtraitCor |
A |
moduleOrder |
A |
traitOrder |
A |
topOnly |
A |
nTop |
A |
p |
A |
label.type |
A |
label.size |
A |
label.nudge_y |
A |
colors |
A |
limit |
A |
axis.text.size |
A |
legend.position |
A |
legend.text.size |
A |
legend.title.size |
A |
colColorMargins |
A |
save |
A |
file |
A |
width |
A |
height |
A |
verbose |
A |
plotMEtraitCor()
is designed to be used in combination with
getMEtraitCor()
. Stars or p-values are used to annotate significant
correlations, as defined by the p-value threshold. The heatmap can optionally
be filtered to include only modules and traits with the most significant
associations, ranked by p-value. A ggplot
object is produced and can
be edited outside of this function if desired.
A ggplot
object.
getModules()
to build a comethylation network and identify
modules of comethylated regions.
getMEtraitCor()
to calculate ME-trait correlations.
getCor()
to calculate correlation coefficients.
getDendro()
and plotDendro()
to generate and visualize
dendrograms.
## 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")
# 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.