R: Compute offsets from a count data using one of several...

compute_offset {PLNmodels} | R Documentation

## Compute offsets from a count data using one of several normalization schemes

### Description

Computes offsets from the count table using one of several normalization schemes (TSS, CSS, RLE, GMPR, etc) described in the literature.

### Usage

    compute_offset(
      counts,
      offset = c("TSS", "GMPR", "RLE", "CSS", "Wrench", "none"),
      ...
    )

### Arguments

`counts` | Required. An abundance count table, preferably with dimensions names and species as columns.
`offset` | Optional. Normalization scheme used to compute scaling factors used as offset during PLN inference. Available schemes are "TSS" (Total Sum Scaling, default), "CSS" (Cumulative Sum Scaling, used in metagenomeSeq), "RLE" (Relative Log Expression, used in DESeq2), "GMPR" (Geometric Mean of Pairwise Ratio, introduced in Chen et al., 2018), Wrench (introduced in Kumar et al., 2018) or "none". Alternatively the user can supply its own vector or matrix of offsets (see note for specification of the user-supplied offsets).
`...` | Additional parameters passed on to specific methods (for now CSS and RLE)

### Details

RLE has additional `pseudocounts` and `type` arguments to add pseudocounts to the observed counts (defaults to 0L) and to compute offsets using only positive counts (if `type == "poscounts"`). This mimics the behavior of `DESeq2::DESeq()` when using `sfType == "poscounts"`. CSS has an additional `reference` argument to choose the location function used to compute the reference quantiles (defaults to `median` as in the Nature publication but can be set to `mean` to reproduce behavior of functions cumNormStat* from metagenomeSeq). Wrench has two additional parameters: `groups` to specify sample groups and `type` to either reproduce exactly the default `Wrench::wrench()` behavior (`type = "wrench"`, default) or to use simpler heuristics (`type = "simple"`). Note that (i) CSS normalization fails when the median absolute deviation around quantiles does not become instable for high quantiles (limited count variations both within and across samples) and/or one sample has less than two positive counts, (ii) RLE fails when there are no common species across all samples (unless `type == "poscounts"` has been specified) and (iii) GMPR fails if a sample does not share any species with all other samples.

### Value

If `offset = "none"`, `NULL` else a vector of length `nrow(counts)` with one offset per sample.

### References

Chen, L., Reeve, J., Zhang, L., Huang, S., Wang, X. and Chen, J. (2018) GMPR: A robust normalization method for zero-inflated count data with application to microbiome sequencing data. PeerJ, 6, e4600 doi: 10.7717/peerj.4600

Paulson, J. N., Colin Stine, O., Bravo, H. C. and Pop, M. (2013) Differential abundance analysis for microbial marker-gene surveys. Nature Methods, 10, 1200-1202 doi: 10.1038/nmeth.2658

Anders, S. and Huber, W. (2010) Differential expression analysis for sequence count data. Genome Biology, 11, R106 doi: 10.1186/gb-2010-11-10-r106

Kumar, M., Slud, E., Okrah, K. et al. (2018) Analysis and correction of compositional bias in sparse sequencing count data. BMC Genomics 19, 799 doi: 10.1186/s12864-018-5160-5

### Examples

    data(trichoptera)
    counts <- trichoptera$Abundance
    compute_offset(counts)
    ## Other normalization schemes
    compute_offset(counts, offset = "RLE", pseudocounts = 1)
    compute_offset(counts, offset = "Wrench", groups = trichoptera$Covariate$Group)
    compute_offset(counts, offset = "GMPR")
    ## User supplied offsets
    my_offset <- setNames(rep(1, nrow(counts)), rownames(counts))
    compute_offset(counts, offset = my_offset)

[Package PLNmodels version 0.11.6 Index]