Functions for transforming raw read counts into rescaled reads (
z) and theoretical
cumulative distribution function values (
1 2 3 4
vector of observed counts
data frame OTU table
columns that should not be transform (e.g., OTU IDs) have names that match
this pattern (i.e., those columns are excluded using
z.transform.sample fits the Poisson lognormal distribution to the count data and uses
that fit to transform those raw read counts into rescaled reads.
z.transform.table performs the same function on an OTU table, which
should have one sample per column and, potentially, an ID column that matches
ignore option (e.g.,
'otu' will match
OTU_ID). This function is just for convenience: it applies
z.transform.sample to each column (that does not match the
option) and packages the result into a data frame. Because it uses a
dplyr function, the rownames will be lost.
f.transform.table are analogous to the
only they return theoretical cumulative distribution function values.
The resulting tables could be used on their own for analysis, but
designed to slice that data into smaller “quads” (using
returns a vector of transformed values
returns a data frame of transformed values
Scott Olesen firstname.lastname@example.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# make up a table of data sim.data <- function() rpoilog(100, 1.0, 1.0, condS=TRUE) sample1 <- sim.data() # transform it hist(f.transform.sample(sample1)) # make up a table of data sample2 <- sim.data() otu.ids <- paste('otu', seq(1, 100), sep='') otu.table <- data.frame(OTU_ID=otu.ids, sample1=sample1, sample2=sample2) # make a new table from those fitted values f.table <- f.transform.table(otu.table) hist(f.table$sample1)
Loading required package: dplyr Attaching package: 'dplyr' The following objects are masked from 'package:stats': filter, lag The following objects are masked from 'package:base': intersect, setdiff, setequal, union Loading required package: ggplot2 Warning message: In value[[3L]](cond) : fit 1 failed Warning message: In value[[3L]](cond) : fit 1 failed
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.