12
|
1 require("minfi", quietly = TRUE)
|
|
2
|
|
3 options(warn = -1)
|
|
4 options("download.file.method"="wget")
|
11
|
5
|
10
|
6 args <- commandArgs(trailingOnly = TRUE)
|
12
|
7 input1 = args[1]
|
|
8 input2 = args[2]
|
|
9 cutoff = as.numeric(args[3])
|
|
10 B = as.numeric(args[4])
|
|
11 pickCutoffQ = as.numeric(args[5])
|
|
12 output1 = args[6]
|
|
13 output2 = args[7]
|
0
|
14
|
12
|
15 GRset <- get(load(input1))
|
0
|
16
|
12
|
17 pheno <- fread(input2)
|
10
|
18
|
12
|
19 designMatrix <- model.matrix(~ pheno$Phenotype)
|
0
|
20
|
12
|
21 dmrs <- bumphunter(GRset, design = designMatrix,
|
|
22 cutoff =cutoff, B=B, type="Beta", pickCutoff=TRUE,
|
|
23 pickCutoffQ=pickCutoffQ)
|
|
24
|
|
25 DMRTable <- dmrs$table
|
|
26
|
|
27 write.table(DMRTable, output1)
|
0
|
28
|
12
|
29 sign=sign(DMRTable$value)
|
10
|
30
|
12
|
31 sign[sign==-1]="-"
|
|
32 sign[sign==1]="+"
|
|
33
|
|
34 dmr_track<-cbind(as.character(DMRTable$chr),DMRTable$start,DMRTable$end,sign)
|
|
35
|
|
36 write.table(dmr_track,output2,quote = FALSE, sep = "\t\t\t\t",row.names = FALSE, col.names = FALSE,append=TRUE) |