annotate findDMR/findDMR.R @ 11:24ac6f93cc3e draft

Uploaded
author testtool
date Thu, 11 May 2017 11:26:02 -0400
parents 7df2b7d79391
children 083895dbc289
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
24ac6f93cc3e Uploaded
testtool
parents: 10
diff changeset
1 require("BiocGenerics", quietly = TRUE)
24ac6f93cc3e Uploaded
testtool
parents: 10
diff changeset
2 require("data.table", quietly = TRUE)
24ac6f93cc3e Uploaded
testtool
parents: 10
diff changeset
3 require("bumphunter", quietly = TRUE)
24ac6f93cc3e Uploaded
testtool
parents: 10
diff changeset
4
10
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
5 args <- commandArgs(trailingOnly = TRUE)
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
6 GSMTable = args[1]
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
7 platform = args[2]
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
8 Data_Table = args[3]
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
9 cutoff = as.numeric(args[4])
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
10 clusterSize = as.numeric(args[5])
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
11 DMR = args[6]
0
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
12
10
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
13 TAB = fread(GSMTable)
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
14
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
15 IlmnInfo = fread(platform)
0
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
16
10
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
17 gmSet = fread(Data_Table)
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
18
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
19 # bumphunter Run with processed data
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
20 designMatrix <- model.matrix( ~ TAB$Phenotype)
0
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
21
10
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
22 bumps <- bumphunter(
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
23 as.matrix(gmSet),
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
24 design = designMatrix,
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
25 pos = IlmnInfo$BP,
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
26 cutoff = cutoff,
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
27 chr = IlmnInfo$CHR
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
28 )
0
ca66a1487d4a Uploaded
testtool
parents:
diff changeset
29
10
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
30 # choose DMR's of a certain length threshold
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
31 DMRTable <- bumps$table[which(bumps$table$L >= clusterSize), ]
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
32 DMRInfo <- data.table(DMRTable$chr, DMRTable$start, DMRTable$end)
6
a0e3f4efb03f Uploaded
testtool
parents: 5
diff changeset
33
10
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
34
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
35 write.table(
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
36 DMRInfo,
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
37 DMR,
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
38 quote = F,
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
39 sep = "\t",
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
40 row.names = F,
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
41 col.names = F
7df2b7d79391 Uploaded
testtool
parents: 9
diff changeset
42 )