Description Usage Arguments Value See Also Examples
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.
1 2 3 | transform_sample_counts(physeq, fun, ...)
transformSampleCounts(physeq, fun, ...)
|
physeq |
(Required). |
fun |
(Required). A single-argument function that will be applied
to the abundance counts of each sample.
Can be an anonymous |
... |
(Optional). Additional, optionally-named, arguments passed to
|
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.
1 2 3 4 5 6 7 8 9 10 11 12 | #
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)
|
OTU Table: [10 taxa and 3 samples]
taxa are rows
B C D
59_8_22 57.0 55 53
59_5_13 50.0 50 50
59_8_12 50.0 53 50
65_3_22 50.0 50 50
65_5_1 50.0 50 50
65_1_10 50.0 50 50
65_7_12 50.5 50 55
59_6_1 50.0 50 50
65_2_17 53.0 50 50
65_9_26 50.0 50 50
OTU Table: [10 taxa and 3 samples]
taxa are rows
B C D
59_8_22 57.0 55 53.0
59_5_13 15.5 38 10.5
59_8_12 46.5 53 10.5
65_3_22 15.5 38 31.5
65_5_1 15.5 13 31.5
65_1_10 15.5 13 31.5
65_7_12 50.5 38 55.0
59_6_1 15.5 30 10.5
65_2_17 53.0 30 50.0
65_9_26 15.5 13 50.0
[1] FALSE
OTU Table: [10 taxa and 3 samples]
taxa are rows
B C D
59_8_22 4.007333 3.178054 2.302585
59_5_13 1.609438 1.945910 1.609438
59_8_12 1.945910 2.890372 1.609438
65_3_22 1.609438 1.945910 1.791759
65_5_1 1.609438 1.609438 1.791759
65_1_10 1.609438 1.609438 1.791759
65_7_12 2.079442 1.945910 2.639057
59_6_1 1.609438 1.791759 1.609438
65_2_17 2.397895 1.791759 2.079442
65_9_26 1.609438 1.609438 2.079442
OTU Table: [10 taxa and 3 samples]
taxa are rows
B C D
59_8_22 5467 651 34
59_5_13 0 5 0
59_8_12 5 282 0
65_3_22 0 5 1
65_5_1 0 0 1
65_1_10 0 0 1
65_7_12 11 5 126
59_6_1 0 1 0
65_2_17 52 1 11
65_9_26 0 0 11
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.