comparison csaw.R @ 6:ee07a679ac08 draft

Uploaded
author dktanwar
date Mon, 18 Dec 2017 12:10:21 -0500
parents aa29b20bbb45
children c2ec7fb35e97
comparison
equal deleted inserted replaced
5:aa29b20bbb45 6:ee07a679ac08
49 colnames(table)[4:ncol(table)] <- file_names 49 colnames(table)[4:ncol(table)] <- file_names
50 50
51 # Remove spaces in the table ---- 51 # Remove spaces in the table ----
52 setDT(table) 52 setDT(table)
53 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)]])
54 54 table_sp <- data.frame(table)
55
55 # Save final table ---- 56 # Save final table ----
56 # fwrite(x = table_sp, file = output, quote = F, row.names = F, sep = "\t") 57 fwrite(x = table_sp, file = output, quote = F, row.names = F, sep = "\t")
57 dt <- table[,regions:=paste0(seqnames,"-", start, "-", end)] 58 dt <- table[,regions:=paste0(seqnames,"-", start, "-", end)]
58 table_sp <- data.frame(dt) 59 table_sp <- data.frame(dt)
59 60
60 for(i in 4:(ncol(table_sp)-1)){ 61 for(i in 4:(ncol(table_sp)-1)){
61 tmp <- table_sp[,c(ncol(table_sp), i)] 62 tmp <- table_sp[,c(ncol(table_sp), i)]
62 fwrite(x = tmp, file = output, quote = F, row.names = F, sep = "\t") 63 n <- colnames(table_sp)[i]
64 fwrite(x = tmp, file = n, quote = F, row.names = F, sep = "\t")
63 } 65 }
64 66
65 # # Save individual files ---- 67 # # Save individual files ----
66 # Sys.time() 68 # Sys.time()
67 # r <- paste(table_sp[,1], table_sp[,2], table_sp[,3], sep = "-") 69 # r <- paste(table_sp[,1], table_sp[,2], table_sp[,3], sep = "-")