plotMethTrait | R Documentation |
plotMethTrait()
extracts the methylation values for regions in a given
module, plots it against a sample trait in a heatmap, and then saves it as a
.pdf. trait
must be in the same order as the columns in meth
.
plotMethTrait(
module,
regions,
meth,
trait,
discrete = NULL,
traitCode = NULL,
traitColors = NULL,
heatmapColors = blueWhiteRed(100, gamma = 0.3),
limit = NULL,
expandY = 0.05,
axis.text.size = 11,
heatmap.legend.position = c(1.1, 0.743),
trait.legend.position = c(1.017, 4.39),
heatmap.legend.title = "Relative\nMethylation (%)",
trait.legend.title = "Trait",
legend.text.size = 11,
legend.title.size = 14,
heatmapMargins = c(1, 8, 0, 1),
traitMargins = c(0, 6, 1, 5.15),
save = TRUE,
file = "Module_Methylation_Trait_Heatmap.pdf",
width = 11,
height = 4,
verbose = TRUE
)
module |
A |
regions |
A |
meth |
A |
trait |
A |
discrete |
A |
traitCode |
A named |
traitColors |
A named |
heatmapColors |
A |
limit |
A |
expandY |
A |
axis.text.size |
A |
heatmap.legend.position |
A |
trait.legend.position |
A |
heatmap.legend.title |
A |
trait.legend.title |
A |
legend.text.size |
A |
legend.title.size |
A |
heatmapMargins |
A |
traitMargins |
A |
save |
A |
file |
A |
width |
A |
height |
A |
verbose |
A |
NA
values in the trait are removed if present, along with corresponding
ME
values. If discrete
is not provided plotMethTrait()
will guess if the trait is discrete (<= 5 unique values) and plot the trait
color as a discrete scale rather than a continuous one. Samples are ordered by
trait value in ascending order. Methylation values are plotted relative to the
mean methylation in that region.
A ggplot
object.
getModules()
to build a comethylation network and identify
modules of comethylated regions.
getMEtraitCor()
and plotMEtraitCor()
to calculate and
visualize all ME-trait correlations.
plotMEtraitDot()
and plotMEtraitScatter()
for other methods
to visualize a single ME-trait correlation.
## 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")
plotMEtraitCor(MEtraitCor, moduleOrder = moduleDendro$order,
traitOrder = traitDendro$order,
file = "ME_Trait_Correlation_Heatmap.pdf")
# Explore Individual ME-Trait Correlations
plotMEtraitDot(MEs$bisque4, trait = colData$Diagnosis_ASD,
traitCode = c("TD" = 0, "ASD" = 1),
colors = c("TD" = "#3366CC", "ASD" = "#FF3366"),
ylim = c(-0.2,0.2), xlab = "Diagnosis",
ylab = "Bisque 4 Module Eigennode",
file = "bisque4_ME_Diagnosis_Dotplot.pdf")
plotMEtraitScatter(MEs$paleturquoise, trait = colData$Gran,
ylim = c(-0.15,0.15), xlab = "Granulocytes",
ylab = "Pale Turquoise Module Eigennode",
file = "paleturquoise_ME_Granulocytes_Scatterplot.pdf")
regions <- modules$regions
plotMethTrait("bisque4", regions = regions, meth = meth,
trait = colData$Diagnosis_ASD,
traitCode = c("TD" = 0, "ASD" = 1),
traitColors = c("TD" = "#3366CC", "ASD" = "#FF3366"),
trait.legend.title = "Diagnosis",
file = "bisque4_Module_Methylation_Diagnosis_Heatmap.pdf")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.