Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

transformcounts

Transform abundance data in an otu_table, sample-by-sample.


Description

This function transforms the sample counts of a taxa abundance matrix according to a user-provided function. The counts of each sample will be transformed individually. No sample-sample interaction/comparison is possible by this method.

Usage

transform_sample_counts(physeq, fun, ...)

transformSampleCounts(physeq, fun, ...)

Arguments

physeq

(Required). phyloseq-class of otu_table-class.

fun

(Required). A single-argument function that will be applied to the abundance counts of each sample. Can be an anonymous function.

...

(Optional). Additional, optionally-named, arguments passed to fun during transformation of abundance data.

Value

A transformed otu_table – or phyloseq object with its transformed otu_table. In general, trimming is not expected by this method, so it is suggested that the user provide only functions that return a full-length vector. Filtering/trimming can follow, for which the genefilter_sample and prune_taxa functions are suggested.

See Also

Examples

#
data(esophagus)
x1 = transform_sample_counts(esophagus, threshrankfun(50))
head(otu_table(x1), 10)
x2 = transform_sample_counts(esophagus, rank)
head(otu_table(x2), 10)
identical(x1, x2)
x3 = otu_table(esophagus) + 5
x3 = transform_sample_counts(x3, log)
head(otu_table(x3), 10)
x4 = transform_sample_counts(esophagus, function(x) round(x^2.2, 0))
head(otu_table(x4), 10)

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.