From 22946049472d92f0bdde726d180a46551236346b Mon Sep 17 00:00:00 2001
From: Beibei Chen <beibei.chen@utsouthwestern.edu>
Date: Thu, 29 Dec 2016 14:04:59 -0600
Subject: [PATCH] chipseeker framework done. Need to test diffbind output
 column name conflict

---
 workflow/main.nf               |  2 +-
 workflow/scripts/runDiffBind.R | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/workflow/main.nf b/workflow/main.nf
index 2766722..ffdf4d8 100644
--- a/workflow/main.nf
+++ b/workflow/main.nf
@@ -23,9 +23,9 @@ process peakanno {
 //   set peak_id, file("${pattern}_annotation.xls"), file("${pattern}_peakTssDistribution.png") into peakanno
      script:
      """
+     module load python/2.7.x-anaconda
      module load R/3.2.1-intel
      module load deeptools/2.5.3
-     module load python/2.7.x-anaconda
      python $baseDir/scripts/process.py
      #Rscript /project/BICF/BICF_Core/bchen4/chipseq_analysis/workflow/scripts/runchipseeker.R     
 """
diff --git a/workflow/scripts/runDiffBind.R b/workflow/scripts/runDiffBind.R
index 266fea7..d6e88d1 100644
--- a/workflow/scripts/runDiffBind.R
+++ b/workflow/scripts/runDiffBind.R
@@ -24,11 +24,15 @@ write.table(as.data.frame(normcount),"diffbind.normcount.txt",sep="\t",quote=F,r
 for (i in c(1:length(data$contrasts)))
 {
  contrast_name = paste(data$contrasts[[i]]$name1,"vs",
- contrast_bed_name = paste(data$contrasts[[i]]$name1,"vs",
+ #contrast_bed_name = paste(data$contrasts[[i]]$name1,"vs",
                       data$contrasts[[i]]$name2,"diffbind.bed",sep="_")
  report <- dba.report(data, contrast=i, th=1, bCount=TRUE)
- write.table(as.data.frame(report),contrast_name,sep="\t",quote=F,row.names=F)
- write.table(as.data.frame(report),contrast_bed_name,sep="\t",quote=F,row.names=F, col.names=F)
+ report <- as.data.frame(report)
+ print(head(report))
+ colnames(report)[1:5]<-c("chrom","peak_start","peak_stop","peak_width","peak_strand")
+ print(head(report))
+ write.table(report,contrast_name,sep="\t",quote=F,row.names=F)
+ #write.table(as.data.frame(report),contrast_bed_name,sep="\t",quote=F,row.names=F, col.names=F)
 
 }
 
-- 
GitLab