R/effectiveLibSizes.R

Defines functions effectiveLibSizes.default effectiveLibSizes.DGEGLM effectiveLibSizes.DGEList effectiveLibSizes

Documented in effectiveLibSizes effectiveLibSizes.default effectiveLibSizes.DGEGLM effectiveLibSizes.DGEList

effectiveLibSizes <- function(y, log=FALSE, ...)
UseMethod("effectiveLibSizes")

effectiveLibSizes.DGEList <- function(y, log=FALSE, ...)
#	Effective (normalized) library size
#	Gordon Smyth.
#	Created 19 Apr 2020. Last modified.
{
	if(is.null(y$offset)) {
		els <- y$samples$lib.size*y$samples$norm.factors
		if(log) els <- log(els)
	} else {
		els <- y$offset[1,]
		if(!log) els <- exp(els)
	}
	els
}

effectiveLibSizes.DGELRT <- effectiveLibSizes.DGEGLM <- function(y, log=FALSE, ...)
#	Effective (normalized) library size from DGEGLM fit.
#	Gordon Smyth.
#	Created 19 Apr 2020. Last modified.
{
	els <- y$offset[1,]
	if(!log) els <- exp(els)
	els
}

effectiveLibSizes.default <- function(y, log=FALSE, ...)
#	Effective library sizes for a matrix, i.e., just the column sums
#	Gordon Smyth.
#	Created 19 Apr 2020. Last modified.
{
	y <- as.matrix(y)
	els <- colSums(y)
	if(log) els <- log(els)
	els
}

Try the edgeR package in your browser

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

edgeR documentation built on Jan. 16, 2021, 2:03 a.m.