annotate findDMR/findDMR.R @ 5:715d03e1fd83 draft

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