R/base_bg_SET.R

Defines functions .bg_SET

Documented in .bg_SET

# calculate background by excluding combined binding sites

.bg_SET <- function( L, mu, R, n_group ) {
  denom <- R + L - 1 - L

  if ( n_group > 1 ) {
    for ( g in seq(from = 2, to = n_group)) {
      denom <- denom - as.numeric( mu[g] - mu[(g-1)] <= L ) * abs( mu[g] - mu[(g-1)] ) -
        as.numeric( mu[g] - mu[(g-1)] > L ) * L
    }
  }

  denom <- pmax( denom, 1 ) # avoid non-positive values

  return( denom )
}
carter-allen/dpeak documentation built on April 23, 2020, 4:09 p.m.