changeset 5:aa29b20bbb45 draft

Uploaded
author dktanwar
date Mon, 18 Dec 2017 12:05:05 -0500
parents 609b5a2ae0e8
children ee07a679ac08
files csaw.R
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/csaw.R	Mon Dec 18 11:20:20 2017 -0500
+++ b/csaw.R	Mon Dec 18 12:05:05 2017 -0500
@@ -48,14 +48,19 @@
 table <- data.frame(df, assay(windows), stringsAsFactors = F, check.names = F)
 colnames(table)[4:ncol(table)] <- file_names
 
-
 # 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")
+}
 
 # # Save individual files ----
 # Sys.time()