annotate findDMR/findDMR.R @ 0:ca66a1487d4a draft

Uploaded
author testtool
date Mon, 06 Feb 2017 06:10:47 -0500
parents
children 0d1957068766
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]
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
9 IlmnTable = args[2]
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
10 gmTable = args[3]
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 #GSMTable<-("test-data/input.csv")
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
16 TAB = fread(GSMTable)
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
17 #IlmnTable <- ("test-data/IlmnTable.csv")
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
18 IlmnInfo = fread(IlmnTable)
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
19 #gmTable<-("test-data/gmTable.csv")
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
20 gmSet = fread(gmTable)
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
21
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
22 # bumphunter Run with processed data
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
23 designMatrix <- model.matrix( ~ TAB$Phenotype)
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
24
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
25 bumps <- bumphunter(
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
26 as.matrix(gmSet),
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
27 design = designMatrix,
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
28 pos = IlmnInfo$BP,
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
29 cutoff = cutoff,
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
30 chr = IlmnInfo$CHR
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
31 )
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
32
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
33 # choose DMR's of a certain length threshold
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
34 DMRTable <- bumps$table[which(bumps$table$L >= clusterSize), ]
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
35 DMRInfo <- data.table(DMRTable$chr, DMRTable$start, DMRTable$end)
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
36
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
37
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
38 #DMR<-("test-data/DMR.bed")
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
39 write.table(
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
40 DMRInfo,
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
41 DMR,
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
42 quote = F,
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
43 sep = "\t",
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
44 row.names = F,
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
45 col.names = F
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
46 )