wrench: Normalization for sparse, under-sampled count data.

Description Usage Arguments Value Author(s) Examples

Description

Obtain normalization factors for sparse, under-sampled count data that often arise with metagenomic count data.

Usage

1
2
wrench(mat, condition, etype = "w.marg.mean", ebcf = TRUE,
  z.adj = FALSE, phi.adj = TRUE, detrend = FALSE, ...)

Arguments

mat

count matrix; rows are features and columns are samples

condition

a vector with group information on the samples

etype

weighting strategy with the following options:

  • hurdle.w.mean, the W1 estimator in manuscript.

  • w.marg.mean, the W2 estimator in manuscript. These are appropriately computed depending on whether z.adj=TRUE (see below)

  • s2.w.mean, weight by inverse of feature-variances of logged count data.

ebcf

TRUE if empirical bayes regularization of ratios needs to be performed. Default recommended.

z.adj

TRUE if the feature-wise ratios need to be adjusted by hurdle probabilities (arises when taking marginal expectation). Default recommended.

phi.adj

TRUE if estimates need to be adjusted for variance terms (arises when considering positive-part expectations). Default recommended.

detrend

FALSE if any linear dependence between sample-depth and compositional factors needs to be removed. (setting this to TRUE reduces variation in compositional factors and can improve accuracy, but requires an extra assumption that no linear dependence between compositional factors and sample depth is present in samples).

...

other parameters

Value

a list with components:

Author(s)

M. Senthil Kumar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#Obtain counts matrix and some group information
require(metagenomeSeq)
data(mouseData)
cntsMatrix <- MRcounts(mouseData)
group <- pData(mouseData)$diet
#Running wrench with defaults
W <- wrench( cntsMatrix, condition=group  )
compositionalFactors <- W$ccf
normalizationFactors <- W$nf

#Introducing the above normalization factors for the most
# commonly used tools is shown below.

#If using metagenomeSeq
normalizedObject <- mouseData
normFactors(normalizedObject) <- normalizationFactors

#If using edgeR, we must pass in the compositional factors
require(edgeR)
edgerobj <- DGEList( counts=cntsMatrix,
                     group = as.matrix(group),
                     norm.factors=compositionalFactors )

#If using DESeq/DESeq2
require(DESeq2)
deseq.obj <- DESeqDataSetFromMatrix(countData = cntsMatrix,
                                   DataFrame(group),
                                   ~ group )
DESeq2::sizeFactors(deseq.obj) <- normalizationFactors

HCBravoLab/Wrench documentation built on May 13, 2019, 5:35 p.m.