This function normalizes the data by dividing each observation by the total library size of its sample. The resulting values represent the proportion (0 to 1) of the sample composed of that specific feature.
This is a common transformation for microbiome data, as it accounts for differences in sequencing depth across samples, allowing for comparison of community composition.
Arguments
- biom
An rbiom object, or any value accepted by
as_rbiom().- clone
Create a copy of
biombefore modifying. IfFALSE,biomis modified in place as a side-effect. See speed ups for use cases. Default:TRUE
Value
An rbiom object.
See also
Other transformations:
biom_inflate(),
biom_rescale(),
modify_metadata,
rarefy(),
slice_metadata,
subset(),
with()
Examples
library(rbiom)
biom <- hmp50[1:5]
# Raw counts sum to different library sizes
sample_sums(biom)
#> HMP01 HMP02 HMP03 HMP04 HMP05
#> 1660 1371 1353 1895 3939
# Relativized counts sum to 1
biom_rel <- biom_relativize(biom)
sample_sums(biom_rel)
#> HMP01 HMP02 HMP03 HMP04 HMP05
#> 1 1 1 1 1