comparison csaw.R @ 5:aa29b20bbb45 draft

Uploaded
author dktanwar
date Mon, 18 Dec 2017 12:05:05 -0500
parents ce3ad612a104
children ee07a679ac08
comparison
equal deleted inserted replaced
4:609b5a2ae0e8 5:aa29b20bbb45
46 46
47 # Final table with all windows and read counts ---- 47 # Final table with all windows and read counts ----
48 table <- data.frame(df, assay(windows), stringsAsFactors = F, check.names = F) 48 table <- data.frame(df, assay(windows), stringsAsFactors = F, check.names = F)
49 colnames(table)[4:ncol(table)] <- file_names 49 colnames(table)[4:ncol(table)] <- file_names
50 50
51
52 # Remove spaces in the table ---- 51 # Remove spaces in the table ----
53 setDT(table) 52 setDT(table)
54 for (j in names(table)) set(table, j = j, value = table[[trimws(j)]]) 53 for (j in names(table)) set(table, j = j, value = table[[trimws(j)]])
55 table_sp <- data.frame(table)
56 54
57 # Save final table ---- 55 # Save final table ----
58 fwrite(x = table_sp, file = output, quote = F, row.names = F, sep = "\t") 56 # fwrite(x = table_sp, file = output, quote = F, row.names = F, sep = "\t")
57 dt <- table[,regions:=paste0(seqnames,"-", start, "-", end)]
58 table_sp <- data.frame(dt)
59
60 for(i in 4:(ncol(table_sp)-1)){
61 tmp <- table_sp[,c(ncol(table_sp), i)]
62 fwrite(x = tmp, file = output, quote = F, row.names = F, sep = "\t")
63 }
59 64
60 # # Save individual files ---- 65 # # Save individual files ----
61 # Sys.time() 66 # Sys.time()
62 # r <- paste(table_sp[,1], table_sp[,2], table_sp[,3], sep = "-") 67 # r <- paste(table_sp[,1], table_sp[,2], table_sp[,3], sep = "-")
63 # Sys.time() 68 # Sys.time()