From 637ac8744a60b1fbe99906922eea32da79be0945 Mon Sep 17 00:00:00 2001 From: belleau Date: Tue, 12 Apr 2016 17:03:57 -0400 Subject: [PATCH] Extract constant from loop in postMerge --- R/rjmcmcMethodsIntern.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/rjmcmcMethodsIntern.R b/R/rjmcmcMethodsIntern.R index bd2652d..72fbb79 100644 --- a/R/rjmcmcMethodsIntern.R +++ b/R/rjmcmcMethodsIntern.R @@ -2342,6 +2342,10 @@ postMerge <- function(startPosForwardReads, startPosReverseReads, uniqueOverlap <- unique(allOverlap) nbOverlap <- length(uniqueOverlap) + ## Interval used to check for reads + maxLimit <- 74 + extendingSize + minLimit <- 74 - extendingSize + ## Treat each overlapping region separatly newMu <- array(dim = nbOverlap) cpt <- 1L @@ -2354,8 +2358,7 @@ postMerge <- function(startPosForwardReads, startPosReverseReads, valCentral <- mean(resultRJMCMC$mu[current]) a <- min(resultRJMCMC$mu[current]) # - (74 + extendingSize) b <- max(resultRJMCMC$mu[current]) # + (74 - extendingSize) - maxLimit <- 74 + extendingSize - minLimit <- 74 - extendingSize + if(length(segReads$yF[segReads$yF >= (a - maxLimit) & segReads$yF <= (b - minLimit)]) > 4 & length(segReads$yR[segReads$yR >= (a + minLimit) &