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