Introduction

In this report, I will take you through a re-analysis methylation data first described by Kok et al (2015).

In their study, they analysed the DNA methylation patterns of 87 participants of aged 65-75 years with midly elevated Homocysteine levels. THese individuals were randomly asigned to take 400 μg folic acid and 500 μg vitamin B12 per day or a placebo during an intervention period of 2 years.

The platform used in the study is the Illumina Infinium HumanMethylation450k BeadChip assay. The authors used a pipeline based on DMRs (Peters et al, 2017), together with Benjamini-Hochberg(BH) procedure (Benjamini et al, 1995).

The methylation data have been deposited to NCBI GEO repository accession number GSE74548

The main conclusions from the original study were:

  • Long-term supplementation with folic acid and vitamin B12 resulted in DNA methylation changes in leukocytes of older persons.

  • A change in DNA methylation was observed to be different between the participants receiving folic acid and vitamin B12 versus placebo.

  • DNA methylation levels of several genomic loci were found to correlate to serum levels of either folate, vitamin B12, or plasma homocysteine.

  • Most prominent DNA methylation patterns associated with supplemental intake or status of B-vitamins are related to developmental processes as well as carcinogenesis.

The aim of this work is to;

  1. Asses the relationship between Homocysteine to DNA methylation patterns

  2. develop the analytical pipelines required for efficient re-analysis of 450K array data,

  3. to confirm that we are able to obtain differential methylation results that are similar to those obtained in the original study, and

  4. to critically evaluate the conclusions made in the original study.

Loading packages

These packackes will help us to perform vital steps such as normalisation, filtering, differential analysis, etc, and provide information about the array probe annotaions.

knitr::opts_chunk$set(dev = "png")

suppressPackageStartupMessages({
    library("missMethyl")
    library("GEOquery")
    library("limma")
    library("topconfects")
    library("minfi")
    library("IlluminaHumanMethylation450kmanifest")
    library("IlluminaHumanMethylation450kanno.ilmn12.hg19")
    library("DMRcate")
    library("mitch")

    library("kableExtra")
    library("forestplot")
    library("RColorBrewer")
    library("plyr")
    library("R.utils")
    library("eulerr")
    library("gplots")
    library("reshape2")
    library("beeswarm")
    library("RCircos")
  })
# Annotation
ann450k <- getAnnotation(IlluminaHumanMethylation450kanno.ilmn12.hg19)
myann <- data.frame(ann450k[,c("UCSC_RefGene_Name","Regulatory_Feature_Group")])
promoters <- grep("Prom",myann$Regulatory_Feature_Group)

Loading functions

These functions provide shortcuts to help with charts and other analysis. They will eventually be shoved into another Rscript or package but can stay here for now.

source("https://raw.githubusercontent.com/markziemann/ART_methylation/master/meth_functions.R")
myranks<-function(x) {
  x$score <- sign(x$logFC)/log10(x$adj.P.Val)
  y <- x[,"score",drop=FALSE]
  y$rn <- x$Row.names
  return(y)
}

# heatmap for continuous data
heatmap_c<-function(dm,name,mx,n, groups) {
  my_palette <- colorRampPalette(c("blue", "white", "red"))(25)
  topgenes <-  rownames(head(dm[order(dm$P.Value),],n))
  ss <- mx[which(rownames(mx) %in% topgenes),]
  mycols <- colorRampPalette(c("white","yellow", "orange", "red","darkred"))(n = length(groups))
  colCols <- mycols[order(groups)]
  heatmap.2(ss,scale="row",margin=c(10, 10),cexRow=0.6,trace="none",cexCol=0.4,
  ColSideColors=colCols ,  col=my_palette, main=name)
}

# heatmap for continuous data - topconfects
make_heatmap2_c <- function(confects,name,mx,n, groups) {
  topgenes <-  head(confects$table$name,n)
  my_palette <- colorRampPalette(c("blue", "white", "red"))(25)
  ss <- mx[which(rownames(mx) %in% topgenes),]
  mycols <- colorRampPalette(c("white","yellow", "orange", "red","darkred"))(n = length(groups))
  colCols <- mycols[order(groups)]
  heatmap.2(ss,scale="row",margin=c(10, 10),cexRow=0.6,trace="none",cexCol=0.4,
  ColSideColors=colCols ,  col=my_palette, main=name)  
}

Data import

Data will be imported from GEO data base under the accession number-GSE74548 https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE74548

dir.create("GSE74548")
## Warning in dir.create("GSE74548"): 'GSE74548' already exists
ARRAY_SAMPLESHEET="GSE74548/GSE74548_Sample_description_BProof.txt"
# only download it if it is not present on the system
if ( !file.exists(ARRAY_SAMPLESHEET ) ) {
    DLFILE=paste(ARRAY_SAMPLESHEET,".gz",sep="")
    download.file("https://ftp.ncbi.nlm.nih.gov/geo/series/GSE74nnn/GSE74548/suppl/GSE74548_Sample_description_BProof.txt.gz",
        destfile = DLFILE)
    gunzip(DLFILE)
}

ARRAY_DATA="GSE74548/GSE74548_RAW.tar"
# only download it if it is not present on the system
if ( !dir.exists("GSE74548/IDAT") ) {
  dir.create("GSE74548/IDAT")
  download.file("https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE74548&format=file",
    destfile = ARRAY_DATA)
    untar(exdir = "GSE74548/IDAT", tarfile = ARRAY_DATA)
}

baseDir <- "GSE74548"
R.utils::gunzip("GSE74548/IDAT/GPL13534_HumanMethylation450_15017482_v.1.1.csv.gz",overwrite=TRUE, remove=FALSE)
targets <- read.metharray.sheet(baseDir,pattern="csv")
## [read.metharray.sheet] Found the following CSV files:
## [1] "GSE74548/IDAT/GPL13534_HumanMethylation450_15017482_v.1.1.csv"   
## [2] "GSE74548/IDAT/GPL13534_HumanMethylation450_15017482_v.1.1.csv.gz"
## Warning in FUN(X[[i]], ...): Could not infer array name for file: GSE74548/IDAT/
## GPL13534_HumanMethylation450_15017482_v.1.1.csv
## Warning in FUN(X[[i]], ...): Could not infer slide name for file: GSE74548/IDAT/
## GPL13534_HumanMethylation450_15017482_v.1.1.csv
## Warning in FUN(X[[i]], ...): Could not infer array name for file: GSE74548/IDAT/
## GPL13534_HumanMethylation450_15017482_v.1.1.csv.gz
## Warning in FUN(X[[i]], ...): Could not infer slide name for file: GSE74548/IDAT/
## GPL13534_HumanMethylation450_15017482_v.1.1.csv.gz
if (! file.exists("GSE74548_series_matrix.txt.gz") ) { 
  URL="https://ftp.ncbi.nlm.nih.gov/geo/series/GSE74nnn/GSE74548/matrix/GSE74548_series_matrix.txt.gz"
  download.file(URL,destfile = "GSE74548_series_matrix.txt.gz")
}
gse<- getGEO(filename = "GSE74548_series_matrix.txt.gz")
## 
## ── Column specification ─────────────────────────────────────────────────────────────────────────────────
## cols(
##   .default = col_double(),
##   ID_REF = col_character()
## )
## ℹ Use `spec()` for the full column specifications.
## File stored at:
## /tmp/RtmpXt1SCk/GPL13534.soft
## Warning: 65 parsing failures.
##    row     col           expected     actual         file
## 485513 SPOT_ID 1/0/T/F/TRUE/FALSE rs10796216 literal data
## 485514 SPOT_ID 1/0/T/F/TRUE/FALSE rs715359   literal data
## 485515 SPOT_ID 1/0/T/F/TRUE/FALSE rs1040870  literal data
## 485516 SPOT_ID 1/0/T/F/TRUE/FALSE rs10936224 literal data
## 485517 SPOT_ID 1/0/T/F/TRUE/FALSE rs213028   literal data
## ...... ....... .................. .......... ............
## See problems(...) for more details.
targets <- pData(phenoData(gse))
targets <- targets[order(rownames(targets)),]
mybase <- unique(gsub("_Red.idat.gz" ,"", gsub("_Grn.idat.gz", "" ,list.files("./GSE74548",pattern = "GSM",recursive = TRUE))))
mybase <- paste("GSE74548/", mybase, sep = "")
# sample number discrepancy. 311 IDAT FILES but GEO states 174 subjects.
gsm <-sapply(strsplit(mybase,"_"),"[[",1)
gsm <-gsub("GSE74548/IDAT/","",gsm)
#only using sampels described in meta data
targets$Basename<- mybase[which(gsm %in% rownames(targets))]
rgSet <- read.metharray.exp(targets = targets)
## Warning in readChar(con, nchars = n): truncating string with embedded nuls
## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls

## Warning in readChar(con, nchars = n): truncating string with embedded nuls
targets[1:6,1:5]
##                                        title geo_accession
## GSM1922494  Buffy_Placebo_Baseline_Subject_1    GSM1922494
## GSM1922495 Buffy_Placebo_Follow-up_Subject_1    GSM1922495
## GSM1922496  Buffy_Placebo_Baseline_Subject_2    GSM1922496
## GSM1922497 Buffy_Placebo_Follow-up_Subject_2    GSM1922497
## GSM1922498  Buffy_Placebo_Baseline_Subject_3    GSM1922498
## GSM1922499 Buffy_Placebo_Follow-up_Subject_3    GSM1922499
##                           status submission_date last_update_date
## GSM1922494 Public on Nov 16 2015     Oct 30 2015      Apr 25 2016
## GSM1922495 Public on Nov 16 2015     Oct 30 2015      Apr 25 2016
## GSM1922496 Public on Nov 16 2015     Oct 30 2015      Apr 25 2016
## GSM1922497 Public on Nov 16 2015     Oct 30 2015      Apr 25 2016
## GSM1922498 Public on Nov 16 2015     Oct 30 2015      Apr 25 2016
## GSM1922499 Public on Nov 16 2015     Oct 30 2015      Apr 25 2016

Normalisation

mSet <- preprocessRaw(rgSet)
mSetSw <- SWAN(mSet,verbose=FALSE)
## [SWAN] Preparing normalization subset
## 450k
## [SWAN] Normalizing methylated channel
## [SWAN] Normalizing unmethylated channel
par(mfrow=c(1,2), cex=0.8)
densityByProbeType(mSet[,1], main = "Raw")
densityByProbeType(mSetSw[,1], main = "SWAN")
Figure 1. Normalisation of bead-array data with SWAN.

Figure 1. Normalisation of bead-array data with SWAN.

Filter probes

Here we are running parallel analyses, both including and excluding sex chromosomes.

# include sex chromosomes
detP <- detectionP(rgSet)
keep <- rowSums(detP < 0.01) == ncol(rgSet)
mSetSw <- mSetSw[keep,]

# exclude SNP probes
mSetSw <- mapToGenome(mSetSw)
mSetSw_nosnp <- dropLociWithSnps(mSetSw)
dim(mSetSw)
## [1] 446510    174
dim(mSetSw_nosnp)
## [1] 432127    174
mSetSw <- mSetSw_nosnp

# exclude sex chromosomes
keep <- !(featureNames(mSetSw) %in% ann450k$Name[ann450k$chr %in% c("chrX","chrY")])
mSetFlt <- mSetSw[keep,]
mSetFlt[1:6,1:5]
## class: GenomicMethylSet 
## dim: 6 5 
## metadata(0):
## assays(2): Meth Unmeth
## rownames(6): cg13869341 cg14008030 ... cg00381604 cg20253340
## rowData names(0):
## colnames(5): GSM1922494_9373550096_R03C01 GSM1922495_9373550096_R04C01
##   GSM1922496_9374343071_R03C01 GSM1922497_9374343071_R04C01
##   GSM1922498_9374343068_R03C01
## colData names(57): title geo_accession ... Basename filenames
## Annotation
##   array: IlluminaHumanMethylation450k
##   annotation: ilmn12.hg19
## Preprocessing
##   Method: SWAN (based on a MethylSet 
##                                                     preprocessed as 'Raw (no normalization or bg correction)')
##   minfi version: 1.34.0
##   Manifest version: 0.4.0
dim(mSetFlt)
## [1] 422374    174

Extracting Beta and M-values

# include sex chromosomes
meth <- getMeth(mSetSw)
unmeth <- getUnmeth(mSetSw)
Mval <- log2((meth + 100)/(unmeth + 100))
beta <- getBeta(mSetSw)

# exclude sex chromosomes
meth <- getMeth(mSetFlt)
unmeth <- getUnmeth(mSetFlt)
Mval_flt <- log2((meth + 100)/(unmeth + 100))
beta_flt <- getBeta(mSetFlt)

sex chromosome diagnostic

colnames(Mval)<-sapply(strsplit(colnames(Mval