annotate findDMR/findDMR.R @ 33:2c799524e1d3 draft

Uploaded
author testtool
date Fri, 14 Apr 2017 06:44:35 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
1 require("minfi", quietly = TRUE)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
2 require("ChIPseeker", quietly = TRUE)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
3 require("ChIPpeakAnno", quietly = TRUE)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
4 require("data.table", quietly = TRUE)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
5
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
6
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
7 args <- commandArgs(trailingOnly = TRUE)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
8 GSMTable = args[1]
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
9 platform = args[2]
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
10 Data_Table = args[3]
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
11 cutoff = as.numeric(args[4])
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
12 clusterSize = as.numeric(args[5])
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
13 DMR = args[6]
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
14
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
15 TAB = fread(GSMTable)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
16
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
17 IlmnInfo = fread(platform)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
18
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
19 gmSet = fread(Data_Table)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
20
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
21 # bumphunter Run with processed data
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
22 designMatrix <- model.matrix( ~ TAB$Phenotype)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
23
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
24 bumps <- bumphunter(
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
25 as.matrix(gmSet),
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
26 design = designMatrix,
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
27 pos = IlmnInfo$BP,
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
28 cutoff = cutoff,
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
29 chr = IlmnInfo$CHR
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
30 )
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
31
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
32 # choose DMR's of a certain length threshold
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
33 DMRTable <- bumps$table[which(bumps$table$L >= clusterSize), ]
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
34 DMRInfo <- data.table(DMRTable$chr, DMRTable$start, DMRTable$end)
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
35
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
36
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
37
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
38 write.table(
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
39 DMRInfo,
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
40 DMR,
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
41 quote = F,
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
42 sep = "\t",
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
43 row.names = F,
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
44 col.names = F
2c799524e1d3 Uploaded
testtool
parents:
diff changeset
45 )