diff report_clonality/RScript.r @ 20:9185c3dfc679 draft

Uploaded
author davidvanzessen
date Fri, 27 Jan 2017 03:44:18 -0500
parents 5d11c9139a55
children d5d203d38c8a
line wrap: on
line diff
--- a/report_clonality/RScript.r	Thu Dec 22 03:43:02 2016 -0500
+++ b/report_clonality/RScript.r	Fri Jan 27 03:44:18 2017 -0500
@@ -596,19 +596,22 @@
       
       res[is.na(res)] = 0
       
-      write.table(res, file=paste("raw_clonality_", sample_id, ".csv", sep=""), sep=",",quote=F,row.names=F,col.names=F)
+      write.table(res, file=paste("raw_clonality_", sample_id, ".txt", sep=""), sep="\t",quote=F,row.names=F,col.names=F)
+      write.table(as.matrix(res[,2:ncol(res)]), file=paste("raw_clonality2_", sample_id, ".txt", sep=""), sep="\t",quote=F,row.names=F,col.names=F)
+      
+      res = read.table(paste("raw_clonality_", sample_id, ".txt", sep=""), header=F, sep="\t", quote="", stringsAsFactors=F, fill=T, comment.char="")
       
       infer.result = infer.clonality(as.matrix(res[,2:ncol(res)]))
       
       #print(infer.result)
       
-      write.table(data.table(infer.result[[12]]), file=paste("lymphclon_clonality_", sample_id, ".csv", sep=""), sep=",",quote=F,row.names=F,col.names=F)
+      write.table(data.table(infer.result[[12]]), file=paste("lymphclon_clonality_", sample_id, ".txt", sep=""), sep="\t",quote=F,row.names=F,col.names=F)
       
       res$type = rowSums(res[,2:ncol(res)])
       
       coincidence.table = data.frame(table(res$type))
       colnames(coincidence.table) = c("Coincidence Type",  "Raw Coincidence Freq")
-      write.table(coincidence.table, file=paste("lymphclon_coincidences_", sample_id, ".csv", sep=""), sep=",",quote=F,row.names=F,col.names=T)
+      write.table(coincidence.table, file=paste("lymphclon_coincidences_", sample_id, ".txt", sep=""), sep="\t",quote=F,row.names=F,col.names=T)
     }
   } else if(clonality_method == "old") {
     clonalFreq = data.frame(data.table(clonalityFrame)[, list(Type=.N), by=c("Sample", "clonaltype")])