diff report_clonality/RScript.r @ 34:f2010de70741 draft

Uploaded
author davidvanzessen
date Mon, 18 Jan 2016 07:55:31 -0500
parents 672d5e010b1f
children fd55088e48d2
line wrap: on
line diff
--- a/report_clonality/RScript.r	Wed Jan 13 05:05:32 2016 -0500
+++ b/report_clonality/RScript.r	Mon Jan 18 07:55:31 2016 -0500
@@ -484,10 +484,42 @@
 }
 
 
+# ---------------------- output tables for the circos plots ----------------------
+
+print("Report Clonality - Circos data")
+
+for(smpl in unique(PRODF$Sample)){
+	PRODF.sample = PRODF[PRODF$Sample == smpl,]
+	
+	fltr = PRODF.sample$Top.V.Gene == ""
+	if(sum(fltr) > 0){
+	  PRODF.sample[fltr, "Top.V.Gene"] = "NA"
+	}
+
+	fltr = PRODF.sample$Top.D.Gene == ""
+	if(sum(fltr) > 0){
+	  PRODF.sample[fltr, "Top.D.Gene"] = "NA"
+	}
+
+	fltr = PRODF.sample$Top.J.Gene == ""
+	if(sum(fltr) > 0){
+	  PRODF.sample[fltr, "Top.J.Gene"] = "NA"
+	}
+	
+	v.d = table(PRODF.sample$Top.V.Gene, PRODF.sample$Top.D.Gene)
+	v.j = table(PRODF.sample$Top.V.Gene, PRODF.sample$Top.J.Gene)
+	d.j = table(PRODF.sample$Top.D.Gene, PRODF.sample$Top.J.Gene)
+
+	write.table(v.d, file=paste(smpl, "_VD_circos.txt", sep=""), sep="\t", quote=F, row.names=T, col.names=NA)
+	write.table(v.j, file=paste(smpl, "_VJ_circos.txt", sep=""), sep="\t", quote=F, row.names=T, col.names=NA)
+	write.table(d.j, file=paste(smpl, "_DJ_circos.txt", sep=""), sep="\t", quote=F, row.names=T, col.names=NA)
+}
+
 # ---------------------- calculating the clonality score ----------------------
 
 if("Replicate" %in% colnames(inputdata)) #can only calculate clonality score when replicate information is available
 {
+  print("Report Clonality - Clonality")
   if(clonality_method == "boyd"){
     samples = split(clonalityFrame, clonalityFrame$Sample, drop=T)