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 )
}

Try the dpeak package in your browser

Any scripts or data that you put into this service are public.

dpeak documentation built on Nov. 8, 2020, 7:45 p.m.