calc_wad | R Documentation |
Calculates weighted average densities for each microbial taxa in each sample replicate
calc_wad(
data,
tax_id = c(),
sample_id = c(),
frac_id = c(),
frac_dens = c(),
frac_abund = c(),
rel_abund = c(),
grouping_cols = c()
)
data |
Data as a long-format data.table where each row represents a taxonomic feature within a single fraction. |
tax_id |
Column name specifying unique identifier for each taxonomic feature. Required. |
sample_id |
Column name specifying unique identifier for each replicate. Required |
frac_id |
Column name specifying fraction identifier. Does not have to be unique to each replciate because |
frac_dens |
Column name specifying buoyant density value for each fraction. Typically expressed as grams per milliliter from a cesium chloride density buffer. Required |
frac_abund |
Column name specifying abundance measurement for each fraction. Typically either the numbers of a target gene amplicon (e.g., 16S, ITS such as from qPCR) or DNA concentration (e.g., nanograms per microliter such as from a Qubit). Required |
rel_abund |
Column name specifying relativized abundance of each taxonomic feature, typically calculated after the removal of non-target lineages but before frequency filtering has been applied. Required |
grouping_cols |
Additional columns that should be included as important treatment groups in the output. Not strictly necessary for the calculation, but these will be utilized next to calculate fractional isotopic enrichment. Taxonomic information may be included here as well. |
The weighted average buoyant density (WAD) for taxon's DNA i in replicate j, designated as W_{ij}
, is:
W_{ij} = \sum_{k=1}^{K} x_{jk} \cdot \left( \frac{y_{ijk}}{y_{ij}} \right)
Where
y_{ij} = \sum_{k=1}^{K} y_{ijk}
: Total abundance of taxon i in replicate j, by summing across all fractions (K)
y_{ijk} = P_{ijk} \cdot f_{jk}
: The total abundance per \mu
L for taxon i in density fraction
k of replicate i as calculated by it's relative abundance, P_{ijk}
in that fraction multiplied by the
total abundance of DNA or specific amplicons in that fraction, f_{jk}
x_{jk}
: Density of fraction k of replicate j in (g cm^-3
)
calc_wad
returns a reduced data.table where each row represents a taxonomic feature within a single replicate.
The following columns are produced: weighted average densities (wad
), weighted variance of densities (wvd
), and
replicate-level abundances (abund
). wad
values < 0 are removed.
The wvd
term produced is the weighted variance in density, essentially a measure of how spread-out a feature's WAD value is.
It is not strictly necessary to calculate fractional enrichment.
It can sometimes be useful as a diagnostic of the quality of a feature’s density estimate.
Abundances are expressed in the same unit as fraction-level abundance measures of the community. For example, if fraction-level
abundances were made using qPCR of a target gene (e.g., 16S or ITS), abundances represent the proportion of that gene attributed
to a given taxon. If fraction-level abundances were made using DNA concentrations (e.g., such as from a Qubit measure), then the
abund
column is an expression of a taxon's proportional contribution to DNA concentration.
Hungate, Bruce, et al. 2015. Quantitative microbial ecology through stable isotope probing. Applied and Environmental Microbiology 81: 7570 - 7581.
# Load in example data
data(example_qsip)
# relativize sequence abundances (should be done after taxonomic filtering)
example_qsip[, rel_abund := seq_abund / sum(seq_abund), by = sampleID]
# calculate weighted average densities
wads <- calc_wad(example_qsip,
tax_id = 'asv_id', sample_id = 'sampleID', frac_id = 'fraction',
frac_dens = 'Density.g.ml', frac_abund = 'avg_16S_g_soil',
rel_abund = 'rel_abund',
grouping_cols = c('treatment', 'isotope', 'iso_trt', 'Phylum'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.