[Patchwork-commits] r70 - pkg/patchworkCG/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 19 16:25:25 CET 2012


Author: mayrhofer
Date: 2012-01-19 16:25:25 +0100 (Thu, 19 Jan 2012)
New Revision: 70

Modified:
   pkg/patchworkCG/R/patchwork.CGCNV.r
Log:
fixed patchwork.CGCNV

Modified: pkg/patchworkCG/R/patchwork.CGCNV.r
===================================================================
--- pkg/patchworkCG/R/patchwork.CGCNV.r	2012-01-19 14:52:38 UTC (rev 69)
+++ pkg/patchworkCG/R/patchwork.CGCNV.r	2012-01-19 15:25:25 UTC (rev 70)
@@ -110,7 +110,8 @@
     ai$cn3m1 <- ifelse (!is.null(med),med,expectedAt)
 
     # now for cn3m0
-    expectedAt <- ai$cn3m1 + range # approx of cn3m0
+    expectedAt <- ai$cn3m1 + range; if (expextedAt>1) expectedAt <- (ai$cn3m1+1)/2
+    
     ix <- (abs(data$ai-expectedAt) < (expectedAt-ai$cn3m1)/4)  # take those much closer to exp than to cn3m1
     med <- weightedMedian(data$ai[ix],data$snvs[ix]) 
     try (if (med<ai$cn2m0) med <- NULL, silent=T)    ## in case of heterogeneities or strange signals, we disallow this effect.
@@ -138,7 +139,7 @@
     med <- weightedMedian(data$ai[ix],data$snvs[ix]) 
     ai$cn4m1 <- ifelse (!is.null(med),med,expectedAt)
 
-    # now 4(0) is at about 3(0) + [0.9 - 3(0)] * [3(0)-2(0)] / [0.9-2(0)] 
+    # now 4(0) is at about 3(0) + [1 - 3(0)] * [3(0)-2(0)] / [1-2(0)]
     expectedAt <- ai$cn3m0 + (ceiling-ai$cn3m0)*(ai$cn3m0-ai$cn2m0)/(ceiling-ai$cn2m0)
     ix <- abs(data$ai-expectedAt) < 0.2*(expectedAt-ai$cn4m2) # we take those very close to exp
     med <- weightedMedian(data$ai[ix],data$snvs[ix])



More information about the Patchwork-commits mailing list