biom_inflate: Inflate Relative Abundances to Integer Counts
Description
Scaling a matrix of proportions (or counts) to a new target depth,
rounding to integers while preserving the original total abundance sum
exactly.
Usage
biom_inflate(biom, depth = NULL, clone = TRUE)
Value
An rbiom object.
Arguments
biom
An rbiom object, or any value accepted by as_rbiom().
depth
The target library size (sum) for each sample. Must be an
integer greater than 0. If NULL (the default), the depth is
estimated per-sample using the "Singleton Peak Heuristic". See
suggest_inflate_depths() for algorithm details.
clone
Create a copy of biom before modifying. If FALSE, biom
is modified in place as a side-effect. See speed ups for
use cases. Default: TRUE
Rounding (Largest Remainder Method)
To ensure the sum of the resulting counts equals the target depth exactly
(avoiding drift caused by simple rounding), this function uses the Largest
Remainder Method (also known as the Hare-Niemeyer method).
It assigns the integer part of the scaled value to each feature, and then
distributes the remaining counts to the features with the largest fractional
parts.
See Also
suggest_inflate_depths() for details on how target depths are
estimated when depth = NULL.
Other transformations:
biom_relativize(),
biom_rescale(),
modify_metadata,
rarefy(),
slice_metadata,
subset(),
with()