Defines functions addPriorCount

Documented in addPriorCount

addPriorCount <- function(y, lib.size=NULL, offset=NULL, prior.count=1) 
# Add library size-adjusted prior counts to values of 'y'.
# Also add twice the adjusted prior to the library sizes, 
# which are provided as log-transformed values in 'offset'.
# written by Aaron Lun
# created 26 September 2016
# last modified 21 June 2017    
#	Check y
	if (!is.numeric(y)) stop('count matrix must be numeric')
	y <- as.matrix(y)

#	Check prior.count
	prior.count <- .compressPrior(y, prior.count)

#	Check lib.size and offset.
#	If offsets are provided, they must have a similar average to log(lib.size)
#	for the results to be meaningful as logCPM values
	offset <- .compressOffsets(y, lib.size=lib.size, offset=offset)

#   Adding the prior count.
	out <- .Call(.cxx_add_prior_count, y, offset, prior.count)
	names(out) <- c("y", "offset")
	out$offset <- makeCompressedMatrix(out$offset, dim(y), byrow=TRUE)

Try the edgeR package in your browser

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

edgeR documentation built on June 25, 2018, 6 p.m.