lapply(packages_to_load, require, character.only=TRUE)
Loading required package: data.table
Warning: package ‘data.table’ was built under R version 4.3.3data.table 1.16.2 using 8 threads (see ?getDTthreads). Latest news: r-datatable.com
Attaching package: ‘data.table’
The following object is masked from ‘package:SummarizedExperiment’:
shift
The following objects are masked from ‘package:reshape2’:
dcast, melt
The following object is masked from ‘package:bit’:
setattr
The following object is masked from ‘package:GenomicRanges’:
shift
The following object is masked from ‘package:IRanges’:
shift
The following objects are masked from ‘package:S4Vectors’:
first, second
Loading required package: pheatmap
Warning: package ‘pheatmap’ was built under R version 4.3.3Loading required package: RColorBrewer
Loading required package: Gostats
Warning: there is no package called ‘Gostats’
[[1]]
[1] TRUE
[[2]]
[1] TRUE
[[3]]
[1] TRUE
[[4]]
[1] TRUE
[[5]]
[1] TRUE
[[6]]
[1] TRUE
[[7]]
[1] FALSE
#let's use dimensionality reduction to look at data variation
dred.sites <- rnb.execute.dreduction(rnb)
Calculated MDS coordinates using manhattan distance
Calculated MDS coordinates using euclidean distance
dred.promoters <- rnb.execute.dreduction(rnb, target = "promoters")
Calculated MDS coordinates using manhattan distance
Calculated MDS coordinates using euclidean distance
dred <- list(sites = dred.sites, promoters = dred.promoters)
sample.colors <- ifelse(pheno(rnb)$CellType == "Glia", "orange", "yellowgreen")
#plot MDS for Glia an d Neurons
plot(dred[["sites"]]$mds$euclidean, col = sample.colors, xlab = "Dimension 1", ylab = "Dimension 2", cex = 2, pch = 19,
main = "MDS plot - all Sites")
plot(dred[["sites"]]$pca$x, col = sample.colors, xlab = "PC1", ylab = "PC2", cex = 2, pch = 19,
main = "PCA plot - all Sites")
plot(dred[["promoters"]]$pca$x, col = sample.colors, xlab = "PC1", ylab = "PC2", cex = 2, pch = 19,
main = "PCA plot - Promoters")
Check for batch effects by correlating PCA coordinates with known sample parameters.
#check if have some batch effects by correlation PCA and known sample parameters
# e.g. "Group" biologic samplegroups - "Type = 'sorted' vs 'unsorted'
assoc <- rnb.execute.batcheffects(rnb, pcoordinates = dred)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:17:34 Inf STATUS STARTED Tests for Associations
Warning: 'memory.size()' is no longer supported
2026-01-15 18:17:34 Inf INFO Testing the following traits for associations: DonorID; Sex; Age; Type; CellType; Tissue; Diagnosis; Group; stage; Sentrix_ID; Sentrix_Position; AD_vs_CTRL_Neuron; AD_vs_CTRL_Glia; AD_vs_CTRL_FC; AD_vs_CTRL_TC; Predicted Male Probability; Predicted Sex; Genome-wide methylation; predicted_ages; age_increase; Immune Cell Content (LUMP)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:17:35 Inf STATUS Created 10000 sample permutations
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:10 Inf STATUS Computed correlations between principal components and traits.
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:25 Inf STATUS Computed pairwise correlations between traits.
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:25 Inf STATUS COMPLETED Tests for Associations
str(assoc)
List of 3
$ permutations: int [1:64, 1:10000] 1 2 3 4 5 6 7 8 9 10 ...
$ pc :List of 2
..$ sites :List of 4
.. ..$ failures : chr [1:21, 1:8] NA NA NA NA ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
.. ..$ tests : chr [1:21, 1:8] "Kruskal-Wallis" "Wilcoxon" "Correlation" "Wilcoxon" ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
.. ..$ correlations: num [1:21, 1:8] NA NA 0.195 NA NA ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
.. ..$ pvalues : num [1:21, 1:8] 1.00 3.59e-01 1.24e-01 8.96e-01 7.40e-07 ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
..$ promoters:List of 4
.. ..$ failures : chr [1:21, 1:8] NA NA NA NA ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
.. ..$ tests : chr [1:21, 1:8] "Kruskal-Wallis" "Wilcoxon" "Correlation" "Wilcoxon" ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
.. ..$ correlations: num [1:21, 1:8] NA NA 0.185 NA NA ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
.. ..$ pvalues : num [1:21, 1:8] 1.00 4.26e-01 1.45e-01 9.40e-01 7.40e-07 ...
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. .. ..$ Principal component: chr [1:8] "1" "2" "3" "4" ...
$ traits :List of 4
..$ failures : chr [1:21, 1:21] NA NA NA NA ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
..$ tests : chr [1:21, 1:21] NA "Fisher" "Kruskal-Wallis" "Fisher" ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
..$ correlations: num [1:21, 1:21] NA NA NA NA NA NA NA NA NA NA ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
..$ pvalues : num [1:21, 1:21] NA 0.00002 0.00126 0.00002 1 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
.. .. ..$ : chr [1:21] "DonorID" "Sex" "Age" "Type" ...
rnb.options(exploratory.columns=c("Group", "Type"))
assoc.qc <- rnb.execute.batch.qc(rnb, pcoordinates=dred)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and bisulfite conversion I for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and bisulfite conversion II for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and extension for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and hybridization for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and non-polymorphic for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and specificity I for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and specificity II for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and staining for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and target removal for sites
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and bisulfite conversion I for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and bisulfite conversion II for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and extension for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and hybridization for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and non-polymorphic for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and specificity I for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and specificity II for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and staining for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:18:27 Inf STATUS Computed associations between 8 principal component(s) and target removal for promoters
Visualize methylation deviation by probe types (e.g., Type I vs Type II) in a PDF file.
setwd("D:/Work/Epigenetics/Workshops/2024_deNBI-DNA_methylation_design_to_discovery/")
probe.types <- as.character(annotation(rnb)[, "Design"])
pdf(file = "deviationPlot_probeType.pdf", width = 11)
deviation.plot.beta(meth(rnb),
probe.types,
c.legend = c("I" = "blue", "II" = "red")
)
dev.off()
null device
1
Cluster the samples based on methylation values from sites or promoters, and visualize the clustered promoters as a heatmap
#cluster the samples based on indivudal sites or promoters
clusterings.sites <- rnb.execute.clustering(rnb, region.type = "sites")
Warning: 'memory.size()' is no longer supported
2026-01-15 18:25:27 Inf STATUS Performed clustering on sites using correlation as a distance metric
Warning: 'memory.size()' is no longer supported
2026-01-15 18:25:43 Inf STATUS Performed clustering on sites using manhattan as a distance metric
Warning: 'memory.size()' is no longer supported
2026-01-15 18:25:58 Inf STATUS Performed clustering on sites using euclidean as a distance metric
clusterings.promoters <- rnb.execute.clustering(rnb, region.type = "promoters")
Warning: 'memory.size()' is no longer supported
2026-01-15 18:25:58 Inf STATUS Performed clustering on promoters using correlation as a distance metric
Warning: 'memory.size()' is no longer supported
2026-01-15 18:25:59 Inf STATUS Performed clustering on promoters using manhattan as a distance metric
Warning: 'memory.size()' is no longer supported
2026-01-15 18:26:02 Inf STATUS Performed clustering on promoters using euclidean as a distance metric
# Get the methylation values
X <- meth(rnb, type = "promoters")[1:100, ]
# Convert the clustering result to a dendrogram
# Index 7 holds euclidean distance, average linkage clustering
cresult <- clusterings.promoters[[7]]@result
attr(cresult, "class") <- "hclust"
cresult <- as.dendrogram(cresult)
# Save the heatmap as pdf file
pdf(file="promoter_heatmap.pdf")
heatmap.2(X, Rowv = TRUE, Colv = cresult, dendrogram = "both", scale = "none", trace = "none")
dev.off()
null device
1
# if we want to compare Neuron vs Glia cells from Controls only,
# we will need to add a new column to pheno data to establish this comparison
#first we create a dedicated sample scheme
SortedControl <- ifelse(pheno(rnb)[, "Diagnosis"] == "CTRL" & pheno(rnb)[, "CellType"] == "Glia", "Glia_CTRL",
ifelse(pheno(rnb)[, "Diagnosis"] == "CTRL" & pheno(rnb)[, "CellType"] == "Neuron", "Neuron_CTRL", NA)
)
#now we add the scheme as a new column to the phenotypic data
#rnb <- addPheno(rnb, SortedControl, "Neuron_CTRL_vs_Glia_CTRL")
# Specify the sample annotation table columns for which
# differential methylation is to be computed
rnb.options("differential.site.test.method" = "limma") #'limma' or 'ttest'
cmp.cols_sorted <- c("Neuron_CTRL_vs_Glia_CTRL", "AD_vs_CTRL_Neuron","AD_vs_CTRL_Glia")
# Specify the region types
reg.types <- c("genes", "promoters")
# Conduct the analysis #takes 5 minutes
diffmeth_sorted <- rnb.execute.computeDiffMeth(x = rnb,
pheno.cols = cmp.cols_sorted,
region.types = reg.types,
columns.adj = "Age",
adjust.sva = FALSE,
skip.sites = FALSE,
adjust.celltype = FALSE)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:30 Inf STATUS STARTED Retrieving comparison info
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:30 Inf STATUS COMPLETED Retrieving comparison info
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:30 Inf STATUS STARTED Computing differential methylation tables
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:30 Inf STATUS STARTED Comparing: Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:30 Inf STATUS STARTED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:30 Inf INFO Adjusting for covariates: Age
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:30 Inf INFO Conducting differential analysis using limma
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:39 Inf STATUS COMPLETED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:40 Inf STATUS STARTED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:54:59 Inf STATUS Computed table for genes
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:16 Inf STATUS Computed table for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:16 Inf STATUS COMPLETED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:16 Inf STATUS COMPLETED Comparing: Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:16 Inf STATUS STARTED Comparing: Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:16 Inf STATUS STARTED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:16 Inf INFO Adjusting for covariates: Age
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:16 Inf INFO Conducting differential analysis using limma
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:25 Inf STATUS COMPLETED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:26 Inf STATUS STARTED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:55:45 Inf STATUS Computed table for genes
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:01 Inf STATUS Computed table for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:01 Inf STATUS COMPLETED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:01 Inf STATUS COMPLETED Comparing: Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:01 Inf STATUS STARTED Comparing: Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:01 Inf STATUS STARTED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:02 Inf INFO Adjusting for covariates: Age
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:02 Inf INFO Conducting differential analysis using limma
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:11 Inf STATUS COMPLETED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:12 Inf STATUS STARTED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:31 Inf STATUS Computed table for genes
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS Computed table for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS COMPLETED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS COMPLETED Comparing: Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS COMPLETED Computing differential methylation tables
#save the results as compressed tables
save.rnb.diffmeth(object = diffmeth_sorted, path = "D:/Work/Epigenetics/Workshops/2024_deNBI-DNA_methylation_design_to_discovery/analysis/rnbDiffMeth.Rdata")
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf WARNING Zip not found on this Windows system, this RnBDiffMeth object will not be saved. See the instructions for installing ZIP on Windows in the FAQ section of the RnBeads website.
cmp.cols_tissue <- c("AD_vs_CTRL_FC","AD_vs_CTRL_TC")
# Specify the region types
reg.types <- c("genes", "promoters")
# Conduct the analysis
diffmeth_tissue <- rnb.execute.computeDiffMeth(x = rnb,
pheno.cols = cmp.cols_tissue,
region.types = reg.types,
columns.adj = c("Age", "Sex"),
adjust.sva = FALSE,
pheno.cols.adjust.sva = "NeuronalContent",
skip.sites = FALSE,
adjust.celltype = TRUE)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS STARTED Retrieving comparison info
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS COMPLETED Retrieving comparison info
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS STARTED Computing differential methylation tables
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS STARTED Comparing: FrontalCortex_AD vs. FrontalCortex_CTRL (based on AD_vs_CTRL_FC)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:48 Inf STATUS STARTED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:49 Inf INFO Adjusting for covariates: Age,Sex,ct_1,ct_2
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:49 Inf INFO Conducting differential analysis using limma
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:58 Inf STATUS COMPLETED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:56:59 Inf STATUS STARTED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:18 Inf STATUS Computed table for genes
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:35 Inf STATUS Computed table for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:35 Inf STATUS COMPLETED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:35 Inf STATUS COMPLETED Comparing: FrontalCortex_AD vs. FrontalCortex_CTRL (based on AD_vs_CTRL_FC)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:35 Inf STATUS STARTED Comparing: TemporalCortex_AD vs. TemporalCortex_CTRL (based on AD_vs_CTRL_TC)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:35 Inf STATUS STARTED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:36 Inf INFO Adjusting for covariates: Age,Sex,ct_1,ct_2
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:36 Inf INFO Conducting differential analysis using limma
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:46 Inf STATUS COMPLETED Computing Differential Methylation Table
Warning: 'memory.size()' is no longer supported
2026-01-15 18:57:46 Inf STATUS STARTED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:58:06 Inf STATUS Computed table for genes
Warning: 'memory.size()' is no longer supported
2026-01-15 18:58:23 Inf STATUS Computed table for promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 18:58:23 Inf STATUS COMPLETED Computing Differential Methylation Tables (Region Level)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:58:23 Inf STATUS COMPLETED Comparing: TemporalCortex_AD vs. TemporalCortex_CTRL (based on AD_vs_CTRL_TC)
Warning: 'memory.size()' is no longer supported
2026-01-15 18:58:23 Inf STATUS COMPLETED Computing differential methylation tables
save.rnb.diffmeth(object = diffmeth_tissue, path = "D:/Work/Epigenetics/Workshops/2024_deNBI-DNA_methylation_design_to_discovery/analysis/DifferentialAnalysis_Tissue")
Warning: 'memory.size()' is no longer supported
2026-01-15 18:58:23 Inf WARNING Zip not found on this Windows system, this RnBDiffMeth object will not be saved. See the instructions for installing ZIP on Windows in the FAQ section of the RnBeads website.
This code snippet adds a new phenotype column to classify samples into “Glia_CTRL” or “Neuron_CTRL” from control donors only. It then configures and runs a differential methylation analysis using specified comparison groups and region types, adjusting for certain covariates. Finally, it saves the resulting differential methylation results for further interpretation.
#let's focus on the differential comparisons performed with sorted samples only
#we can inspect the chosen parameters in the differential object
str(diffmeth_sorted)
Formal class 'RnBDiffMeth' [package "RnBeads"] with 12 slots
..@ sites :List of 3
.. ..$ Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL): list()
.. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. ..- attr(*, "maxlength")= int 11004744
.. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/sites_cmp1.ff"
.. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. ..- attr(*, "virtual")= list()
.. .. .. ..- attr(*, "Length")= int 11004744
.. .. .. ..- attr(*, "Dim")= int [1:2] 458531 24
.. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. ..$ : NULL
.. .. .. .. ..$ : chr [1:24] "mean.g1" "mean.g2" "mean.diff" "mean.quot.log2" ...
.. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
.. ..$ Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron) : list()
.. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. ..- attr(*, "maxlength")= int 11004744
.. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/sites_cmp2.ff"
.. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. ..- attr(*, "virtual")= list()
.. .. .. ..- attr(*, "Length")= int 11004744
.. .. .. ..- attr(*, "Dim")= int [1:2] 458531 24
.. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. ..$ : NULL
.. .. .. .. ..$ : chr [1:24] "mean.g1" "mean.g2" "mean.diff" "mean.quot.log2" ...
.. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
.. ..$ Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia) : list()
.. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. ..- attr(*, "maxlength")= int 11004744
.. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/sites_cmp3.ff"
.. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. ..- attr(*, "virtual")= list()
.. .. .. ..- attr(*, "Length")= int 11004744
.. .. .. ..- attr(*, "Dim")= int [1:2] 458531 24
.. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. ..$ : NULL
.. .. .. .. ..$ : chr [1:24] "mean.g1" "mean.g2" "mean.diff" "mean.quot.log2" ...
.. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
..@ regions :List of 2
.. ..$ genes :List of 3
.. .. ..$ Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL): list()
.. .. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. .. ..- attr(*, "maxlength")= int 416556
.. .. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/regions_reg1_cmp1.ff"
.. .. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. .. ..- attr(*, "virtual")= list()
.. .. .. .. ..- attr(*, "Length")= int 416556
.. .. .. .. ..- attr(*, "Dim")= int [1:2] 29754 14
.. .. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. .. ..$ : NULL
.. .. .. .. .. ..$ : chr [1:14] "mean.mean.g1" "mean.mean.g2" "mean.mean.diff" "mean.mean.quot.log2" ...
.. .. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
.. .. ..$ Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron) : list()
.. .. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. .. ..- attr(*, "maxlength")= int 416556
.. .. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/regions_reg1_cmp2.ff"
.. .. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. .. ..- attr(*, "virtual")= list()
.. .. .. .. ..- attr(*, "Length")= int 416556
.. .. .. .. ..- attr(*, "Dim")= int [1:2] 29754 14
.. .. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. .. ..$ : NULL
.. .. .. .. .. ..$ : chr [1:14] "mean.mean.g1" "mean.mean.g2" "mean.mean.diff" "mean.mean.quot.log2" ...
.. .. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
.. .. ..$ Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia) : list()
.. .. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. .. ..- attr(*, "maxlength")= int 416556
.. .. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/regions_reg1_cmp3.ff"
.. .. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. .. ..- attr(*, "virtual")= list()
.. .. .. .. ..- attr(*, "Length")= int 416556
.. .. .. .. ..- attr(*, "Dim")= int [1:2] 29754 14
.. .. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. .. ..$ : NULL
.. .. .. .. .. ..$ : chr [1:14] "mean.mean.g1" "mean.mean.g2" "mean.mean.diff" "mean.mean.quot.log2" ...
.. .. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
.. ..$ promoters:List of 3
.. .. ..$ Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL): list()
.. .. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. .. ..- attr(*, "maxlength")= int 418978
.. .. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/regions_reg2_cmp1.ff"
.. .. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. .. ..- attr(*, "virtual")= list()
.. .. .. .. ..- attr(*, "Length")= int 418978
.. .. .. .. ..- attr(*, "Dim")= int [1:2] 29927 14
.. .. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. .. ..$ : NULL
.. .. .. .. .. ..$ : chr [1:14] "mean.mean.g1" "mean.mean.g2" "mean.mean.diff" "mean.mean.quot.log2" ...
.. .. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
.. .. ..$ Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron) : list()
.. .. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. .. ..- attr(*, "maxlength")= int 418978
.. .. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/regions_reg2_cmp2.ff"
.. .. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. .. ..- attr(*, "virtual")= list()
.. .. .. .. ..- attr(*, "Length")= int 418978
.. .. .. .. ..- attr(*, "Dim")= int [1:2] 29927 14
.. .. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. .. ..$ : NULL
.. .. .. .. .. ..$ : chr [1:14] "mean.mean.g1" "mean.mean.g2" "mean.mean.diff" "mean.mean.quot.log2" ...
.. .. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
.. .. ..$ Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia) : list()
.. .. .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr>
.. .. .. .. ..- attr(*, "vmode")= chr "double"
.. .. .. .. ..- attr(*, "maxlength")= int 418978
.. .. .. .. ..- attr(*, "pattern")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/ff"
.. .. .. .. ..- attr(*, "filename")= chr "C:/Users/nihit/AppData/Local/Temp/RtmpoT7QNl/diffMethTables_73e05a6d5733/regions_reg2_cmp3.ff"
.. .. .. .. ..- attr(*, "pagesize")= int 65536
.. .. .. .. ..- attr(*, "finalizer")= chr "close"
.. .. .. .. ..- attr(*, "finonexit")= logi TRUE
.. .. .. .. ..- attr(*, "readonly")= logi FALSE
.. .. .. .. ..- attr(*, "caching")= chr "mmnoflush"
.. .. .. ..- attr(*, "virtual")= list()
.. .. .. .. ..- attr(*, "Length")= int 418978
.. .. .. .. ..- attr(*, "Dim")= int [1:2] 29927 14
.. .. .. .. ..- attr(*, "Dimorder")= int [1:2] 1 2
.. .. .. .. ..- attr(*, "Symmetric")= logi FALSE
.. .. .. .. ..- attr(*, "Dimnames")=List of 2
.. .. .. .. .. ..$ : NULL
.. .. .. .. .. ..$ : chr [1:14] "mean.mean.g1" "mean.mean.g2" "mean.mean.diff" "mean.mean.quot.log2" ...
.. .. .. .. - attr(*, "class") = chr [1:3] "ff_matrix" "ff_array" "ff"
..@ comparisons : Named chr [1:3] "Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)" "Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)" "Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)"
.. ..- attr(*, "names")= chr [1:3] "cmp1" "cmp2" "cmp3"
..@ region.types : Named chr [1:2] "genes" "promoters"
.. ..- attr(*, "names")= chr [1:2] "reg1" "reg2"
..@ comparison.grouplabels: chr [1:3, 1:2] "Glia_CTRL" "Neuron_AD" "Glia_AD" "Neuron_CTRL" ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : Named chr [1:3] "Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)" "Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)" "Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)"
.. .. .. ..- attr(*, "names")= chr [1:3] "cmp1" "cmp2" "cmp3"
.. .. ..$ : NULL
..@ comparison.info :List of 3
.. ..$ Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL):List of 9
.. .. ..$ comparison : chr "Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)"
.. .. ..$ pheno.colname : chr "Neuron_CTRL_vs_Glia_CTRL"
.. .. ..$ group.names : chr [1:2] "Glia_CTRL" "Neuron_CTRL"
.. .. ..$ group.inds :List of 2
.. .. .. ..$ group1: int [1:6] 5 7 9 11 13 15
.. .. .. ..$ group2: int [1:6] 6 8 10 12 14 16
.. .. ..$ paired : logi FALSE
.. .. ..$ adj.sva : logi FALSE
.. .. ..$ adj.celltype : logi FALSE
.. .. ..$ adjustment.table:'data.frame': 12 obs. of 1 variable:
.. .. .. ..$ Age: int [1:12] 77 77 83 87 71 75 77 77 83 87 ...
.. .. ..$ region.types : chr [1:2] "genes" "promoters"
.. ..$ Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron) :List of 9
.. .. ..$ comparison : chr "Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)"
.. .. ..$ pheno.colname : chr "AD_vs_CTRL_Neuron"
.. .. ..$ group.names : chr [1:2] "Neuron_AD" "Neuron_CTRL"
.. .. ..$ group.inds :List of 2
.. .. .. ..$ group1: int [1:6] 2 4 18 20 22 24
.. .. .. ..$ group2: int [1:6] 6 8 10 12 14 16
.. .. ..$ paired : logi FALSE
.. .. ..$ adj.sva : logi FALSE
.. .. ..$ adj.celltype : logi FALSE
.. .. ..$ adjustment.table:'data.frame': 12 obs. of 1 variable:
.. .. .. ..$ Age: int [1:12] 78 76 76 78 85 73 77 77 83 87 ...
.. .. ..$ region.types : chr [1:2] "genes" "promoters"
.. ..$ Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia) :List of 9
.. .. ..$ comparison : chr "Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)"
.. .. ..$ pheno.colname : chr "AD_vs_CTRL_Glia"
.. .. ..$ group.names : chr [1:2] "Glia_AD" "Glia_CTRL"
.. .. ..$ group.inds :List of 2
.. .. .. ..$ group1: int [1:6] 1 3 17 19 21 23
.. .. .. ..$ group2: int [1:6] 5 7 9 11 13 15
.. .. ..$ paired : logi FALSE
.. .. ..$ adj.sva : logi FALSE
.. .. ..$ adj.celltype : logi FALSE
.. .. ..$ adjustment.table:'data.frame': 12 obs. of 1 variable:
.. .. .. ..$ Age: int [1:12] 78 76 76 78 85 73 77 77 83 87 ...
.. .. ..$ region.types : chr [1:2] "genes" "promoters"
..@ includesSites : logi TRUE
..@ site.test.method : chr "limma"
..@ variability.method : chr "diffVar"
..@ covg.thres : int 5
..@ disk.dump : logi TRUE
..@ disk.path : chr "C:\\Users\\nihit\\AppData\\Local\\Temp\\RtmpoT7QNl\\diffMethTables_73e05a6d5733"
get.comparisons(diffmeth_sorted)
cmp1
"Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)"
cmp2
"Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)"
cmp3
"Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)"
get.region.types(diffmeth_sorted)
reg1 reg2
"genes" "promoters"
get.comparison.grouplabels(diffmeth_sorted)
[,1]
Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL) "Glia_CTRL"
Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron) "Neuron_AD"
Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia) "Glia_AD"
[,2]
Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL) "Neuron_CTRL"
Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron) "Neuron_CTRL"
Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia) "Glia_CTRL"
#select one specific comaprison
comparison <- get.comparisons(diffmeth_sorted)[1]
tab.sites <- get.table(object = diffmeth_sorted, comparison, "sites", return.data.frame = TRUE)
str(tab.sites)
'data.frame': 458531 obs. of 24 variables:
$ mean.g1 : num 0.8791 0.7246 0.0441 0.1785 0.043 ...
$ mean.g2 : num 0.8885 0.7686 0.0423 0.1685 0.0398 ...
$ mean.diff : num -0.00936 -0.04398 0.00189 0.00999 0.00314 ...
$ mean.quot.log2 : num -0.0151 -0.0839 0.0512 0.0786 0.0882 ...
$ diffmeth.p.val : num 0.631 0.215 0.576 0.43 0.44 ...
$ max.g1 : num 0.9268 0.8341 0.0579 0.2565 0.0503 ...
$ min.g1 : num 0.838 0.6625 0.0346 0.1527 0.0331 ...
$ sd.g1 : num 0.03661 0.06243 0.00795 0.03888 0.00685 ...
$ max.g2 : num 0.9288 0.8738 0.0727 0.2603 0.0491 ...
$ min.g2 : num 0.8431 0.6955 0.033 0.1067 0.0308 ...
$ sd.g2 : num 0.03281 0.06671 0.01503 0.05022 0.00618 ...
$ min.diff : num 0 0 0 0 0 0 0 0 0 0 ...
$ diffmeth.p.adj.fdr : num 0.768 0.365 0.727 0.601 0.61 ...
$ num.na.g1 : num 0 0 0 0 0 0 0 0 0 0 ...
$ num.na.g2 : num 0 0 0 0 0 0 0 0 0 0 ...
$ mean.covg.g1 : num 14.83 12 10.83 9.17 8.83 ...
$ mean.covg.g2 : num 13 12.83 11.5 9.33 9.17 ...
$ min.covg.g1 : num 12 5 7 5 2 7 10 3 6 7 ...
$ min.covg.g2 : num 7 8 7 6 6 8 8 6 10 8 ...
$ max.covg.g1 : num 20 18 16 17 14 14 17 20 18 15 ...
$ max.covg.g2 : num 19 20 15 16 14 22 21 15 23 15 ...
$ covg.thresh.nsamples.g1: num 6 6 6 6 5 6 6 5 6 6 ...
$ covg.thresh.nsamples.g2: num 6 6 6 6 6 6 6 6 6 6 ...
$ combinedRank : num 376429 269774 386472 328360 353870 ...
This code adds detailed annotation to the differential methylation results for both CpG sites and promoter regions. It merges the results from RnBeads with external annotation sources (e.g., gene symbols, genomic regions, and ENTREZ IDs), then reorders and exports them as well-structured tables for downstream analysis. Additionally, it identifies the most frequently represented genes among the top-ranking CpG sites.
#let's annotate the results
#first we add the annotation which is delivered by RnBeads by default
rnb.annotation.sites <- annotation(rnb, type="sites")
difSitesAnn <- data.frame(rnb.annotation.sites, tab.sites)
#but important information are missing, e.g. gene symbol or genomic region
# we can retrieve this information from other resources
# e.g. Illumina.com
# https://emea.support.illumina.com/array/array_kits/infinium_humanmethylation450_beadchip_kit/downloads.html
# https://bioconductor.org/packages/release/data/annotation/html/IlluminaHumanMethylation450kmanifest.html
# We prefer this source
# https://zwdzwd.github.io/InfiniumAnnotation
# needs to be downloaded
# we also provide this table on hiz-cloud
#let's import that annotation
a450 = as.data.frame(fread("d:/Work/Epigenetics/Workshops/2024_deNBI-DNA_methylation_design_to_discovery/450K_anno_v1.txt", sep = "\t", header = TRUE))
|--------------------------------------------------|
|==================================================|
#add columns for gene ID, region and entrez ID from this annotation to our results table
difSitesAnn [, c("gene", "geneRegion", "entrezID")] = a450[match(rownames(difSitesAnn), a450$TargetID) , c("SYMBOL", "GROUP02", "ENTREZ_ID")]
#add CpG ID as a column
difSitesAnn$cgID = rownames(difSitesAnn)
#optional: now we reorder the table based on CombinedRank value, so the best results are on top of the table
difSitesAnn = difSitesAnn [order(difSitesAnn$combinedRank), ]
#select a set of columns to be included in final result table, then export differential results with annotation
exportColumns = c("cgID", "Chromosome", "Start", "End", "Strand", "Design", "Color", "Context", "CGI.Relation",
"mean.g1", "mean.g2", "mean.diff", "diffmeth.p.val", "diffmeth.p.adj.fdr",
"combinedRank", "gene", "geneRegion", "entrezID")
fwrite(difSitesAnn [, exportColumns],
file = paste0("d:/Work/Epigenetics/Workshops/2024_deNBI-DNA_methylation_design_to_discovery/DifferentialResultsSites_Annotated_", comparison, ".txt"),
sep = "\t", col.names = TRUE, row.names = FALSE, quote = FALSE)
#which genes are most prominent in the top 1000 ranking CpGs?
topGenes = as.data.frame(table(difSitesAnn$gene [1:1000]))
topGenes = topGenes [order(topGenes$Freq, decreasing = TRUE), ]
head(topGenes, 10)
#we can also do this annotation with region sets, e.g. promoters
tab.promoters <- get.table(diffmeth_sorted, comparison, "promoters", return.data.frame = TRUE)
str(tab.promoters)
'data.frame': 29927 obs. of 14 variables:
$ mean.mean.g1 : num 0.0885 0.0885 0.6676 0.8875 0.1438 ...
$ mean.mean.g2 : num 0.0835 0.0835 0.665 0.9088 0.1345 ...
$ mean.mean.diff : num 0.00501 0.00501 0.00258 -0.02125 0.00931 ...
$ mean.mean.quot.log2 : num 0.0727 0.0727 0.0055 -0.0341 0.0901 ...
$ comb.p.val : num 0.49871 0.49871 0.92877 0.00641 0.38352 ...
$ comb.p.adj.fdr : num 0.5618 0.5618 0.9332 0.0206 0.4735 ...
$ num.sites : num 3 3 1 2 1 1 3 10 4 4 ...
$ mean.num.na.g1 : num 0 0 0 0 0 0 0 0 0 0 ...
$ mean.num.na.g2 : num 0 0 0 0 0 0 0 0 0 0 ...
$ mean.mean.covg.g1 : num 9.61 9.61 10.83 15.75 14.33 ...
$ mean.mean.covg.g2 : num 10 10 13.2 13.7 12.3 ...
$ mean.nsamples.covg.thresh.g1: num 5.67 5.67 6 6 6 ...
$ mean.nsamples.covg.thresh.g2: num 6 6 6 5.5 6 ...
$ combinedRank : num 26567 26567 29784 22726 24237 ...
annoPromoters = annotation(rnb, type = "promoters")
#add annotation
difProAnn = data.frame(annoPromoters, tab.promoters)
difProAnn$EnsemblID = rownames(difProAnn)
#sort results by combined rank
difProAnn = difProAnn[order(difProAnn$combinedRank), ]
#export
fwrite(difProAnn,
file = paste0("d:/Work/Epigenetics/Workshops/2024_deNBI-DNA_methylation_design_to_discovery/DifferentialResultsPromoters_Annotated_", comparison, ".txt"),
sep = "\t", col.names = TRUE, row.names = FALSE, quote = FALSE)
# let's visualize the promoter results with a volcano plot
# use red to highlight most differential promoters
dmrs <- get.table(object = diffmeth_sorted, comparison, "promoters")
plot(dmrs[, "mean.mean.diff"],
-log10(dmrs[, "comb.p.val"]),
xlab = "mean difference",
ylab = "-log10(combined p-value)",
col = ifelse((dmrs[, "comb.p.val"] < 0.01 &
dmrs [, "mean.mean.diff"] > 0.2) , "red",
ifelse((dmrs[, "comb.p.val"] < 0.01 &
dmrs [, "mean.mean.diff"] < -0.2), "blue", "grey")
),
pch = 19,
main = paste0(gsub(" \\(.*", "", comparison), " - promoters"))
#scatter plot
plot(dmrs[, "mean.mean.g1"],
dmrs[, "mean.mean.g2"],
xlab = "mean Glia_CTRL",
ylab = "mean Neuron_CTRL",
col = ifelse((dmrs[, "comb.p.val"] < 0.01 &
dmrs [, "mean.mean.diff"] > 0.2) , "red",
ifelse((dmrs[, "comb.p.val"] < 0.01 &
dmrs [, "mean.mean.diff"] < -0.2), "blue", "grey")
),
pch = 19, cex = 0.6,
main = paste0(gsub(" \\(.*", "", comparison), " - promoters"))
########################################################################################################
# let's perform GO enrichment analysis
BiocManager::install(version = "3.18")
'getOption("repos")' replaces Bioconductor standard repositories, see
'help("repositories", package = "BiocManager")' for details.
Replacement repositories:
CRAN: https://cran.rstudio.com/
Bioconductor version 3.18 (BiocManager 1.30.25), R 4.3.1 (2023-06-16
ucrt)
Installation paths not writeable, unable to update packages
path: C:/Program Files/R/R-4.3.1/library
packages:
boot, class, codetools, foreign, KernSmooth, rpart, spatial
Old packages: 'acepack', 'AER', 'akima', 'ape', 'argparse', 'arrow',
'bench', 'betareg', 'BH', 'bigD', 'binGroup', 'BiocManager', 'bit',
'bit64', 'blob', 'bookdown', 'broom', 'bslib', 'btergm', 'Cairo',
'caret', 'checkmate', 'chron', 'circlize', 'classInt', 'cli', 'clock',
'cluster', 'cobs', 'collapse', 'colorspace', 'commonmark',
'CompQuadForm', 'covr', 'cowplot', 'cpp11', 'credentials', 'crosstalk',
'curl', 'DAAG', 'data.table', 'DBItest', 'dbplyr', 'dbscan',
'dendextend', 'DEoptimR', 'depmixS4', 'Deriv', 'devtools', 'dfidx',
'diffobj', 'digest', 'diptest', 'distributions3', 'doBy', 'doRNG',
'downlit', 'dreamerr', 'DT', 'e1071', 'effects', 'emmeans', 'epiR',
'ergm', 'evaluate', 'extrafont', 'extrafontdb', 'fansi', 'faraway',
'fastICA', 'ff', 'fields', 'fixest', 'flexmix', 'flextable', 'forcats',
'fpc', 'fs', 'futile.logger', 'future', 'future.apply', 'gam', 'gclus',
'gdtools', 'gee', 'geepack', 'generics', 'geojsonsf', 'geometries',
'geometry', 'gert', 'GetoptLong', 'GGally', 'ggbeeswarm', 'ggplot2',
'ggpp', 'ggpubr', 'ggsci', 'ggstats', 'gh', 'gifski', 'glmnet',
'GlobalOptions', 'globals', 'gmm', 'gower', 'GPArotation', 'gplots',
'gprofiler2', 'gridSVG', 'gstat', 'gt', 'hardhat', 'haven', 'here',
'Hmisc', 'hmmr', 'hms', 'htmltools', 'httpuv', 'httr2', 'hunspell',
'igraph', 'inline', 'insight', 'isoband', 'ISwR', 'joineRML', 'jpeg',
'jsonify', 'jsonlite', 'JuliaCall', 'Kendall', 'keras', 'keyring',
'knitr', 'ks', 'Lahman', 'later', 'lattice', 'latticeExtra', 'lava',
'lavaan', 'leafem', 'leaflet', 'lfe', 'lifecycle', 'listenv',
'litedown', 'lm.beta', 'lme4', 'lobstr', 'locfit', 'lpSolve',
'lpSolveAPI', 'lsmeans', 'lubridate', 'lwgeom', 'magick', 'magrittr',
'mapproj', 'maps', 'markdown', 'mathjaxr', 'MatrixModels',
'matrixStats', 'maxLik', 'mclust', 'mediation', 'merDeriv', 'metadat',
'metafor', 'mfx', 'mice', 'mime', 'miniUI', 'mix', 'mlbench', 'mlogit',
'mockery', 'modeldata', 'modeltests', 'modeltools', 'multcomp',
'mvtnorm', 'nanoarrow', 'nanonext', 'network', 'networkD3', 'nlme',
'nloptr', 'nnet', 'officer', 'openssl', 'optimx', 'ordinal', 'packrat',
'pak', 'pander', 'parallelly', 'partitions', 'party', 'partykit',
'patchwork', 'pbapply', 'pbkrtest', 'permute', 'pheatmap', 'phyr',
'pillar', 'pingr', 'pkgbuild', 'pkgdown', 'pkgload', 'PKI', 'plm',
'plotly', 'plotrix', 'prabclus', 'pracma', 'pROC', 'processx',
'prodlim', 'profmem', 'progressr', 'proj4', 'promises', 'proxy', 'ps',
'psych', 'psychotools', 'psychotree', 'purrr', 'qgam', 'qreport', 'qs',
'quantmod', 'quantreg', 'quarto', 'R.cache', 'R.devices', 'R.oo',
'R.utils', 'R6', 'ragg', 'rapidjsonr', 'raster', 'rbibutils',
'rcartocolor', 'Rcpp', 'RcppArmadillo', 'RcppParallel', 'RcppTOML',
'RCurl', 'Rdpack', 'reactable', 'readr', 'readxl', 'recipes',
'relations', 'renv', 'reshape', 'reshape2', 'restfulr', 'reticulate',
'rgl', 'rhub', 'rio', 'rlang', 'rle', 'RMariaDB', 'rmarkdown',
'RMySQL', 'rnaturalearth', 'robustbase', 'roxygen2', 'RPostgreSQL',
'rprojroot', 'rrcov', 'rsample', 'rsconnect', 'Rsolnp', 'RSQLite',
'rstatix', 'rsvg', 'Rttf2pt1', 'RUnit', 'rversions', 's2', 'S7',
'sass', 'scales', 'secretbase', 'seriation', 'sessioninfo', 'sf',
'sfheaders', 'sftime', 'shiny', 'shinyjs', 'slider', 'sodium', 'sp',
'spacetime', 'spam', 'spatialreg', 'spData', 'spdep', 'spelling',
'stars', 'statmod', 'statnet.common', 'stringfish', 'stringi',
'stringmagic', 'stringr', 'styler', 'survey', 'survival', 'svglite',
'systemfonts', 'tables', 'targets', 'tensorflow', 'terra', 'testit',
'testthat', 'textshaping', 'tfruns', 'TH.data', 'thematic', 'tibble',
'tidyr', 'timeDate', 'timeSeries', 'tinytex', 'tmap', 'tmaptools',
'tseries', 'TSP', 'tzdb', 'unitizer', 'units', 'usethis', 'utf8', 'V8',
'vegan', 'VGAM', 'vroom', 'waldo', 'warp', 'webfakes', 'wk', 'writexl',
'xfun', 'XML', 'xml2', 'yaml', 'zeallot', 'zip', 'zoo'
Update all/some/none? [a/s/n]:
n
enrich.go <- performGoEnrichment.diffMeth(rnb, diffmeth_sorted, verbose = TRUE) #takes 30-45 minutes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:03:42 Inf STATUS STARTED Differential Methylation GO Enrichment Analysis
Warning: 'memory.size()' is no longer supported
2026-01-15 19:03:42 Inf STATUS STARTED Comparison: Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:03:42 Inf STATUS STARTED Ontology: BP
Warning: 'memory.size()' is no longer supported
2026-01-15 19:03:42 Inf STATUS STARTED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:03:42 Inf STATUS STARTED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:03:42 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:05:03 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:07:03 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:09:13 Inf INFO Rank cutoff: 765 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:11:56 Inf STATUS COMPLETED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:11:56 Inf STATUS STARTED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:11:57 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:13:43 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:16:15 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:18:59 Inf INFO Rank cutoff: 895 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:21:30 Inf STATUS COMPLETED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:21:30 Inf STATUS COMPLETED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:21:30 Inf STATUS COMPLETED Ontology: BP
Warning: 'memory.size()' is no longer supported
2026-01-15 19:21:30 Inf STATUS STARTED Ontology: MF
Warning: 'memory.size()' is no longer supported
2026-01-15 19:21:30 Inf STATUS STARTED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:21:30 Inf STATUS STARTED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:21:30 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:22:19 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:23:17 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:24:08 Inf INFO Rank cutoff: 765 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:25:04 Inf STATUS COMPLETED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:25:04 Inf STATUS STARTED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:25:04 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:25:58 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:26:53 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:27:49 Inf INFO Rank cutoff: 895 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS COMPLETED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS COMPLETED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS COMPLETED Ontology: MF
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS COMPLETED Comparison: Glia_CTRL vs. Neuron_CTRL (based on Neuron_CTRL_vs_Glia_CTRL)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS STARTED Comparison: Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS STARTED Ontology: BP
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS STARTED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf STATUS STARTED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:28:43 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:30:40 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:33:22 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:36:13 Inf INFO Rank cutoff: 2 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:36:46 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 19:37:23 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 19:37:23 Inf STATUS COMPLETED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:37:23 Inf STATUS STARTED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:37:23 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:39:27 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:41:57 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:21 Inf INFO Rank cutoff: 2 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:49 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:49 Inf STATUS COMPLETED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:49 Inf STATUS COMPLETED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:49 Inf STATUS COMPLETED Ontology: BP
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:49 Inf STATUS STARTED Ontology: MF
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:49 Inf STATUS STARTED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:49 Inf STATUS STARTED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:44:50 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:45:31 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:46:13 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:46:56 Inf INFO Rank cutoff: 2 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:47:16 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 19:47:34 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 19:47:34 Inf STATUS COMPLETED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:47:34 Inf STATUS STARTED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:47:34 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:48:21 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:49:02 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:49:48 Inf INFO Rank cutoff: 2 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS COMPLETED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS COMPLETED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS COMPLETED Ontology: MF
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS COMPLETED Comparison: Neuron_AD vs. Neuron_CTRL (based on AD_vs_CTRL_Neuron)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS STARTED Comparison: Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS STARTED Ontology: BP
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS STARTED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf STATUS STARTED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:50:07 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:51:55 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 19:54:20 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 19:56:55 Inf INFO Rank cutoff: 3 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 19:57:23 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 19:57:23 Inf STATUS COMPLETED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 19:57:23 Inf STATUS STARTED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 19:57:23 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 19:59:04 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 20:01:28 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 20:03:48 Inf INFO Rank cutoff: 2 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 20:04:30 Inf STATUS COMPLETED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 20:04:30 Inf STATUS COMPLETED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 20:04:30 Inf STATUS COMPLETED Ontology: BP
Warning: 'memory.size()' is no longer supported
2026-01-15 20:04:30 Inf STATUS STARTED Ontology: MF
Warning: 'memory.size()' is no longer supported
2026-01-15 20:04:30 Inf STATUS STARTED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 20:04:30 Inf STATUS STARTED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 20:04:30 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 20:05:15 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 20:06:00 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 20:06:50 Inf INFO Rank cutoff: 3 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 20:07:12 Inf INFO Could not conduct enrichment analysis as associated genes are not in GO database.
Warning: 'memory.size()' is no longer supported
2026-01-15 20:07:12 Inf STATUS COMPLETED Region Type: genes
Warning: 'memory.size()' is no longer supported
2026-01-15 20:07:12 Inf STATUS STARTED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 20:07:12 Inf INFO Rank cutoff: 100
Warning: 'memory.size()' is no longer supported
2026-01-15 20:07:59 Inf INFO Rank cutoff: 500
Warning: 'memory.size()' is no longer supported
2026-01-15 20:08:46 Inf INFO Rank cutoff: 1000
Warning: 'memory.size()' is no longer supported
2026-01-15 20:09:36 Inf INFO Rank cutoff: 2 (auto-select)
Warning: 'memory.size()' is no longer supported
2026-01-15 20:09:58 Inf STATUS COMPLETED Region Type: promoters
Warning: 'memory.size()' is no longer supported
2026-01-15 20:09:58 Inf STATUS COMPLETED Region Level
Warning: 'memory.size()' is no longer supported
2026-01-15 20:09:58 Inf STATUS COMPLETED Ontology: MF
Warning: 'memory.size()' is no longer supported
2026-01-15 20:09:58 Inf STATUS COMPLETED Comparison: Glia_AD vs. Glia_CTRL (based on AD_vs_CTRL_Glia)
Warning: 'memory.size()' is no longer supported
2026-01-15 20:09:58 Inf STATUS COMPLETED Differential Methylation GO Enrichment Analysis
#result is a complex nested table so let's extract some results to get an impression about the results
enrich.table.go <-enrich.go[["region"]][[comparison]][["BP"]][["promoters"]][["rankCut_500"]][["hyper"]]
class(enrich.table.go)
[1] "GOHyperGResult"
attr(,"package")
[1] "GOstats"
summary(enrich.table.go)
NA
library(LOLA)
library(simpleCache)
lolaDest <- tempfile()
dir.create(lolaDest)
lolaDirs <- downloadLolaDbs(dest = lolaDest, dbs = "LOLACore") #downloads ca 500MB
#if download breaks with timeout error change timeout limit e.g. options(timeout=300), then try again #
#perform LOLA
enrich.lola <-performLolaEnrichment.diffMeth(rnb, diffmeth_sorted, lolaDirs[["hg19"]]) #5min
#extract some results
enrich.table.lola <- enrich.lola$region[[comparison]][["promoters"]]
enrich.table.lola <- enrich.table.lola[enrich.table.lola$userSet == "rankCut_500_hyper", ]
#plot results
lolaBarPlot(enrich.lola$lolaDb, enrich.table.lola, scoreCol = "pValueLog", orderCol = "maxRnk", pvalCut = 0.05, signifCol = "pValueLog")
lolaBoxPlotPerTarget(enrich.lola$lolaDb, enrich.table.lola, scoreCol = "pValueLog", orderCol = "maxRnk", pvalCut = 0.05, signifCol = "pValueLog")
#########################################################################################################
#export of rnbeads data
rnb.options(export.to.csv = TRUE)
rnb.run.tnt(rnb, report.dir)
#########################################################################################################
# Coordinates around specific locus
chrom <- "chr2"
start <- 177010000#112252200
end <- 177040000#112252300
sample.grouping <- rnb.sample.groups(rnb)[['Neuron_CTRL_vs_Glia_CTRL']]
rnb.plot.locus.profile(rnb, chrom, start, end, grps = sample.grouping)
#change grouping so inspect other groups, see all groupings by using names(rnb.sample.groups(rnb))
sample.grouping <- rnb.sample.groups(rnb)[['AD_vs_CTRL_Neuron']]
rnb.plot.locus.profile(rnb, chrom, start, end, grps = sample.grouping)
sample.grouping <- rnb.sample.groups(rnb)[['AD_vs_CTRL_Glia']]
rnb.plot.locus.profile(rnb, chrom, start, end, grps = sample.grouping)