comparison findDMR/findDMR.R @ 0:ca66a1487d4a draft

Uploaded
author testtool
date Mon, 06 Feb 2017 06:10:47 -0500
parents
children 0d1957068766
comparison
equal deleted inserted replaced
-1:000000000000 0:ca66a1487d4a
1 require("minfi", quietly = TRUE)
2 require("ChIPseeker", quietly = TRUE)
3 require("ChIPpeakAnno", quietly = TRUE)
4 require("data.table", quietly = TRUE)
5
6
7 args <- commandArgs(trailingOnly = TRUE)
8 GSMTable = args[1]
9 IlmnTable = args[2]
10 gmTable = args[3]
11 cutoff = as.numeric(args[4])
12 clusterSize = as.numeric(args[5])
13 DMR = args[6]
14
15 #GSMTable<-("test-data/input.csv")
16 TAB = fread(GSMTable)
17 #IlmnTable <- ("test-data/IlmnTable.csv")
18 IlmnInfo = fread(IlmnTable)
19 #gmTable<-("test-data/gmTable.csv")
20 gmSet = fread(gmTable)
21
22 # bumphunter Run with processed data
23 designMatrix <- model.matrix( ~ TAB$Phenotype)
24
25 bumps <- bumphunter(
26 as.matrix(gmSet),
27 design = designMatrix,
28 pos = IlmnInfo$BP,
29 cutoff = cutoff,
30 chr = IlmnInfo$CHR
31 )
32
33 # choose DMR's of a certain length threshold
34 DMRTable <- bumps$table[which(bumps$table$L >= clusterSize), ]
35 DMRInfo <- data.table(DMRTable$chr, DMRTable$start, DMRTable$end)
36
37
38 #DMR<-("test-data/DMR.bed")
39 write.table(
40 DMRInfo,
41 DMR,
42 quote = F,
43 sep = "\t",
44 row.names = F,
45 col.names = F
46 )