R/evalBinSize.R

Defines functions evalBinSize

Documented in evalBinSize

# evalBinSize: evaluate bin size using Shimazaki cost function
# This function should be called only within selectBinSize.R
# Author: Yue
###############################################################################

evalBinSize <- function(binSize, alignGR)
{					
	
	# selecting chromosome with at least a non-zero count
	# esp. when anlayses are separate for individual chromosomes
	ki <- binCount(alignGR, binSize, returnBinCountOnly = TRUE)
		
	# apply Shimazaki cost formula
	k <- mean(ki)
	
	v <- sum((ki - k)^2)/length(ki)
	
	cost <- (2*k - v)/binSize^2
		
	return(cost)	
}

Try the RIPSeeker package in your browser

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

RIPSeeker documentation built on Oct. 31, 2019, 7:29 a.m.