diff findDMR/findDMR.R @ 6:a0e3f4efb03f draft

Uploaded
author testtool
date Tue, 25 Apr 2017 13:19:29 -0400
parents 715d03e1fd83
children bae8d90853b7
line wrap: on
line diff
--- a/findDMR/findDMR.R	Mon Mar 20 06:51:59 2017 -0400
+++ b/findDMR/findDMR.R	Tue Apr 25 13:19:29 2017 -0400
@@ -1,45 +1,22 @@
+require("IlluminaHumanMethylation450kanno.ilmn12.hg19", quietly = TRUE)
+require("IlluminaHumanMethylation450kanno.ilmn12.hg19", quietly = TRUE)
 require("minfi", quietly = TRUE)
-require("ChIPseeker", quietly = TRUE)
-require("ChIPpeakAnno", quietly = TRUE)
-require("data.table", quietly = TRUE)
 
+options(warn = -1)
+options("download.file.method"="wget")
 
 args <- commandArgs(trailingOnly = TRUE)
-GSMTable = args[1]
-platform = args[2]
-Data_Table = args[3]
-cutoff = as.numeric(args[4])
-clusterSize = as.numeric(args[5])
-DMR = args[6]
 
-TAB = fread(GSMTable)
-
-IlmnInfo = fread(platform)
+input1 = args[1]
+input2 = args[2]
+output = args[3]
 
-gmSet = fread(Data_Table)
-
-# bumphunter Run with processed data
-designMatrix <- model.matrix( ~ TAB$Phenotype)
+GRset <- get(load(input1))
 
-bumps <- bumphunter(
-  as.matrix(gmSet),
-  design = designMatrix,
-  pos = IlmnInfo$BP,
-  cutoff = cutoff,
-  chr = IlmnInfo$CHR
-)
+pheno <- fread(input2)
+
+designMatrix <- model.matrix(~ pheno$Phenotype)
 
-# choose DMR's of a certain length threshold
-DMRTable <- bumps$table[which(bumps$table$L >= clusterSize), ]
-DMRInfo <- data.table(DMRTable$chr, DMRTable$start, DMRTable$end)
-
-
-
-write.table(
-  DMRInfo,
-  DMR,
-  quote = F,
-  sep = "\t",
-  row.names = F,
-  col.names = F
-)
+dmrs <- bumphunter(GRset, design = designMatrix,
+                   cutoff = 0.2, B=0, type="Beta")
+write.table(dmrs, output)