comparison findDMR/findDMR.R @ 10:7df2b7d79391 draft

Uploaded
author testtool
date Thu, 11 May 2017 11:15:33 -0400
parents bae8d90853b7
children 24ac6f93cc3e
comparison
equal deleted inserted replaced
9:bae8d90853b7 10:7df2b7d79391
1 require("IlluminaHumanMethylation450kanno.ilmn12.hg19", quietly = TRUE) 1 args <- commandArgs(trailingOnly = TRUE)
2 require("data.table", quietly = TRUE) 2 GSMTable = args[1]
3 require("minfi", quietly = TRUE) 3 platform = args[2]
4 Data_Table = args[3]
5 cutoff = as.numeric(args[4])
6 clusterSize = as.numeric(args[5])
7 DMR = args[6]
4 8
5 options(warn = -1) 9 TAB = fread(GSMTable)
6 options("download.file.method"="wget")
7 10
8 args <- commandArgs(trailingOnly = TRUE) 11 IlmnInfo = fread(platform)
9 12
10 input1 = args[1] 13 gmSet = fread(Data_Table)
11 input2 = args[2]
12 output = args[3]
13 14
14 GRset <- get(load(input1)) 15 # bumphunter Run with processed data
16 designMatrix <- model.matrix( ~ TAB$Phenotype)
15 17
16 pheno <- fread(input2) 18 bumps <- bumphunter(
19 as.matrix(gmSet),
20 design = designMatrix,
21 pos = IlmnInfo$BP,
22 cutoff = cutoff,
23 chr = IlmnInfo$CHR
24 )
17 25
18 designMatrix <- model.matrix(~ pheno$Phenotype) 26 # choose DMR's of a certain length threshold
27 DMRTable <- bumps$table[which(bumps$table$L >= clusterSize), ]
28 DMRInfo <- data.table(DMRTable$chr, DMRTable$start, DMRTable$end)
19 29
20 dmrs <- bumphunter(GRset, design = designMatrix, 30
21 cutoff = 0.2, B=0, type="Beta") 31
22 write.table(dmrs, output) 32 write.table(
33 DMRInfo,
34 DMR,
35 quote = F,
36 sep = "\t",
37 row.names = F,
38 col.names = F
39 )