changeset 6:ee07a679ac08 draft

Uploaded
author dktanwar
date Mon, 18 Dec 2017 12:10:21 -0500
parents aa29b20bbb45
children c2ec7fb35e97
files csaw.R
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/csaw.R	Mon Dec 18 12:05:05 2017 -0500
+++ b/csaw.R	Mon Dec 18 12:10:21 2017 -0500
@@ -51,15 +51,17 @@
 # Remove spaces in the table ----
 setDT(table)
 for (j in names(table)) set(table, j = j, value = table[[trimws(j)]]) 
-
+table_sp <- data.frame(table)
+  
 # Save final table ----
-# fwrite(x = table_sp, file = output, quote = F, row.names = F, sep = "\t")
+fwrite(x = table_sp, file = output, quote = F, row.names = F, sep = "\t")
 dt <- table[,regions:=paste0(seqnames,"-", start, "-", end)]
 table_sp <- data.frame(dt)
 
 for(i in 4:(ncol(table_sp)-1)){
   tmp <- table_sp[,c(ncol(table_sp), i)]
-  fwrite(x = tmp, file = output, quote = F, row.names = F, sep = "\t")
+  n <- colnames(table_sp)[i]
+  fwrite(x = tmp, file = n, quote = F, row.names = F, sep = "\t")
 }
 
 # # Save individual files ----