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

Uploaded
author testtool
date Thu, 11 May 2017 11:15:33 -0400
parents bae8d90853b7
children 24ac6f93cc3e
line wrap: on
line source

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)

gmSet = fread(Data_Table)

# bumphunter Run with processed data
designMatrix <- model.matrix( ~ TAB$Phenotype)

bumps <- bumphunter(
  as.matrix(gmSet),
  design = designMatrix,
  pos = IlmnInfo$BP,
  cutoff = cutoff,
  chr = IlmnInfo$CHR
)

# 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
)