normalizeCounts {tweeDEseq} | R Documentation |
Normalize count data to remove systematic technical effects.
normalizeCounts(counts, group=rep.int(1,ncol(counts)), method=c("TMM", "cqn"), common.disp = FALSE, prior.df=8, annot=NULL, lib.sizes=NULL, verbose=TRUE)
counts |
numeric data.frame or matrix containing the count data. |
group |
vector giving the experimental group/condition for each
sample/library. This argument is only relevant
when |
method |
specific method to use in order to normalize the input matrix of counts. By default this is set to TMM (Robinson and Oshlack, 2010) using the implementation available in the edgeR package. The other option is cqn (Hansen, Irizarry and Wu, 2012). |
common.disp |
logical indicating whether a common or tagwise (default) dispersions
should be estimated and employed when adjusting counts. This argument is only relevant
when |
prior.df |
argument provided to the call of |
annot |
matrix or data frame with row names matching at least part of the row names in the
|
lib.sizes |
vector of the total number of reads to be considered per sample/library. If
|
verbose |
logical indicating whether progress should be reported. |
This function encapsulates calls to RNA-seq normalization procedures
available in
the edgeR
and cqn
packages
in order to try
to remove systematic technical effects from raw counts.By default,
the
TMM method described in Robinson and Oshlack (2010) is employed
to calculate normalization factors which are applied to
estimate effective library sizes, then common and tagwise
(only when the
argument common.disp=TRUE) dispersions are calculated
(Robinson and Smyth,
Bioinformatics 2007) and finally counts are adjusted so
that library sizes
are approximately equal for the given dispersion values
(Robinson and
Smyth, Biostatistics 2008).Setting the argument
method="cqn"
, conditional
quantile normalization (Hansen, Irizarry and Wu,
2012) is applied which aims at
adjusting for tag/feature/gene length and other
covariate such as G+C content. This
information should be provided through the
annot
argument. This procedure
calculates, for every gene and every sample,
an offset to apply to the log2 reads per
million (RPM) and the function
normalizeCounts()
adds this offset to the
the log2 RPM values calculated from the
input count data matrix, unlogs them and rolls
back these normalized RPM values into
integer counts. Details on these two normalization
procedures are given in the
documentation of the edgeR
and cqn
Bioconductor
packages.
A matrix of normalized counts.
J.R. Gonzalez and R. Castelo
K.D. Hansen, R.A. Irizarry and Z. Wu. Removing technical variability in RNA-seq data using conditional quantile normalization. Biostatistics, 2012.
M.D. Robinson and A. Oshlack. A scaling normalization method for differential expression analysis of RNA-seq data. Genome Biol, 11:R25, 2010.
Robinson MD and Smyth GK (2007). Moderated statistical tests for assessing differences in tag abundance. _Bioinformatics_ 23, 2881-2887
Robinson MD and Smyth GK (2008). Small-sample estimation of negative binomial dispersion, with applications to SAGE data. _Biostatistics_, 9, 321-332
# Generate a random matrix of counts counts <- matrix(rPT(n=1000, a=0.5, mu=10, D=5), ncol = 40) colSums(counts) counts[1:5, 1:5] # Normalize counts normCounts <- normalizeCounts(counts, rep(c(1,2), 20)) colSums(normCounts) normCounts[1:5, 1:5]