View source: R/Examine_Region_Methylation.R
adjustRegionMeth | R Documentation |
adjustRegionMeth()
adjusts region methylation data for the top
principal components, transposes it, and then saves it as a .rds file.
adjustRegionMeth(
meth,
PCs,
save = TRUE,
file = "Adjusted_Region_Methylation.rds",
verbose = TRUE
)
meth |
A |
PCs |
A |
save |
A |
file |
A |
verbose |
A |
adjustRegionMeth()
regresses out the top principal components
generated by getPCs()
. This is the same approach as taken by
sva::sva_network()
. More information on the function and approach is given
in the documentation and publications related to the sva package.
A numeric matrix
, where each row is a sample and each column
is a region.
getRegionMeth()
to extract region methylation values.
getPCs()
to calculate top principal components for region
methylation values.
getMEtraitCor()
to compare these top PCs to sample traits.
getDendro()
and plotDendro()
to generate and visualize
dendrograms.
getSoftPower()
and plotSoftPower()
to estimate the best
soft-thresholding power and visualize scale-free topology fit
and connectivity.
getModules()
to build a comethylation network and identify
modules of comethylated regions.
## Not run:
# Get Methylation Data
meth <- getRegionMeth(regions, bs = bs, file = "Region_Methylation.rds")
# Adjust Methylation Data for PCs
mod <- model.matrix(~1, data = pData(bs))
PCs <- getPCs(meth, mod = mod, file = "Top_Principal_Components.rds")
methAdj <- adjustRegionMeth(meth, PCs = PCs,
file = "Adjusted_Region_Methylation.rds")
# 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")
# Assess Sample Similarity
getDendro(methAdj, distance = "euclidean") %>%
plotDendro(file = "Sample_Dendrogram.pdf", expandY = c(0.25,0.08))
# Select Soft Power Threshold
sft <- getSoftPower(methAdj, corType = "pearson", file = "Soft_Power.rds")
plotSoftPower(sft, file = "Soft_Power_Plots.pdf")
# Get Comethylation Modules
modules <- getModules(methAdj, power = sft$powerEstimate, regions = regions,
corType = "pearson", file = "Modules.rds")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.