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

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