diff report_clonality/RScript.r @ 6:d001d0c05dbe draft

Uploaded
author davidvanzessen
date Fri, 16 Dec 2016 07:30:32 -0500
parents bcec7bb4e089
children 8cbc1a8d27ae
line wrap: on
line diff
--- a/report_clonality/RScript.r	Mon Dec 12 05:22:57 2016 -0500
+++ b/report_clonality/RScript.r	Fri Dec 16 07:30:32 2016 -0500
@@ -400,6 +400,10 @@
   maxVD = data.frame(data.table(VandDCount)[, list(max=max(l)), by=c("Sample")])
   VandDCount = merge(VandDCount, maxVD, by.x="Sample", by.y="Sample", all.x=T)
   VandDCount$relLength = VandDCount$l / VandDCount$max
+  check = is.nan(VandDCount$relLength)
+  if(any(check)){
+	VandDCount[check,"relLength"] = 0
+  }
   
   cartegianProductVD = expand.grid(Top.V.Gene = Vchain$v.name, Top.D.Gene = Dchain$v.name)
   
@@ -446,6 +450,11 @@
 VandJCount = merge(VandJCount, maxVJ, by.x="Sample", by.y="Sample", all.x=T)
 VandJCount$relLength = VandJCount$l / VandJCount$max
 
+check = is.nan(VandJCount$relLength)
+if(any(check)){
+	VandJCount[check,"relLength"] = 0
+}
+
 cartegianProductVJ = expand.grid(Top.V.Gene = Vchain$v.name, Top.J.Gene = Jchain$v.name)
 
 completeVJ = merge(VandJCount, cartegianProductVJ, all.y=TRUE)
@@ -490,6 +499,11 @@
   DandJCount = merge(DandJCount, maxDJ, by.x="Sample", by.y="Sample", all.x=T)
   DandJCount$relLength = DandJCount$l / DandJCount$max
   
+  check = is.nan(DandJCount$relLength)
+  if(any(check)){
+    DandJCount[check,"relLength"] = 0
+  }
+  
   cartegianProductDJ = expand.grid(Top.D.Gene = Dchain$v.name, Top.J.Gene = Jchain$v.name)
   
   completeDJ = merge(DandJCount, cartegianProductDJ, all.y=TRUE)