-
Notifications
You must be signed in to change notification settings - Fork 28
/
epic-demo.rmd
115 lines (89 loc) · 3.21 KB
/
epic-demo.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
```{r epic-demo-init, echo=FALSE, message=F}
library(knitr)
library(Cairo)
opts_chunk$set(warning=FALSE, fig.width=6, fig.height=6, dev="CairoPNG", stop=TRUE)
```
# Normalize an EPIC dataset
## Download example data set
```{r child = 'dataset-epic-demo.rmd'}
```
```{r}
path <- download.epic.demo.dataset()
```
## Normalize dataset
Create samplesheet
```{r}
library(meffil)
samplesheet <- meffil.read.samplesheet(base=path, pattern="Demo_SampleSheet.csv")
```
Parameters.
```{r}
qc.file <- "epic-demo/qc-report.html"
author <- "Illumina, et al."
study <- "EPIC demo dataset"
number.pcs <- 2
norm.file <- "epic-demo/normalization-report.html"
```
Generate QC objects.
```{r epic-demo-qc, cache=T}
qc.objects <- meffil.qc(samplesheet, cell.type.reference="blood gse35069 complete", verbose=T)
```
QC report.
```{r}
qc.summary <- meffil.qc.summary(qc.objects, verbose=T)
meffil.qc.report(qc.summary,
output.file=qc.file,
author=author,
study=study)
```
Normalization dataset.
```{r epic-demo-norm, cache=T}
norm.objects <- meffil.normalize.quantiles(qc.objects, number.pcs=number.pcs, verbose=T)
norm.dataset <- meffil.normalize.samples(norm.objects,
just.beta=F,
cpglist.remove=qc.summary$bad.cpgs$name,
verbose=T)
```
```{r}
beta.meffil <- meffil.get.beta(norm.dataset$M, norm.dataset$U)
```
Compute principal components of the normalized methylation matrix.
```{r epic-demo-pcs, cache=T}
pcs <- meffil.methylation.pcs(beta.meffil, sites=meffil.get.autosomal.sites("epic"), verbose=T)
```
Normalization report.
```{r}
parameters <- meffil.normalization.parameters(norm.objects)
parameters$batch.threshold <- 0.01
norm.summary <- meffil.normalization.summary(norm.objects=norm.objects,
pcs=pcs,
parameters=parameters, verbose=T)
meffil.normalization.report(norm.summary,
output.file=norm.file,
author=author,
study=study)
```
## Horvath's clock and the EPIC microarray
```{r}
#require(RCurl)
#clock <- read.csv(textConnection(getURL("https://labs.genetics.ucla.edu/horvath/dnamage/AdditionalFile3.csv")), comment.char="#", stringsAsFactors=F)
clock <- read.csv("AdditionalFile3.csv", comment.char="#", stringsAsFactors=F)
length(setdiff(clock$CpGmarker, rownames(beta.meffil)))
nrow(clock)
length(intersect(clock$CpGmarker, rownames(beta.meffil)))/nrow(clock)
```
20 of the 'clock' sites are missing.
## Hannum predictor CpG sites and the EPIC microarray
71 CpG sites were used in the Hannum et al. age predictor:
> Hannum G, et al.
> Genome-wide methylation profiles reveal quantitative views of human aging rates.
> Mol Cell. 2013 Jan 24;49(2):359-67.
The list can be obtained from here:
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3780611/bin/NIHMS418935-supplement-02.xlsx
```{r}
hannum.sites <- readLines("hannum.txt")
length(hannum.sites)
length(setdiff(hannum.sites, rownames(beta.meffil)))
length(intersect(hannum.sites, rownames(beta.meffil)))/length(hannum.sites)
```
6 of the 71 sites are missing.