Source: https://github.com/markziemann/TODO

Introduction

Here we are establishing the methylation profile of ovarian cancer versus healthy tissue in order to understand whether this signature can be observed in the blood of individuals who will soon be diagnosed with the disease.

baseDir=getwd()
dataDir=paste(baseDir,"/idat",sep="")

suppressPackageStartupMessages({
  library("missMethyl")
  library("limma")
  library("minfi")
  library("IlluminaHumanMethylation450kanno.ilmn12.hg19")
  library("IlluminaHumanMethylationEPICanno.ilm10b4.hg19")
  library("RColorBrewer")
  library("matrixStats")
  library("gplots")
  library("WGCNA")
  library("FlowSorted.Blood.450k")
  library("reshape2")
  library("ggplot2")
  library("missMethyl")
  library("DMRcate")
  #library("FlowSorted.Blood.EPIC")
  library("mitch")
  library("kableExtra")
  library("vioplot")
  library("RhpcBLASctl")
})

source("../../meth_functions.R")

RhpcBLASctl::blas_set_num_threads(1)

Load data

Load the annotation data and the Epic methylation data.

This analysis is to be conducted on Ubuntu with R4.

ann <- getAnnotation(IlluminaHumanMethylationEPICanno.ilm10b4.hg19)
anno <- ann
ann_sub <- ann[,c("chr","pos","strand","Name","Islands_Name",
    "Relation_to_Island","UCSC_RefGene_Name","UCSC_RefGene_Group")]

targets_gen <- read.metharray.sheet(base=dataDir,pattern = "samplesheet.csv")
## [read.metharray.sheet] Found the following CSV files:
## [1] "/home/mark.ziemann@domain.internal.burnet.edu.au/projects/cancer_biomarkers/ovarian/GSE133556/idat/samplesheet.csv"
targets_gen$Basename <- paste(targets_gen$SampleID,targets_gen$ChipID,sep="_")

#targets$ID = paste(targets$Sample_Group,targets_gen$Sample_Name,sep=".")
rgSet <- read.metharray.exp(base=dataDir, targets = targets_gen)

sampleNames(rgSet) <- targets_gen$SampleID

Testing MZ status

snpBetas <- getSnpBeta(rgSet)
## Loading required package: IlluminaHumanMethylationEPICmanifest
d <- dist(t(snpBetas))
hr <- hclust(d, method = "complete", members=NULL)
plot(hr,cex=0.5)

Quality control

detP <- detectionP(rgSet)
qcReport(rgSet, sampNames = targets_gen$Sample_Name, pdf="qc-report.pdf")
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning: SPECIFICITY I probes outside plot range
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning: SPECIFICITY I probes outside plot range
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning: SPECIFICITY I probes outside plot range
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning: SPECIFICITY I probes outside plot range
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning: SPECIFICITY I probes outside plot range
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## Warning in type.convert.default(X[[i]], ...): 'as.is' should be specified by
## the caller; using TRUE
## png 
##   2
cols <- brewer.pal(4,"Set1")

barplot(apply(detP,2,mean),
  col=as.numeric(factor(targets_gen$Sample_Name)),
  las=2,cex.names= 0.8, cex.axis=0.75,
  main="Mean detection p-values of probe signals",
  ylab="Mean detection p-value")

barplot(apply(detP,2,mean),
  col=as.numeric(factor(targets_gen$Sample_Name)),
  las=2,cex.names= 0.8, cex.axis=0.75,ylim=c(0,0.010),
  main="Mean detection p-values of probe signals",
  ylab="Mean detection p-value")

Preprocessing

mset.raw <- preprocessRaw(rgSet)

mset <- preprocessQuantile(rgSet)
## [preprocessQuantile] Mapping to genome.
## Warning in .getSex(CN = CN, xIndex = xIndex, yIndex = yIndex, cutoff = cutoff):
## An inconsistency was encountered while determining sex. One possibility is that
## only one sex is present. We recommend further checks, for example with the
## plotSex function.
## [preprocessQuantile] Fixing outliers.
## [preprocessQuantile] Quantile normalizing.

Data exploration

Using Multi-dimensional scaling (MDS) plots before filtering.

mdsPlot(mset.raw, numPositions = 1000, sampGroups = targets_gen$Sample_Name,
  sampNames=targets_gen$SampleID,legendPos="bottom")

mdsPlot(getBeta(mset), numPositions = 1000, sampGroups = targets_gen$Sample_Name,
  sampNames=targets_gen$SampleID,legendPos="bottom")

Filteringhead

None of the p-values are less than 0.05.

Now filter for high detection p-value and overlap with SNP.

Need to get a copy of the Xreact probes from Namitha. In the mean time I have downloaded from github - link below.

detP <- detectionP(rgSet)
badPcnt <- apply(detP,2,function(x) { length(which(x>0.01)) } )
badPcnt <- badPcnt[order(badPcnt)]

barplot(badPcnt,horiz=TRUE,las=1,cex.names=0.5)

barplot(tail(badPcnt,20),horiz=TRUE,las=1,cex.names=0.6)

badP <- apply(detP,1,function(x) { length(which(x>0.01)) } )
dim(detP)
## [1] 866091    111
length(which(badP>10))
## [1] 6882
keep <- which(badP<10)
mset[rownames(mset) %in% names(keep),]
## class: GenomicRatioSet 
## dim: 858245 111 
## metadata(0):
## assays(2): M CN
## rownames(858245): cg14817997 cg26928153 ... cg07587934 cg16855331
## rowData names(0):
## colnames(111): GSM3911862 GSM3911863 ... GSM3912031 GSM3912032
## colData names(11): SampleID ChipID ... yMed predictedSex
## Annotation
##   array: IlluminaHumanMethylationEPIC
##   annotation: ilm10b4.hg19
## Preprocessing
##   Method: Raw (no normalization or bg correction)
##   minfi version: 1.50.0
##   Manifest version: 0.3.0
gmset <- mapToGenome(mset)

#remove SNPs
gmset <- dropLociWithSnps(gmset, snps = c("CpG", "SBE"))

#Removing cross-reactive probes
XURL="https://raw.githubusercontent.com/sirselim/illumina450k_filtering/master/EPIC/13059_2016_1066_MOESM1_ESM.csv"
Xreact <- read.csv(XURL)

noXreact <- !(featureNames(gmset) %in% Xreact$X)

gmset <- gmset[noXreact,]

#Removing probes on X and Y chromosomes
autosomes <- !(featureNames(gmset) %in% ann$Name[ann$chr %in% c("chrX","chrY")])
gmset <- gmset[autosomes,]

#getBeta
beta <- getM(gmset)
saveRDS(beta,"bl_beta.rds")
df <- data.frame(t(t(colMeans(beta))))
df
##            t.t.colMeans.beta...
## GSM3911862           -0.4474743
## GSM3911863           -0.4532306
## GSM3911864           -0.4496271
## GSM3911865           -0.4496127
## GSM3911866           -0.4469514
## GSM3911867           -0.4421429
## GSM3911868           -0.4485742
## GSM3911869           -0.4521518
## GSM3911870           -0.4494008
## GSM3911871           -0.4463365
## GSM3911872           -0.4447413
## GSM3911873           -0.4541568
## GSM3911874           -0.4509595
## GSM3911875           -0.4420105
## GSM3911876           -0.4478256
## GSM3911877           -0.4530201
## GSM3911878           -0.4480999
## GSM3911879           -0.4499674
## GSM3911880           -0.4472988
## GSM3911881           -0.4502712
## GSM3911882           -0.4457314
## GSM3911883           -0.4486873
## GSM3911884           -0.4463951
## GSM3911885           -0.4515549
## GSM3911886           -0.4443727
## GSM3911887           -0.4436849
## GSM3911888           -0.4457299
## GSM3911889           -0.4468304
## GSM3911890           -0.4415188
## GSM3911891           -0.4442675
## GSM3911892           -0.4474649
## GSM3911893           -0.4572643
## GSM3911894           -0.4442860
## GSM3911895           -0.4538831
## GSM3911896           -0.4585926
## GSM3911897           -0.4450196
## GSM3911898           -0.4489041
## GSM3911899           -0.4501816
## GSM3911900           -0.4540031
## GSM3911901           -0.4443511
## GSM3911902           -0.4549322
## GSM3911903           -0.4553253
## GSM3911904           -0.4531865
## GSM3911905           -0.4493668
## GSM3911906           -0.4445540
## GSM3911907           -0.4490076
## GSM3911908           -0.4475309
## GSM3911909           -0.4441517
## GSM3911910           -0.4386959
## GSM3911911           -0.4571929
## GSM3911912           -0.4485718
## GSM3911913           -0.4482994
## GSM3911914           -0.4451191
## GSM3911915           -0.4514618
## GSM3911916           -0.4509893
## GSM3911917           -0.4446942
## GSM3911918           -0.4533041
## GSM3911919           -0.4464384
## GSM3911920           -0.4492698
## GSM3911921           -0.4436142
## GSM3911922           -0.4504614
## GSM3911923           -0.4506988
## GSM3911924           -0.4494134
## GSM3911925           -0.4396179
## GSM3911926           -0.4461498
## GSM3911927           -0.4496587
## GSM3911928           -0.4507816
## GSM3911929           -0.4456993
## GSM3911930           -0.4502994
## GSM3911931           -0.4426471
## GSM3911932           -0.4470735
## GSM3911933           -0.4426173
## GSM3911934           -0.4436359
## GSM3911935           -0.4437165
## GSM3911936           -0.4397457
## GSM3911937           -0.4420491
## GSM3911938           -0.4418171
## GSM3911939           -0.4492959
## GSM3911940           -0.4481805
## GSM3911941           -0.4441673
## GSM3911942           -0.4552438
## GSM3911943           -0.4510021
## GSM3911944           -0.4403518
## GSM3911945           -0.4409476
## GSM3911946           -0.4482015
## GSM3911947           -0.4515890
## GSM3911948           -0.4485105
## GSM3911949           -0.4493624
## GSM3911950           -0.4509996
## GSM3911951           -0.4439952
## GSM3912012           -0.4534565
## GSM3912013           -0.4438707
## GSM3912014           -0.4523521
## GSM3912015           -0.4552149
## GSM3912016           -0.4518657
## GSM3912017           -0.4374802
## GSM3912018           -0.4531850
## GSM3912019           -0.4467999
## GSM3912020           -0.4465207
## GSM3912021           -0.4489707
## GSM3912022           -0.4404712
## GSM3912023           -0.4445440
## GSM3912024           -0.4552310
## GSM3912025           -0.4408353
## GSM3912026           -0.4401412
## GSM3912027           -0.4534165
## GSM3912028           -0.4468481
## GSM3912029           -0.4490814
## GSM3912030           -0.4467013
## GSM3912031           -0.4522135
## GSM3912032           -0.4503872
#Relative log expression (RLE plot)
mvals <- getM(gmset)
medSq <- apply(mvals, 1, median)
YSq <- mvals - medSq

boxplot(YSq,outline=FALSE,ylim=c(-1.5,1.5),
  ylab="Relative Log Methylation Value", cex=0.2 )

MDS plots generation after filtering

pal <- brewer.pal(8, "Dark2")

cols <- gsub("2","blue",gsub("1","red",as.character(as.numeric(factor(targets_gen$Sample_Name)))))

mds1Sq <- plotMDS(getBeta(gmset), top=1000, gene.selection="common",dim.plot=c(1,2), col=cols)

mds2Sq <- plotMDS(getBeta(gmset), top=1000, gene.selection="common",dim.plot=c(1,3), col=cols)

mds3Sq <- plotMDS(getBeta(gmset), top=1000, gene.selection="common",dim.plot=c(2,3), col=cols)

mds4Sq <- plotMDS(getBeta(gmset), top=1000, gene.selection="common",dim.plot=c(3,4), col=cols)

plotMDS(mds1Sq, xlab="Dimension 1", ylab="Dimension 2",
  col=cols, dim=c(1,2), labels=targets_gen$Sample_ID)
legend("bottomright",bg="white",col=pal,cex=.7,pch=1,legend=0:1)

plotMDS(mds2Sq, xlab="Dimension 1", ylab="Dimension 3",
  col=cols, dim=c(1,3), labels=targets_gen$Sample_ID)
legend("bottomright",bg="white",col=pal,cex=.7,pch=1,legend=0:1)

plotMDS(mds3Sq, xlab="Dimension 2", ylab="Dimension 3",
  col=cols,dim=c(2,3), labels=targets_gen$Sample_ID)
legend("bottomright",bg="white",col=pal,cex=.7,pch=1,legend=0:1)

plotMDS(mds4Sq, xlab="Dimension 3", ylab="Dimension 4",
  col=cols,dim=c(3,4), labels=targets_gen$Sample_ID)
legend("bottomright",bg="white",col=pal,cex=.7,pch=1,legend=0:1)

Regression analysis for cancer

cancer <- factor(grepl("High",targets_gen$Sample_Name))

design <- model.matrix(~ cancer )
fit <- lmFit(mvals, design)
fit <- eBayes(fit)
summary(decideTests(fit))
##        (Intercept) cancerTRUE
## Down        317944     143483
## NotSig       86204     475988
## Up          372373     157050
top <- topTable(fit,coef="cancerTRUE",num=Inf, sort.by = "P")

nrow(subset(top,adj.P.Val < 0.05))
## [1] 300533
nrow(subset(top,P.Value < 1e-4))
## [1] 113285
output <-merge(ann_sub,top,by.x="Name",by.y="row.names")
output <- output[order(output$P.Value),]
write.csv(output, file="GSE133556_limma.csv",row.names=FALSE)
output <- subset(output,P.Value<1e-4)
head(output,30) %>% kbl() %>% kable_paper("hover", full_width = F)
Name chr pos strand Islands_Name Relation_to_Island UCSC_RefGene_Name UCSC_RefGene_Group logFC AveExpr t P.Value adj.P.Val B
cg15294607 chr2 28613033
chr2:28612964-28616748 Island -5.909159 -2.3164465 -45.33774 0 0 148.75169
cg05677464 chr17 49171512
OpenSea SPAG9;SPAG9;SPAG9 Body;Body;Body 4.068537 0.9576384 20.25892 0 0 77.75095
cg20111584 chr21 16774725
OpenSea 3.095340 1.4091866 18.31758 0 0 69.46174
cg25059588 chr2 220286185
chr2:220283200-220283750 S_Shelf DES Body 2.016165 2.7122903 17.94317 0 0 67.80341
cg19740353 chr6 53394492
OpenSea GCLC Body 2.812570 1.1206037 17.76753 0 0 67.01877
cg22216738 chr19 18721711
chr19:18721523-18721869 Island -2.664257 -4.0405298 -17.74857 0 0 66.93380
cg21718261 chr8 71086222
OpenSea NCOA2 Body 2.852690 2.4928273 17.50528 0 0 65.83933
cg26562007 chr6 111920964
OpenSea TRAF3IP2-AS1;TRAF3IP2-AS1;TRAF3IP2;TRAF3IP2;TRAF3IP2 Body;Body;Body;5’UTR;5’UTR 3.067066 0.6996643 17.13922 0 0 64.17720
cg08972369 chr3 124687302
OpenSea HEG1 3’UTR 2.200948 2.2091299 16.96616 0 0 63.38499
cg19545040 chr10 103700513
OpenSea C10orf76 Body 2.556039 1.5762841 16.96554 0 0 63.38215
cg04282788 chr1 210407473
chr1:210407401-210407637 Island C1orf133;SERTAD4 TSS200;5’UTR -1.408015 -3.5279296 -16.77345 0 0 62.49804
cg21383646 chr8 38599320
OpenSea TACC1 5’UTR 3.369892 1.2981562 16.74994 0 0 62.38950
cg18951537 chr17 11950516
OpenSea MAP2K4 Body 3.259542 1.0628564 16.72585 0 0 62.27821
cg22880112 chr3 64331448
OpenSea 3.719726 0.9094945 16.67969 0 0 62.06471
cg26248588 chr3 123409971
OpenSea MYLK-AS2;MYLK;MYLK;MYLK;MYLK Body;Body;Body;Body;Body 1.796483 0.8749342 16.63662 0 0 61.86523
cg25576112 chr6 43878504
OpenSea LINC01512 Body 2.042443 0.3286338 16.58295 0 0 61.61635
cg19062021 chr19 18617954
OpenSea ELL Body 3.313115 -0.8476797 16.43450 0 0 60.92582
cg03243768 chr11 9115107
chr11:9112461-9113459 S_Shore FLJ46111 TSS1500 3.204014 2.4494332 16.41020 0 0 60.81255
cg05324501 chr9 73090414
OpenSea 2.808055 1.5967976 16.40526 0 0 60.78947
cg17179492 chr16 3149397
OpenSea ZSCAN10;ZSCAN10;ZSCAN10 TSS200;TSS200;TSS200 1.851535 0.7958453 16.22013 0 0 59.92351
cg08669766 chr10 120016854
OpenSea 3.084577 1.3221865 16.18097 0 0 59.73972
cg27492625 chr3 150987430
OpenSea MED12L;P2RY14 Body;5’UTR 2.375843 1.0411449 15.91333 0 0 58.47832
cg18053228 chr11 68853915
chr11:68849897-68850551 S_Shelf TPCN2 Body 2.204718 1.4630320 15.77200 0 0 57.80840
cg20563852 chr15 85396333
OpenSea ALPK3 Body 3.242126 2.0539980 15.73514 0 0 57.63325
cg18239484 chr4 152097630
OpenSea SH3D19;SH3D19;SH3D19;SH3D19 TSS1500;5’UTR;5’UTR;5’UTR 2.680887 1.7962270 15.73409 0 0 57.62824
cg25990200 chr1 233750794
chr1:233749373-233750314 S_Shore KCNK1 Body -2.083622 -3.7323778 -15.70048 0 0 57.46838
cg11514338 chr1 164543254
chr1:164545540-164545917 N_Shelf PBX1 Body 2.560031 1.9775870 15.59797 0 0 56.97991
cg21424209 chr6 148792600
OpenSea SASH1 Body 2.834990 1.3891108 15.49288 0 0 56.47767
cg06376771 chr12 16137468
OpenSea DERA;DERA Body;Body 3.118326 1.7455728 15.45230 0 0 56.28336
cg09652142 chr3 47932918
OpenSea MAP4;MAP4;MAP4;MAP4 Body;Body;Body;Body 3.086762 1.7089041 15.44517 0 0 56.24918
saveRDS(design, "GSE133556_design.rds")
saveRDS(mvals, "GSE133556_mvals.rds")
saveRDS(top, "GSE133556_limma.rds")

Session information

sessionInfo()
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.5 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Australia/Melbourne
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] IlluminaHumanMethylationEPICmanifest_0.3.0         
##  [2] RhpcBLASctl_0.23-42                                
##  [3] vioplot_0.5.0                                      
##  [4] zoo_1.8-12                                         
##  [5] sm_2.2-6.0                                         
##  [6] kableExtra_1.4.0                                   
##  [7] mitch_1.19.3                                       
##  [8] DMRcate_3.0.10                                     
##  [9] ggplot2_3.5.1                                      
## [10] reshape2_1.4.4                                     
## [11] FlowSorted.Blood.450k_1.42.0                       
## [12] WGCNA_1.73                                         
## [13] fastcluster_1.2.6                                  
## [14] dynamicTreeCut_1.63-1                              
## [15] gplots_3.2.0                                       
## [16] RColorBrewer_1.1-3                                 
## [17] limma_3.60.6                                       
## [18] missMethyl_1.38.0                                  
## [19] IlluminaHumanMethylationEPICanno.ilm10b4.hg19_0.6.0
## [20] IlluminaHumanMethylation450kanno.ilmn12.hg19_0.6.1 
## [21] minfi_1.50.0                                       
## [22] bumphunter_1.46.0                                  
## [23] locfit_1.5-9.10                                    
## [24] iterators_1.0.14                                   
## [25] foreach_1.5.2                                      
## [26] Biostrings_2.72.1                                  
## [27] XVector_0.44.0                                     
## [28] SummarizedExperiment_1.34.0                        
## [29] Biobase_2.64.0                                     
## [30] MatrixGenerics_1.16.0                              
## [31] matrixStats_1.4.1                                  
## [32] GenomicRanges_1.56.2                               
## [33] GenomeInfoDb_1.40.1                                
## [34] IRanges_2.38.1                                     
## [35] S4Vectors_0.42.1                                   
## [36] BiocGenerics_0.50.0                                
## 
## loaded via a namespace (and not attached):
##   [1] ProtGenerics_1.36.0       bitops_1.0-9             
##   [3] httr_1.4.7                doParallel_1.0.17        
##   [5] tools_4.4.1               doRNG_1.8.6              
##   [7] backports_1.5.0           utf8_1.2.4               
##   [9] R6_2.5.1                  HDF5Array_1.32.1         
##  [11] lazyeval_0.2.2            Gviz_1.48.0              
##  [13] rhdf5filters_1.16.0       permute_0.9-7            
##  [15] withr_3.0.2               GGally_2.2.1             
##  [17] prettyunits_1.2.0         gridExtra_2.3            
##  [19] base64_2.0.2              preprocessCore_1.66.0    
##  [21] cli_3.6.3                 sass_0.4.9               
##  [23] readr_2.1.5               genefilter_1.86.0        
##  [25] askpass_1.2.1             systemfonts_1.1.0        
##  [27] Rsamtools_2.20.0          foreign_0.8-87           
##  [29] svglite_2.1.3             siggenes_1.78.0          
##  [31] illuminaio_0.46.0         R.utils_2.12.3           
##  [33] dichromat_2.0-0.1         scrime_1.3.5             
##  [35] BSgenome_1.72.0           rstudioapi_0.17.1        
##  [37] impute_1.80.0             RSQLite_2.3.8            
##  [39] generics_0.1.3            BiocIO_1.14.0            
##  [41] gtools_3.9.5              dplyr_1.1.4              
##  [43] GO.db_3.19.1              Matrix_1.7-1             
##  [45] interp_1.1-6              fansi_1.0.6              
##  [47] abind_1.4-8               R.methodsS3_1.8.2        
##  [49] lifecycle_1.0.4           edgeR_4.2.2              
##  [51] yaml_2.3.10               rhdf5_2.48.0             
##  [53] SparseArray_1.4.8         BiocFileCache_2.12.0     
##  [55] grid_4.4.1                blob_1.2.4               
##  [57] promises_1.3.1            ExperimentHub_2.12.0     
##  [59] crayon_1.5.3              lattice_0.22-6           
##  [61] echarts4r_0.4.5           GenomicFeatures_1.56.0   
##  [63] annotate_1.82.0           KEGGREST_1.44.1          
##  [65] pillar_1.9.0              knitr_1.49               
##  [67] beanplot_1.3.1            rjson_0.2.23             
##  [69] codetools_0.2-20          glue_1.8.0               
##  [71] data.table_1.16.2         vctrs_0.6.5              
##  [73] png_0.1-8                 gtable_0.3.6             
##  [75] cachem_1.1.0              xfun_0.49                
##  [77] mime_0.12                 S4Arrays_1.4.1           
##  [79] survival_3.7-0            statmod_1.5.0            
##  [81] nlme_3.1-166              bit64_4.5.2              
##  [83] bsseq_1.40.0              progress_1.2.3           
##  [85] filelock_1.0.3            bslib_0.8.0              
##  [87] nor1mix_1.3-3             KernSmooth_2.23-24       
##  [89] rpart_4.1.23              colorspace_2.1-1         
##  [91] DBI_1.2.3                 Hmisc_5.2-0              
##  [93] nnet_7.3-19               tidyselect_1.2.1         
##  [95] bit_4.5.0                 compiler_4.4.1           
##  [97] curl_6.0.1                httr2_1.0.7              
##  [99] htmlTable_2.4.3           xml2_1.3.6               
## [101] DelayedArray_0.30.1       rtracklayer_1.64.0       
## [103] checkmate_2.3.2           scales_1.3.0             
## [105] caTools_1.18.3            quadprog_1.5-8           
## [107] rappdirs_0.3.3            stringr_1.5.1            
## [109] digest_0.6.37             rmarkdown_2.29           
## [111] GEOquery_2.72.0           htmltools_0.5.8.1        
## [113] pkgconfig_2.0.3           jpeg_0.1-10              
## [115] base64enc_0.1-3           sparseMatrixStats_1.16.0 
## [117] dbplyr_2.5.0              fastmap_1.2.0            
## [119] ensembldb_2.28.1          rlang_1.1.4              
## [121] htmlwidgets_1.6.4         UCSC.utils_1.0.0         
## [123] shiny_1.9.1               DelayedMatrixStats_1.26.0
## [125] jquerylib_0.1.4           jsonlite_1.8.9           
## [127] BiocParallel_1.38.0       mclust_6.1.1             
## [129] R.oo_1.27.0               VariantAnnotation_1.50.0 
## [131] RCurl_1.98-1.16           magrittr_2.0.3           
## [133] Formula_1.2-5             GenomeInfoDbData_1.2.12  
## [135] Rhdf5lib_1.26.0           munsell_0.5.1            
## [137] Rcpp_1.0.13-1             stringi_1.8.4            
## [139] zlibbioc_1.50.0           MASS_7.3-61              
## [141] AnnotationHub_3.12.0      plyr_1.8.9               
## [143] org.Hs.eg.db_3.19.1       ggstats_0.7.0            
## [145] deldir_2.0-4              splines_4.4.1            
## [147] multtest_2.60.0           hms_1.1.3                
## [149] rngtools_1.5.2            biomaRt_2.60.1           
## [151] BiocVersion_3.19.1        XML_3.99-0.17            
## [153] evaluate_1.0.1            latticeExtra_0.6-30      
## [155] biovizBase_1.52.0         BiocManager_1.30.25      
## [157] httpuv_1.6.15             tzdb_0.4.0               
## [159] tidyr_1.3.1               openssl_2.2.2            
## [161] purrr_1.0.2               reshape_0.8.9            
## [163] xtable_1.8-4              restfulr_0.0.15          
## [165] AnnotationFilter_1.28.0   later_1.4.0              
## [167] viridisLite_0.4.2         tibble_3.2.1             
## [169] beeswarm_0.4.0            memoise_2.0.1.9000       
## [171] AnnotationDbi_1.66.0      GenomicAlignments_1.40.0 
## [173] cluster_2.1.6