Skip to content

Commit

Permalink
Adding parameter minReads to postMerge
Browse files Browse the repository at this point in the history
  • Loading branch information
belleau authored and belleau committed Apr 12, 2016
1 parent ce2a2e5 commit b1f9139
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 9 additions & 3 deletions R/rjmcmcMethodsIntern.R
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,12 @@ validatePrepMergeParameters <- function(startPosForwardReads,
#' chromosome is used to ensure that the consensus positions are all
#' located inside the chromosome.
#'
#' @param minReads a positive \code{integer} or \code{numeric}, the minimum
#' number of reads in a potential canditate region. Non-integer values
#' of \code{minReads} will be casted to \code{integer} and truncated towards
#' zero. Default: 5.
#
#'
#' @return a \code{array} of \code{numeric}, the updated values of the
#' nucleosome positions.
#'
Expand Down Expand Up @@ -2308,7 +2314,7 @@ validatePrepMergeParameters <- function(startPosForwardReads,
#' @keywords internal
#'
postMerge <- function(startPosForwardReads, startPosReverseReads,
resultRJMCMC, extendingSize, chrLength)
resultRJMCMC, extendingSize, chrLength, minReads = 5)
{
## Prepare information about reads
segReads <- list(yF = numeric(), yR = numeric())
Expand Down Expand Up @@ -2360,9 +2366,9 @@ postMerge <- function(startPosForwardReads, startPosReverseReads,
b <- max(resultRJMCMC$mu[current]) # + (74 - extendingSize)

if(length(segReads$yF[segReads$yF >= (a - maxLimit) &
segReads$yF <= (b - minLimit)]) > 4 &
segReads$yF <= (b - minLimit)]) >= minReads &
length(segReads$yR[segReads$yR >= (a + minLimit) &
segReads$yR <= (b + maxLimit)]) > 4) {
segReads$yR <= (b + maxLimit)]) >= minReads) {
## Calculate the new position of the nucleosome
newMu[cpt] <- (mean(segReads$yF[segReads$yF >= (a - maxLimit) &
segReads$yF <= (b - minLimit)]) +
Expand Down
7 changes: 6 additions & 1 deletion man/postMerge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1f9139

Please sign in to comment.