Skip to contents

add_total_density() adds the total microbial density to the sample table of a tidytacos object under the column name "total_density".

Usage

add_total_density(
  ta,
  spike_taxon,
  spike_added = spike_added,
  material_sampled = material_sampled
)

Arguments

ta

A tidytacos object.

spike_taxon

The taxon id of the spike.

spike_added

The column name of the samples table which indicates how much spike was added per sample, e.g. 16S rRNA gene copy numbers added to the DNA extraction tube.

material_sampled

The column name indicating the amount of material from which DNA was extracted, e.g gram of soil. This parameter encourages researchers to consider that absolute abundances are only meaningful if they can be translated into densities.

Value

A tidytacos object with the total densities added to the sample table.

Examples

# Initiate count matrix
x <- matrix(
  c(1500, 1300, 14, 280, 356, 9),
  ncol = 2
)
rownames(x) <- c("taxon1", "taxon2", "taxon3")
colnames(x) <- c("sample1", "sample2")

# Convert to tidytacos object
data <- create_tidytacos(x,
  taxa_are_columns = FALSE
)
data$samples$spike_added <- c(100, 150)
data$samples$material_sampled <- c(1, 5)

# Add total abundance
data <- data %>%
  add_total_density(spike_taxon = "t3")